mirror_ubuntu-kernels/drivers/net
Sebastian Andrzej Siewior baebdf48c3 net: dev: Makes sure netif_rx() can be invoked in any context.
Dave suggested a while ago (eleven years by now) "Let's make netif_rx()
work in all contexts and get rid of netif_rx_ni()". Eric agreed and
pointed out that modern devices should use netif_receive_skb() to avoid
the overhead.
In the meantime someone added another variant, netif_rx_any_context(),
which behaves as suggested.

netif_rx() must be invoked with disabled bottom halves to ensure that
pending softirqs, which were raised within the function, are handled.
netif_rx_ni() can be invoked only from process context (bottom halves
must be enabled) because the function handles pending softirqs without
checking if bottom halves were disabled or not.
netif_rx_any_context() invokes on the former functions by checking
in_interrupts().

netif_rx() could be taught to handle both cases (disabled and enabled
bottom halves) by simply disabling bottom halves while invoking
netif_rx_internal(). The local_bh_enable() invocation will then invoke
pending softirqs only if the BH-disable counter drops to zero.

Eric is concerned about the overhead of BH-disable+enable especially in
regard to the loopback driver. As critical as this driver is, it will
receive a shortcut to avoid the additional overhead which is not needed.

Add a local_bh_disable() section in netif_rx() to ensure softirqs are
handled if needed.
Provide __netif_rx() which does not disable BH and has a lockdep assert
to ensure that interrupts are disabled. Use this shortcut in the
loopback driver and in drivers/net/*.c.
Make netif_rx_ni() and netif_rx_any_context() invoke netif_rx() so they
can be removed once they are no more users left.

Link: https://lkml.kernel.org/r/20100415.020246.218622820.davem@davemloft.net
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-14 13:38:35 +00:00
..
appletalk net: Don't include filter.h from net/sock.h 2021-12-29 08:48:14 -08:00
arcnet
bonding Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-10 17:29:56 -08:00
caif virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
can can: flexcan: mark RX via mailboxes as supported on MCF5441X 2022-01-24 18:27:43 +01:00
dsa dsa: mv88e6xxx: make serdes SGMII/Fiber tx amplitude configurable 2022-02-11 11:21:34 +00:00
ethernet ice: Simplify tracking status of RDMA support 2022-02-14 13:35:12 +00:00
fddi net:Remove initialization of static variables to 0 2021-12-27 14:53:00 +00:00
fjes drivers: net: Replace acpi_bus_get_device() 2022-02-02 08:05:06 -08:00
hamradio yam: fix a memory leak in yam_siocdevprivate() 2022-01-25 11:04:55 +00:00
hippi
hyperv Netvsc: Call hv_unmap_memory() in the netvsc_device_remove() 2022-02-09 11:54:05 +00:00
ieee802154 Merge tag 'ieee802154-for-davem-2022-02-10' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan-next 2022-02-10 14:28:04 +00:00
ipa net: ipa: determine replenish doorbell differently 2022-02-04 10:16:08 +00:00
ipvlan
mctp
mdio Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-10 17:29:56 -08:00
netdevsim
pcs net: stmmac/xpcs: convert to pcs_validate() 2022-01-26 11:20:37 +00:00
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-10 17:29:56 -08:00
plip
ppp TTY/Serial driver updates for 5.17-rc1 2022-01-12 11:21:52 -08:00
slip
team
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-10 17:29:56 -08:00
vmxnet3 vmxnet3: Remove useless DMA-32 fallback configuration 2022-01-09 16:52:19 -08:00
wan net: wan/lmc: fix spelling of "its" 2021-12-24 10:23:47 +00:00
wireguard lib/crypto: blake2s: move hmac construction into wireguard 2022-01-18 13:03:55 +01:00
wireless mt76 patches for 5.18 2022-02-10 16:36:03 +02:00
wwan net: wwan: iosm: Enable M.2 7360 WWAN card support 2022-02-13 11:55:28 +00:00
xen-netback
amt.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
bareudp.c
dummy.c
eql.c
geneve.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
gtp.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
ifb.c
Kconfig lib/crypto: blake2s: include as built-in 2022-01-07 00:25:25 +01:00
LICENSE.SRC
loopback.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
macsec.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
macvlan.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
macvtap.c
Makefile
mdio.c
mhi_net.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
rionet.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
sb1000.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-12-31 14:35:40 +00:00
veth.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
virtio_net.c bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
vrf.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
vsockmon.c
vxlan.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
xen-netfront.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-12-31 14:35:40 +00:00