From: netdev-bot+sashiko@kernel.org
To: bjorn@kernel.org
Cc: alexanderduyck@fb.com, kuba@kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com,
ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
john.fastabend@gmail.com, willemb@google.com,
netdev@vger.kernel.org, bpf@vger.kernel.org,
kernel-team@meta.com, sdf@fomichev.me, horms@kernel.org,
dimitri.daskalakis1@gmail.com, bobbyeshleman@meta.com,
daniel.zahka@gmail.com, mike.marciniszyn@gmail.com,
hmohsin@meta.com, leitao@debian.org
Subject: Re: [PATCH net-next v2] eth: fbnic: Support XDP redirect
Date: Fri, 04 Dec 2026 18:11:27 +0000 [thread overview]
Message-ID: <179640788740.3146.6062961675841789495@kernel.org> (raw)
In-Reply-To: <20261203180924.3862144-1-bjorn@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] This patch lets fbnic hand multi-buffer XDP frames to redirect
targets.
--
eth: fbnic: Support XDP redirect
This commit adds the XDP_REDIRECT verdict to fbnic_run_xdp() and
advertises NETDEV_XDP_ACT_REDIRECT. Each RX queue flushes its pending
redirects once per poll, and a flag in the NAPI vector records when a
flush is needed.
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> index 381831b7e1080..9525ad2f7e14d 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
[ ... ]
> @@ -1211,10 +1212,15 @@ static struct sk_buff *fbnic_run_xdp(struct fbnic_napi_vector *nv,
> return fbnic_build_skb(nv, pkt);
> case XDP_TX:
> return ERR_PTR(fbnic_pkt_tx(nv, pkt));
> + case XDP_REDIRECT:
> + if (xdp_do_redirect(nv->napi.dev, &pkt->buff, xdp_prog))
> + goto xdp_exception;
> + return ERR_PTR(-FBNIC_XDP_REDIRECT);
[Severity: High]
Can multi-buffer frames redirected from fbnic end up as skbs whose
truesize is much smaller than the memory they hold?
REDIRECT is now advertised together with NETDEV_XDP_ACT_RX_SG. That means
a header-split frame with payload frags can reach a cpumap (or veth).
There, cpu_map_kthread_run() builds the skb with
__xdp_build_skb_from_frame(), which ignores sinfo->xdp_frags_truesize:
net/core/xdp.c:__xdp_build_skb_from_frame() {
...
if (unlikely(xdp_frame_has_frags(xdpf)))
xdp_update_skb_frags_info(skb, nr_frags, sinfo->xdp_frags_size,
nr_frags * xdpf->frame_sz,
xdp_frame_get_skb_flags(xdpf));
...
}
In fbnic, frame_sz only covers the header chunk:
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c:fbnic_pkt_prepare() {
...
frame_sz = hdr_pg_end - hdr_pg_start;
xdp_init_buff(&pkt->buff, frame_sz, &qt->xdp_rxq);
...
}
With FBNIC_RX_HROOM and FBNIC_RX_TROOM, that comes to roughly 704 bytes
for a split TCP header.
The payload frags are added in fbnic_add_rx_frag() with their real
truesize, which can be up to FBNIC_BD_PAGE_SIZE - pg_off:
added = xdp_buff_add_frag(&pkt->buff, netmem, pg_off, len, truesize);
xdp_buff_add_frag() can also coalesce adjacent device pages into one
frag. So a 9000-byte jumbo payload could end up as nr_frags == 1 with
about 9 KiB of real truesize, yet it would be charged only frame_sz.
The XDP_PASS path avoids this, because xdp_build_skb_from_buff() prefers
sinfo->xdp_frags_truesize. The redirect-to-cpumap path does not.
If skb->truesize ends up below skb->len, socket rcvbuf and tcp_mem
accounting would be under-charged by a large factor. A remote sender
could exploit that to pin far more memory than the limits allow.
It would also trigger this warning when TCP coalesces into the
receive-queue tail via tcp_queue_rcv()->tcp_try_coalesce()->
skb_try_coalesce():
if (WARN_ON_ONCE(delta < 0 || delta < len))
return false;
Would it make sense to have __xdp_build_skb_from_frame() use
sinfo->xdp_frags_truesize? That field should still be valid, since
xdp_convert_buff_to_frame() does not touch it.
Alternatively, could frames with frags be kept off the redirect path
until the core accounts for them correctly?
> default:
> bpf_warn_invalid_xdp_action(nv->napi.dev, xdp_prog, act);
> fallthrough;
> case XDP_ABORTED:
> +xdp_exception:
> trace_xdp_exception(nv->napi.dev, xdp_prog, act);
> fallthrough;
> case XDP_DROP:
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203180924.3862144-1-bjorn%40kernel.org
prev parent reply other threads:[~2026-12-04 18:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 18:09 [PATCH net-next v2] eth: fbnic: Support XDP redirect Björn Töpel
2026-12-04 18:11 ` netdev-bot+sashiko [this message]
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=179640788740.3146.6062961675841789495@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bobbyeshleman@meta.com \
--cc=bpf@vger.kernel.org \
--cc=daniel.zahka@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dimitri.daskalakis1@gmail.com \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=hmohsin@meta.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=mike.marciniszyn@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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