The frames dropped on a TX error are never returned to BQL. Each error
shrinks the BQL budget for good until the queue stops with an empty
ring.
netdev_tx_reset_queue() is not safe here as the task runs without
tx_ptr_lock, so macb_start_xmit() may still be queueing.
Fixes: e6a532185daa ("net: cadence: macb: Implement BQL")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/ethernet/cadence/macb_main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index f087f278f9e56..b6105f915fe35 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1412,10 +1412,8 @@ static void macb_tx_error_task(struct work_struct *work)
skb->data);
bp->netdev->stats.tx_packets++;
queue->stats.tx_packets++;
- packets++;
bp->netdev->stats.tx_bytes += skb->len - tx_skb->fcs_len;
queue->stats.tx_bytes += skb->len - tx_skb->fcs_len;
- bytes += skb->len;
}
} else {
/* "Buffers exhausted mid-frame" errors may only happen@@ -1428,6 +1426,12 @@ static void macb_tx_error_task(struct work_struct *work)
desc->ctrl = ctrl | MACB_BIT(TX_USED);
}
+ /* BQL has to see every frame leaving the ring, sent or not */
+ if (skb) {
+ packets++;
+ bytes += skb->len;
+ }
+
macb_tx_unmap(&bp->info, tx_skb, 0);
}
--
2.53.0