lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220225085929.269568-1-simon.horman@corigine.com>
Date:   Fri, 25 Feb 2022 09:59:29 +0100
From:   Simon Horman <simon.horman@...igine.com>
To:     David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, oss-drivers@...igine.com,
        Yinjun Zhang <yinjun.zhang@...igine.com>,
        Louis Peens <louis.peens@...igine.com>,
        Simon Horman <simon.horman@...igine.com>
Subject: [PATCH net-next] nfp: make RSS can be switched on/off by ethtool

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