Skip to content

Commit

Permalink
tsnep: Fix NAPI polling with budget 0
Browse files Browse the repository at this point in the history
[ Upstream commit 46589db ]

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>
  • Loading branch information
Gerhard Engleder authored and gregkh committed Oct 6, 2023
1 parent 78ac1e7 commit 146ba15
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/engleder/tsnep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 146ba15

Please sign in to comment.