[openwrt/openwrt] bmips: switch to napi_build_skb() to reuse skbuff_heads

LEDE Commits lede-commits at lists.infradead.org
Sat Mar 4 10:29:56 PST 2023


noltari pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/330cbcc09c4d142279b958e6d0e4b764dacd686c

commit 330cbcc09c4d142279b958e6d0e4b764dacd686c
Author: Sieng Piaw Liew <liew.s.piaw at gmail.com>
AuthorDate: Thu Jun 23 12:49:28 2022 +0800

    bmips: switch to napi_build_skb() to reuse skbuff_heads
    
    napi_build_skb() reuses NAPI skbuff_head cache in order to save some
    cycles on freeing/allocating skbuff_heads on every new rx or completed
    tx.
    Use napi_consume_skb() to feed the cache with skbuff_heads of completed
    tx so it's never empty.
    
    Signed-off-by: Sieng Piaw Liew <liew.s.piaw at gmail.com>
---
 .../linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
index 854bcc0a8c..962f9ac887 100644
--- a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
+++ b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
@@ -407,7 +407,7 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
 			frag_size = priv->rx_frag_size;
 		}
 
-		skb = build_skb(buf, frag_size);
+		skb = napi_build_skb(buf, frag_size);
 		if (unlikely(!skb)) {
 			skb_free_frag(buf);
 			dev->stats.rx_dropped++;
@@ -475,7 +475,7 @@ static int bcm6368_enetsw_tx_reclaim(struct net_device *dev, int force)
 		if (desc->len_stat & DMADESC_UNDER_MASK)
 			dev->stats.tx_errors++;
 
-		dev_kfree_skb(skb);
+		napi_consume_skb(skb, !force);
 		released++;
 	}
 




More information about the lede-commits mailing list