mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sieng Piaw Liew <liew.s.piaw@gmail.com>
Subject: [PATCH V2] bcm63xx_enet: switch to napi_build_skb() to reuse skbuff_heads
Date: Wed, 15 Jun 2022 14:09:22 +0800	[thread overview]
Message-ID: <20220615060922.3402-1-liew.s.piaw@gmail.com> (raw)
In-Reply-To: <20220614021009.696-1-liew.s.piaw@gmail.com>

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@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 698438a2ee0f..514d61dd91c7 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -388,7 +388,7 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget)
 					 priv->rx_buf_size, DMA_FROM_DEVICE);
 			priv->rx_buf[desc_idx] = NULL;
 
-			skb = build_skb(buf, priv->rx_frag_size);
+			skb = napi_build_skb(buf, priv->rx_frag_size);
 			if (unlikely(!skb)) {
 				skb_free_frag(buf);
 				dev->stats.rx_dropped++;
@@ -468,7 +468,7 @@ static int bcm_enet_tx_reclaim(struct net_device *dev, int force)
 			dev->stats.tx_errors++;
 
 		bytes += skb->len;
-		dev_kfree_skb(skb);
+		napi_consume_skb(skb, !force);
 		released++;
 	}
 
-- 
2.17.1


  parent reply	other threads:[~2022-06-15  6:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14  2:10 [PATCH] bcm63xx_enet: reuse skbuff_head Sieng Piaw Liew
2022-06-14 16:12 ` Florian Fainelli
2022-06-15  4:50 ` Jakub Kicinski
2022-06-15  6:09 ` Sieng Piaw Liew [this message]
2022-06-15 12:10   ` [PATCH V2] bcm63xx_enet: switch to napi_build_skb() to reuse skbuff_heads patchwork-bot+netdevbpf
2022-07-08  8:03   ` [PATCH] bcm63xx: fix Tx cleanup when NAPI poll budget is zero Sieng-Piaw Liew
2022-07-11 20:40     ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220615060922.3402-1-liew.s.piaw@gmail.com \
    --to=liew.s.piaw@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®