Skip to content

Commit 407e0ef

Browse files
edumazetkuba-moo
authored andcommitted
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: c2d548c ("idpf: add TX splitq napi poll support") Reported-by: Peter Newman <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/T/#u Signed-off-by: Eric Dumazet <[email protected]> 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]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d83ec0b commit 407e0ef

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/net/ethernet/intel/idpf/idpf_txrx.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4025,6 +4025,14 @@ static int idpf_vport_splitq_napi_poll(struct napi_struct *napi, int budget)
40254025
return budget;
40264026
}
40274027

4028+
/* Switch to poll mode in the tear-down path after sending disable
4029+
* queues virtchnl message, as the interrupts will be disabled after
4030+
* that.
4031+
*/
4032+
if (unlikely(q_vector->num_txq && idpf_queue_has(POLL_MODE,
4033+
q_vector->tx[0])))
4034+
return budget;
4035+
40284036
work_done = min_t(int, work_done, budget - 1);
40294037

40304038
/* 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)
40354043
else
40364044
idpf_vport_intr_set_wb_on_itr(q_vector);
40374045

4038-
/* Switch to poll mode in the tear-down path after sending disable
4039-
* queues virtchnl message, as the interrupts will be disabled after
4040-
* that
4041-
*/
4042-
if (unlikely(q_vector->num_txq && idpf_queue_has(POLL_MODE,
4043-
q_vector->tx[0])))
4044-
return budget;
4045-
else
4046-
return work_done;
4046+
return work_done;
40474047
}
40484048

40494049
/**

0 commit comments

Comments
 (0)