Re: [PATCH net-next v2] drivers: net: xgene: Fix dma_unmap_single() size

From: Daniel Machon

Date: Fri Oct 16 2026 - 04:28:21 EST


> > In xgene_enet_refill_bufpool(), the skb->data is dma-mapped with length
> > len which is set to XGENE_ENET_STD_MTU which equals 1536. However, in
> > xgene_enet_delete_bufpool(), the same buffer is unmapped with length
> > XGENE_ENET_MAX_MTU which is 9600. This may erroneously unmap other
> > DMA buffers or cause other issues.
> >
> > Change unmap length to XGENE_ENET_STD_MTU.
>
> I don't know this driver, so i could be wrong.....
>
> map/unmap is expensive, because it needs to flush/invalidate the cache
> etc. So the hot path part of the code, dealing with real frame data,
> sometimes only maps/unmaps the length of the frame, which is less than
> the length of the buffer, particularly when jumbo is involved.
>
> So you could allocate a buffer for 9600 jumbo, but in the hot path
> only map/unmap part of it, but when you release the buffer, you need
> to unmap the full 9600 size of the buffer, to be on the safe size.

I don't think that applies here. The bufpool skbs are mapped and unmapped in the
RX path with XGENE_ENET_STD_MTU, never with the frame length. The teardown unmap
with XGENE_ENET_MAX_MTU is the only mismatch (AFAICT), and that is what this
patch fixes.

>
> Please look at the driver and consider this. As i said, i could be
> wrong...
>
> Andrew
>

/Daniel