OpenCloudOS-Kernel/drivers
Vladimir Oltean f964f8399d net: mscc: ocelot: fix VCAP filters not matching on MAC with "protocol 802.1Q"
Alternative short title: don't instruct the hardware to match on
EtherType with "protocol 802.1Q" flower filters. It doesn't work for the
reasons detailed below.

With a command such as the following:

tc filter add dev $swp1 ingress chain $(IS1 2) pref 3 \
	protocol 802.1Q flower skip_sw vlan_id 200 src_mac $h1_mac \
	action vlan modify id 300 \
	action goto chain $(IS2 0 0)

the created filter is set by ocelot_flower_parse_key() to be of type
OCELOT_VCAP_KEY_ETYPE, and etype is set to {value=0x8100, mask=0xffff}.
This gets propagated all the way to is1_entry_set() which commits it to
hardware (the VCAP_IS1_HK_ETYPE field of the key). Compare this to the
case where src_mac isn't specified - the key type is OCELOT_VCAP_KEY_ANY,
and is1_entry_set() doesn't populate VCAP_IS1_HK_ETYPE.

The problem is that for VLAN-tagged frames, the hardware interprets the
ETYPE field as holding the encapsulated VLAN protocol. So the above
filter will only match those packets which have an encapsulated protocol
of 0x8100, rather than all packets with VLAN ID 200 and the given src_mac.

The reason why this is allowed to occur is because, although we have a
block of code in ocelot_flower_parse_key() which sets "match_protocol"
to false when VLAN keys are present, that code executes too late.
There is another block of code, which executes for Ethernet addresses,
and has a "goto finished_key_parsing" and skips the VLAN header parsing.
By skipping it, "match_protocol" remains with the value it was
initialized with, i.e. "true", and "proto" is set to f->common.protocol,
or 0x8100.

