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@gmail.com>
This commit is contained in:
Sieng Piaw Liew 2022-06-29 16:16:13 +08:00 committed by Álvaro Fernández Rojas
parent 686050b2b2
commit 85d403a579

View File

@ -335,6 +335,7 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
struct bcm6368_enetsw *priv = netdev_priv(dev); struct bcm6368_enetsw *priv = netdev_priv(dev);
struct device *kdev = &priv->pdev->dev; struct device *kdev = &priv->pdev->dev;
struct list_head rx_list; struct list_head rx_list;
struct sk_buff *skb;
int processed = 0; int processed = 0;
INIT_LIST_HEAD(&rx_list); INIT_LIST_HEAD(&rx_list);
@ -347,7 +348,6 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
do { do {
struct bcm6368_enetsw_desc *desc; struct bcm6368_enetsw_desc *desc;
unsigned int frag_size; unsigned int frag_size;
struct sk_buff *skb;
unsigned char *buf; unsigned char *buf;
int desc_idx; int desc_idx;
u32 len_stat; 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_reserve(skb, NET_SKB_PAD);
skb_put(skb, len); skb_put(skb, len);
skb->protocol = eth_type_trans(skb, dev);
dev->stats.rx_packets++; dev->stats.rx_packets++;
dev->stats.rx_bytes += len; dev->stats.rx_bytes += len;
list_add_tail(&skb->list, &rx_list); list_add_tail(&skb->list, &rx_list);
} while (processed < budget); } while (processed < budget);
list_for_each_entry(skb, &rx_list, list)
skb->protocol = eth_type_trans(skb, dev);
netif_receive_skb_list(&rx_list); netif_receive_skb_list(&rx_list);
priv->rx_desc_count -= processed; priv->rx_desc_count -= processed;