net: mvneta: use buf->type to determine whether to dma-unmap
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 10 May 2023 10:15:53 +0000 (11:15 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 11 May 2023 11:05:07 +0000 (13:05 +0200)
commitf00ba4f41acc050c959803f290a0f0c03dc0da5c
treecfe20663c24c1b59f9f3d6ba870b09d67efd4a34
parentb0bd1b07c3add928e33282a52ad64a3f011d4fb7
net: mvneta: use buf->type to determine whether to dma-unmap

Now that we use a different buffer type for TSO headers, we can use
buf->type to determine whether the original buffer was DMA-mapped or
not. The rules are:

MVNETA_TYPE_XDP_TX - from a DMA pool, no unmap is required
MVNETA_TYPE_XDP_NDO - dma_map_single()'d
MVNETA_TYPE_SKB - normal skbuff, dma_map_single()'d
MVNETA_TYPE_TSO - from the TSO buffer area

This means we only need to call dma_unmap_single() on the XDP_NDO and
SKB types of buffer, and we no longer need the private IS_TSO_HEADER()
which relies on the TSO region being contiguously allocated.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/marvell/mvneta.c