4db3ffe4e149d4a757135f1b5ae4ddd989e0c25e
[openwrt/staging/xback.git] /
1 From e3c77d0a1b635d114c147fd2078afb57ed558b81 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Mon, 3 Apr 2023 19:30:25 +0100
4 Subject: [PATCH 2/5] net: mvneta: mark mapped and tso buffers separately
5
6 Mark dma-mapped skbs and TSO buffers separately, so we can use
7 buf->type to identify their differences.
8
9 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
10 ---
11 drivers/net/ethernet/marvell/mvneta.c | 6 ++++--
12 1 file changed, 4 insertions(+), 2 deletions(-)
13
14 --- a/drivers/net/ethernet/marvell/mvneta.c
15 +++ b/drivers/net/ethernet/marvell/mvneta.c
16 @@ -607,6 +607,7 @@ struct mvneta_rx_desc {
17 #endif
18
19 enum mvneta_tx_buf_type {
20 + MVNETA_TYPE_TSO,
21 MVNETA_TYPE_SKB,
22 MVNETA_TYPE_XDP_TX,
23 MVNETA_TYPE_XDP_NDO,
24 @@ -1852,7 +1853,8 @@ static void mvneta_txq_bufs_free(struct
25 dma_unmap_single(pp->dev->dev.parent,
26 tx_desc->buf_phys_addr,
27 tx_desc->data_size, DMA_TO_DEVICE);
28 - if (buf->type == MVNETA_TYPE_SKB && buf->skb) {
29 + if ((buf->type == MVNETA_TYPE_TSO ||
30 + buf->type == MVNETA_TYPE_SKB) && buf->skb) {
31 bytes_compl += buf->skb->len;
32 pkts_compl++;
33 dev_kfree_skb_any(buf->skb);
34 @@ -2607,7 +2609,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb,
35 tx_desc->command |= MVNETA_TXD_F_DESC;
36 tx_desc->buf_phys_addr = txq->tso_hdrs_phys +
37 txq->txq_put_index * TSO_HEADER_SIZE;
38 - buf->type = MVNETA_TYPE_SKB;
39 + buf->type = MVNETA_TYPE_TSO;
40 buf->skb = NULL;
41
42 mvneta_txq_inc_put(txq);