[openwrt/openwrt] bmips: add BQL support

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


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

commit cbc1fcf0e4e21cf331cbd92dd7802b8f40c31107
Author: Sieng Piaw Liew <liew.s.piaw at gmail.com>
AuthorDate: Wed Jun 29 16:18:12 2022 +0800

    bmips: add BQL support
    
    Add Byte Queue Limits support to reduce/remove bufferbloat.
    
    Signed-off-by: Sieng Piaw Liew <liew.s.piaw at gmail.com>
---
 .../bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c    | 8 ++++++++
 1 file changed, 8 insertions(+)

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 9b7c21c019..b3dc53c20f 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
@@ -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;
 }
 




More information about the lede-commits mailing list