aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro
diff options
context:
space:
mode:
authorBeniamino Galvani <b.galvani@gmail.com>2015-01-21 13:07:27 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-26 18:22:15 -0500
commit3897957494d979ad592a00a6ced4b6c9410e9452 (patch)
treec98c305d5d60eb1174cc79499b7b6579e7043868 /drivers/net/ethernet/stmicro
parent1793c798c34b03ba033d3905fe0f87b88c48b504 (diff)
net: stmmac: add BQL support
Add support for Byte Queue Limits to the STMicro MAC driver. Tested on a Amlogic S802 quad Cortex-A9 board, where the use of BQL decreases the latency of a high priority ping from ~12ms to ~1ms when the 100Mbit link is saturated by 20 TCP streams. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8c6b7c1651e5..d7fc2b5a1408 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1097,6 +1097,7 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
1097 1097
1098 priv->dirty_tx = 0; 1098 priv->dirty_tx = 0;
1099 priv->cur_tx = 0; 1099 priv->cur_tx = 0;
1100 netdev_reset_queue(priv->dev);
1100 1101
1101 stmmac_clear_descriptors(priv); 1102 stmmac_clear_descriptors(priv);
1102 1103
@@ -1300,6 +1301,7 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
1300static void stmmac_tx_clean(struct stmmac_priv *priv) 1301static void stmmac_tx_clean(struct stmmac_priv *priv)
1301{ 1302{
1302 unsigned int txsize = priv->dma_tx_size; 1303 unsigned int txsize = priv->dma_tx_size;
1304 unsigned int bytes_compl = 0, pkts_compl = 0;
1303 1305
1304 spin_lock(&priv->tx_lock); 1306 spin_lock(&priv->tx_lock);
1305 1307
@@ -1356,6 +1358,8 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
1356 priv->hw->mode->clean_desc3(priv, p); 1358 priv->hw->mode->clean_desc3(priv, p);
1357 1359
1358 if (likely(skb != NULL)) { 1360 if (likely(skb != NULL)) {
1361 pkts_compl++;
1362 bytes_compl += skb->len;
1359 dev_consume_skb_any(skb); 1363 dev_consume_skb_any(skb);
1360 priv->tx_skbuff[entry] = NULL; 1364 priv->tx_skbuff[entry] = NULL;
1361 } 1365 }
@@ -1364,6 +1368,9 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
1364 1368
1365 priv->dirty_tx++; 1369 priv->dirty_tx++;
1366 } 1370 }
1371
1372 netdev_completed_queue(priv->dev, pkts_compl, bytes_compl);
1373
1367 if (unlikely(netif_queue_stopped(priv->dev) && 1374 if (unlikely(netif_queue_stopped(priv->dev) &&
1368 stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv))) { 1375 stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv))) {
1369 netif_tx_lock(priv->dev); 1376 netif_tx_lock(priv->dev);
@@ -1418,6 +1425,7 @@ static void stmmac_tx_err(struct stmmac_priv *priv)
1418 (i == txsize - 1)); 1425 (i == txsize - 1));
1419 priv->dirty_tx = 0; 1426 priv->dirty_tx = 0;
1420 priv->cur_tx = 0; 1427 priv->cur_tx = 0;
1428 netdev_reset_queue(priv->dev);
1421 priv->hw->dma->start_tx(priv->ioaddr); 1429 priv->hw->dma->start_tx(priv->ioaddr);
1422 1430
1423 priv->dev->stats.tx_errors++; 1431 priv->dev->stats.tx_errors++;
@@ -2050,6 +2058,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
2050 if (!priv->hwts_tx_en) 2058 if (!priv->hwts_tx_en)
2051 skb_tx_timestamp(skb); 2059 skb_tx_timestamp(skb);
2052 2060
2061 netdev_sent_queue(dev, skb->len);
2053 priv->hw->dma->enable_dma_transmission(priv->ioaddr); 2062 priv->hw->dma->enable_dma_transmission(priv->ioaddr);
2054 2063
2055 spin_unlock(&priv->tx_lock); 2064 spin_unlock(&priv->tx_lock);