* [PATCH net v2] gve: Fixes for napi_poll when budget is 0
@ 2023-11-14 0:41 Ziwei Xiao
2023-11-15 4:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Ziwei Xiao @ 2023-11-14 0:41 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, edumazet, pabeni, stable, willemb, csully, shailend,
jeroendb, pkaligineedi, jonolson, sagis, lrizzo, bpf, ast, daniel,
hawk, john.fastabend, Ziwei Xiao
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: f5cedc84a30d ("gve: Add transmit and receive support")
Signed-off-by: Ziwei Xiao <ziweixiao@google.com>
---
Changes since v1:
- Adjust the logic of checking budget when it's 0
- Update the commit message based on the new change
- CCed the maintainers queried from get_maintainer.pl, but it outputs 19 lines which seems excessive
drivers/net/ethernet/google/gve/gve_main.c | 8 +++++++-
drivers/net/ethernet/google/gve/gve_rx.c | 4 ----
drivers/net/ethernet/google/gve/gve_tx.c | 4 ----
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 276f996f95dc..2d42e733837b 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -254,10 +254,13 @@ static int gve_napi_poll(struct napi_struct *napi, int budget)
if (block->tx) {
if (block->tx->q_num < priv->tx_cfg.num_queues)
reschedule |= gve_tx_poll(block, budget);
- else
+ else if (budget)
reschedule |= gve_xdp_poll(block, budget);
}
+ if (!budget)
+ return 0;
+
if (block->rx) {
work_done = gve_rx_poll(block, budget);
reschedule |= work_done == budget;
@@ -298,6 +301,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;
diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c
index e84a066aa1a4..73655347902d 100644
--- a/drivers/net/ethernet/google/gve/gve_rx.c
+++ b/drivers/net/ethernet/google/gve/gve_rx.c
@@ -1007,10 +1007,6 @@ int 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)
work_done = gve_clean_rx_done(rx, budget, feat);
diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c
index 6957a865cff3..9f6ffc4a54f0 100644
--- a/drivers/net/ethernet/google/gve/gve_tx.c
+++ b/drivers/net/ethernet/google/gve/gve_tx.c
@@ -925,10 +925,6 @@ bool gve_xdp_poll(struct gve_notify_block *block, int budget)
bool repoll;
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 */
nic_done = gve_tx_load_event_counter(priv, tx);
to_do = min_t(u32, (nic_done - tx->done), budget);
--
2.43.0.rc0.421.g78406f8d94-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net v2] gve: Fixes for napi_poll when budget is 0
2023-11-14 0:41 [PATCH net v2] gve: Fixes for napi_poll when budget is 0 Ziwei Xiao
@ 2023-11-15 4:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-11-15 4:10 UTC (permalink / raw)
To: Ziwei Xiao
Cc: netdev, davem, kuba, edumazet, pabeni, stable, willemb, csully,
shailend, jeroendb, pkaligineedi, jonolson, sagis, lrizzo, bpf,
ast, daniel, hawk, john.fastabend
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 13 Nov 2023 16:41:44 -0800 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net,v2] gve: Fixes for napi_poll when budget is 0
https://git.kernel.org/netdev/net/c/278a370c1766
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-15 4:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 0:41 [PATCH net v2] gve: Fixes for napi_poll when budget is 0 Ziwei Xiao
2023-11-15 4:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).