Commit 9bee385a authored by Shay Drory's avatar Shay Drory Committed by Saeed Mahameed

net/mlx5: E-switch, refactor FDB miss rule add/remove

Currently, E-switch FDB have a single peer miss rule.
In order to support more than one peer, refactor E-switch FDB to
have peer miss rule per peer, and change the code to add/remove a
rule from specific peer.
Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 18e31d42
...@@ -218,7 +218,7 @@ struct mlx5_eswitch_fdb { ...@@ -218,7 +218,7 @@ struct mlx5_eswitch_fdb {
struct mlx5_flow_group *send_to_vport_grp; struct mlx5_flow_group *send_to_vport_grp;
struct mlx5_flow_group *send_to_vport_meta_grp; struct mlx5_flow_group *send_to_vport_meta_grp;
struct mlx5_flow_group *peer_miss_grp; struct mlx5_flow_group *peer_miss_grp;
struct mlx5_flow_handle **peer_miss_rules; struct mlx5_flow_handle **peer_miss_rules[MLX5_MAX_PORTS];
struct mlx5_flow_group *miss_grp; struct mlx5_flow_group *miss_grp;
struct mlx5_flow_handle **send_to_vport_meta_rules; struct mlx5_flow_handle **send_to_vport_meta_rules;
struct mlx5_flow_handle *miss_rule_uni; struct mlx5_flow_handle *miss_rule_uni;
......
...@@ -1132,7 +1132,7 @@ static int esw_add_fdb_peer_miss_rules(struct mlx5_eswitch *esw, ...@@ -1132,7 +1132,7 @@ static int esw_add_fdb_peer_miss_rules(struct mlx5_eswitch *esw,
flows[vport->index] = flow; flows[vport->index] = flow;
} }
esw->fdb_table.offloads.peer_miss_rules = flows; esw->fdb_table.offloads.peer_miss_rules[mlx5_get_dev_index(peer_dev)] = flows;
kvfree(spec); kvfree(spec);
return 0; return 0;
...@@ -1160,13 +1160,14 @@ static int esw_add_fdb_peer_miss_rules(struct mlx5_eswitch *esw, ...@@ -1160,13 +1160,14 @@ static int esw_add_fdb_peer_miss_rules(struct mlx5_eswitch *esw,
return err; return err;
} }
static void esw_del_fdb_peer_miss_rules(struct mlx5_eswitch *esw) static void esw_del_fdb_peer_miss_rules(struct mlx5_eswitch *esw,
struct mlx5_core_dev *peer_dev)
{ {
struct mlx5_flow_handle **flows; struct mlx5_flow_handle **flows;
struct mlx5_vport *vport; struct mlx5_vport *vport;
unsigned long i; unsigned long i;
flows = esw->fdb_table.offloads.peer_miss_rules; flows = esw->fdb_table.offloads.peer_miss_rules[mlx5_get_dev_index(peer_dev)];
mlx5_esw_for_each_vf_vport(esw, i, vport, mlx5_core_max_vfs(esw->dev)) mlx5_esw_for_each_vf_vport(esw, i, vport, mlx5_core_max_vfs(esw->dev))
mlx5_del_flow_rules(flows[vport->index]); mlx5_del_flow_rules(flows[vport->index]);
...@@ -2700,7 +2701,7 @@ static void mlx5_esw_offloads_unpair(struct mlx5_eswitch *esw, ...@@ -2700,7 +2701,7 @@ static void mlx5_esw_offloads_unpair(struct mlx5_eswitch *esw,
mlx5e_tc_clean_fdb_peer_flows(esw); mlx5e_tc_clean_fdb_peer_flows(esw);
#endif #endif
mlx5_esw_offloads_rep_event_unpair(esw, peer_esw); mlx5_esw_offloads_rep_event_unpair(esw, peer_esw);
esw_del_fdb_peer_miss_rules(esw); esw_del_fdb_peer_miss_rules(esw, peer_esw->dev);
} }
static int mlx5_esw_offloads_pair(struct mlx5_eswitch *esw, static int mlx5_esw_offloads_pair(struct mlx5_eswitch *esw,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment