Linux Documentation
 help / color / mirror / Atom feed
From: Taehee Yoo <ap420073@gmail.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, almasrymina@google.com,
	donald.hunter@gmail.com, corbet@lwn.net,
	michael.chan@broadcom.com, andrew+netdev@lunn.ch,
	hawk@kernel.org, ilias.apalodimas@linaro.org, ast@kernel.org,
	daniel@iogearbox.net, john.fastabend@gmail.com, dw@davidwei.uk,
	sdf@fomichev.me, asml.silence@gmail.com, brett.creeley@amd.com,
	linux-doc@vger.kernel.org, netdev@vger.kernel.org
Cc: kory.maincent@bootlin.com, maxime.chevallier@bootlin.com,
	danieller@nvidia.com, hengqi@linux.alibaba.com,
	ecree.xilinx@gmail.com, przemyslaw.kitszel@intel.com,
	hkallweit1@gmail.com, ahmed.zaki@intel.com,
	rrameshbabu@nvidia.com, idosch@nvidia.com, jiri@resnulli.us,
	bigeasy@linutronix.de, lorenzo@kernel.org, jdamato@fastly.com,
	aleksander.lobakin@intel.com, kaiyuanz@google.com,
	willemb@google.com, daniel.zahka@gmail.com, ap420073@gmail.com
Subject: [PATCH net-next v4 6/8] net: ethtool: add ring parameter filtering
Date: Tue, 22 Oct 2024 16:23:57 +0000	[thread overview]
Message-ID: <20241022162359.2713094-7-ap420073@gmail.com> (raw)
In-Reply-To: <20241022162359.2713094-1-ap420073@gmail.com>

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@fomichev.me>
Signed-off-by: Taehee Yoo <ap420073@gmail.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


  parent reply	other threads:[~2024-10-22 16:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 16:23 [PATCH net-next v4 0/7] bnxt_en: implement device memory TCP for bnxt Taehee Yoo
2024-10-22 16:23 ` [PATCH net-next v4 1/8] bnxt_en: add support for rx-copybreak ethtool command Taehee Yoo
2024-10-24  6:40   ` Michael Chan
2024-10-24 16:38     ` Taehee Yoo
2024-10-25  4:54       ` Michael Chan
2024-10-25  8:07         ` Taehee Yoo
2024-10-22 16:23 ` [PATCH net-next v4 2/8] bnxt_en: add support for tcp-data-split " Taehee Yoo
2024-10-25  5:02   ` Michael Chan
2024-10-25  7:59     ` Taehee Yoo
2024-10-25 19:24     ` Andy Gospodarek
2024-10-25 22:00       ` Michael Chan
2024-10-26  5:11         ` Taehee Yoo
2024-10-30 20:39           ` Andy Gospodarek
2024-10-31  5:20             ` Taehee Yoo
2024-10-22 16:23 ` [PATCH net-next v4 3/8] net: ethtool: add support for configuring header-data-split-thresh Taehee Yoo
2024-11-01 14:55   ` Mina Almasry
2024-11-01 18:50     ` Taehee Yoo
2024-10-22 16:23 ` [PATCH net-next v4 4/8] bnxt_en: add support for header-data-split-thresh ethtool command Taehee Yoo
2024-10-22 16:23 ` [PATCH net-next v4 5/8] net: devmem: add ring parameter filtering Taehee Yoo
2024-11-01 14:29   ` Mina Almasry
2024-11-01 18:02     ` Taehee Yoo
2024-11-01 20:40       ` Mina Almasry
2024-10-22 16:23 ` Taehee Yoo [this message]
2024-11-01 14:35   ` [PATCH net-next v4 6/8] net: ethtool: " Mina Almasry
2024-11-01 18:08     ` Taehee Yoo
2024-10-22 16:23 ` [PATCH net-next v4 7/8] net: netmem: add netmem_is_pfmemalloc() helper function Taehee Yoo
2024-11-01 14:36   ` Mina Almasry
2024-10-22 16:23 ` [PATCH net-next v4 8/8] bnxt_en: add support for device memory tcp Taehee Yoo
2024-11-01 14:53   ` Mina Almasry
2024-11-01 18:24     ` Taehee Yoo
2025-02-19  0:15       ` David Wei
2025-02-19  2:37         ` Taehee Yoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241022162359.2713094-7-ap420073@gmail.com \
    --to=ap420073@gmail.com \
    --cc=ahmed.zaki@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=asml.silence@gmail.com \
    --cc=ast@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=brett.creeley@amd.com \
    --cc=corbet@lwn.net \
    --cc=daniel.zahka@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=danieller@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dw@davidwei.uk \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=hengqi@linux.alibaba.com \
    --cc=hkallweit1@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jdamato@fastly.com \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --cc=kaiyuanz@google.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=rrameshbabu@nvidia.com \
    --cc=sdf@fomichev.me \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox