Skip to contentSkip to conversation

net: ibm: emac: Use napi_gro_receive() for Rx packets

PATCH Applied Rosen Penev 2 participants 2 messages May 21 – May 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ibm: emac: Use napi_gro_receive() for Rx packets

emac_poll_rx() already runs in NAPI context and TAH-equipped EMACs set CHECKSUM_UNNECESSARY on verified frames, which lets GRO coalesce TCP segments without a software checksum on the merge path. Replace the per-poll rx_list batched with netif_receive_skb_list() with direct napi_gro_receive() calls so the stack can merge segments into super-skbs and skip a full traversal per packet -- a meaningful win on the slow 4xx-class CPUs this driver targets.

Small routing speed improvement tested on a Cisco Meraki MX60W:

Tested with iperf3

Before:

[ ID] Interval Transfer Bitrate Retr

[  5]   0.00-10.00  sec   494 MBytes   414 Mbits/sec  839             sender
[  5]   0.00-10.04  sec   492 MBytes   411 Mbits/sec                  receiver

After:

[ ID] Interval Transfer Bitrate Retr

[  5]   0.00-10.00  sec   510 MBytes   428 Mbits/sec  580             sender
[  5]   0.00-10.04  sec   508 MBytes   424 Mbits/sec                  receiver

Traffic to and from the router seems to be slow no matter what:

Tested with iperf3 --bidir

Before:

[ ID][Role] Interval Transfer Bitrate Retr

[  8][TX-C]   0.00-10.00  sec   297 MBytes   249 Mbits/sec   35            sender
[  8][TX-C]   0.00-10.00  sec   293 MBytes   245 Mbits/sec                  receiver
[ 10][RX-C]   0.00-10.00  sec   184 MBytes   154 Mbits/sec    0            sender
[ 10][RX-C]   0.00-10.00  sec   184 MBytes   154 Mbits/sec                  receiver

After:

[ ID][Role] Interval Transfer Bitrate Retr

[  8][TX-C]   0.00-10.00  sec   295 MBytes   248 Mbits/sec   31            sender
[  8][TX-C]   0.00-10.00  sec   294 MBytes   246 Mbits/sec                  receiver
[ 10][RX-C]   0.00-10.00  sec   181 MBytes   152 Mbits/sec    0            sender
[ 10][RX-C]   0.00-10.00  sec   181 MBytes   152 Mbits/sec                  receiver
Assisted-by Claude:Opus-4.7
---
 drivers/net/ethernet/ibm/emac/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/ibm/emac/core.c +1 -4
index adac0b55936c..11d673a9f119 100644
@@ -1738,7 +1738,6 @@ static inline int emac_rx_sg_append(struct emac_instance *dev, int slot)
 /* NAPI poll context */
 static int emac_poll_rx(void *param, int budget)
 {
-	LIST_HEAD(rx_list);
 	struct emac_instance *dev = param;
 	int slot = dev->rx_slot, received = 0;
 
@@ -1795,7 +1794,7 @@ static int emac_poll_rx(void *param, int budget)
 		skb->protocol = eth_type_trans(skb, dev->ndev);
 		emac_rx_csum(dev, skb, ctrl);
 
-		list_add_tail(&skb->list, &rx_list);
+		napi_gro_receive(&dev->mal->napi, skb);
 	next:
 		++dev->stats.rx_packets;
 	skip:
@@ -1839,8 +1838,6 @@ static int emac_poll_rx(void *param, int budget)
 		goto next;
 	}
 
-	netif_receive_skb_list(&rx_list);
-
 	if (received) {
 		DBG2(dev, "rx %d BDs" NL, received);
 		dev->rx_slot = slot;
Signature · 1 line
2.54.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 21 May 2026 14:59:08 -0700 you wrote:

emac_poll_rx() already runs in NAPI context and TAH-equipped EMACs set CHECKSUM_UNNECESSARY on verified frames, which lets GRO coalesce TCP segments without a software checksum on the merge path. Replace the per-poll rx_list batched with netif_receive_skb_list() with direct napi_gro_receive() calls so the stack can merge segments into super-skbs and skip a full traversal per packet -- a meaningful win on the slow 4xx-class CPUs this driver targets.

[...]

Here is the summary with links:
- net: ibm: emac: Use napi_gro_receive() for Rx packets

    https://git.kernel.org/netdev/net-next/c/da91508bdd1d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html