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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241022162359.2713094-7-ap420073@gmail.com>
Date: Tue, 22 Oct 2024 16:23:57 +0000
From: Taehee Yoo <ap420073@...il.com>
To: davem@...emloft.net,
	kuba@...nel.org,
	pabeni@...hat.com,
	edumazet@...gle.com,
	almasrymina@...gle.com,
	donald.hunter@...il.com,
	corbet@....net,
	michael.chan@...adcom.com,
	andrew+netdev@...n.ch,
	hawk@...nel.org,
	ilias.apalodimas@...aro.org,
	ast@...nel.org,
	daniel@...earbox.net,
	john.fastabend@...il.com,
	dw@...idwei.uk,
	sdf@...ichev.me,
	asml.silence@...il.com,
	brett.creeley@....com,
	linux-doc@...r.kernel.org,
	netdev@...r.kernel.org
Cc: kory.maincent@...tlin.com,
	maxime.chevallier@...tlin.com,
	danieller@...dia.com,
	hengqi@...ux.alibaba.com,
	ecree.xilinx@...il.com,
	przemyslaw.kitszel@...el.com,
	hkallweit1@...il.com,
	ahmed.zaki@...el.com,
	rrameshbabu@...dia.com,
	idosch@...dia.com,
	jiri@...nulli.us,
	bigeasy@...utronix.de,
	lorenzo@...nel.org,
	jdamato@...tly.com,
	aleksander.lobakin@...el.com,
	kaiyuanz@...gle.com,
	willemb@...gle.com,
	daniel.zahka@...il.com,
	ap420073@...il.com
Subject: [PATCH net-next v4 6/8] net: ethtool: add ring parameter filtering

While the devmem is running, the tcp-data-split and
header-data-split-thresh configuration should not be changed.
If user tries to change tcp-data-split and threshold value while the
devmem is running, it fails and shows extack message.

Tested-by: Stanislav Fomichev <sdf@...ichev.me>
Signed-off-by: Taehee Yoo <ap420073@...il.com>
---

v4:
 - Add netdev_devmem_enabled() helper.
 - Add Test tag from Stanislav.

v3:
 - Patch added

 include/net/netdev_rx_queue.h | 14 ++++++++++++++
 net/ethtool/common.h          |  1 +
 net/ethtool/rings.c           | 13 +++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/include/net/netdev_rx_queue.h b/include/net/netdev_rx_queue.h
index 596836abf7bf..7fbb64ce8d89 100644
--- a/include/net/netdev_rx_queue.h
+++ b/include/net/netdev_rx_queue.h
@@ -55,6 +55,20 @@ get_netdev_rx_queue_index(struct netdev_rx_queue *queue)
 	return index;
 }
 
+static inline bool netdev_devmem_enabled(struct net_device *dev)
+{
+	struct netdev_rx_queue *queue;
+	int i;
+
+	for (i = 0; i < dev->real_num_rx_queues; i++) {
+		queue = __netif_get_rx_queue(dev, i);
+		if (queue->mp_params.mp_priv)
+			return true;
+	}
+
+	return false;
+}
+
 int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq);
 
 #endif
diff --git a/net/ethtool/common.h b/net/ethtool/common.h
index 4a2de3ce7354..5b8e5847ba3c 100644
--- a/net/ethtool/common.h
+++ b/net/ethtool/common.h
@@ -5,6 +5,7 @@
 
 #include <linux/netdevice.h>
 #include <linux/ethtool.h>
+#include <net/netdev_rx_queue.h>
 
 #define ETHTOOL_DEV_FEATURE_WORDS	DIV_ROUND_UP(NETDEV_FEATURE_COUNT, 32)
 
diff --git a/net/ethtool/rings.c b/net/ethtool/rings.c
index e1fd82a91014..ca313c301081 100644
--- a/net/ethtool/rings.c
+++ b/net/ethtool/rings.c
@@ -258,6 +258,19 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
 		return -ERANGE;
 	}
 
+	if (netdev_devmem_enabled(dev)) {
+		if (kernel_ringparam.tcp_data_split !=
+		    ETHTOOL_TCP_DATA_SPLIT_ENABLED) {
+			NL_SET_ERR_MSG(info->extack,
+				       "tcp-data-split should be enabled while devmem is running");
+			return -EINVAL;
+		} else if (kernel_ringparam.hds_thresh) {
+			NL_SET_ERR_MSG(info->extack,
+				       "header-data-split-thresh should be zero while devmem is running");
+			return -EINVAL;
+		}
+	}
+
 	/* ensure new ring parameters are within limits */
 	if (ringparam.rx_pending > ringparam.rx_max_pending)
 		err_attr = tb[ETHTOOL_A_RINGS_RX];
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