Skip to contentSkip to conversation

r8169: use netif_receive_skb_list batching

PATCH Applied Heiner Kallweit 5 participants 9 messages Mar 31, 2019 – Apr 1, 2019

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 1/1 r8169: use netif_receive_skb_list batching

Use netif_receive_skb_list() instead of napi_gro_receive() to benefit from batched skb processing.

---
 drivers/net/ethernet/realtek/r8169.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169.c +4 -1
index a8ca26c2a..c9ee1c8eb 100644
@@ -6426,6 +6426,7 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 {
 	unsigned int cur_rx, rx_left;
 	unsigned int count;
+	LIST_HEAD(rx_list);
 
 	cur_rx = tp->cur_rx;
 
@@ -6501,7 +6502,7 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 			if (skb->pkt_type == PACKET_MULTICAST)
 				dev->stats.multicast++;
 
-			napi_gro_receive(&tp->napi, skb);
+			list_add_tail(&skb->list, &rx_list);
 
 			u64_stats_update_begin(&tp->rx_stats.syncp);
 			tp->rx_stats.packets++;
@@ -6516,6 +6517,8 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 	count = cur_rx - tp->cur_rx;
 	tp->cur_rx = cur_rx;
 
+	netif_receive_skb_list(&rx_list);
+
 	return count;
 }
 
Signature · 1 line
2.21.0
#2 lore raw
Quoted 10 lines · David Miller

From: Heiner Kallweit <[email protected]>
Date: Sun, 31 Mar 2019 15:18:48 +0200

Quoted 4 lines

Use netif_receive_skb_list() instead of napi_gro_receive() to benefit from batched skb processing.

Applied.

This means no GRO at all, and reduced performance in many useful cases.

#3 lore raw
Quoted 7 lines · On Mon, 1 Apr 2019 02:17:12 -0700 Eric Dumazet <[email protected]> wrote:
Quoted 6 lines · David Miller

From: Heiner Kallweit <[email protected]>
Date: Sun, 31 Mar 2019 15:18:48 +0200

Quoted 3 lines

Use netif_receive_skb_list() instead of napi_gro_receive() to benefit from batched skb processing.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Applied.

This means no GRO at all, and reduced performance in many useful cases.

As Eric says, this in-effect disables GRO for this driver. This will very likely give a slowdown for local TCP delivery (while it might helps for UDP and forwarding).

That is why I was saying we need a GRO version of this... (which need to be combined with bulk SKB alloc, to compete with GRO fast-recycle of same SKB).

Signature · 4 lines
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer
maintainer
#4 lore raw

From: Jesper Dangaard Brouer <[email protected]>
Date: Mon, 1 Apr 2019 14:53:26 +0200

Quoted 12 lines
Quoted 9 lines · On Mon, 1 Apr 2019 02:17:12 -0700 Eric Dumazet <[email protected]> wrote:
Quoted 8 lines · David Miller

From: Heiner Kallweit <[email protected]>
Date: Sun, 31 Mar 2019 15:18:48 +0200

Quoted 4 lines

Use netif_receive_skb_list() instead of napi_gro_receive() to benefit from batched skb processing.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Applied.

This means no GRO at all, and reduced performance in many useful cases.

As Eric says, this in-effect disables GRO for this driver.

Really? __netif_receive_skb_list_core() does GRO.

#5 lore raw
Quoted 5 lines · David Miller

From: Jesper Dangaard Brouer <[email protected]>

Quoted 2 lines

As Eric says, this in-effect disables GRO for this driver.

Really? __netif_receive_skb_list_core() does GRO.

At least on current public trees, it can not do GRO, since we do not pass a napi context.

#7 lore raw
Quoted 6 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Mon, 1 Apr 2019 02:17:12 -0700

Quoted 1 line

This means no GRO at all

I do not think that is true as the SKB list layer does queue up to GRO.

No, Eric is right; the current list layer bypasses GRO completely.

netif_receive_skb_list() ends up doing the same things netif_receive_skb() would do on each SKB in the list, and that does not include GRO. (For this reason the sfc driver only uses netif_receive_skb_list() for non-TCP packets; TCP packets go to napi_gro_frags().)
I had a patch series to add napi_gro_receive_list() which would use the SKB list layer to handle the packets GRO didn't coalesce ([1]) but the performance tests I ran were inconclusive and it never got applied.

-Ed

[1]: https://marc.info/?l=linux-netdev&m=154221888012410&w=2

author maintainer
#8 lore raw
Quoted 17 lines · Edward Cree
Quoted 6 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Mon, 1 Apr 2019 02:17:12 -0700

Quoted 1 line

This means no GRO at all

I do not think that is true as the SKB list layer does queue up to GRO.

No, Eric is right; the current list layer bypasses GRO completely.

netif_receive_skb_list() ends up doing the same things netif_receive_skb() would do on each SKB in the list, and that does not include GRO. (For this reason the sfc driver only uses netif_receive_skb_list() for non-TCP packets; TCP packets go to napi_gro_frags().)
I had a patch series to add napi_gro_receive_list() which would use the SKB list layer to handle the packets GRO didn't coalesce ([1]) but the performance tests I ran were inconclusive and it never got applied.

Quoted 4 lines

-Ed

[1]: https://marc.info/?l=linux-netdev&m=154221888012410&w=2

Patch 0a25d92c6f4f ("dpaa2-eth: use netif_receive_skb_list") was well perceived [1], therefore I was under the assumption that netif_receive_skb_list is kind of successor for napi_gro_receive(). Does what you say apply to that patch too?

Based on feedback so far it seems to best if I revert the patch.

Heiner

[1] https://patchwork.ozlabs.org/patch/1064334/