Article View: linux.kernel.netdev
Article #1404Re: [PATCH net 2/2] bnxt_en: Pad short SW USO segments to BNXT_MIN_PKT_SIZE
From: Joe Damato
Date: Fri, 09 Oct 2026 17:33
Date: Fri, 09 Oct 2026 17:33
56 lines
11132 bytes
11132 bytes
On Thu, Oct 08, 2026 at 10:26:06PM -0700, Michael Chan wrote: > On Thu, Oct 8, 2026 at 12:11 PM Joe Damato <joe@dama.to> wrote: > > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_gso.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_gso.c > > index ef04c9d08066..f87e02ef3033 100644 > > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_gso.c > > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_gso.c > > @@ -82,11 +82,14 @@ int bnxt_sw_udp_gso_xmit(struct bnxt *bp, struct bnxt_tx_ring_info *txr, > > if (unlikely(num_segs <= 1)) > > goto drop; > > > > + if (unlikely(bnxt_sw_gso_pad_len(hdr_len, mss))) > > + goto drop; > > + > > This looks redundant since you already have the same check in > bnxt_features_check(). It's redundant for skbs that go through validate_xmit_skb(), but generic XDP doesn't AFAIU. Not sure how else to handle this case, but open to suggestions. If you agree and are OK with dropping these, then I could add a comment clarifying this in the v2. LMK what you think. > > /* Upper bound on the number of descriptors needed. > > * > > * Each segment uses 1 long BD + 1 ext BD + payload BDs, which is > > * at most num_segs + nr_frags (each frag boundary crossing adds at > > - * most 1 extra BD). > > + * most 1 extra BD). The last segment may need 1 pad BD. > > */ > > bds_needed = 3 * num_segs + skb_shinfo(skb)->nr_frags + 1; > > I don't quite understand why we don't need to add 1 more for possible > padding here. Re-reading the code, I think the +1 was never needed in the first place. Payload BDs come from at most 1 + nr_frags DMA regions. Going from one region to the next adds at most one BD on top of one BD per segment. There are nr_frags boundaries at most, so I think the math is: 2*num_segs + num_segs + nr_frags which simplifies to 3*num_segs + nr_frags. I would appreciate a double check on the math :) but I think the +1 from the original code was actually unnecessary and so for this change we can use it for the pad BD. Shockingly: it seems sashiko didn't find any issues (?). If you agree with the above I can respin to add the comment for the generic XDP path and re-send later today. Thanks, Joe
Technical Details
Message-ID:
<asklVFvUJx8P/k1d@devvm20253.cco0.facebook.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343841-linux-kernel-netdev=dewy.ruReferences:
<20261008191114.3736826-1-joe@dama.to> <20261008191114.3736826-3-joe@dama.to> <CACKFLikWkH6QaOG=EO_zu8cqCFRxGqtA2-+R-btp0TwUbJjVBg@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343841-linux-kernel-netdev=dewy.ru
From: joe@dama.to (Joe Damato)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 2/2] bnxt_en: Pad short SW USO segments to
BNXT_MIN_PKT_SIZE
Date: Fri, 9 Oct 2026 10:33:08 -0700
Organization: Usenet Network
Message-ID: <asklVFvUJx8P/k1d@devvm20253.cco0.facebook.com>
References: <20261008191114.3736826-1-joe@dama.to>
<20261008191114.3736826-3-joe@dama.to>
<CACKFLikWkH6QaOG=EO_zu8cqCFRxGqtA2-+R-btp0TwUbJjVBg@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1158150"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:HVaLzJ6K5tIvGuKVrJUoY3WNPkk= sha256:YkSGjHTCylHqhhZLp2FeS2Sz+M/iPZjHYG1sWydT6iI=
sha1:fZWqFKYnoVM/Ysn4mqiKIbYM3M0= sha256:qbJ8T04YPPLqaQe+vWb8fgrrBO7EjKEbIPoJe9RRLk8=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id D4EC210F763; Fri, 9 Oct 2026 20:33:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=dama-to.20251104.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id X46t14T02KbG;
Fri, 9 Oct 2026 20:33:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-343841-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=dama.to
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 7026410F6C8; Fri, 9 Oct 2026 20:33:14 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sto.lore.kernel.org (Postfix) with ESMTP id 16B7660A764; Fri, 9 Oct 2026 17:33:14 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D1323AE715;
Fri, 9 Oct 2026 17:33:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=dama-to.20251104.gappssmtp.com header.i=@dama-to.20251104.gappssmtp.com header.b="Kz+M7ghT"
X-Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1507038838F
for <netdev@vger.kernel.org>; Fri, 9 Oct 2026 17:33:10 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791567192; cv=none; b=u8XkgeRlCPbt6cNbbaSBHFHglD7qFBSm5ntYBTigHL/wVYNpd9Td6xeTW9eqeC2PFwle1wi0Pxmjmtv+S1eSw1k6NqcCA8SpBEIQGk8FsvPc/+AEDfkmMKsQ/6Qj5ikg/BzZyOKuM16L+TWzyqToiKji0O+cb44apPW6e1gdSHI=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791567192; c=relaxed/simple;
bh=HkIkB+dqyxrAL4iBkZUM6mZrOi0zi8ugvAIKpk7F+dE=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=QlRVfTUZnmh49t2xfwvBvjEL9TmvBQoHprkKJO9gn+5U3yPa7HxYq+udBI7VeP+ylLq4qHDMqNuSF9VwUf2C91eVLhDmFfIgcanyXP64pSO4dlO11ebrqhQKH4FjUEcGHW61ehBTMowJtq5yoVAwUwpm6jGGCNKVRwmLOrHQtx8=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to; spf=none smtp.mailfrom=dama.to; dkim=pass (2048-bit key) header.d=dama-to.20251104.gappssmtp.com header.i=@dama-to.20251104.gappssmtp.com header.b=Kz+M7ghT; arc=none smtp.client-ip=209.85.216.51
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to
X-Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-3a7cfe8f761so1404168a91.1
for <netdev@vger.kernel.org>; Fri, 09 Oct 2026 10:33:10 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=dama-to.20251104.gappssmtp.com; s=20251104; t=1791567190; x=1792171990; darn=vger.kernel.org;
h=in-reply-to:content-transfer-encoding:content-disposition
:content-type:mime-version:references:mail-followup-to:message-id
:subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=c2jD9IJYGfmVcnhpThjvZylfTJOWRr2wSFSn38TwVbE=;
b=Kz+M7ghToLcxEPLsGhNMENOREy02pE8g1DL2Ja3ecdo3GQulOGf9xLnItO87cAgrGp
Ikh8XzTzeSNw8/EbIVGELTdxvEckVB6ibaRUgOW8RxS/BjysdykXS7/yMLjj18UNyMPn
v+g5qkIM8vHoAIPx+ndnta9TuSiXJkOCZihznMh1FCJs8GQ/T6Uy3Wqgi43dRxUAunUP
RoxQOD/7tr5hqsscCMwBUp7nTHSHH833BEaWFAqGtGwM7eadZmXul8V9FvVllr8OcX7a
6btmH+5Dp/3OP2K0jYmLtI4EYmQ2dV6uQadQsZoPaop32HeT3mGzq//F8s9YyPw5uXvc
nvew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1791567190; x=1792171990;
h=in-reply-to:content-transfer-encoding:content-disposition
:content-type:mime-version:references:mail-followup-to:message-id
:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=c2jD9IJYGfmVcnhpThjvZylfTJOWRr2wSFSn38TwVbE=;
b=OFSH1wgNENaGZNA+YWfhWx0oRNqlSRLOgUrT5kETaOA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ri, 09 Oct 2026 10:33:10 -0700 (PDT)
X-Received: from localhost ([2a03:2880:2ff:70::])
by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3ab395e11a0sm2740419a91.2.2026.10.09.10.33.09
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 09 Oct 2026 10:33:09 -0700 (PDT)
X-Cc: netdev@vger.kernel.org, Pavan Chebbi <pavan.chebbi@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
edumazet@google.com, horms@kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
X-Mail-Followup-To: Joe Damato <joe@dama.to>,
Michael Chan <michael.chan@broadcom.com>, netdev@vger.kernel.org,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
edumazet@google.com, horms@kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <CACKFLikWkH6QaOG=EO_zu8cqCFRxGqtA2-+R-btp0TwUbJjVBg@mail.gmail.com>