[openwrt/openwrt] kernel: use napi_build_skb in mtk_eth_soc

LEDE Commits lede-commits at lists.infradead.org
Thu Jun 6 02:49:38 PDT 2024


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/f352ca5a8ad66d0b6b58053e4cfa3c77b5c06f9d

commit f352ca5a8ad66d0b6b58053e4cfa3c77b5c06f9d
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon May 20 14:36:55 2024 +0200

    kernel: use napi_build_skb in mtk_eth_soc
    
    Improves performance
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 ...t-ethernet-mtk_eth_soc-use-napi_build_skb.patch | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch b/target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch
new file mode 100644
index 0000000000..71c0734ce7
--- /dev/null
+++ b/target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch
@@ -0,0 +1,30 @@
+From: Felix Fietkau <nbd at nbd.name>
+Date: Mon, 20 May 2024 14:29:58 +0200
+Subject: [PATCH] net: ethernet: mtk_eth_soc: use napi_build_skb()
+
+The napi_build_skb() can reuse the skb in skb cache per CPU or
+can allocate skbs in bulk, which helps improve the performance.
+
+Signed-off-by: Felix Fietkau <nbd at nbd.name>
+---
+
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -2120,7 +2120,7 @@ static int mtk_poll_rx(struct napi_struc
+ 			if (ret != XDP_PASS)
+ 				goto skip_rx;
+ 
+-			skb = build_skb(data, PAGE_SIZE);
++			skb = napi_build_skb(data, PAGE_SIZE);
+ 			if (unlikely(!skb)) {
+ 				page_pool_put_full_page(ring->page_pool,
+ 							page, true);
+@@ -2158,7 +2158,7 @@ static int mtk_poll_rx(struct napi_struc
+ 			dma_unmap_single(eth->dma_dev, ((u64)trxd.rxd1 | addr64),
+ 					 ring->buf_size, DMA_FROM_DEVICE);
+ 
+-			skb = build_skb(data, ring->frag_size);
++			skb = napi_build_skb(data, ring->frag_size);
+ 			if (unlikely(!skb)) {
+ 				netdev->stats.rx_dropped++;
+ 				skb_free_frag(data);




More information about the lede-commits mailing list