gve: Fixes for napi_poll when budget is 0
PATCH v2 1/1 gve: Fixes for napi_poll when budget is 0
Netpoll will explicitly 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.
The original fix was merged here:
https://lore.kernel.org/r/[email protected]
Resend it since the original one was not cleanly applied to 5.15 kernel.
commit 278a370c1766 ("gve: Fixes for napi_poll when budget is 0")
---
Changes in v2:
* Add the original git commit id
--- drivers/net/ethernet/google/gve/gve_main.c | 7 +++++++ drivers/net/ethernet/google/gve/gve_rx.c | 4 ---- drivers/net/ethernet/google/gve/gve_tx.c | 4 ---- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +7 -0
@@ -198,6 +198,10 @@ static int gve_napi_poll(struct napi_struct *napi, int budget)if (block->tx) reschedule |=gve_tx_poll (block, budget); + +if (!budget) +return 0 ; +if (block->rx) reschedule |=gve_rx_poll (block, budget);
@@ -246,6 +250,9 @@ static int gve_napi_poll_dqo(struct napi_struct *napi, int budget)if (block->tx) reschedule |=gve_tx_poll_dqo (block,/*do_clean=*/ true); +if (!budget) +return 0 ; +if (block->rx) { work_done =gve_rx_poll_dqo (block, budget); reschedule |= work_done == budget;
drivers/net/ethernet/google/gve/gve_rx.c +0 -4
@@ -599,10 +599,6 @@ bool gve_rx_poll(struct gve_notify_block *block, int budget) feat = block->napi.dev->features; -/* If budget is 0, do all the work */ -if (budget ==0 ) - budget =INT_MAX ; -if (budget >0 ) repoll |=gve_clean_rx_done (rx, budget, feat);else
drivers/net/ethernet/google/gve/gve_tx.c +0 -4
@@ -691,10 +691,6 @@ bool gve_tx_poll(struct gve_notify_block *block, int budget)u32 nic_done;u32 to_do; -/* If budget is 0, do all the work */ -if (budget ==0 ) - budget =INT_MAX ; -/* Find out how much work there is to be done */ tx->last_nic_done =gve_tx_load_event_counter (priv, tx); nic_done =be32_to_cpu (tx->last_nic_done);
Signature · 1 line
2.47.0.338.g60cca15819-goog
Sasha Levin
maintainer[ Sasha's backport helper bot ]
Hi,
Found matching upstream commit: 278a370c1766060d2144d6cf0b06c101e1043b6d
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: ff33be9cecee)
6.1.y | Not found
5.15.y | Not found
Note: The patch differs from the upstream commit:
---
1: 278a370c17660 < -: ------------- gve: Fixes for napi_poll when budget is 0 -: ------------- > 1: e087e88ff8e6e gve: Fixes for napi_poll when budget is 0
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.15.y | Success | Success |
Greg KH
maintainerQuoted 13 lines · Ziwei Xiao
Netpoll will explicitly pass the polling call with a budget of 0 to indicate it's clearing the Tx path only. For the
gve_rx_pollandgve_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 avoidnapi_complete_donebeing called when budget is 0 for netpoll.The original fix was merged here:
https://lore.kernel.org/r/[email protected]
Resend it since the original one was not cleanly applied to 5.15 kernel.commit
278a370c1766("gve: Fixes fornapi_pollwhen budget is 0")
Quoted 7 lines
Fixes f5cedc84a30d ("gve: Add transmit and receive support")Signed-off-by Ziwei Xiao <[email protected]>Reviewed-by Praveen Kaligineedi <[email protected]>Signed-off-by Praveen Kaligineedi <[email protected]>---
Changes in v2:
* Add the original git commit id
In the future, please add it in a way that we can figure it out (see the hundreds of examples on the mailing list for how it is done.)
thanks,
greg k-h