[openwrt/openwrt] bmips: batch process eth_type_trans() in rx path

LEDE Commits lede-commits at lists.infradead.org
Sat Mar 4 10:29:59 PST 2023


noltari pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/85d403a5790cc1f0942800cee352bc0990d25d95

commit 85d403a5790cc1f0942800cee352bc0990d25d95
Author: Sieng Piaw Liew <liew.s.piaw at gmail.com>
AuthorDate: Wed Jun 29 16:16:13 2022 +0800

    bmips: batch process eth_type_trans() in rx path
    
    Improve cache efficiency by running eth_type_trans() in its own loop.
    
    Signed-off-by: Sieng Piaw Liew <liew.s.piaw at gmail.com>
---
 .../linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
index b7485ca51a..9b7c21c019 100644
--- a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
+++ b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
@@ -335,6 +335,7 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
 	struct bcm6368_enetsw *priv = netdev_priv(dev);
 	struct device *kdev = &priv->pdev->dev;
 	struct list_head rx_list;
+	struct sk_buff *skb;
 	int processed = 0;
 
 	INIT_LIST_HEAD(&rx_list);
@@ -347,7 +348,6 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
 	do {
 		struct bcm6368_enetsw_desc *desc;
 		unsigned int frag_size;
-		struct sk_buff *skb;
 		unsigned char *buf;
 		int desc_idx;
 		u32 len_stat;
@@ -418,12 +418,13 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
 
 		skb_reserve(skb, NET_SKB_PAD);
 		skb_put(skb, len);
-		skb->protocol = eth_type_trans(skb, dev);
 		dev->stats.rx_packets++;
 		dev->stats.rx_bytes += len;
 		list_add_tail(&skb->list, &rx_list);
 	} while (processed < budget);
 
+	list_for_each_entry(skb, &rx_list, list)
+		skb->protocol = eth_type_trans(skb, dev);
 	netif_receive_skb_list(&rx_list);
 	priv->rx_desc_count -= processed;
 




More information about the lede-commits mailing list