Re: [net-next v6 09/12] net: bnxt: Add SW GSO completion and teardown support

From: Joe Damato

Date: Tue Mar 31 2026 - 17:20:53 EST


On Mon, Mar 30, 2026 at 04:57:48PM -0700, Jakub Kicinski wrote:
> On Thu, 26 Mar 2026 16:52:28 -0700 Joe Damato wrote:
> > @@ -4645,6 +4687,10 @@ static int bnxt_init_tx_rings(struct bnxt *bp)
> >
> > bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2,
> > BNXT_MIN_TX_DESC_CNT);
> > + if (!(bp->flags & BNXT_FLAG_UDP_GSO_CAP) &&
> > + (bp->dev->features & NETIF_F_GSO_UDP_L4))
> > + bp->tx_wake_thresh = max_t(int, bp->tx_wake_thresh,
> > + BNXT_SW_USO_MAX_DESCS);
> >
> > for (i = 0; i < bp->tx_nr_rings; i++) {
> > struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
> > @@ -13832,6 +13878,11 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
> > if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp, false))
> > features &= ~NETIF_F_NTUPLE;
> >
> > + if ((features & NETIF_F_GSO_UDP_L4) &&
> > + !(bp->flags & BNXT_FLAG_UDP_GSO_CAP) &&
> > + bp->tx_ring_size < 2 * BNXT_SW_USO_MAX_DESCS)
> > + features &= ~NETIF_F_GSO_UDP_L4;
> > +
> > if ((bp->flags & BNXT_FLAG_NO_AGG_RINGS) || bp->xdp_prog)
> > features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
> >
> > @@ -13877,6 +13928,15 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features)
> > int rc = 0;
> > bool re_init = false;
> >
> > + if (!(bp->flags & BNXT_FLAG_UDP_GSO_CAP)) {
> > + if (features & NETIF_F_GSO_UDP_L4)
> > + bp->tx_wake_thresh = max_t(int, bp->tx_wake_thresh,
> > + BNXT_SW_USO_MAX_DESCS);
> > + else
> > + bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2,
> > + BNXT_MIN_TX_DESC_CNT);
>
> Adding extra handling for min ring size all over the place looks a bit
> messy. Can you factor something out of this logic?

Could add something like:

static int bnxt_min_tx_desc_cnt(struct bnxt *bp)
{
if (!(bp->flags & BNXT_FLAG_UDP_GSO_CAP) &&
(bp->dev->features & NETIF_F_GSO_UDP_L4))
return BNXT_SW_USO_MAX_DESCS;
return BNXT_MIN_TX_DESC_CNT;
}

and then when setting the tx_wake_thresh, it becomes:

bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2,
bnxt_min_tx_desc_cnt(bp));

and fix_features can use the same helper.

Question then is just do we still want to bump BNXT_MIN_TX_DESC_CNT (as per
your previous comment)?