diff mbox series

[OpenWrt-Devel] ath79: ag71xx: use netif_receive_skb_list on 4.19

Message ID 20200107001203.22342-1-rosenp@gmail.com
State Accepted, archived
Delegated to: Chuanhong Guo
Headers show
Series [OpenWrt-Devel] ath79: ag71xx: use netif_receive_skb_list on 4.19 | expand

Commit Message

Rosen Penev Jan. 7, 2020, 12:12 a.m. UTC
From: Chuanhong Guo <gch981213@gmail.com>

This new function make batch processing of network packets possible,
which slightly improves performance.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Tested-by: Rosen Penev <rosenp@gmail.com>
---
 around a 20mbps improvement is measured on a TP-LINK Archer C7v2
 .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Comments

Chuanhong Guo Feb. 7, 2020, 3:06 a.m. UTC | #1
On Tue, Jan 7, 2020 at 8:12 AM Rosen Penev <rosenp@gmail.com> wrote:
>
> From: Chuanhong Guo <gch981213@gmail.com>
>
> This new function make batch processing of network packets possible,
> which slightly improves performance.
>
> Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
> Tested-by: Rosen Penev <rosenp@gmail.com>
> ---
>  around a 20mbps improvement is measured on a TP-LINK Archer C7v2

I almost forget this commit now :D

Merged. Thanks!

Regards,
Chuanhong Guo
diff mbox series

Patch

diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 0924b81b92..8831a51acc 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -1106,14 +1106,22 @@  static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
 	unsigned int offset = ag->rx_buf_offset;
 	int ring_mask = BIT(ring->order) - 1;
 	int ring_size = BIT(ring->order);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+	struct list_head rx_list;
+	struct sk_buff *next;
+#else
 	struct sk_buff_head queue;
+#endif
 	struct sk_buff *skb;
 	int done = 0;
 
 	DBG("%s: rx packets, limit=%d, curr=%u, dirty=%u\n",
 			dev->name, limit, ring->curr, ring->dirty);
-
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+	INIT_LIST_HEAD(&rx_list);
+#else
 	skb_queue_head_init(&queue);
+#endif
 
 	while (done < limit) {
 		unsigned int i = ring->curr & ring_mask;
@@ -1155,7 +1163,11 @@  static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
 		} else {
 			skb->dev = dev;
 			skb->ip_summed = CHECKSUM_NONE;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+			list_add_tail(&skb->list, &rx_list);
+#else
 			__skb_queue_tail(&queue, skb);
+#endif
 		}
 
 next:
@@ -1167,10 +1179,16 @@  next:
 
 	ag71xx_ring_rx_refill(ag);
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
+	list_for_each_entry_safe(skb, next, &rx_list, list)
+		skb->protocol = eth_type_trans(skb, dev);
+	netif_receive_skb_list(&rx_list);
+#else
 	while ((skb = __skb_dequeue(&queue)) != NULL) {
 		skb->protocol = eth_type_trans(skb, dev);
 		netif_receive_skb(skb);
 	}
+#endif
 
 	DBG("%s: rx finish, curr=%u, dirty=%u, done=%d\n",
 		dev->name, ring->curr, ring->dirty, done);