bmips: add BQL support
authorSieng Piaw Liew <liew.s.piaw@gmail.com>
Wed, 29 Jun 2022 08:18:12 +0000 (16:18 +0800)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Sat, 4 Mar 2023 18:28:16 +0000 (19:28 +0100)
Add Byte Queue Limits support to reduce/remove bufferbloat.

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

index 9b7c21c019c40637ccd480e8e1c06d4f5251e771..b3dc53c20f839d3fb2e5caf6059f9abc41d6879f 100644 (file)
@@ -445,6 +445,7 @@ static int bcm6368_enetsw_receive_queue(struct net_device *dev, int budget)
 static int bcm6368_enetsw_tx_reclaim(struct net_device *dev, int force)
 {
        struct bcm6368_enetsw *priv = netdev_priv(dev);
+       unsigned int bytes = 0;
        int released = 0;
 
        while (priv->tx_desc_count < priv->tx_ring_size) {
@@ -481,10 +482,13 @@ static int bcm6368_enetsw_tx_reclaim(struct net_device *dev, int force)
                if (desc->len_stat & DMADESC_UNDER_MASK)
                        dev->stats.tx_errors++;
 
+               bytes += skb->len;
                napi_consume_skb(skb, !force);
                released++;
        }
 
+       netdev_completed_queue(dev, released, bytes);
+
        if (netif_queue_stopped(dev) && released)
                netif_wake_queue(dev);
 
@@ -617,6 +621,8 @@ bcm6368_enetsw_start_xmit(struct sk_buff *skb, struct net_device *dev)
        desc->len_stat = len_stat;
        wmb();
 
+       netdev_sent_queue(dev, skb->len);
+
        /* kick tx dma */
        dmac_writel(priv, priv->dma_chan_en_mask, DMAC_CHANCFG_REG,
                    priv->tx_chan);
@@ -876,6 +882,8 @@ static int bcm6368_enetsw_stop(struct net_device *dev)
                free_irq(priv->irq_tx, dev);
        free_irq(priv->irq_rx, dev);
 
+       netdev_reset_queue(dev);
+
        return 0;
 }