Re: [net-next v9 07/10] net: bnxt: Implement software USO

From: Joe Damato

Date: Wed Apr 08 2026 - 15:13:34 EST


On Wed, Apr 08, 2026 at 11:06:52AM -0700, Jakub Kicinski wrote:
> On Wed, 8 Apr 2026 10:04:55 -0700 Joe Damato wrote:

[...]

> > 2. Or, keep the smaller buffer that we have now (BNXT_SW_USO_MAX_SEGS (64)
> > * 256b = 16kb per ring) and fix the try_stop like this:
> >
> > +static inline u16 bnxt_inline_avail(struct bnxt_tx_ring_info *txr)
> > +{
> > + return BNXT_SW_USO_MAX_SEGS -
> > + (u16)(txr->tx_inline_prod - READ_ONCE(txr->tx_inline_cons));
> > +}
> > +
> >
> > - slots = txr->tx_inline_prod - txr->tx_inline_cons;
> > - slots = BNXT_SW_USO_MAX_SEGS - slots;
> > -
> > - if (unlikely(slots < num_segs)) {
> > - netif_txq_try_stop(txq, slots, num_segs);
> > + if (unlikely(bnxt_inline_avail(txr) < num_segs)) {
> > + netif_txq_try_stop(txq, bnxt_inline_avail(txr), num_segs);
>
> I think option 2 makes sense. The point (which I think you got) is that
> the condition must be evaluated after the memory barrier.
>
> Since the condition is repeated in your latest snippet - you can
> probably use netif_txq_maybe_stop() ?

Yea, that's better, thanks.

I'll go with the inline wrapper above and:

- slots = txr->tx_inline_prod - txr->tx_inline_cons;
- slots = BNXT_SW_USO_MAX_SEGS - slots;
-
- if (unlikely(slots < num_segs)) {
- netif_txq_try_stop(txq, slots, num_segs);
+ if (!netif_txq_maybe_stop(txq, bnxt_inline_avail(txr),
+ num_segs, num_segs))
return NETDEV_TX_BUSY;