mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: sdf.kernel@gmail.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
	edumazet@kernel.org, horms@kernel.org, corbet@lwn.net,
	skhan@linuxfoundation.org, rdunlap@infradead.org,
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com,
	alexanderduyck@fb.com, kernel-team@meta.com, sdf@fomichev.me,
	dimitri.daskalakis1@gmail.com, almasrymina@google.com,
	dtatulea@nvidia.com, bobbyeshleman@meta.com,
	asml.silence@gmail.com, daniel@iogearbox.net,
	razor@blackwall.org, leitao@debian.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org,
	leon@kernel.org
Subject: Re: [PATCH net-next v3 1/9] bnxt_en: let the stack segment GSO skbs with too many frags
Date: Mon, 09 Nov 2026 01:22:52 +0000	[thread overview]
Message-ID: <179418737248.994134.10509157155829463489@kernel.org> (raw)
In-Reply-To: <20261105222058.944293-2-sdf@fomichev.me>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The patch fixes real functional bugs in existing bnxt code, but
  it has no Fixes: tag and is not routed to stable.
- [Low] Clearing NETIF_F_GSO_MASK in bnxt_features_check() makes the
  stack segment a GSO skb with nr_frags > TX_MAX_FRAGS.

--

bnxt_en: let the stack segment GSO skbs with too many frags

When MAX_SKB_FRAGS > TX_MAX_FRAGS, this patch clears the GSO features in
bnxt_features_check() for skbs that have more than TX_MAX_FRAGS frags.
The stack then segments those skbs, and bnxt_start_xmit() no longer
linearizes them. Non-GSO skbs with too many frags are still linearized in
the xmit path.

Link: https://lore.kernel.org/all/CANn89i+ps_CozfOyRnKav0_LUmSekJ9ExB5JkDbTAVf_ss_98g@mail.gmail.com/

> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 33c4cacc8ffe3..f20b61180ab2d 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -14320,6 +14320,11 @@ static netdev_features_t bnxt_features_check(struct sk_buff *skb,
>  				skb_shinfo(skb)->gso_size))
>  		features &= ~NETIF_F_GSO_MASK;
>  
> +#if (MAX_SKB_FRAGS > TX_MAX_FRAGS)
> +	if (skb_shinfo(skb)->nr_frags > TX_MAX_FRAGS)
> +		features &= ~NETIF_F_GSO_MASK;
> +#endif

[Severity: Low]
Should this patch have a Fixes: tag?

