Skip to content

Commit

Permalink
net: airoha: Implement BQL support
Browse files Browse the repository at this point in the history
Introduce BQL support in the airoha_eth driver reporting to the kernel
info about tx hw DMA queues in order to avoid bufferbloat and keep the
latency small.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20241012-en7581-bql-v2-1-4deb4efdb60b@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Lorenzo Bianconi authored and Jakub Kicinski committed Oct 15, 2024
1 parent 57c28e9 commit 1d30417
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/ethernet/mediatek/airoha_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1709,9 +1709,11 @@ static int airoha_qdma_tx_napi_poll(struct napi_struct *napi, int budget)
WRITE_ONCE(desc->msg1, 0);

if (skb) {
u16 queue = skb_get_queue_mapping(skb);
struct netdev_queue *txq;

txq = netdev_get_tx_queue(skb->dev, qid);
txq = netdev_get_tx_queue(skb->dev, queue);
netdev_tx_completed_queue(txq, 1, skb->len);
if (netif_tx_queue_stopped(txq) &&
q->ndesc - q->queued >= q->free_thr)
netif_tx_wake_queue(txq);
Expand Down Expand Up @@ -2487,7 +2489,9 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
q->queued += i;

skb_tx_timestamp(skb);
if (!netdev_xmit_more())
netdev_tx_sent_queue(txq, skb->len);

if (netif_xmit_stopped(txq) || !netdev_xmit_more())
airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid),
TX_RING_CPU_IDX_MASK,
FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head));
Expand Down

0 comments on commit 1d30417

Please sign in to comment.