net/mlx5e: Clear mirred devices array if the rule is split
PATCH 1/2 net/mlx5e: Clear mirred devices array if the rule is split
From: Jianbo Liu <[email protected]>
In the cited commit, the mirred devices are recorded and checked while parsing the actions. In order to avoid system crash, the duplicate action in a single rule is not allowed.
But the rule is actually break down into several FTEs in different tables, for either mirroring, or the specified types of actions which use post action infrastructure.
It will reject certain action list by mistake, for example:
actions:enp8s0f0_1,set(ipv4(ttl=63)),enp8s0f0_0,enp8s0f0_1.
Here the rule is split to two FTEs because of pedit action.
To fix this issue, when parsing the rule actions, reset if_count to clear the mirred devices array if the rule is split to multiple FTEs, and then the duplicate checking is restarted.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c | 4 +++- drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c | 4 +++- .../ethernet/mellanox/mlx5/core/en/tc/act/redirect_ingress.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c | 1 + .../net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c | 4 +++- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 + 7 files changed, 13 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c +3 -1
@@ -17,8 +17,10 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state,if (err)return err; -if (mlx5e_is_eswitch_flow (parse_state->flow)) +if (mlx5e_is_eswitch_flow (parse_state->flow)) { attr->esw_attr->split_count = attr->esw_attr->out_count; + parse_state->if_count =0 ; + } attr->flags |=MLX5_ATTR_FLAG_CT ;
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c +1 -0
@@ -294,6 +294,7 @@ parse_mirred_ovs_master(struct mlx5e_tc_act_parse_state *parse_state,if (err)return err; + parse_state->if_count =0 ; esw_attr->out_count++;return 0 ; }
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c +3 -1
@@ -98,8 +98,10 @@ tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state, attr->action |=MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ; -if (ns_type ==MLX5_FLOW_NAMESPACE_FDB ) +if (ns_type ==MLX5_FLOW_NAMESPACE_FDB ) { esw_attr->split_count = esw_attr->out_count; + parse_state->if_count =0 ; + }return 0 ; }
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/redirect_ingress.c +1 -0
@@ -66,6 +66,7 @@ tc_act_parse_redirect_ingress(struct mlx5e_tc_act_parse_state *parse_state,if (err)return err; + parse_state->if_count =0 ; esw_attr->out_count++;return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c +1 -0
@@ -166,6 +166,7 @@ tc_act_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state,return err; esw_attr->split_count = esw_attr->out_count; + parse_state->if_count =0 ;return 0 ; }
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c +3 -1
@@ -65,8 +65,10 @@ tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state,if (err)return err; -if (ns_type ==MLX5_FLOW_NAMESPACE_FDB ) +if (ns_type ==MLX5_FLOW_NAMESPACE_FDB ) { attr->esw_attr->split_count = attr->esw_attr->out_count; + parse_state->if_count =0 ; + }return 0 ; }
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1 -0
@@ -3936,6 +3936,7 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state, } i_split = i +1 ; + parse_state->if_count =0 ;list_add (&attr->list, &flow->attrs); }
Signature · 1 line
2.41.0
PATCH 2/2 mlx5/core: E-Switch, Create ACL FT for eswitch manager in switchdev mode
From: Bodong Wang <[email protected]>
ACL flow table is required in switchdev mode when metadata is enabled, driver creates such table when loading each vport. However, not every vport is loaded in switchdev mode. Such as ECPF if it's the eswitch manager. In this case, ACL flow table is still needed.
To make it modularized, create ACL flow table for eswitch manager as default and skip such operations when loading manager vport.
Also, there is no need to load the eswitch manager vport in switchdev mode. This means there is no need to load it on regular connect-x HCAs where the PF is the eswitch manager. This will avoid creating duplicate ACL flow table for host PF vport.
--- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 21 ++++++-- .../mellanox/mlx5/core/eswitch_offloads.c | 49 +++++++++++++------ 2 files changed, 51 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +16 -5
@@ -1276,12 +1276,19 @@ int mlx5_eswitch_enable_pf_vf_vports(struct mlx5_eswitch *esw, enum mlx5_eswitch_vport_event enabled_events) { + bool pf_needed;int ret; + pf_needed =mlx5_core_is_ecpf_esw_manager (esw->dev) || + esw->mode ==MLX5_ESWITCH_LEGACY ; +/* Enable PF vport */ - ret =mlx5_eswitch_load_pf_vf_vport (esw,MLX5_VPORT_PF , enabled_events); -if (ret) -return ret; +if (pf_needed) { + ret =mlx5_eswitch_load_pf_vf_vport (esw,MLX5_VPORT_PF , + enabled_events); +if (ret) +return ret; + }/* Enable external host PF HCA */ ret =host_pf_enable_hca (esw->dev);
@@ -1317,7 +1324,8 @@ mlx5_eswitch_enable_pf_vf_vports(struct mlx5_eswitch *esw, ecpf_err:host_pf_disable_hca (esw->dev); pf_hca_err: -mlx5_eswitch_unload_pf_vf_vport (esw,MLX5_VPORT_PF ); +if (pf_needed) +mlx5_eswitch_unload_pf_vf_vport (esw,MLX5_VPORT_PF );return ret; }
@@ -1335,7 +1343,10 @@ void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw) }host_pf_disable_hca (esw->dev); -mlx5_eswitch_unload_pf_vf_vport (esw,MLX5_VPORT_PF ); + +if (mlx5_core_is_ecpf_esw_manager (esw->dev) || + esw->mode ==MLX5_ESWITCH_LEGACY ) +mlx5_eswitch_unload_pf_vf_vport (esw,MLX5_VPORT_PF ); }static void mlx5_eswitch_get_devlink_param (struct mlx5_eswitch *esw)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +35 -14
82 lines not on this page · raw message
Signature · 1 line
2.41.0
This series was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 11 lines · On Tue, 5 Sep 2023 10:48:45 -0700 you wrote:
From: Jianbo Liu <[email protected]>
In the cited commit, the mirred devices are recorded and checked while parsing the actions. In order to avoid system crash, the duplicate action in a single rule is not allowed.
But the rule is actually break down into several FTEs in different tables, for either mirroring, or the specified types of actions which use post action infrastructure.
[...]
Here is the summary with links:
- [net,1/2] net/mlx5e: Clear mirred devices array if the rule is split
https://git.kernel.org/netdev/net/c/b7558a77529f - [net,2/2] mlx5/core: E-Switch, Create ACL FT for eswitch manager in switchdev mode https://git.kernel.org/netdev/net/c/344134609a56
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html