summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
diff options
context:
space:
mode:
authorSaeed Mahameed2015-12-01 17:03:20 +0100
committerDavid S. Miller2015-12-03 18:08:46 +0100
commit81848731ff4070a3e4136efa6a99d507177a53fe (patch)
tree38c1eb4a42e57b30b10e9f631085d0d85ed6d2c3 /drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
parentnet/mlx5: E-Switch, Introduce FDB hardware capabilities (diff)
downloadkernel-qcow2-linux-81848731ff4070a3e4136efa6a99d507177a53fe.tar.gz
kernel-qcow2-linux-81848731ff4070a3e4136efa6a99d507177a53fe.tar.xz
kernel-qcow2-linux-81848731ff4070a3e4136efa6a99d507177a53fe.zip
net/mlx5: E-Switch, Add SR-IOV (FDB) support
Enabling E-Switch SRIOV for nvfs+1 vports. Create E-Switch FDB for L2 UC/MC mac steering between VFs/PF and external vport (Uplink). FDB contains forwarding rules such as: UC MAC0 -> vport0(PF). UC MAC1 -> vport1. UC MAC2 -> vport2. MC MACX -> vport0, vport2, Uplink. MC MACY -> vport1, Uplink. For unmatched traffic FDB has the following default rules: Unmached Traffic (src vport != Uplink) -> Uplink. Unmached Traffic (src vport == Uplink) -> vport0(PF). FDB rules population: Each NIC vport (VF) will notify E-Switch manager of its UC/MC vport context changes via modify vport context command, which will be translated to an event that will be handled by E-Switch manager (PF) which will update FDB table accordingly. Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/eswitch.h')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index 0c41f2657824..f222e336f34f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -86,10 +86,25 @@ struct l2addr_node {
kfree(ptr); \
})
+struct mlx5_flow_rule {
+ void *ft;
+ u32 fi;
+ u8 match_criteria_enable;
+ u32 *match_criteria;
+ u32 *match_value;
+ u32 action;
+ u32 flow_tag;
+ bool valid;
+ atomic_t refcount;
+ struct mutex mutex; /* protect flow rule updates */
+ struct list_head dest_list;
+};
+
struct mlx5_vport {
struct mlx5_core_dev *dev;
int vport;
struct hlist_head uc_list[MLX5_L2_ADDR_HASH_SIZE];
+ struct hlist_head mc_list[MLX5_L2_ADDR_HASH_SIZE];
struct work_struct vport_change_handler;
/* This spinlock protects access to vport data, between
@@ -98,6 +113,7 @@ struct mlx5_vport {
*/
spinlock_t lock; /* vport events sync */
bool enabled;
+ u16 enabled_events;
};
struct mlx5_l2_table {
@@ -106,17 +122,26 @@ struct mlx5_l2_table {
unsigned long *bitmap;
};
+struct mlx5_eswitch_fdb {
+ void *fdb;
+};
+
struct mlx5_eswitch {
struct mlx5_core_dev *dev;
struct mlx5_l2_table l2_table;
+ struct mlx5_eswitch_fdb fdb_table;
+ struct hlist_head mc_table[MLX5_L2_ADDR_HASH_SIZE];
struct workqueue_struct *work_queue;
struct mlx5_vport *vports;
int total_vports;
+ int enabled_vports;
};
/* E-Switch API */
int mlx5_eswitch_init(struct mlx5_core_dev *dev);
void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw);
void mlx5_eswitch_vport_event(struct mlx5_eswitch *esw, struct mlx5_eqe *eqe);
+int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs);
+void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw);
#endif /* __MLX5_ESWITCH_H__ */