mirror_ubuntu-kernels/drivers/net
Vladimir Oltean 24e3930971 net: enetc: apply the MDIO workaround for XDP_REDIRECT too
Described in fd5736bf9f ("enetc: Workaround for MDIO register access
issue") is a workaround for a hardware bug that requires a register
access of the MDIO controller to never happen concurrently with a
register access of a port PF. To avoid that, a mutual exclusion scheme
with rwlocks was implemented - the port PF accessors are the 'read'
side, and the MDIO accessors are the 'write' side.

When we do XDP_REDIRECT between two ENETC interfaces, all is fine
because the MDIO lock is already taken from the NAPI poll loop.

But when the ingress interface is not ENETC, just the egress is, the
MDIO lock is not taken, so we might access the port PF registers
concurrently with MDIO, which will make the link flap due to wrong
values returned from the PHY.

To avoid this, let's just slap an enetc_lock_mdio/enetc_unlock_mdio at
the beginning and ending of enetc_xdp_xmit. The fact that the MDIO lock
is designed as a rwlock is important here, because the read side is
reentrant (that is one of the main reasons why we chose it). Usually,
the way we benefit of its reentrancy is by running the data path
concurrently on both CPUs, but in this case, we benefit from the
reentrancy by taking the lock even when the lock is already taken
(and that's the situation where ENETC is both the ingress and the egress
interface for XDP_REDIRECT, which was fine before and still is fine now).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-04-16 17:08:40 -07:00
..
appletalk
arcnet
bonding net: bonding: remove repeated word 2021-03-30 16:56:39 -07:00
caif
can can: etas_es58x: fix null pointer dereference when handling error frames 2021-04-14 09:32:12 +02:00
dsa net: dsa: mt7530: Add support for EEE features 2021-04-13 14:28:08 -07:00
ethernet net: enetc: apply the MDIO workaround for XDP_REDIRECT too 2021-04-16 17:08:40 -07:00
fddi
fjes
hamradio
hippi
hyperv net: remove the new_ifindex argument from dev_change_net_namespace 2021-04-07 14:43:28 -07:00
ieee802154 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
ipa net: ipa: optionally define firmware name via DT 2021-04-16 15:38:32 -07:00
ipvlan
mdio net: mdio: Remove redundant dev_err call in mdio_mux_iproc_probe() 2021-03-29 13:16:44 -07:00
mhi net: mhi: remove pointless conditional before kfree_skb() 2021-03-30 13:47:28 -07:00
netdevsim netdevsim: remove unneeded semicolon 2021-04-06 16:27:33 -07:00
pcs
phy net: phy: at803x: select correct page on config init 2021-04-15 16:49:32 -07:00
plip
ppp ppp: deflate: Remove useless call "zlib_inflateEnd" 2021-03-30 16:59:30 -07:00
slip
team
usb r8152: search the configuration of vendor mode 2021-04-16 15:28:31 -07:00
vmxnet3
wan Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
wireguard
wireless rsi: remove unused including <linux/version.h> 2021-04-13 14:51:41 -07:00
wwan net: Add Qcom WWAN control driver 2021-04-16 15:31:02 -07:00
xen-netback
bareudp.c bareudp: allow UDP L4 GRO passthrou 2021-03-30 17:06:50 -07:00
dummy.c
eql.c
geneve.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
gtp.c
ifb.c
Kconfig net: Add a WWAN subsystem 2021-04-16 15:31:02 -07:00
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile net: Add a WWAN subsystem 2021-04-16 15:31:02 -07:00
mdio.c net: mdio: Correct function name mdio45_links_ok() in comment 2021-03-29 13:42:44 -07:00
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c net: Space: remove hp100 probe 2021-04-13 15:13:13 -07:00
sungem_phy.c
tap.c
thunderbolt.c
tun.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
veth.c veth: check for NAPI instead of xdp_prog before xmit of XDP frame 2021-04-16 15:42:07 -07:00
virtio_net.c virtio-net: page_to_skb() use build_skb when there's sufficient tailroom 2021-04-16 15:33:22 -07:00
vrf.c
vsockmon.c
vxlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
xen-netfront.c