From: Sieng Piaw Liew Date: Wed, 29 Jun 2022 08:18:12 +0000 (+0800) Subject: bmips: add BQL support X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=cbc1fcf0e4e21cf331cbd92dd7802b8f40c31107;p=openwrt%2Fstaging%2Fjow.git bmips: add BQL support Add Byte Queue Limits support to reduce/remove bufferbloat. Signed-off-by: Sieng Piaw Liew --- 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; }