mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
8693115af4
Currently for every representor type and for every single vport, representer function pointers copy is stored even though they don't change from one to other vport. Additionally priv data entry for the rep is not passed during registration, but its copied. It is used (set and cleared) by the user of the reps. As we want to scale vports, to simplify and also to split constants from data, 1. Rename mlx5_eswitch_rep_if to mlx5_eswitch_rep_ops as to match _ops prefix with other standard netdev, ibdev ops. 2. Constify the IB and Ethernet rep ops structure. 3. Instead of storing copy of all rep function pointers, store copy per eswitch rep type. 4. Split data and function pointers to mlx5_eswitch_rep_ops and mlx5_eswitch_rep_data. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
78 lines
2.0 KiB
C
78 lines
2.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
|
|
/*
|
|
* Copyright (c) 2018 Mellanox Technologies. All rights reserved.
|
|
*/
|
|
|
|
#ifndef __MLX5_IB_REP_H__
|
|
#define __MLX5_IB_REP_H__
|
|
|
|
#include <linux/mlx5/eswitch.h>
|
|
#include "mlx5_ib.h"
|
|
|
|
#ifdef CONFIG_MLX5_ESWITCH
|
|
extern const struct mlx5_ib_profile uplink_rep_profile;
|
|
|
|
u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
|
|
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
|
|
int vport_index);
|
|
struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw);
|
|
struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
|
|
int vport_index);
|
|
void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev);
|
|
void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev);
|
|
struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
|
|
struct mlx5_ib_sq *sq,
|
|
u16 port);
|
|
struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
|
|
int vport_index);
|
|
#else /* CONFIG_MLX5_ESWITCH */
|
|
static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
|
|
{
|
|
return SRIOV_NONE;
|
|
}
|
|
|
|
static inline
|
|
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
|
|
int vport_index)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline
|
|
struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline
|
|
struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
|
|
int vport_index)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev) {}
|
|
static inline void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev) {}
|
|
static inline
|
|
struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
|
|
struct mlx5_ib_sq *sq,
|
|
u16 port)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline
|
|
struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
|
|
int vport_index)
|
|
{
|
|
return NULL;
|
|
}
|
|
#endif
|
|
|
|
static inline
|
|
struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
|
|
{
|
|
return rep->rep_data[REP_IB].priv;
|
|
}
|
|
#endif /* __MLX5_IB_REP_H__ */
|