mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dragos Tatulea <dtatulea@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>, Tianyu Zuo <cosmosocket@gmail.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Khalid Manaa <khalidm@nvidia.com>,
	Ben Ben-Ishay <benishay@nvidia.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net/mlx5e: SHAMPO, Fix IP length overflow on large HW GRO sessions
Date: Thu, 20 Aug 2026 15:28:14 +0200	[thread overview]
Message-ID: <000f10a9-481c-403d-9240-67c65f69638b@nvidia.com> (raw)
In-Reply-To: <20260819160303.4be803c5@kernel.org>



On 20.08.26 01:03, Jakub Kicinski wrote:
> On Mon, 17 Aug 2026 14:16:18 -0400 Tianyu Zuo wrote:
>> mlx5e_hw_gro_skb_has_enough_space() bounds a HW GRO session by the
>> payload held in the skb fragments only. The L3/L4 headers that
>> header-data split placed in the linear area are not accounted for, and
>> the limit is inclusive of GRO_LEGACY_MAX_SIZE.
> 
> This regresses both ipv4-large-rem and ipv6-large-rem on CX7
> 
> # # Exception|   STDERR: Expected {64896 600 600 }, Total 3 packets
> # # Exception|           Received {60840 [!=64896]4656 [!=600]600 }, Total 3 packets.
> 
> we could have fit another MSS into the aggregate, easily.
Uh, yes... thanks for the early warning.

I've wanted to improve this function before but had a mental blockage on
the page size difference. Looking at it with fresh eyes I think we
can make it clearer:

+static bool mlx5e_hw_gro_skb_has_enough_space(struct sk_buff *skb,
+                                             u16 data_bcnt, u32 page_size)
+{
+      int nr_frags = skb_shinfo(skb)->nr_frags;
+
+      if (nr_frags + DIV_ROUND_UP(data_bcnt, page_size) > MAX_SKB_FRAGS)
+              return false;
+
+      return skb->len + data_bcnt <= GRO_LEGACY_MAX_SIZE;
+}

Maybe we can squeeze more out of the last frag page, but one too many
extra checks would need to be added because SHAMPO might have moved on
to a new page.

Thanks,
Dragos



      reply	other threads:[~2026-08-20 13:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 18:16 Tianyu Zuo
2026-08-18  9:44 ` Dragos Tatulea
2026-08-19 23:03 ` Jakub Kicinski
2026-08-20 13:28   ` Dragos Tatulea [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=000f10a9-481c-403d-9240-67c65f69638b@nvidia.com \
    --to=dtatulea@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=benishay@nvidia.com \
    --cc=cosmosocket@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=khalidm@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --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®