1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 8 Jun 2020 17:01:12 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: use napi_consume_skb
5 Should improve performance, since it can use bulk free
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
11 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
12 @@ -858,7 +858,8 @@ static int txd_to_idx(struct mtk_tx_ring
13 return ((void *)dma - (void *)ring->dma) / sizeof(*dma);
16 -static void mtk_tx_unmap(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf)
17 +static void mtk_tx_unmap(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf,
20 if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) {
21 if (tx_buf->flags & MTK_TX_FLAGS_SINGLE0) {
22 @@ -890,8 +891,12 @@ static void mtk_tx_unmap(struct mtk_eth
26 - (tx_buf->skb != (struct sk_buff *)MTK_DMA_DUMMY_DESC))
27 - dev_kfree_skb_any(tx_buf->skb);
28 + (tx_buf->skb != (struct sk_buff *)MTK_DMA_DUMMY_DESC)) {
30 + napi_consume_skb(tx_buf->skb, napi);
32 + dev_kfree_skb_any(tx_buf->skb);
37 @@ -1069,7 +1074,7 @@ err_dma:
38 tx_buf = mtk_desc_to_tx_buf(ring, itxd);
41 - mtk_tx_unmap(eth, tx_buf);
42 + mtk_tx_unmap(eth, tx_buf, false);
44 itxd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
45 if (!MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
46 @@ -1386,7 +1391,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
50 - mtk_tx_unmap(eth, tx_buf);
51 + mtk_tx_unmap(eth, tx_buf, true);
53 ring->last_free = desc;
54 atomic_inc(&ring->free_count);
55 @@ -1423,7 +1428,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
59 - mtk_tx_unmap(eth, tx_buf);
60 + mtk_tx_unmap(eth, tx_buf, true);
62 desc = &ring->dma[cpu];
63 ring->last_free = desc;
64 @@ -1625,7 +1630,7 @@ static void mtk_tx_clean(struct mtk_eth
67 for (i = 0; i < MTK_DMA_SIZE; i++)
68 - mtk_tx_unmap(eth, &ring->buf[i]);
69 + mtk_tx_unmap(eth, &ring->buf[i], false);