Skip to content

Commit 278a370

Browse files
ziweixiaokuba-moo
authored andcommitted
gve: Fixes for napi_poll when budget is 0
Netpoll will explicilty pass the polling call with a budget of 0 to indicate it's clearing the Tx path only. For the gve_rx_poll and gve_xdp_poll, they were mistakenly taking the 0 budget as the indication to do all the work. Add check to avoid the rx path and xdp path being called when budget is 0. And also avoid napi_complete_done being called when budget is 0 for netpoll. Fixes: f5cedc8 ("gve: Add transmit and receive support") Signed-off-by: Ziwei Xiao <ziweixiao@google.com> Link: https://lore.kernel.org/r/20231114004144.2022268-1-ziweixiao@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 67af0bd commit 278a370

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

drivers/net/ethernet/google/gve/gve_main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,13 @@ static int gve_napi_poll(struct napi_struct *napi, int budget)
254254
if (block->tx) {
255255
if (block->tx->q_num < priv->tx_cfg.num_queues)
256256
reschedule |= gve_tx_poll(block, budget);
257-
else
257+
else if (budget)
258258
reschedule |= gve_xdp_poll(block, budget);
259259
}
260260

261+
if (!budget)
262+
return 0;
263+
261264
if (block->rx) {
262265
work_done = gve_rx_poll(block, budget);
263266
reschedule |= work_done == budget;
@@ -298,6 +301,9 @@ static int gve_napi_poll_dqo(struct napi_struct *napi, int budget)
298301
if (block->tx)
299302
reschedule |= gve_tx_poll_dqo(block, /*do_clean=*/true);
300303

304+
if (!budget)
305+
return 0;
306+
301307
if (block->rx) {
302308
work_done = gve_rx_poll_dqo(block, budget);
303309
reschedule |= work_done == budget;

drivers/net/ethernet/google/gve/gve_rx.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,6 @@ int gve_rx_poll(struct gve_notify_block *block, int budget)
10071007

10081008
feat = block->napi.dev->features;
10091009

1010-
/* If budget is 0, do all the work */
1011-
if (budget == 0)
1012-
budget = INT_MAX;
1013-
10141010
if (budget > 0)
10151011
work_done = gve_clean_rx_done(rx, budget, feat);
10161012

drivers/net/ethernet/google/gve/gve_tx.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -925,10 +925,6 @@ bool gve_xdp_poll(struct gve_notify_block *block, int budget)
925925
bool repoll;
926926
u32 to_do;
927927

928-
/* If budget is 0, do all the work */
929-
if (budget == 0)
930-
budget = INT_MAX;
931-
932928
/* Find out how much work there is to be done */
933929
nic_done = gve_tx_load_event_counter(priv, tx);
934930
to_do = min_t(u32, (nic_done - tx->done), budget);

0 commit comments

Comments
 (0)