Commit b91e82129400 ("bnxt_en: Linearize TX SKB if the fragments exceed
the max") added the unconditional linearize in bnxt_start_xmit():

bnxt_start_xmit() {
    ...
#if (MAX_SKB_FRAGS > TX_MAX_FRAGS)
	if (skb_shinfo(skb)->nr_frags > TX_MAX_FRAGS) {
		...
		if (skb_linearize(skb))
			goto tx_free;
	}
#endif
    ...
}

bnxt calls netif_set_tso_max_size(dev, GSO_MAX_SIZE), so a BIG TCP skb
can be linearized into a head larger than 64KB. That length is then
encoded here:

	flags = (len << TX_BD_LEN_SHIFT) | TX_BD_TYPE_LONG_TX_BD |
		TX_BD_CNT(last_frag + 2);

TX_BD_LEN_SHIFT is 16 and flags is a u32. The upper bits of the length
are lost, so the BD length no longer matches the DMA mapping.

bnxt also sets dev->netmem_tx = NETMEM_TX_DMA. For devmem GSO skbs,
skb_linearize() always fails, because __pskb_pull_tail() returns NULL
when !skb_frags_readable(). Those skbs are dropped at tx_free.

The commit message describes both problems. Without a Fixes: tag, stable
kernels that carry b91e82129400 won't pick up this fix.

[Severity: Low]
Can the segments that the stack produces here still have more than
TX_MAX_FRAGS unreadable frags?

Only the GSO features are cleared, and nothing limits the frag count of
each resulting segment. zerocopy_fill_skb_from_devmem() adds one frag per
iovec entry and does not merge adjacent ranges:

net/core/datagram.c:zerocopy_fill_skb_from_devmem() {
    ...
		size = min_t(size_t, size, iter_iov_len(from));
		netmem_inc_ref(net_iov_to_netmem(niov));
		skb_add_rx_frag_netmem(skb, i, net_iov_to_netmem(niov), off,
				       size, PAGE_SIZE);
    ...
}

Suppose a devmem sender uses small iovecs: frags averaging under about
47 bytes at a 1500 MTU, or under about 290 bytes at a 9K MTU. Then a
single MSS-sized segment from skb_segment() can span more than 30 frags.
__copy_skb_header() also carries over skb->unreadable to that segment.

Such a non-GSO segment then reaches skb_linearize() in bnxt_start_xmit(),
which fails for net_iov frags, and the segment is dropped at tx_free.
TCP retransmissions rebuild the same layout, so the flow may stall.

This is not worse than before the patch, when the whole GSO skb was
dropped in the same way. However, the commit message gives "always fails
for unreadable skbs" as a reason for the change, and for these flows that
failure can still happen after segmentation.

Could the commit message mention this limitation? Fully closing the gap
would need a fallback that handles unreadable frags, or a frag limit per
MSS window at sendmsg time, rather than skb_linearize().

>  	switch (vlan_get_protocol(skb)) {
>  	case htons(ETH_P_IP):
>  		if (!skb->encapsulation)

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261105222058.944293-1-sdf%40fomichev.me

  reply	other threads:[~2026-11-09  1:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 22:20 [PATCH net-next v3 0/9] net: devmem: size TX net_iovs from the dmabuf layout Stanislav Fomichev
2026-11-05 22:20 ` [PATCH net-next v3 1/9] bnxt_en: let the stack segment GSO skbs with too many frags Stanislav Fomichev
2026-11-09  1:22   ` netdev-bot+sashiko [this message]
2026-11-05 22:20 ` [PATCH net-next v3 2/9] net: devmem: charge the frag length to TX skb truesize Stanislav Fomichev
2026-11-09  1:22   ` netdev-bot+sashiko
2026-11-05 22:20 ` [PATCH net-next v3 3/9] net: devmem: use niov_shift in net_devmem_get_niov_at() Stanislav Fomichev
2026-11-05 22:20 ` [PATCH net-next v3 4/9] net: devmem: add a per-device netmem TX frag size limit Stanislav Fomichev
2026-11-09  1:22   ` netdev-bot+sashiko
2026-11-05 22:20 ` [PATCH net-next v3 5/9] bnxt_en: set the netmem TX frag size limit to 32KB Stanislav Fomichev
2026-11-09  1:22   ` netdev-bot+sashiko
2026-11-05 22:20 ` [PATCH net-next v3 6/9] eth: fbnic: " Stanislav Fomichev
2026-11-05 22:20 ` [PATCH net-next v3 7/9] net/mlx5e: lift the netmem TX frag size limit Stanislav Fomichev
2026-11-09  1:23   ` netdev-bot+sashiko
2026-11-05 22:20 ` [PATCH net-next v3 8/9] net: devmem: size TX net_iovs from the dmabuf sg table Stanislav Fomichev
2026-11-09  1:23   ` netdev-bot+sashiko
2026-11-05 22:20 ` [PATCH net-next v3 9/9] selftests: drv-net: devmem: TX from a hugepage-backed dmabuf Stanislav Fomichev
2026-11-09  1:23   ` netdev-bot+sashiko

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=179418737248.994134.10509157155829463489@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=asml.silence@gmail.com \
    --cc=bobbyeshleman@meta.com \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dimitri.daskalakis1@gmail.com \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@google.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=leon@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=razor@blackwall.org \
    --cc=rdunlap@infradead.org \
    --cc=saeedm@nvidia.com \
    --cc=sdf.kernel@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=skhan@linuxfoundation.org \
    --cc=tariqt@nvidia.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

all inboxes | Powered by JetHome®