From: Oscar Maes <oscmaes92@gmail.com>
To: netdev@vger.kernel.org
Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
Oscar Maes <oscmaes92@gmail.com>
Subject: [PATCH net-next v2 2/2] pcnet32: switch to napi_alloc_skb() and napi_gro_receive()
Date: Mon, 25 May 2026 14:54:37 +0200 [thread overview]
Message-ID: <20260525125437.4061-3-oscmaes92@gmail.com> (raw)
In-Reply-To: <20260525125437.4061-1-oscmaes92@gmail.com>
Use the newer and more efficient napi_alloc_skb() and napi_gro_receive()
APIs to improve RX throughput.
Also removes the manual calls to skb_reserve(NET_IP_ALIGN), since
napi_alloc_skb() already does this internally.
In my testing this resulted in up to a 25% RX throughput increase in iperf3
tests in both directions.
Signed-off-by: Oscar Maes <oscmaes92@gmail.com>
---
drivers/net/ethernet/amd/pcnet32.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index 4f3076d4ea34..06d5432bb464 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1220,13 +1220,12 @@ static void pcnet32_rx_entry(struct net_device *dev,
struct sk_buff *newskb;
dma_addr_t new_dma_addr;
- newskb = netdev_alloc_skb(dev, PKT_BUF_SKB);
+ newskb = napi_alloc_skb(&lp->napi, PKT_BUF_SIZE);
/*
* map the new buffer, if mapping fails, drop the packet and
* reuse the old buffer
*/
if (newskb) {
- skb_reserve(newskb, NET_IP_ALIGN);
new_dma_addr = dma_map_single(&lp->pci_dev->dev,
newskb->data,
PKT_BUF_SIZE,
@@ -1251,14 +1250,13 @@ static void pcnet32_rx_entry(struct net_device *dev,
} else
skb = NULL;
} else
- skb = netdev_alloc_skb(dev, pkt_len + NET_IP_ALIGN);
+ skb = napi_alloc_skb(&lp->napi, pkt_len);
if (!skb) {
dev->stats.rx_dropped++;
return;
}
if (!rx_in_place) {
- skb_reserve(skb, NET_IP_ALIGN);
skb_put(skb, pkt_len); /* Make room */
dma_sync_single_for_cpu(&lp->pci_dev->dev,
lp->rx_dma_addr[entry], pkt_len,
@@ -1272,7 +1270,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
}
dev->stats.rx_bytes += skb->len;
skb->protocol = eth_type_trans(skb, dev);
- netif_receive_skb(skb);
+ napi_gro_receive(&lp->napi, skb);
dev->stats.rx_packets++;
}
--
2.39.5
prev parent reply other threads:[~2026-05-25 12:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 12:54 [PATCH net-next v2 0/2] pcnet32: switch to napi_alloc_skb() and napi_gro_receive() Oscar Maes
2026-05-25 12:54 ` [PATCH net-next v2 1/2] pcnet32: stop holding device spin lock during napi_complete_done Oscar Maes
2026-05-25 13:53 ` Andrew Lunn
2026-05-25 12:54 ` Oscar Maes [this message]
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=20260525125437.4061-3-oscmaes92@gmail.com \
--to=oscmaes92@gmail.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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