]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tsnep: Fix NAPI polling with budget 0
authorGerhard Engleder <gerhard@engleder-embedded.com>
Fri, 15 Sep 2023 21:01:26 +0000 (23:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Oct 2023 12:56:57 +0000 (14:56 +0200)
[ Upstream commit 46589db3817bd8b523701274885984b5a5dda7d1 ]

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>
drivers/net/ethernet/engleder/tsnep_main.c

index 00436a6f785e84c3d7c582881516f10fb04a19b1..2be518db0427003ac41afe5a6e68589e2c9032bc 100644 (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)