tsnep: Fix NAPI polling with budget 0

[ Upstream commit 46589db381 ]

According to the NAPI documentation networking/napi.rst, Rx specific
APIs like page pool and XDP cannot be used at all when budget is 0.
skb Tx processing should happen regardless of the budget.

Stop NAPI polling after Tx processing and skip Rx processing if budget
is 0.

Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Gerhard Engleder
2023-09-15 23:01:26 +02:00
committed by Greg Kroah-Hartman
parent 78ac1e7dec
commit 146ba159f5

View File

@@ -930,6 +930,10 @@ static int tsnep_poll(struct napi_struct *napi, int budget)
if (queue->tx)
complete = tsnep_tx_poll(queue->tx, budget);
/* handle case where we are called by netpoll with a budget of 0 */
if (unlikely(budget <= 0))
return budget;
if (queue->rx) {
done = tsnep_rx_poll(queue->rx, napi, budget);
if (done >= budget)