From: Taehee Yoo <ap420073@gmail.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, netdev@vger.kernel.org,
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
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 v8 01/10] net: ethtool: add hds_config member in ethtool_netdev_state
Date: Sat, 11 Jan 2025 14:45:04 +0000 [thread overview]
Message-ID: <20250111144513.1289403-2-ap420073@gmail.com> (raw)
In-Reply-To: <20250111144513.1289403-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>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v8:
- No changes.
v7:
- Add review tag from Jakub.
- Add dev_xdp_sb_prog_count().
v6:
- use hds_config instead of using tcp_data_split_mod.
v5:
- Patch added.
include/linux/ethtool.h | 2 ++
include/linux/netdevice.h | 1 +
net/core/dev.c | 12 ++++++++++++
net/ethtool/rings.c | 12 ++++++++++++
4 files changed, 27 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/include/linux/netdevice.h b/include/linux/netdevice.h
index e84602e0226c..a5f12ffa903e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4084,6 +4084,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
u8 dev_xdp_prog_count(struct net_device *dev);
int dev_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf);
+u8 dev_xdp_sb_prog_count(struct net_device *dev);
u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode);
u32 dev_get_min_mp_channel_count(const struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index e7223972b9aa..2701920fea05 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9482,6 +9482,18 @@ u8 dev_xdp_prog_count(struct net_device *dev)
}
EXPORT_SYMBOL_GPL(dev_xdp_prog_count);
+u8 dev_xdp_sb_prog_count(struct net_device *dev)
+{
+ u8 count = 0;
+ int i;
+
+ for (i = 0; i < __MAX_XDP_MODE; i++)
+ if (dev->xdp_state[i].prog &&
+ !dev->xdp_state[i].prog->aux->xdp_has_frags)
+ count++;
+ return count;
+}
+
int dev_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
{
if (!dev->netdev_ops->ndo_bpf)
diff --git a/net/ethtool/rings.c b/net/ethtool/rings.c
index b7865a14fdf8..b2a2586b241f 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,
@@ -225,6 +226,14 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info)
if (!mod)
return 0;
+ if (kernel_ringparam.tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
+ dev_xdp_sb_prog_count(dev)) {
+ NL_SET_ERR_MSG_ATTR(info->extack,
+ tb[ETHTOOL_A_RINGS_TCP_DATA_SPLIT],
+ "tcp-data-split can not be enabled with single buffer XDP");
+ return -EINVAL;
+ }
+
/* ensure new ring parameters are within limits */
if (ringparam.rx_pending > ringparam.rx_max_pending)
err_attr = tb[ETHTOOL_A_RINGS_RX];
@@ -252,6 +261,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
next prev parent reply other threads:[~2025-01-11 14:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 14:45 [PATCH net-next v8 0/10] bnxt_en: implement tcp-data-split and thresh option Taehee Yoo
2025-01-11 14:45 ` Taehee Yoo [this message]
2025-01-11 14:45 ` [PATCH net-next v8 02/10] net: ethtool: add support for configuring hds-thresh Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 03/10] net: devmem: add ring parameter filtering Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 04/10] net: ethtool: " Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 05/10] net: disallow setup single buffer XDP when tcp-data-split is enabled Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 06/10] bnxt_en: add support for rx-copybreak ethtool command Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 07/10] bnxt_en: add support for tcp-data-split " Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 08/10] bnxt_en: add support for hds-thresh " Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 09/10] netdevsim: add HDS feature Taehee Yoo
2025-01-11 14:45 ` [PATCH net-next v8 10/10] selftest: net-drv: hds: add test for " Taehee Yoo
2025-01-13 23:08 ` [PATCH net-next v8 0/10] bnxt_en: implement tcp-data-split and thresh option Jakub Kicinski
2025-01-14 3:20 ` 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=20250111144513.1289403-2-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;
as well as URLs for NNTP newsgroup(s).