Re: [net-next v6 08/12] net: bnxt: Implement software USO
From: Joe Damato <hidden>
Date: 2026-03-30 16:53:35
Also in:
lkml
On Sun, Mar 29, 2026 at 03:20:16PM -0700, Jakub Kicinski wrote:
On Thu, 26 Mar 2026 16:52:27 -0700 Joe Damato wrote:quoted
+ /* 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). + */ + bds_needed = 3 * num_segs + skb_shinfo(skb)->nr_frags + 1; + + if (unlikely(bnxt_tx_avail(bp, txr) < bds_needed)) { + netif_txq_try_stop(txq, bnxt_tx_avail(bp, txr), + bp->tx_wake_thresh); + return NETDEV_TX_BUSY; + } + + slots = BNXT_SW_USO_MAX_SEGS - (txr->tx_inline_prod - txr->tx_inline_cons); + + if (unlikely(slots < num_segs)) { + netif_txq_try_stop(txq, bnxt_tx_avail(bp, txr),This looks sus, try_stop() will evaluate the bnxt_tx_avail(bp, txr) and leave the ring running.
Yea, I think the slot check can actually be removed entirely. Each segment consumes 1 inline slot and at least 3 BDs. BNXT_SW_USO_MAX_SEGS is 64 and the ring's minimum size is 2 * BNXT_SW_USO_MAX_DESCS (420). Using 64 slots would consume at least 192 BDs, so the check above would fire first. I think as long as the ring size is constrained by the code in fix_features and set_ringparam then this if block can be removed.
quoted
+ bp->tx_wake_thresh);Is tx_wake_thresh larger than the max USO even for smallest ring size?
Yes, it is. Maybe its worth adding a comment in the code somewhere to make this more clear? Not sure where would be an appropriate place, but maybe bnxt_init_tx_rings?