[PATCH net v3] net: axienet: bound TX completion cleanup by the NAPI budget

Paolo Abeni pabeni at redhat.com
Tue Sep 29 06:21:59 PDT 2026


On 9/24/26 15:50, Sagi Maimon wrote:
> axienet_tx_poll() passes lp->tx_bd_num to axienet_free_tx_chain() as
> @nr_bds, and @budget is only forwarded to napi_consume_skb() as its
> bulk-free hint.  Nothing limits the cleanup loop to the NAPI budget, so
> the number of packets returned is bounded by the TX ring size rather
> than by the budget, and the poll can report more work than it was
> given:
> 
>    eth0: NAPI poll function axienet_tx_poll+0x0/0x180 [xilinx_emac]
>          returned 96, exceeding its budget of 64.
> 
> Returning more than the budget breaks the NAPI contract.  It also makes
> the "packets < budget" test in axienet_tx_poll() false, so
> napi_complete_done() is skipped and TX completion interrupts are not
> re-enabled on that pass.  NAPI reschedules the poll, so this recovers,
> but the accounting is wrong either way.
> 
> In steady state fewer descriptors complete per poll than the budget
> allows, which is why this is rarely observed.  Triggering it needs more
> than @budget completions outstanding at once - for example when TX
> completion interrupts have not been taken for a while and a full ring is
> reclaimed in one go.
> 
> Stop the loop once the budget is spent.  

Napi can process as much TX descriptor as available, even above `budget`
see:

https://elixir.bootlin.com/linux/v7.2.8/source/Documentation/networking/napi.rst#L68

The solution would be capping axienet_tx_poll() return value to `budget`.

/P




More information about the linux-arm-kernel mailing list