Skip to content

Commit 6bfd390

Browse files
hadarhenziondavem330
authored andcommitted
net/mlx5e: Add support for multiple profiles
To allow support in representor netdevices where we create more than one netdevice per NIC, add profiles to the mlx5e driver. The profiling allows for creation of mlx5e instances with different characteristics. Each profile implements its own behavior using set of function pointers defined in struct mlx5e_profile. This is done to allow for avoiding complex per profix branching in the code. Currently only the profile for the conventional NIC is implemented, which is of use when a netdev is created upon pci probe. This patch doesn't add any new functionality. Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 398f335 commit 6bfd390

File tree

2 files changed

+240
-118
lines changed

2 files changed

+240
-118
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,22 @@ enum {
568568
MLX5E_NIC_PRIO
569569
};
570570

571+
struct mlx5e_profile {
572+
void (*init)(struct mlx5_core_dev *mdev,
573+
struct net_device *netdev,
574+
const struct mlx5e_profile *profile);
575+
void (*cleanup)(struct mlx5e_priv *priv);
576+
int (*init_rx)(struct mlx5e_priv *priv);
577+
void (*cleanup_rx)(struct mlx5e_priv *priv);
578+
int (*init_tx)(struct mlx5e_priv *priv);
579+
void (*cleanup_tx)(struct mlx5e_priv *priv);
580+
void (*enable)(struct mlx5e_priv *priv);
581+
void (*disable)(struct mlx5e_priv *priv);
582+
void (*update_stats)(struct mlx5e_priv *priv);
583+
int (*max_nch)(struct mlx5_core_dev *mdev);
584+
int max_tc;
585+
};
586+
571587
struct mlx5e_priv {
572588
/* priv data path fields - start */
573589
struct mlx5e_sq **txq_to_sq_map;
@@ -601,6 +617,7 @@ struct mlx5e_priv {
601617
struct mlx5e_stats stats;
602618
struct mlx5e_tstamp tstamp;
603619
u16 q_counter;
620+
const struct mlx5e_profile *profile;
604621
};
605622

606623
enum mlx5e_link_mode {

0 commit comments

Comments
 (0)