netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, tariqt@nvidia.com, rrameshbabu@nvidia.com,
	saeedm@nvidia.com, yuehaibing@huawei.com, horms@kernel.org,
	jacob.e.keller@intel.com, afaris@nvidia.com
Subject: Re: [PATCH net-next v2] eth: mlx5: expose NETIF_F_NTUPLE when ARFS is compiled out
Date: Thu, 11 Jul 2024 16:05:29 -0700	[thread overview]
Message-ID: <ZpBlOWzyihXUad_V@x130> (raw)
In-Reply-To: <20240711223722.297676-1-kuba@kernel.org>

On 11 Jul 15:37, Jakub Kicinski wrote:
>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.
>
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>---
>v2:
> - hard wire to on (not propagating Simon's review because of this)
>v1: https://lore.kernel.org/20240710175502.760194-1-kuba@kernel.org
>
>CC: tariqt@nvidia.com
>CC: rrameshbabu@nvidia.com
>CC: saeedm@nvidia.com
>CC: yuehaibing@huawei.com
>CC: horms@kernel.org
>CC: jacob.e.keller@intel.com
>CC: afaris@nvidia.com
>---
> drivers/net/ethernet/mellanox/mlx5/core/en/fs.h     | 13 +++++++++++++
> .../net/ethernet/mellanox/mlx5/core/en_ethtool.c    |  2 +-
> drivers/net/ethernet/mellanox/mlx5/core/en_fs.c     |  5 ++---
> drivers/net/ethernet/mellanox/mlx5/core/en_main.c   |  8 +++++---
> .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c   |  8 +++-----
> 5 files changed, 24 insertions(+), 12 deletions(-)
>
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
>index 4d6225e0eec7..1e8b7d330701 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
>@@ -154,6 +154,19 @@ struct mlx5e_tc_table *mlx5e_fs_get_tc(struct mlx5e_flow_steering *fs);
> struct mlx5e_l2_table *mlx5e_fs_get_l2(struct mlx5e_flow_steering *fs);
> struct mlx5_flow_namespace *mlx5e_fs_get_ns(struct mlx5e_flow_steering *fs, bool egress);
> void mlx5e_fs_set_ns(struct mlx5e_flow_steering *fs, struct mlx5_flow_namespace *ns, bool egress);
>+
>+static inline bool mlx5e_fs_has_arfs(struct net_device *netdev)
>+{
>+	return IS_ENABLED(CONFIG_MLX5_EN_ARFS) &&
>+		netdev->hw_features & NETIF_F_NTUPLE;
>+}
>+
>+static inline bool mlx5e_fs_want_arfs(struct net_device *netdev)
>+{
>+	return IS_ENABLED(CONFIG_MLX5_EN_ARFS) &&
>+		netdev->features & NETIF_F_NTUPLE;
>+}
>+
> #ifdef CONFIG_MLX5_EN_RXNFC
> struct mlx5e_ethtool_steering *mlx5e_fs_get_ethtool(struct mlx5e_flow_steering *fs);
> #endif
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>index 3320f12ba2db..5582c93a62f1 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
>@@ -525,7 +525,7 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
>
> 	opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
>
>-	arfs_enabled = opened && (priv->netdev->features & NETIF_F_NTUPLE);
>+	arfs_enabled = opened && mlx5e_fs_want_arfs(priv->netdev);
> 	if (arfs_enabled)
> 		mlx5e_arfs_disable(priv->fs);
>
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
>index 8c5b291a171f..05058710d2c7 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
>@@ -1307,8 +1307,7 @@ int mlx5e_create_flow_steering(struct mlx5e_flow_steering *fs,
> 		return -EOPNOTSUPP;
>
> 	mlx5e_fs_set_ns(fs, ns, false);
>-	err = mlx5e_arfs_create_tables(fs, rx_res,
>-				       !!(netdev->hw_features & NETIF_F_NTUPLE));
>+	err = mlx5e_arfs_create_tables(fs, rx_res, mlx5e_fs_has_arfs(netdev));
> 	if (err) {
> 		fs_err(fs, "Failed to create arfs tables, err=%d\n", err);
> 		netdev->hw_features &= ~NETIF_F_NTUPLE;
>@@ -1355,7 +1354,7 @@ int mlx5e_create_flow_steering(struct mlx5e_flow_steering *fs,
> err_destroy_inner_ttc_table:
> 	mlx5e_destroy_inner_ttc_table(fs);
> err_destroy_arfs_tables:
>-	mlx5e_arfs_destroy_tables(fs, !!(netdev->hw_features & NETIF_F_NTUPLE));
>+	mlx5e_arfs_destroy_tables(fs, mlx5e_fs_has_arfs(netdev));
>
> 	return err;
> }
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>index ff335527c10a..6f686fabed44 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>@@ -5556,8 +5556,10 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
> #if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
> 		netdev->hw_features      |= NETIF_F_HW_TC;
> #endif
>-#ifdef CONFIG_MLX5_EN_ARFS
>+#if IS_ENABLED(CONFIG_MLX5_EN_ARFS)
> 		netdev->hw_features	 |= NETIF_F_NTUPLE;
>+#elif IS_ENABLED(CONFIG_MLX5_EN_RXNFC)
>+		netdev->features	 |= NETIF_F_NTUPLE;

Why default ON when RXNFC and OFF when ARFS ?
Default should be off always, and this needs to be advertised in 
hw_features in both cases.

I think this should be
#if IS_ENABLED(ARFS) || IS_ENABLED(RXFNC)
	netdev->hw_features |= NTUPLE;

Otherwise LGTM

Acked-by: Saeed Mahameed <saeedm@nvidia.com>



  reply	other threads:[~2024-07-11 23:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 22:37 [PATCH net-next v2] eth: mlx5: expose NETIF_F_NTUPLE when ARFS is compiled out Jakub Kicinski
2024-07-11 23:05 ` Saeed Mahameed [this message]
2024-07-11 23:16   ` Jakub Kicinski
2024-07-12  0:06     ` Saeed Mahameed
2024-07-13 23:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZpBlOWzyihXUad_V@x130 \
    --to=saeed@kernel.org \
    --cc=afaris@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rrameshbabu@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).