Skip to contentSkip to conversation

nfp: make RSS can be switched on/off by ethtool

PATCH In review Simon Horman 3 participants 3 messages Feb 25, 2022 – Feb 26, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfp: make RSS can be switched on/off by ethtool

From: Yinjun Zhang <[email protected]>

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

---
 .../net/ethernet/netronome/nfp/nfp_net_common.c    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/netronome/nfp/nfp_net_common.c +12 -2
index 79257ec41987..f80901619fa4 100644
@@ -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;
 
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 4 lines · On Fri, 25 Feb 2022 09:59:29 +0100 Simon Horman wrote:

From: Yinjun Zhang <[email protected]>

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.

#2 lore raw
Quoted 9 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 25 Feb 2022 09:59:29 +0100 Simon Horman wrote:

From: Yinjun Zhang <[email protected]>

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.