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 |
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.
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 --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;