nfp: make RSS can be switched on/off by ethtool
Subsystems (3)
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
@@ -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
Jakub Kicinski
maintainerQuoted 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.
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.