1d6f422e34
Sync ethernet driver code with upstream Linux kernel: -Reduce xmit_more code changes. -Combine rx cleanup code into a function. -Convert to build_skb. -Improve rx loop by optimizing loop tracking. https://lore.kernel.org/netdev/20210106144208.1935-1-liew.s.piaw@gmail.com/ Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com> [Amend commit description, move patches to the top since they are going to be upstreamed] Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
69 lines
1.9 KiB
Diff
69 lines
1.9 KiB
Diff
From 4c59b0f5543db80abbbe9efdd9b25e7899501db5 Mon Sep 17 00:00:00 2001
|
|
From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
|
|
Date: Wed, 6 Jan 2021 22:42:03 +0800
|
|
Subject: [PATCH 2/7] bcm63xx_enet: add BQL support
|
|
|
|
Add Byte Queue Limits support to reduce/remove bufferbloat in
|
|
bcm63xx_enet.
|
|
|
|
Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
|
|
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 9 +++++++++
|
|
1 file changed, 9 insertions(+)
|
|
|
|
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
|
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
|
@@ -418,9 +418,11 @@ static int bcm_enet_receive_queue(struct
|
|
static int bcm_enet_tx_reclaim(struct net_device *dev, int force)
|
|
{
|
|
struct bcm_enet_priv *priv;
|
|
+ unsigned int bytes;
|
|
int released;
|
|
|
|
priv = netdev_priv(dev);
|
|
+ bytes = 0;
|
|
released = 0;
|
|
|
|
while (priv->tx_desc_count < priv->tx_ring_size) {
|
|
@@ -457,10 +459,13 @@ static int bcm_enet_tx_reclaim(struct ne
|
|
if (desc->len_stat & DMADESC_UNDER_MASK)
|
|
dev->stats.tx_errors++;
|
|
|
|
+ bytes += skb->len;
|
|
dev_kfree_skb(skb);
|
|
released++;
|
|
}
|
|
|
|
+ netdev_completed_queue(dev, released, bytes);
|
|
+
|
|
if (netif_queue_stopped(dev) && released)
|
|
netif_wake_queue(dev);
|
|
|
|
@@ -627,6 +632,8 @@ bcm_enet_start_xmit(struct sk_buff *skb,
|
|
desc->len_stat = len_stat;
|
|
wmb();
|
|
|
|
+ netdev_sent_queue(dev, skb->len);
|
|
+
|
|
/* kick tx dma */
|
|
enet_dmac_writel(priv, priv->dma_chan_en_mask,
|
|
ENETDMAC_CHANCFG, priv->tx_chan);
|
|
@@ -1170,6 +1177,7 @@ static int bcm_enet_stop(struct net_devi
|
|
kdev = &priv->pdev->dev;
|
|
|
|
netif_stop_queue(dev);
|
|
+ netdev_reset_queue(dev);
|
|
napi_disable(&priv->napi);
|
|
if (priv->has_phy)
|
|
phy_stop(dev->phydev);
|
|
@@ -2343,6 +2351,7 @@ static int bcm_enetsw_stop(struct net_de
|
|
|
|
del_timer_sync(&priv->swphy_poll);
|
|
netif_stop_queue(dev);
|
|
+ netdev_reset_queue(dev);
|
|
napi_disable(&priv->napi);
|
|
del_timer_sync(&priv->rx_timeout);
|
|
|