The concept of ignoring some keys rather than erroring out when they are
present but can't be offloaded is dubious in itself, but is present
since the initial commit fe3490e610 ("net: mscc: ocelot: Hardware
ofload for tc flower filter"), and it's outside of the scope of this
patch to change that.

The problem was introduced when the driver started to interpret the
flower filter's protocol, and populate the VCAP filter's ETYPE field
based on it.

To fix this, it is sufficient to move the code that parses the VLAN keys
earlier than the "goto finished_key_parsing" instruction. This will
ensure that if we have a flower filter with both VLAN and Ethernet
address keys, it won't match on ETYPE 0x8100, because the VLAN key
parsing sets "match_protocol = false".

Fixes: 86b956de11 ("net: mscc: ocelot: support matching on EtherType")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230205192409.1796428-1-vladimir.oltean@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-02-07 12:20:21 +01:00
..
accel Fix mismerge due to devnode now taking a 'const *' device 2022-12-16 13:04:15 -06:00
accessibility tty: fix possible null-ptr-defer in spk_ttyio_release 2023-01-19 16:24:04 +01:00
acpi - Start checking for -mindirect-branch-cs-prefix clang support too now that LLVM 2023-01-29 11:17:34 -08:00
amba ARM updates for 6.2 2022-12-13 15:22:14 -08:00
android
ata ata: pata_cs5535: Don't build on UML 2023-01-14 07:38:48 +09:00
atm treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
auxdisplay
base driver core: Fix test_async_probe_init saves device in wrong array 2023-01-19 17:27:36 +01:00
bcma
block block-6.2-2023-01-27 2023-01-27 16:16:57 -08:00
bluetooth Bluetooth: hci_qca: Fix driver shutdown on closed serdev 2023-01-17 15:59:02 -08:00
bus bus: sunxi-rsb: Fix error handling in sunxi_rsb_init() 2023-01-08 21:35:01 +01:00
cdrom
char xen: branch for v6.2-rc4 2023-01-12 17:02:20 -06:00
clk A pile of clk driver updates with a small tracepoint patch to the clk core this 2022-12-13 13:46:07 -08:00
clocksource Updates for timers, timekeeping and drivers: 2022-12-12 12:52:02 -08:00
comedi comedi: adv_pci1760: Fix PWM instruction handling 2023-01-19 17:24:47 +01:00
connector
counter counter: stm32-lptimer-cnt: fix the check on arr and cmp registers update 2022-11-26 16:49:28 -05:00
cpufreq cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering 2023-01-10 20:31:08 +01:00
cpuidle powerpc updates for 6.2 2022-12-19 07:13:33 -06:00
crypto MTD changes: 2023-01-12 05:56:06 -06:00
cxl cxl/pmem: Fix nvdimm unregistration when cxl_pmem driver is absent 2023-01-25 15:35:26 -08:00
dax
dca
devfreq PM / devfreq: event: use devm_platform_get_and_ioremap_resource() 2022-12-05 21:57:20 +09:00
dio
dma ptdma: pt_core_execute_cmd() should use spinlock 2023-01-19 18:59:34 +05:30
dma-buf Merge drm/drm-fixes into drm-misc-fixes 2023-01-03 08:32:12 +01:00
edac EDAC/qcom: Do not pass llcc_driv_data as edac_device_ctl_info's pvt_info 2023-01-20 19:47:34 +01:00
eisa
extcon Char/Misc driver changes for 6.2-rc1 2022-12-16 03:49:24 -08:00
firewire firewire: fix memory leak for payload of request subaction to IEC 61883-1 FCP region 2023-01-17 18:09:21 +01:00
firmware Char/Misc driver fixes for 6.2-rc5 2023-01-21 11:20:55 -08:00
fpga Char/Misc driver changes for 6.2-rc1 2022-12-16 03:49:24 -08:00
fsi use less confusing names for iov_iter direction initializers 2022-11-25 13:01:55 -05:00
gnss
gpio gpio: ep93xx: remove unused variable 2023-01-27 14:05:38 +01:00
gpu sound fixes for 6.2-rc7 2023-02-01 10:26:23 -08:00
greybus
hid for-linus-2023011801 2023-01-18 14:44:32 -08:00
hsi
hte
hv Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
hwmon hwmon updates for v6.2 merge window 2022-12-13 13:09:38 -08:00
hwspinlock
hwtracing coresight: etm4x: fix repeated words in comments 2022-11-28 18:29:53 +00:00
i2c i2c: rk3x: fix a bunch of kernel-doc warnings 2023-01-20 10:18:51 +01:00
i3c i3c: export SETDASA method 2022-12-11 21:25:58 +01:00
idle
iio Char/Misc driver changes for 6.2-rc1 2022-12-16 03:49:24 -08:00
infiniband IB/hfi1: Remove user expected buffer invalidate race 2023-01-10 12:21:50 +02:00
input Input updates for v6.2-rc5 2023-01-29 11:06:47 -08:00
interconnect interconnect: qcom: rpm: Use _optional func for provider clocks 2023-01-05 17:29:57 +02:00
iommu iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe() 2023-01-13 13:46:32 +01:00
ipack
irqchip RISC-V Patches for the 6.2 Merge Window, Part 1 2022-12-14 15:23:49 -08:00
isdn treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
leds treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
macintosh
mailbox - qcom: enable sc8280xp, sm8550 and sm4250 support 2022-12-21 09:31:18 -08:00
mcb mcb: mcb-parse: fix error handing in chameleon_parse_gdd() 2022-12-02 17:48:04 +01:00
md hardening fixes for v6.2-rc6 2023-01-27 16:09:12 -08:00
media media: videobuf2: set q->streaming later 2023-01-24 16:34:06 +01:00
memory memory: mvebu-devbus: Fix missing clk_disable_unprepare in mvebu_devbus_probe() 2022-12-27 09:54:32 +01:00
memstick memstick/mspro_block: Convert to use sysfs_emit()/sysfs_emit_at() APIs 2022-12-09 10:29:58 +01:00
message
mfd - New Drivers 2022-12-21 09:19:24 -08:00
misc VMCI: Use threaded irqs instead of tasklets 2023-01-20 13:24:11 +01:00
mmc mmc: sunxi-mmc: Fix clock refcount imbalance during unbind 2023-01-02 15:57:36 +01:00
most
mtd mtd: cfi: allow building spi-intel standalone 2023-01-02 12:08:53 +01:00
mux
net net: mscc: ocelot: fix VCAP filters not matching on MAC with "protocol 802.1Q" 2023-02-07 12:20:21 +01:00
nfc nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame() 2023-01-09 07:34:13 +00:00
ntb
nubus
nvdimm nvdimm/region: Move cache management to the region driver 2022-12-02 23:52:32 -08:00
nvme block-6.2-2023-01-27 2023-01-27 16:16:57 -08:00
nvmem Char/Misc driver changes for 6.2-rc1 2022-12-16 03:49:24 -08:00
of of: fdt: Honor CONFIG_CMDLINE* even without /chosen node, take 2 2023-01-04 21:31:59 -06:00
opp
parisc parisc: led: Fix potential null-ptr-deref in start_task() 2022-12-17 23:19:38 +01:00
parport
pci pci-v6.2-fixes-1 2023-01-13 17:32:22 -06:00
pcmcia treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
peci
perf Partially revert "perf/arm-cmn: Optimise DTC counter accesses" 2023-01-26 13:55:38 +00:00
phy phy: phy-can-transceiver: Skip warning if no "max-bitrate" 2023-01-18 22:58:05 +05:30
pinctrl pinctrl: rockchip: fix mux route data for rk3568 2023-01-17 14:16:45 +01:00
platform platform/x86: touchscreen_dmi: Add Chuwi Vi8 (CWI501) DMI match 2023-02-02 11:34:38 +01:00
pnp PNP: Do not disable devices on suspend when they cannot be re-enabled on resume 2022-11-25 19:36:52 +01:00
power power supply and reset changes for the v6.2 series 2022-12-17 08:39:31 -06:00
powercap powercap: idle_inject: Fix warnings with make W=1 2022-12-02 20:49:49 +01:00
pps
ps3
ptp Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
pwm pwm: Changes for v6.2-rc1 2022-12-21 09:41:28 -08:00
rapidio rapidio: devices: fix missing put_device in mport_cdev_open 2022-12-11 19:30:20 -08:00
ras
regulator regulator: qcom-rpmh: PM8550 ldo11 regulator is an nldo 2023-01-03 15:54:38 +00:00
remoteproc remoteproc: core: Do pm_relax when in RPROC_OFFLINE state 2022-12-07 11:20:55 -07:00
reset reset: uniphier-glue: Fix possible null-ptr-deref 2023-01-03 11:30:46 +01:00
rpmsg
rtc - New Drivers 2022-12-21 09:19:24 -08:00
s390 block-2023-01-06 2023-01-06 13:12:42 -08:00
sbus
scsi SCSI fixes on 20230131 2023-01-31 11:39:08 -08:00
sh
siox
slimbus
soc Qualcomm driver fixes for v6.2 2023-01-10 23:09:09 +01:00
soundwire soundwire updates for 6.2 2022-12-19 08:47:33 -06:00
spi spi: Merge rename of spi-cs-setup-ns DT property 2023-01-11 14:15:22 +00:00
spmi
ssb
staging staging: vchiq_arm: fix enum vchiq_status return types 2023-01-17 19:23:36 +01:00
target scsi: target: core: Fix warning on RT kernels 2023-01-13 20:24:24 -05:00
tc
tee SoC driver updates for 6.2 2022-12-12 10:17:08 -08:00
thermal thermal: intel: int340x: Add locking to int340x_thermal_get_trip_type() 2023-01-25 15:37:21 +01:00
thunderbolt thunderbolt: Disable XDomain lane 1 only in software connection manager 2023-01-09 10:44:43 +02:00
tty TTY/Serial driver fixes for 6.2-rc5 2023-01-21 11:12:42 -08:00
ufs scsi: ufs: core: Fix devfreq deadlocks 2023-01-18 19:08:37 -05:00
uio
usb USB / Thunderbolt fixes for 6.2-rc5 2023-01-21 11:10:03 -08:00
vdpa vdpa: ifcvf: Do proper cleanup if IFCVF init fails 2023-01-27 06:18:41 -05:00
vfio vfio/type1: Respect IOMMU reserved regions in vfio_test_domain_fgsp() 2023-01-10 10:44:37 -07:00
vhost vhost-scsi: unbreak any layout for response 2023-01-27 06:18:41 -05:00
video xen: branch for v6.2-rc4 2023-01-12 17:02:20 -06:00
virt Char/Misc driver changes for 6.2-rc1 2022-12-16 03:49:24 -08:00
virtio virtio: Implementing attribute show with sysfs_emit 2022-12-28 05:28:11 -05:00
vlynq
w1 w1: fix WARNING after calling w1_process() 2023-01-19 17:26:33 +01:00
watchdog watchdog: diag288_wdt: fix __diag288() inline assembly 2023-01-30 14:40:50 +01:00
xen xen: branch for v6.2-rc4 2023-01-12 17:02:20 -06:00
zorro
Kconfig
Makefile