Re: [PATCH net 2/2] bnxt_en: Pad short SW USO segments to BNXT_MIN_PKT_SIZE

From: Joe Damato

Date: Fri Oct 09 2026 - 15:46:33 EST


On Fri, Oct 09, 2026 at 11:33:07AM -0700, Michael Chan wrote:
> On Fri, Oct 9, 2026 at 10:33 AM Joe Damato <joe@xxxxxxx> wrote:
> >
> > 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@xxxxxxx> 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.
> >
>
> Did you mean generic XDP turning around incoming packets with XDP_TX
> actions and transmitting them through the software stack? This path
> cannot generate USO packets, right?

Hm, I'm probably missing something, but the case I'm describing is generic XDP
bouncing received packets back out with XDP_TX.

I could be wrong (and if so I am happy to drop this if statement from the
code), but IIUC generic XDP runs from __netif_receive_skb_core() after
software GRO, so the packet it sees can be a GRO'd UDP packet with
SKB_GSO_UDP_L4 set (because maybe the socket had UDP_GRO set?).

The generic XDP path seems to keep all of the gso fields. Later generic
XDP TX calls netdev_start_xmit without validate_xmit_skb being called
and so gso_size could potentially be some tiny value.

LMK if that makes sense? I think that's what happens and if so, it is a weird
corner case that is probably pretty unlikely to happen so it felt like drop
might be the most appropriate thing to do.