net/mlx5e: Rename state_destroy to rx_mode_active in flow steering
Subsystems (5)
Tariq Toukan
maintainerPATCH 1/1 net/mlx5e: Rename state_destroy to rx_mode_active in flow steering
From: Alexei Lazar <[email protected]>
This flag controls the enablement of RX mode handling (promisc, allmulti, broadcast, netdev addr sync). It acts as a safeguard that prevents new FS (flow steering) operations during device teardown. When the device is in destroying state it is set to false to indicate RX mode operations are not allowed. Its name is misleading, as it suggests a destroy-state flag rather than RX mode activity. Rename it for clarity.
No functional change.
--- drivers/net/ethernet/mellanox/mlx5/core/en/fs.h | 5 +++-- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 17 +++++++++-------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 15 +++++++++------ 3 files changed, 21 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +3 -2
@@ -158,7 +158,7 @@ void mlx5e_destroy_flow_steering(struct mlx5e_flow_steering *fs, bool ntuple,struct mlx5e_flow_steering *mlx5e_fs_init (const struct mlx5e_profile *profile,struct mlx5_core_dev *mdev, -bool state_destroy, +bool rx_mode_active,struct dentry *dfs_root);void mlx5e_fs_cleanup (struct mlx5e_flow_steering *fs);struct mlx5e_vlan_table *mlx5e_fs_get_vlan (struct mlx5e_flow_steering *fs);
@@ -198,7 +198,8 @@ void mlx5e_fs_set_udp(struct mlx5e_flow_steering *fs, struct mlx5e_fs_udp *udp);struct mlx5e_accel_fs_tcp *mlx5e_fs_get_accel_tcp (struct mlx5e_flow_steering *fs);void mlx5e_fs_set_accel_tcp (struct mlx5e_flow_steering *fs,struct mlx5e_accel_fs_tcp *accel_tcp);#endif -void mlx5e_fs_set_state_destroy (struct mlx5e_flow_steering *fs,bool state_destroy); +void mlx5e_fs_set_rx_mode_active (struct mlx5e_flow_steering *fs, +bool rx_mode_active);void mlx5e_fs_set_vlan_strip_disable (struct mlx5e_flow_steering *fs,bool vlan_strip_disable);struct mlx5_core_dev *mlx5e_fs_get_mdev (struct mlx5e_flow_steering *fs);
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +9 -8
@@ -44,7 +44,7 @@struct mlx5e_flow_steering {struct work_struct set_rx_mode_work; -bool state_destroy; +bool rx_mode_active;bool vlan_strip_disable;struct mlx5_core_dev *mdev;struct mlx5_flow_namespace *ns;
@@ -560,7 +560,7 @@ static void mlx5e_del_vlan_rules(struct mlx5e_flow_steering *fs)for_each_set_bit (i, fs->vlan->active_svlans,VLAN_N_VID )mlx5e_fs_del_vlan_rule (fs,MLX5E_VLAN_RULE_TYPE_MATCH_STAG_VID , i); -WARN_ON_ONCE (fs->state_destroy); +WARN_ON_ONCE (fs->rx_mode_active);mlx5e_remove_vlan_trap (fs);
@@ -743,7 +743,7 @@ static void mlx5e_handle_netdev_addr(struct mlx5e_flow_steering *fs,mlx5e_for_each_hash_node (hn, tmp, fs->l2.netdev_mc, i) hn->action =MLX5E_ACTION_DEL ; -if (fs->state_destroy) +if (fs->rx_mode_active)mlx5e_sync_netdev_addr (fs, netdev, uc, mc);mlx5e_apply_netdev_addr (fs);
@@ -840,7 +840,7 @@ void mlx5e_fs_set_rx_mode_work(struct mlx5e_flow_steering *fs, goto update_vport_context; } -bool rx_mode_enable = fs->state_destroy; +bool rx_mode_enable = fs->rx_mode_active;bool promisc_enabled = rx_mode_enable && (netdev->flags &IFF_PROMISC );bool allmulti_enabled = rx_mode_enable && (netdev->flags &IFF_ALLMULTI );bool broadcast_enabled = rx_mode_enable;
@@ -1479,7 +1479,7 @@ static void mlx5e_fs_debugfs_init(struct mlx5e_flow_steering *fs,struct mlx5e_flow_steering *mlx5e_fs_init (const struct mlx5e_profile *profile,struct mlx5_core_dev *mdev, -bool state_destroy, +bool rx_mode_active,struct dentry *dfs_root) {struct mlx5e_flow_steering *fs;
@@ -1490,7 +1490,7 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile, goto err; fs->mdev = mdev; - fs->state_destroy = state_destroy; + fs->rx_mode_active = rx_mode_active;if (mlx5e_profile_feature_cap (profile,FS_VLAN )) { err =mlx5e_fs_vlan_alloc (fs);if (err)
@@ -1606,9 +1606,10 @@ void mlx5e_fs_set_accel_tcp(struct mlx5e_flow_steering *fs, struct mlx5e_accel_f }#endif -void mlx5e_fs_set_state_destroy (struct mlx5e_flow_steering *fs,bool state_destroy) +void mlx5e_fs_set_rx_mode_active (struct mlx5e_flow_steering *fs, +bool rx_mode_active) { - fs->state_destroy = state_destroy; + fs->rx_mode_active = rx_mode_active; } void mlx5e_fs_set_vlan_strip_disable(struct mlx5e_flow_steering *fs,
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +9 -6
@@ -6557,8 +6557,9 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv)clear_bit (MLX5E_STATE_DESTROYING , &priv->state);if (priv->fs) -mlx5e_fs_set_state_destroy (priv->fs, - !test_bit (MLX5E_STATE_DESTROYING , &priv->state)); +mlx5e_fs_set_rx_mode_active (priv->fs, + !test_bit (MLX5E_STATE_DESTROYING , + &priv->state));/* Validate the max_wqe_size_sq capability. */ if (WARN_ON_ONCE (mlx5e_get_max_sq_wqebbs (priv->mdev) <MLX5E_MAX_TX_WQEBBS )) {
@@ -6638,8 +6639,9 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv)mlx5e_reset_channels (priv->netdev);set_bit (MLX5E_STATE_DESTROYING , &priv->state);if (priv->fs) -mlx5e_fs_set_state_destroy (priv->fs, - !test_bit (MLX5E_STATE_DESTROYING , &priv->state)); +mlx5e_fs_set_rx_mode_active (priv->fs, + !test_bit (MLX5E_STATE_DESTROYING , + &priv->state));cancel_work_sync (&priv->update_stats_work);return err; }
@@ -6650,8 +6652,9 @@ void mlx5e_detach_netdev(struct mlx5e_priv *priv)set_bit (MLX5E_STATE_DESTROYING , &priv->state);if (priv->fs) -mlx5e_fs_set_state_destroy (priv->fs, - !test_bit (MLX5E_STATE_DESTROYING , &priv->state)); +mlx5e_fs_set_rx_mode_active (priv->fs, + !test_bit (MLX5E_STATE_DESTROYING , + &priv->state));if (profile->disable) profile->disable (priv);
base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
Signature · 1 line
2.44.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] net/mlx5e: spurious WARN_ON_ONCE in mlx5e_del_vlan_rules() on error paths --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] net/mlx5e: spurious WARN_ON_ONCE in mlx5e_del_vlan_rules() on error paths --
commit cc0cc005a261a4ae9c4dc0882c52ded86fc801c3
Author: Alexei Lazar <[email protected]>
net/mlx5e: Rename state_destroy to rx_mode_active in flow steering
This commit renames the state_destroy flag to rx_mode_active to better clarify its purpose in the flow steering code. It controls the enablement of RX mode handling and acts as a safeguard during device teardown.
Quoted 4 lines
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +0
-0
[ ... ]
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c static void mlx5e_del_vlan_rules(struct mlx5e_flow_steering *fs) · line 563
Quoted 6 lines
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +1
-1@@ -560,7 +560,7 @@ static void mlx5e_del_vlan_rules(struct mlx5e_flow_steering *fs)for_each_set_bit (i, fs->vlan->active_svlans,VLAN_N_VID )mlx5e_fs_del_vlan_rule (fs,MLX5E_VLAN_RULE_TYPE_MATCH_STAG_VID , i); -WARN_ON_ONCE (fs->state_destroy); +WARN_ON_ONCE (fs->rx_mode_active);
[Severity: Low]
Does this trigger a spurious warning on error paths?
If mlx5e_attach_netdev() begins execution, it sets rx_mode_active to true. If a subsequent function like profile->init_rx() fails (for example, if mlx5e_ptp_alloc_rx_fs() fails), the error rollback path calls mlx5e_destroy_vlan_table() which calls mlx5e_del_vlan_rules(). Since rx_mode_active is still true, the WARN_ON_ONCE() is hit during the rollback.
[ ... ]
drivers/net/ethernet/mellanox/mlx5/core/en_main.c int mlx5e_attach_netdev(struct mlx5e_priv *priv) · line 6562
Quoted 13 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3
-2@@ -6557,8 +6557,9 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv)clear_bit (MLX5E_STATE_DESTROYING , &priv->state);if (priv->fs) -mlx5e_fs_set_state_destroy (priv->fs, - !test_bit (MLX5E_STATE_DESTROYING , &priv->state)); +mlx5e_fs_set_rx_mode_active (priv->fs, + !test_bit (MLX5E_STATE_DESTROYING , + &priv->state));
[Severity: Low]
Because rx_mode_active is set to true early in device attachment here before calling init_rx(), could it remain true when handling a failure and lead to the spurious warning mentioned above?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 12 lines · Tariq Toukan
From: Alexei Lazar <[email protected]>
This flag controls the enablement of RX mode handling (promisc, allmulti, broadcast, netdev addr sync). It acts as a safeguard that prevents new FS (flow steering) operations during device teardown. When the device is in destroying state it is set to false to indicate RX mode operations are not allowed. Its name is misleading, as it suggests a destroy-state flag rather than RX mode activity. Rename it for clarity.
No functional change.
Quoted 8 lines
Signed-off-by Alexei Lazar <[email protected]>Reviewed-by Shahar Shitrit <[email protected]>Signed-off-by Tariq Toukan <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en/fs.h | 5 +++-- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 17 +++++++++-------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 15 +++++++++------ 3 files changed, 21 insertions(+), 16 deletions(-)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Sun, 11 Oct 2026 12:31:00 +0300 you wrote:
From: Alexei Lazar <[email protected]>
This flag controls the enablement of RX mode handling (promisc, allmulti, broadcast, netdev addr sync). It acts as a safeguard that prevents new FS (flow steering) operations during device teardown. When the device is in destroying state it is set to false to indicate RX mode operations are not allowed. Its name is misleading, as it suggests a destroy-state flag rather than RX mode activity. Rename it for clarity.
[...]
Here is the summary with links:
- [net-next] net/mlx5e: Rename state_destroy to rx_mode_active in flow steering
https://git.kernel.org/netdev/net-next/c/cdcb648a97eb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html