Skip to content

Commit 3771266

Browse files
committed
eth: mlx5: expose NETIF_F_NTUPLE when ARFS is compiled out
ARFS depends on NTUPLE filters, but the inverse is not true. Drivers which don't support ARFS commonly still support NTUPLE filtering. mlx5 has a Kconfig option to disable ARFS (MLX5_EN_ARFS) and does not advertise NTUPLE filters as a feature at all when ARFS is compiled out. That's not correct, ntuple filters indeed still work just fine (as long as MLX5_EN_RXNFC is enabled). This is needed to make the RSS test not skip all RSS context related testing. Acked-by: Saeed Mahameed <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 464b99e commit 3771266

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ struct mlx5e_tc_table *mlx5e_fs_get_tc(struct mlx5e_flow_steering *fs);
154154
struct mlx5e_l2_table *mlx5e_fs_get_l2(struct mlx5e_flow_steering *fs);
155155
struct mlx5_flow_namespace *mlx5e_fs_get_ns(struct mlx5e_flow_steering *fs, bool egress);
156156
void mlx5e_fs_set_ns(struct mlx5e_flow_steering *fs, struct mlx5_flow_namespace *ns, bool egress);
157+
158+
static inline bool mlx5e_fs_has_arfs(struct net_device *netdev)
159+
{
160+
return IS_ENABLED(CONFIG_MLX5_EN_ARFS) &&
161+
netdev->hw_features & NETIF_F_NTUPLE;
162+
}
163+
164+
static inline bool mlx5e_fs_want_arfs(struct net_device *netdev)
165+
{
166+
return IS_ENABLED(CONFIG_MLX5_EN_ARFS) &&
167+
netdev->features & NETIF_F_NTUPLE;
168+
}
169+
157170
#ifdef CONFIG_MLX5_EN_RXNFC
158171
struct mlx5e_ethtool_steering *mlx5e_fs_get_ethtool(struct mlx5e_flow_steering *fs);
159172
#endif

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
525525

526526
opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
527527

528-
arfs_enabled = opened && (priv->netdev->features & NETIF_F_NTUPLE);
528+
arfs_enabled = opened && mlx5e_fs_want_arfs(priv->netdev);
529529
if (arfs_enabled)
530530
mlx5e_arfs_disable(priv->fs);
531531

drivers/net/ethernet/mellanox/mlx5/core/en_fs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,8 +1307,7 @@ int mlx5e_create_flow_steering(struct mlx5e_flow_steering *fs,
13071307
return -EOPNOTSUPP;
13081308

13091309
mlx5e_fs_set_ns(fs, ns, false);
1310-
err = mlx5e_arfs_create_tables(fs, rx_res,
1311-
!!(netdev->hw_features & NETIF_F_NTUPLE));
1310+
err = mlx5e_arfs_create_tables(fs, rx_res, mlx5e_fs_has_arfs(netdev));
13121311
if (err) {
13131312
fs_err(fs, "Failed to create arfs tables, err=%d\n", err);
13141313
netdev->hw_features &= ~NETIF_F_NTUPLE;
@@ -1355,7 +1354,7 @@ int mlx5e_create_flow_steering(struct mlx5e_flow_steering *fs,
13551354
err_destroy_inner_ttc_table:
13561355
mlx5e_destroy_inner_ttc_table(fs);
13571356
err_destroy_arfs_tables:
1358-
mlx5e_arfs_destroy_tables(fs, !!(netdev->hw_features & NETIF_F_NTUPLE));
1357+
mlx5e_arfs_destroy_tables(fs, mlx5e_fs_has_arfs(netdev));
13591358

13601359
return err;
13611360
}

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5556,8 +5556,10 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
55565556
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
55575557
netdev->hw_features |= NETIF_F_HW_TC;
55585558
#endif
5559-
#ifdef CONFIG_MLX5_EN_ARFS
5559+
#if IS_ENABLED(CONFIG_MLX5_EN_ARFS)
55605560
netdev->hw_features |= NETIF_F_NTUPLE;
5561+
#elif IS_ENABLED(CONFIG_MLX5_EN_RXNFC)
5562+
netdev->features |= NETIF_F_NTUPLE;
55615563
#endif
55625564
}
55635565

@@ -5731,7 +5733,7 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)
57315733
err_tc_nic_cleanup:
57325734
mlx5e_tc_nic_cleanup(priv);
57335735
err_destroy_flow_steering:
5734-
mlx5e_destroy_flow_steering(priv->fs, !!(priv->netdev->hw_features & NETIF_F_NTUPLE),
5736+
mlx5e_destroy_flow_steering(priv->fs, mlx5e_fs_has_arfs(priv->netdev),
57355737
priv->profile);
57365738
err_destroy_rx_res:
57375739
mlx5e_rx_res_destroy(priv->rx_res);
@@ -5747,7 +5749,7 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv)
57475749
{
57485750
mlx5e_accel_cleanup_rx(priv);
57495751
mlx5e_tc_nic_cleanup(priv);
5750-
mlx5e_destroy_flow_steering(priv->fs, !!(priv->netdev->hw_features & NETIF_F_NTUPLE),
5752+
mlx5e_destroy_flow_steering(priv->fs, mlx5e_fs_has_arfs(priv->netdev),
57515753
priv->profile);
57525754
mlx5e_rx_res_destroy(priv->rx_res);
57535755
priv->rx_res = NULL;

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
372372

373373
mlx5e_fs_set_ns(priv->fs, ns, false);
374374
err = mlx5e_arfs_create_tables(priv->fs, priv->rx_res,
375-
!!(priv->netdev->hw_features & NETIF_F_NTUPLE));
375+
mlx5e_fs_has_arfs(priv->netdev));
376376
if (err) {
377377
netdev_err(priv->netdev, "Failed to create arfs tables, err=%d\n",
378378
err);
@@ -391,17 +391,15 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
391391
return 0;
392392

393393
err_destroy_arfs_tables:
394-
mlx5e_arfs_destroy_tables(priv->fs,
395-
!!(priv->netdev->hw_features & NETIF_F_NTUPLE));
394+
mlx5e_arfs_destroy_tables(priv->fs, mlx5e_fs_has_arfs(priv->netdev));
396395

397396
return err;
398397
}
399398

400399
static void mlx5i_destroy_flow_steering(struct mlx5e_priv *priv)
401400
{
402401
mlx5e_destroy_ttc_table(priv->fs);
403-
mlx5e_arfs_destroy_tables(priv->fs,
404-
!!(priv->netdev->hw_features & NETIF_F_NTUPLE));
402+
mlx5e_arfs_destroy_tables(priv->fs, mlx5e_fs_has_arfs(priv->netdev));
405403
mlx5e_ethtool_cleanup_steering(priv->fs);
406404
}
407405

0 commit comments

Comments
 (0)