Re: [PATCH net-next] net: ps3_gelic_net: Use napi_alloc_skb() and napi_gro_receive()
From: Eric Dumazet <edumazet@google.com>
Date: 2025-12-01 10:34:21
Also in:
lkml, netdev
On Sun, Nov 30, 2025 at 11:51 AM Florian Fuchs [off-list ref] wrote:
Use the napi functions napi_alloc_skb() and napi_gro_receive() instead of netdev_alloc_skb() and netif_receive_skb() for more efficient packet receiving. The switch to napi aware functions increases the RX throughput, reduces the occurrence of retransmissions and improves the resilience against SKB allocation failures. Signed-off-by: Florian Fuchs <redacted> --- Note: This change has been tested on real hardware Sony PS3 (CECHL04 PAL), the patch was tested for many hours, with continuous system load, high network transfer load and injected failslab errors. In my tests, the RX throughput increased up to 100% and reduced the occurrence of retransmissions drastically, with GRO enabled: iperf3 before and after the commit, where PS3 (with this driver) is on the receiving side: Before: [ 5] 0.00-10.00 sec 551 MBytes 462 Mbits/sec receiver After: [ 5] 0.00-10.00 sec 1.09 GBytes 939 Mbits/sec receiver stats from the sending client to the PS3: Before: [ 5] 0.00-10.00 sec 552 MBytes 463 Mbits/sec 3151 sender After: [ 5] 0.00-10.00 sec 1.09 GBytes 940 Mbits/sec 37 sender drivers/net/ethernet/toshiba/ps3_gelic_net.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
Patch looks fine to me. My PS3 died years ago, so I can not test it :) Reviewed-by: Eric Dumazet <edumazet@google.com> BTW, I think we can cleanup gelic_descr_prepare_rx() a bit :
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.cb/drivers/net/ethernet/toshiba/ps3_gelic_net.c index 5ee8e8980393c3491bf9cf91eb8e0dbb2df0f427..f4f34e9ed49c5b7fd1cf4ea3f5bfe7297e97ea23 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c@@ -392,10 +392,8 @@ static int gelic_descr_prepare_rx(struct gelic_card *card, descr->hw_regs.payload.size = 0; descr->skb = netdev_alloc_skb(*card->netdev, rx_skb_size); - if (!descr->skb) { - descr->hw_regs.payload.dev_addr = 0; /* tell DMAC
don't touch memory */
+ if (!descr->skb)
return -ENOMEM;
- }
offset = ((unsigned long)descr->skb->data) &
(GELIC_NET_RXBUF_ALIGN - 1);@@ -404,13 +402,12 @@ static int gelic_descr_prepare_rx(struct gelic_card *card, /* io-mmu-map the skb */ cpu_addr = dma_map_single(ctodev(card), descr->skb->data, GELIC_NET_MAX_FRAME, DMA_FROM_DEVICE); - descr->hw_regs.payload.dev_addr = cpu_to_be32(cpu_addr); + if (dma_mapping_error(ctodev(card), cpu_addr)) { dev_kfree_skb_any(descr->skb); descr->skb = NULL; dev_info(ctodev(card), "%s:Could not iommu-map rx buffer\n", __func__); - gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); return -ENOMEM; }