bmips: batch process rx path
authorSieng Piaw Liew <liew.s.piaw@gmail.com>
Wed, 29 Jun 2022 08:11:38 +0000 (16:11 +0800)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Sat, 4 Mar 2023 18:28:16 +0000 (19:28 +0100)
Use netif_receive_skb_list() to batch process rx skb. This improves
cache efficiency.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c

index 04884a122d10d60c51b4f60bcb871d09a763367b..b7485ca51ae2e59aee4ef3a0a810ca894f80a13f 100644 (file)
@@ -334,8 +334,11 @@ 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;
        int processed = 0;
 
+       INIT_LIST_HEAD(&rx_list);
+
        /* don't scan ring further than number of refilled
         * descriptor */
        if (budget > priv->rx_desc_count)
@@ -418,9 +421,10 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
                skb->protocol = eth_type_trans(skb, dev);
                dev->stats.rx_packets++;
                dev->stats.rx_bytes += len;
-               netif_receive_skb(skb);
+               list_add_tail(&skb->list, &rx_list);
        } while (processed < budget);
 
+       netif_receive_skb_list(&rx_list);
        priv->rx_desc_count -= processed;
 
        if (processed || !priv->rx_desc_count) {