Skip to contentSkip to conversation

netif_receive_skb_list and interrupts enabled/disabled

DISCUSSION Heiner Kallweit 2 participants 3 messages Mar 26, 2019 – Mar 27, 2019

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

A question inspired by 0a25d92c6f4f ("dpaa2-eth: use netif_receive_skb_list"):
kerneldoc of netif_receive_skb_list states that interrupts should be enabled. When used from NAPI context irqs typically are disabled. And if the NAPI budget is fully consumed then interrupts don't get enabled in the same NAPI poll loop. How is this supposed to play together?

Thanks, Heiner

#1 lore raw
Quoted 3 lines · On Tue, 26 Mar 2019 21:04:09 +0100 Heiner Kallweit <[email protected]> wrote:

A question inspired by 0a25d92c6f4f ("dpaa2-eth: use netif_receive_skb_list"):
kerneldoc of netif_receive_skb_list states that interrupts should be enabled.

Do notice that the exact same comment (and rule) applies to netif_receive_skb() which also have below comment:

/* [...]
* This function may only be called from softirq context and interrupts
* should be enabled.
*/

Quoted 3 lines

When used from NAPI context irqs typically are disabled.
And if the NAPI budget is fully consumed then interrupts don't get enabled in the same NAPI poll loop. How is this supposed to play together?

You have misunderstood that is means that interrupts should be enabled. It is talking about local_irq_disable/enable and local_irq_save/restore. This is different from disabling the IRQs on a given NIC RX-queue.

Signature · 4 lines
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer
#2 lore raw
Quoted 15 lines · Jesper Dangaard Brouer
Quoted 3 lines · On Tue, 26 Mar 2019 21:04:09 +0100 Heiner Kallweit <[email protected]> wrote:

A question inspired by 0a25d92c6f4f ("dpaa2-eth: use netif_receive_skb_list"):
kerneldoc of netif_receive_skb_list states that interrupts should be enabled.

Do notice that the exact same comment (and rule) applies to netif_receive_skb() which also have below comment:

/* [...]
* This function may only be called from softirq context and interrupts
* should be enabled.
*/

Quoted 9 lines
Quoted 3 lines

When used from NAPI context irqs typically are disabled.
And if the NAPI budget is fully consumed then interrupts don't get enabled in the same NAPI poll loop. How is this supposed to play together?

You have misunderstood that is means that interrupts should be enabled. It is talking about local_irq_disable/enable and local_irq_save/restore. This is different from disabling the IRQs on a given NIC RX-queue.

Uh, you're right of course, my bad. One more question because this part of the network stack was beyond my horizon so far.
The referenced patch replaces a number of calls to napi_gro_receive() with a call to netif_receive_skb_list(). In a follow-up to this mail thread there was a remark "We should likely add a similar napi_gro_receive_list() function."
For my understanding: When is it safe to replace a number of napi_gro_receive() calls with netif_receive_skb_list() and when would we need the new napi_gro_receive_list()?