Skip to contentSkip to conversation

idpf: fix idpf_vport_splitq_napi_poll()

PATCH Applied Eric Dumazet 2 participants 2 messages May 20, 2025 – May 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 idpf: fix idpf_vport_splitq_napi_poll()

idpf_vport_splitq_napi_poll() can incorrectly return @budget after napi_complete_done() has been called.

This violates NAPI rules, because after napi_complete_done(), current thread lost napi ownership.

Move the test against POLL_MODE before the napi_complete_done().

Fixes c2d548cad150 ("idpf: add TX splitq napi poll support")
Cc Joshua Hay <[email protected]>
Cc Alan Brady <[email protected]>
Cc Madhu Chittim <[email protected]>
Cc Phani Burra <[email protected]>
Cc Pavan Kumar Linga <[email protected]>
---
 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +9 -9
index bdf52cef3891b8ff1d919b7024d42d024299215e..2d5f5c9f91ce1ef331e577848d91b0d130dcce8c 100644
@@ -4025,6 +4025,14 @@ static int idpf_vport_splitq_napi_poll(struct napi_struct *napi, int budget)
 		return budget;
 	}
 
+	/* Switch to poll mode in the tear-down path after sending disable
+	 * queues virtchnl message, as the interrupts will be disabled after
+	 * that.
+	 */
+	if (unlikely(q_vector->num_txq && idpf_queue_has(POLL_MODE,
+							 q_vector->tx[0])))
+		return budget;
+
 	work_done = min_t(int, work_done, budget - 1);
 
 	/* Exit the polling mode, but don't re-enable interrupts if stack might
@@ -4035,15 +4043,7 @@ static int idpf_vport_splitq_napi_poll(struct napi_struct *napi, int budget)
 	else
 		idpf_vport_intr_set_wb_on_itr(q_vector);
 
-	/* Switch to poll mode in the tear-down path after sending disable
-	 * queues virtchnl message, as the interrupts will be disabled after
-	 * that
-	 */
-	if (unlikely(q_vector->num_txq && idpf_queue_has(POLL_MODE,
-							 q_vector->tx[0])))
-		return budget;
-	else
-		return work_done;
+	return work_done;
 }
 
 /**
Signature · 1 line
2.49.0.1101.gccaa498523-goog
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 20 May 2025 12:40:30 +0000 you wrote:

idpf_vport_splitq_napi_poll() can incorrectly return @budget after napi_complete_done() has been called.

This violates NAPI rules, because after napi_complete_done(), current thread lost napi ownership.

Move the test against POLL_MODE before the napi_complete_done().

[...]

Here is the summary with links:
- [net] idpf: fix idpf_vport_splitq_napi_poll()

    https://git.kernel.org/netdev/net/c/407e0efdf8ba

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html