public inbox for netdev@vger.kernel.org 
 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 v6 2/9] net: ethtool: add hds_config member in ethtool_netdev_state
Date: Wed, 18 Dec 2024 14:45:23 +0000	[thread overview]
Message-ID: <20241218144530.2963326-3-ap420073@gmail.com> (raw)
In-Reply-To: <20241218144530.2963326-1-ap420073@gmail.com>

When tcp-data-split is UNKNOWN mode, drivers arbitrarily handle it.
For example, bnxt_en driver automatically enables if at least one of
LRO/GRO/JUMBO is enabled.
If tcp-data-split is UNKNOWN and LRO is enabled, a driver returns
ENABLES of tcp-data-split, not UNKNOWN.
So, `ethtool -g eth0` shows tcp-data-split is enabled.

The problem is in the setting situation.
In the ethnl_set_rings(), it first calls get_ringparam() to get the
current driver's config.
At that moment, if driver's tcp-data-split config is UNKNOWN, it returns
ENABLE if LRO/GRO/JUMBO is enabled.
Then, it sets values from the user and driver's current config to
kernel_ethtool_ringparam.
Last it calls .set_ringparam().
The driver, especially bnxt_en driver receives
ETHTOOL_TCP_DATA_SPLIT_ENABLED.
But it can't distinguish whether it is set by the user or just the
current config.

When user updates ring parameter, the new hds_config value is updated
and current hds_config value is stored to old_hdsconfig.
Driver's .set_ringparam() callback can distinguish a passed
tcp-data-split value is came from user explicitly.
If .set_ringparam() is failed, hds_config is rollbacked immediately.

Suggested-by: Jakub Kicinski <kuba@kernel•org>
Signed-off-by: Taehee Yoo <ap420073@gmail•com>
---

v6:
 - use hds_config instead of using tcp_data_split_mod.

v5:
 - Patch added.

 include/linux/ethtool.h | 2 ++
 net/ethtool/rings.c     | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index f711bfd75c4d..4e451084d58a 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -1134,12 +1134,14 @@ int ethtool_virtdev_set_link_ksettings(struct net_device *dev,
  * @rss_ctx:		XArray of custom RSS contexts
  * @rss_lock:		Protects entries in @rss_ctx.  May be taken from
  *			within RTNL.
+ * @hds_config:		HDS value from userspace.
  * @wol_enabled:	Wake-on-LAN is enabled
  * @module_fw_flash_in_progress: Module firmware flashing is in progress.
  */
 struct ethtool_netdev_state {
 	struct xarray		rss_ctx;
 	struct mutex		rss_lock;
+	u8			hds_config;
 	unsigned		wol_enabled:1;
 	unsigned		module_fw_flash_in_progress:1;
 };
diff --git a/net/ethtool/rings.c b/net/ethtool/rings.c
index b7865a14fdf8..2e8239a76234 100644
--- a/net/ethtool/rings.c
+++ b/net/ethtool/rings.c
@@ -203,6 +203,7 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
 
 	dev->ethtool_ops->get_ringparam(dev, &ringparam,
 					&kernel_ringparam, info->extack);
+	kernel_ringparam.tcp_data_split = dev->ethtool->hds_config;
 
 	ethnl_update_u32(&ringparam.rx_pending, tb[ETHTOOL_A_RINGS_RX], &mod);
 	ethnl_update_u32(&ringparam.rx_mini_pending,
@@ -252,6 +253,9 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
 
 	ret = dev->ethtool_ops->set_ringparam(dev, &ringparam,
 					      &kernel_ringparam, info->extack);
+	if (!ret)
+		dev->ethtool->hds_config = kernel_ringparam.tcp_data_split;
+
 	return ret < 0 ? ret : 1;
 }
 
-- 
2.34.1


  parent reply	other threads:[~2024-12-18 14:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 14:45 [PATCH net-next v6 0/9] bnxt_en: implement tcp-data-split and thresh option Taehee Yoo
2024-12-18 14:45 ` [PATCH net-next v6 1/9] bnxt_en: add support for rx-copybreak ethtool command Taehee Yoo
2024-12-19  2:07   ` Jakub Kicinski
2024-12-19 13:24     ` Taehee Yoo
2024-12-18 14:45 ` Taehee Yoo [this message]
2024-12-19  2:16   ` [PATCH net-next v6 2/9] net: ethtool: add hds_config member in ethtool_netdev_state Jakub Kicinski
2024-12-18 14:45 ` [PATCH net-next v6 3/9] bnxt_en: add support for tcp-data-split ethtool command Taehee Yoo
2024-12-19  2:25   ` Jakub Kicinski
2024-12-19  2:41     ` Jakub Kicinski
2024-12-19 14:05     ` Taehee Yoo
2024-12-19 14:29       ` Jakub Kicinski
2024-12-19 15:14         ` Taehee Yoo
2024-12-19 15:25           ` Jakub Kicinski
2024-12-19 19:33             ` Andy Gospodarek
2024-12-19 20:18               ` Jakub Kicinski
2024-12-19 23:41                 ` Michael Chan
2024-12-20  2:08                   ` Jakub Kicinski
2024-12-18 14:45 ` [PATCH net-next v6 4/9] net: ethtool: add support for configuring hds-thresh Taehee Yoo
2024-12-19  2:35   ` Jakub Kicinski
2024-12-19 14:10     ` Taehee Yoo
2024-12-18 14:45 ` [PATCH net-next v6 5/9] bnxt_en: add support for hds-thresh ethtool command Taehee Yoo
2024-12-19  2:40   ` Jakub Kicinski
2024-12-19 14:12     ` Taehee Yoo
2024-12-18 14:45 ` [PATCH net-next v6 6/9] net: devmem: add ring parameter filtering Taehee Yoo
2024-12-18 14:45 ` [PATCH net-next v6 7/9] net: ethtool: " Taehee Yoo
2024-12-18 14:45 ` [PATCH net-next v6 8/9] net: disallow setup single buffer XDP when tcp-data-split is enabled Taehee Yoo
2024-12-19  2:44   ` Jakub Kicinski
2024-12-19 14:14     ` Taehee Yoo
2024-12-18 14:45 ` [PATCH net-next v6 9/9] netdevsim: add HDS feature Taehee Yoo
2024-12-19  2:49   ` Jakub Kicinski
2024-12-19 14:37     ` Taehee Yoo
2024-12-19 14:45       ` Jakub Kicinski
2024-12-19 15:19         ` Taehee Yoo
2024-12-19 15:28           ` Jakub Kicinski

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

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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