Skip to content

Commit d1978d0

Browse files
Suraj GuptaPaolo Abeni
authored andcommitted
net: xilinx: axienet: Fix BQL accounting for multi-BD TX packets
When a TX packet spans multiple buffer descriptors (scatter-gather), axienet_free_tx_chain sums the per-BD actual length from descriptor status into a caller-provided accumulator. That sum is reset on each NAPI poll. If the BDs for a single packet complete across different polls, the earlier bytes are lost and never credited to BQL. This causes BQL to think bytes are permanently in-flight, eventually stalling the TX queue. The SKB pointer is stored only on the last BD of a packet. When that BD completes, use skb->len for the byte count instead of summing per-BD status lengths. This matches netdev_sent_queue(), which debits skb->len, and naturally survives across polls because no partial packet contributes to the accumulator. Fixes: c900e49 ("net: xilinx: axienet: Implement BQL") Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com> Reviewed-by: Sean Anderson <sean.anderson@linux.dev> Link: https://patch.msgid.link/20260327073238.134948-3-suraj.gupta2@amd.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 393e0b4 commit d1978d0

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,8 @@ static int axienet_device_reset(struct net_device *ndev)
770770
* @first_bd: Index of first descriptor to clean up
771771
* @nr_bds: Max number of descriptors to clean up
772772
* @force: Whether to clean descriptors even if not complete
773-
* @sizep: Pointer to a u32 filled with the total sum of all bytes
774-
* in all cleaned-up descriptors. Ignored if NULL.
773+
* @sizep: Pointer to a u32 accumulating the total byte count of
774+
* completed packets (using skb->len). Ignored if NULL.
775775
* @budget: NAPI budget (use 0 when not called from NAPI poll)
776776
*
777777
* Would either be called after a successful transmit operation, or after
@@ -805,6 +805,8 @@ static int axienet_free_tx_chain(struct axienet_local *lp, u32 first_bd,
805805
DMA_TO_DEVICE);
806806

807807
if (cur_p->skb && (status & XAXIDMA_BD_STS_COMPLETE_MASK)) {
808+
if (sizep)
809+
*sizep += cur_p->skb->len;
808810
napi_consume_skb(cur_p->skb, budget);
809811
packets++;
810812
}
@@ -818,9 +820,6 @@ static int axienet_free_tx_chain(struct axienet_local *lp, u32 first_bd,
818820
wmb();
819821
cur_p->cntrl = 0;
820822
cur_p->status = 0;
821-
822-
if (sizep)
823-
*sizep += status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK;
824823
}
825824

826825
if (!force) {

0 commit comments

Comments
 (0)