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

From: Jakub Kicinski <[email-masked]>
Date: Mon, 30 Mar 2026 16:59:40 -0700

On Mon, 30 Mar 2026 10:07:17 -0700 Joe Damato wrote:
> On Sun, Mar 29, 2026 at 03:22:36PM -0700, Jakub Kicinski wrote:
> > On Thu, 26 Mar 2026 16:52:28 -0700 Joe Damato wrote:  
> > > +			if (head_buf->is_sw_gso == BNXT_SW_GSO_LAST) {
> > > +				if (dma_use_iova(&head_buf->iova_state))
> > > +					dma_iova_destroy(&pdev->dev,
> > > +							 &head_buf->iova_state,
> > > +							 head_buf->iova_total_len,
> > > +							 DMA_TO_DEVICE, 0);  
> > 
> > Do we have to expose the dma_use_iova() stuff to the driver at all?
> > Could we have a function the driver is supposed to call to clean up,
> > always, and what the function does is up to the TSO lib?  
> 
> I could add a tso_dma_map_destroy(dev, iova_state, len) that the driver calls,
> but the driver would still need to stash iova_state and total_len on the ring.
> 
> That would be easiest, but I'm not sure if you were thinking that the IOVA
> stuff should be as opague as possible?
> 
> Because if you do want it to be as opague as possible, maybe:
> 
> /* Add a struct to tso.h to track completion state */
> struct tso_dma_map_completion_state {
>   struct dma_iova_state iova_state;
>   size_t total_len;
> }
> 
> Add a save function: tso_dma_map_completion_save(map, completion_state);
> 
> And then: 
>  - the bnxt sw bd stores a struct tso_dma_map_completion_state.
>  - xmit calls tso_dma_map_completion_save to store the iova_state
>  - completion calls tso_dma_complete(dev, &head_buf->completion_state)
> 
> LMK if you meant the easier way or the more opague way?

I'm not gonna lie, only noticed you keep the tso struct on the stack
now. But the proposal above looks pretty clean to me.