* [PATCH net] net: make dev_xdp_sb_prog_count() see programs attached through a link
@ 2026-10-01 1:25 Jakub Kicinski
2026-10-01 17:04 ` Stanislav Fomichev
2026-10-05 22:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-10-01 1:25 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
daniel, hawk, john.fastabend, sdf, ap420073, bpf
ethtool refuses to enable tcp-data-split on a device running
a single-buffer XDP program (which can't deal with the payload
landing in a separate buffer). dev_xdp_sb_prog_count() only looks
at xdp_state[].prog though, ignoring bpf_link integration.
Get the prog pointer from dev_xdp_prog(), which will consult both.
bpf_xdp_link_update() needs a bit of a touch-up, too, since
ethtool calls dev_xdp_sb_prog_count() with just the instance
lock (for ops-locked devices) - we now have to make sure the
link updates happen under that lock.
Spotted by AI while reviewing the XDP propagation series,
verified and tested on netdevsim with a C test along these lines:
link = bpf_program__attach_xdp(prog, ifindex);
system("ethtool -G eth0 tcp-data-split on")
Fixes: 197258f0ef68 ("net: ethtool: add hds_config member in ethtool_netdev_state")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: daniel@iogearbox.net
CC: hawk@kernel.org
CC: john.fastabend@gmail.com
CC: sdf@fomichev.me
CC: ap420073@gmail.com
CC: bpf@vger.kernel.org
---
net/core/dev.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 79be99b52f20..030c444aee45 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10367,13 +10367,15 @@ EXPORT_SYMBOL_GPL(dev_xdp_prog_count);
u8 dev_xdp_sb_prog_count(struct net_device *dev)
{
+ struct bpf_prog *prog;
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)
+ for (i = 0; i < __MAX_XDP_MODE; i++) {
+ prog = dev_xdp_prog(dev, i);
+ if (prog && !prog->aux->xdp_has_frags)
count++;
+ }
return count;
}
@@ -10753,11 +10755,12 @@ static int bpf_xdp_link_update(struct bpf_link *link, struct bpf_prog *new_prog,
bpf_op = dev_xdp_bpf_op(xdp_link->dev, mode);
err = dev_xdp_install(xdp_link->dev, mode, bpf_op, NULL,
xdp_link->flags, new_prog);
+ if (!err)
+ old_prog = xchg(&link->prog, new_prog);
netdev_unlock_ops(xdp_link->dev);
if (err)
goto out_unlock;
- old_prog = xchg(&link->prog, new_prog);
bpf_prog_put(old_prog);
out_unlock:
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: make dev_xdp_sb_prog_count() see programs attached through a link
2026-10-01 1:25 [PATCH net] net: make dev_xdp_sb_prog_count() see programs attached through a link Jakub Kicinski
@ 2026-10-01 17:04 ` Stanislav Fomichev
2026-10-05 22:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Stanislav Fomichev @ 2026-10-01 17:04 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, daniel,
hawk, john.fastabend, sdf, ap420073, bpf
On 09/30, Jakub Kicinski wrote:
> ethtool refuses to enable tcp-data-split on a device running
> a single-buffer XDP program (which can't deal with the payload
> landing in a separate buffer). dev_xdp_sb_prog_count() only looks
> at xdp_state[].prog though, ignoring bpf_link integration.
> Get the prog pointer from dev_xdp_prog(), which will consult both.
>
> bpf_xdp_link_update() needs a bit of a touch-up, too, since
> ethtool calls dev_xdp_sb_prog_count() with just the instance
> lock (for ops-locked devices) - we now have to make sure the
> link updates happen under that lock.
>
> Spotted by AI while reviewing the XDP propagation series,
> verified and tested on netdevsim with a C test along these lines:
>
> link = bpf_program__attach_xdp(prog, ifindex);
> system("ethtool -G eth0 tcp-data-split on")
>
> Fixes: 197258f0ef68 ("net: ethtool: add hds_config member in ethtool_netdev_state")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: make dev_xdp_sb_prog_count() see programs attached through a link
2026-10-01 1:25 [PATCH net] net: make dev_xdp_sb_prog_count() see programs attached through a link Jakub Kicinski
2026-10-01 17:04 ` Stanislav Fomichev
@ 2026-10-05 22:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-10-05 22:10 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, daniel,
hawk, john.fastabend, sdf, ap420073, bpf
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 30 Sep 2026 18:25:59 -0700 you wrote:
> ethtool refuses to enable tcp-data-split on a device running
> a single-buffer XDP program (which can't deal with the payload
> landing in a separate buffer). dev_xdp_sb_prog_count() only looks
> at xdp_state[].prog though, ignoring bpf_link integration.
> Get the prog pointer from dev_xdp_prog(), which will consult both.
>
> bpf_xdp_link_update() needs a bit of a touch-up, too, since
> ethtool calls dev_xdp_sb_prog_count() with just the instance
> lock (for ops-locked devices) - we now have to make sure the
> link updates happen under that lock.
>
> [...]
Here is the summary with links:
- [net] net: make dev_xdp_sb_prog_count() see programs attached through a link
https://git.kernel.org/netdev/net/c/d333c8bca6dc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-05 22:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-01 1:25 [PATCH net] net: make dev_xdp_sb_prog_count() see programs attached through a link Jakub Kicinski
2026-10-01 17:04 ` Stanislav Fomichev
2026-10-05 22:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox