Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <saeedm@nvidia.com>
Link: https://patch.msgid.link/20240711223722.297676-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+24 -12
+13
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
··· 154 154 struct mlx5e_l2_table *mlx5e_fs_get_l2(struct mlx5e_flow_steering *fs); 155 155 struct mlx5_flow_namespace *mlx5e_fs_get_ns(struct mlx5e_flow_steering *fs, bool egress); 156 156 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 + 157 170 #ifdef CONFIG_MLX5_EN_RXNFC 158 171 struct mlx5e_ethtool_steering *mlx5e_fs_get_ethtool(struct mlx5e_flow_steering *fs); 159 172 #endif
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 525 525 526 526 opened = test_bit(MLX5E_STATE_OPENED, &priv->state); 527 527 528 - arfs_enabled = opened && (priv->netdev->features & NETIF_F_NTUPLE); 528 + arfs_enabled = opened && mlx5e_fs_want_arfs(priv->netdev); 529 529 if (arfs_enabled) 530 530 mlx5e_arfs_disable(priv->fs); 531 531
+2 -3
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
··· 1307 1307 return -EOPNOTSUPP; 1308 1308 1309 1309 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)); 1312 1311 if (err) { 1313 1312 fs_err(fs, "Failed to create arfs tables, err=%d\n", err); 1314 1313 netdev->hw_features &= ~NETIF_F_NTUPLE; ··· 1354 1355 err_destroy_inner_ttc_table: 1355 1356 mlx5e_destroy_inner_ttc_table(fs); 1356 1357 err_destroy_arfs_tables: 1357 - mlx5e_arfs_destroy_tables(fs, !!(netdev->hw_features & NETIF_F_NTUPLE)); 1358 + mlx5e_arfs_destroy_tables(fs, mlx5e_fs_has_arfs(netdev)); 1358 1359 1359 1360 return err; 1360 1361 }
+5 -3
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 5556 5556 #if IS_ENABLED(CONFIG_MLX5_CLS_ACT) 5557 5557 netdev->hw_features |= NETIF_F_HW_TC; 5558 5558 #endif 5559 - #ifdef CONFIG_MLX5_EN_ARFS 5559 + #if IS_ENABLED(CONFIG_MLX5_EN_ARFS) 5560 5560 netdev->hw_features |= NETIF_F_NTUPLE; 5561 + #elif IS_ENABLED(CONFIG_MLX5_EN_RXNFC) 5562 + netdev->features |= NETIF_F_NTUPLE; 5561 5563 #endif 5562 5564 } 5563 5565 ··· 5733 5731 err_tc_nic_cleanup: 5734 5732 mlx5e_tc_nic_cleanup(priv); 5735 5733 err_destroy_flow_steering: 5736 - mlx5e_destroy_flow_steering(priv->fs, !!(priv->netdev->hw_features & NETIF_F_NTUPLE), 5734 + mlx5e_destroy_flow_steering(priv->fs, mlx5e_fs_has_arfs(priv->netdev), 5737 5735 priv->profile); 5738 5736 err_destroy_rx_res: 5739 5737 mlx5e_rx_res_destroy(priv->rx_res); ··· 5749 5747 { 5750 5748 mlx5e_accel_cleanup_rx(priv); 5751 5749 mlx5e_tc_nic_cleanup(priv); 5752 - mlx5e_destroy_flow_steering(priv->fs, !!(priv->netdev->hw_features & NETIF_F_NTUPLE), 5750 + mlx5e_destroy_flow_steering(priv->fs, mlx5e_fs_has_arfs(priv->netdev), 5753 5751 priv->profile); 5754 5752 mlx5e_rx_res_destroy(priv->rx_res); 5755 5753 priv->rx_res = NULL;
+3 -5
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
··· 372 372 373 373 mlx5e_fs_set_ns(priv->fs, ns, false); 374 374 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)); 376 376 if (err) { 377 377 netdev_err(priv->netdev, "Failed to create arfs tables, err=%d\n", 378 378 err); ··· 391 391 return 0; 392 392 393 393 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)); 396 395 397 396 return err; 398 397 } ··· 399 400 static void mlx5i_destroy_flow_steering(struct mlx5e_priv *priv) 400 401 { 401 402 mlx5e_destroy_ttc_table(priv->fs); 402 - mlx5e_arfs_destroy_tables(priv->fs, 403 - !!(priv->netdev->hw_features & NETIF_F_NTUPLE)); 403 + mlx5e_arfs_destroy_tables(priv->fs, mlx5e_fs_has_arfs(priv->netdev)); 404 404 mlx5e_ethtool_cleanup_steering(priv->fs); 405 405 } 406 406