bmips: add BQL support

Add Byte Queue Limits support to reduce/remove bufferbloat.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
This commit is contained in:
Sieng Piaw Liew 2022-06-29 16:18:12 +08:00 committed by Álvaro Fernández Rojas
parent 85d403a579
commit cbc1fcf0e4

View 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;
}