diff mbox series

[net-next] nfp: make RSS can be switched on/off by ethtool

Message ID 20220225085929.269568-1-simon.horman@corigine.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] nfp: make RSS can be switched on/off by ethtool | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 33 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Simon Horman Feb. 25, 2022, 8:59 a.m. UTC
From: Yinjun Zhang <yinjun.zhang@corigine.com>

RSS is default on in nfp net device, and cannot be switched off
by `ethtool -K <int> receive-hashing off`. Implement it now.

Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 .../net/ethernet/netronome/nfp/nfp_net_common.c    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Feb. 25, 2022, 3:48 p.m. UTC | #1
On Fri, 25 Feb 2022 09:59:29 +0100 Simon Horman wrote:
> From: Yinjun Zhang <yinjun.zhang@corigine.com>
> 
> RSS is default on in nfp net device, and cannot be switched off
> by `ethtool -K <int> receive-hashing off`. Implement it now.

Does rxhash mean RSS or reporting of the flow hash?
User can "disable RSS" by changing the indirection table to all-0.
Currently rxhash controls copying the rxhash to the skb for the nfp.
Yinjun Zhang Feb. 26, 2022, 9:29 a.m. UTC | #2
On Fri, Feb 25, 2022 at 07:48:09AM -0800, Jakub Kicinski wrote:
> On Fri, 25 Feb 2022 09:59:29 +0100 Simon Horman wrote:
> > From: Yinjun Zhang <yinjun.zhang@corigine.com>
> > 
> > RSS is default on in nfp net device, and cannot be switched off
> > by `ethtool -K <int> receive-hashing off`. Implement it now.
> 
> Does rxhash mean RSS or reporting of the flow hash?
> User can "disable RSS" by changing the indirection table to all-0.
> Currently rxhash controls copying the rxhash to the skb for the nfp.

Seems you're right. `rxhash` is to enable/disable rx hash offload only.
But it seems that some few nic vendors also use it as the switch of RSS.
Anyway, thanks for correction, please ignore this patch.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 79257ec41987..f80901619fa4 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -3515,8 +3515,8 @@  static int nfp_net_set_features(struct net_device *netdev,
 				netdev_features_t features)
 {
 	netdev_features_t changed = netdev->features ^ features;
+	u32 new_ctrl, update = NFP_NET_CFG_UPDATE_GEN;
 	struct nfp_net *nn = netdev_priv(netdev);
-	u32 new_ctrl;
 	int err;
 
 	/* Assume this is not called with features we have not advertised */
@@ -3573,6 +3573,16 @@  static int nfp_net_set_features(struct net_device *netdev,
 			new_ctrl &= ~NFP_NET_CFG_CTRL_GATHER;
 	}
 
+	if (changed & NETIF_F_RXHASH) {
+		if (features & NETIF_F_RXHASH)
+			new_ctrl |= nn->cap & NFP_NET_CFG_CTRL_RSS2 ?:
+					      NFP_NET_CFG_CTRL_RSS;
+		else
+			new_ctrl &= ~NFP_NET_CFG_CTRL_RSS_ANY;
+
+		update |= NFP_NET_CFG_UPDATE_RSS;
+	}
+
 	err = nfp_port_set_features(netdev, features);
 	if (err)
 		return err;
@@ -3585,7 +3595,7 @@  static int nfp_net_set_features(struct net_device *netdev,
 
 	nn_dbg(nn, "NIC ctrl: 0x%x -> 0x%x\n", nn->dp.ctrl, new_ctrl);
 	nn_writel(nn, NFP_NET_CFG_CTRL, new_ctrl);
-	err = nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_GEN);
+	err = nfp_net_reconfig(nn, update);
 	if (err)
 		return err;