WSL2-Linux-Kernel/drivers
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
..
accessibility
acpi ACPI: processor: Fix build when CONFIG_ACPI_PROCESSOR=m 2021-04-07 19:02:43 +02:00
amba
android
ata
atm atm: idt77252: remove unused function 2021-04-14 13:52:59 -07:00
auxdisplay auxdisplay: Remove in_interrupt() usage. 2021-03-16 16:32:40 +01:00
base Driver core fix for 5.12-rc6 2021-04-03 10:14:47 -07:00
bcma
block block-5.12-2021-04-02 2021-04-02 16:13:13 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
bus ARM: mvebu: avoid clang -Wtautological-constant warning 2021-04-01 16:32:38 +02:00
cdrom
char parisc: parisc-agp requires SBA IOMMU driver 2021-04-06 11:46:39 +02:00
clk clk: qcom: gcc-sc7180: Use floor ops for the correct sdcc1 clk 2021-03-13 13:00:05 -08:00
clocksource
connector
counter
cpufreq cpufreq: Fix scaling_{available,boost}_frequencies_show() comments 2021-03-26 17:43:48 +01:00
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon extcon: Fix error handling in extcon_dev_register 2021-03-15 11:09:38 +09:00
firewire firewire: nosy: Fix a use-after-free bug in nosy_ioctl() 2021-04-04 14:05:45 -07:00
firmware Another couple of EFI fixes for v5.12-rc: 2021-03-19 14:23:46 +01:00
fpga
fsi
gnss
gpio gpiolib: Assign fwnode to parent's if no primary one provided 2021-03-16 10:18:08 +01:00
gpu - Fix invalid access to ACPI _DSM objects (Takashi) 2021-04-10 05:18:35 +10:00
greybus
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
ide
idle
iio First set of IIO and counter fixes for the 5.12 cycle 2021-03-15 16:34:39 +01:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
input module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
interconnect interconnect: Fix kerneldoc warning 2021-03-18 23:46:21 +02:00
iommu iommu/tegra-smmu: Make tegra_smmu_probe_device() to handle all IOMMU phandles 2021-03-18 11:31:12 +01:00
ipack
irqchip
isdn mISDN: Use LIST_HEAD() for list_head 2021-03-30 13:34:42 -07:00
leds
lightnvm
macintosh
mailbox
mcb
md dm ioctl: fix out of bounds array access when no devices 2021-03-26 14:51:50 -04:00
media module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
memory
memstick
message
mfd mfd: intel_quark_i2c_gpio: Revert "Constify static struct resources" 2021-03-23 09:14:12 +00:00
misc mei: allow map and unmap of client dma buffer only for disconnected client 2021-03-23 15:15:15 +01:00
mmc
most
mtd module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
mux
net net: enetc: apply the MDIO workaround for XDP_REDIRECT too 2021-04-16 17:08:40 -07:00
nfc nfc: st-nci: remove unnecessary label 2021-04-13 14:50:57 -07:00
ntb
nubus
nvdimm
nvme nvmet-tcp: fix kmap leak when data digest in use 2021-03-18 05:39:18 +01:00
nvmem
of of: net: fix of_get_mac_addr_nvmem() for non-platform devices 2021-04-13 14:35:02 -07:00
opp opp: Don't drop extra references to OPPs accidentally 2021-03-12 09:26:52 +05:30
parisc
parport module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
pci Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux 2021-04-09 18:07:21 -07:00
pcmcia
perf perf/arm_dmc620_pmu: Fix error return code in dmc620_pmu_device_probe() 2021-03-12 11:30:31 +00:00
phy time64.h: Consolidated PSEC_PER_SEC definition 2021-04-06 16:32:17 -07:00
pinctrl intel-pinctrl for v5.12-3 2021-03-30 00:46:49 +02:00
platform platform/x86: intel-hid: Fix spurious wakeups caused by tablet-mode events during suspend 2021-04-06 22:10:21 +02:00
pnp
power
powercap
pps
ps3
ptp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-03-25 15:31:22 -07:00
pwm
rapidio
ras
regulator regulator: bd9571mwv: Convert device attribute to sysfs_emit() 2021-03-15 15:42:12 +00:00
remoteproc remoteproc: pru: Fix firmware loading crashes on K3 SoCs 2021-03-17 14:15:07 -05:00
reset
rpmsg
rtc
s390 mld: convert ifmcaddr6 to RCU 2021-03-26 15:14:56 -07:00
sbus module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-04-09 20:48:35 -07:00
sh module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
siox
slimbus
soc ARM SoC fixes for v5.12, part 2 2021-04-07 09:26:50 -07:00
soundwire
spi spi: cadence: set cqspi to the driver_data field of struct device 2021-03-11 13:32:32 +00:00
spmi
ssb
staging of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
target scsi: target: pscsi: Clean up after failure in pscsi_map_sg() 2021-03-24 23:19:23 -04:00
tc
tee module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
thermal thermal/core: Add NULL pointer check before using cooling device stats 2021-03-17 09:55:58 +01:00
thunderbolt
tty Serial driver fix for 5.12-rc6 2021-04-03 10:00:53 -07:00
uio
usb usb: dwc2: Prevent core suspend when port connection flag is 0 2021-03-26 14:51:34 +01:00
vdpa vdpa/mlx5: Fix suspend/resume index restoration 2021-04-09 12:08:28 -04:00
vfio vfio/nvlink: Add missing SPAPR_TCE_IOMMU depends 2021-03-29 14:48:00 -06:00
vhost virtio: fixes, cleanups 2021-03-18 11:20:35 -07:00
video hyperv-fixes for 5.12-rc6 2021-04-03 10:42:20 -07:00
virt
virtio virtio: fixes, cleanups 2021-03-18 11:20:35 -07:00
visorbus
vlynq
vme
w1
watchdog module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
xen xen: branch for v5.12-rc7 2021-04-09 09:58:42 -07:00
zorro
Kconfig
Makefile