OpenCloudOS-Kernel/drivers/net/dsa
Vladimir Oltean 0b6d642510 net: dsa: mt7530: don't change PVC_EG_TAG when CPU port becomes VLAN-aware
Frank reports that in a mt7530 setup where some ports are standalone and
some are in a VLAN-aware bridge, 8021q uppers of the standalone ports
lose their VLAN tag on xmit, as seen by the link partner.

This seems to occur because once the other ports join the VLAN-aware
bridge, mt7530_port_vlan_filtering() also calls
mt7530_port_set_vlan_aware(ds, cpu_dp->index), and this affects the way
that the switch processes the traffic of the standalone port.

Relevant is the PVC_EG_TAG bit. The MT7530 documentation says about it:

EG_TAG: Incoming Port Egress Tag VLAN Attribution
0: disabled (system default)
1: consistent (keep the original ingress tag attribute)

My interpretation is that this setting applies on the ingress port, and
"disabled" is basically the normal behavior, where the egress tag format
of the packet (tagged or untagged) is decided by the VLAN table
(MT7530_VLAN_EGRESS_UNTAG or MT7530_VLAN_EGRESS_TAG).

But there is also an option of overriding the system default behavior,
and for the egress tagging format of packets to be decided not by the
VLAN table, but simply by copying the ingress tag format (if ingress was
tagged, egress is tagged; if ingress was untagged, egress is untagged;
aka "consistent). This is useful in 2 scenarios:

- VLAN-unaware bridge ports will always encounter a miss in the VLAN
  table. They should forward a packet as-is, though. So we use
  "consistent" there. See commit e045124e93 ("net: dsa: mt7530: fix
  tagged frames pass-through in VLAN-unaware mode").

- Traffic injected from the CPU port. The operating system is in god
  mode; if it wants a packet to exit as VLAN-tagged, it sends it as
  VLAN-tagged. Otherwise it sends it as VLAN-untagged*.

*This is true only if we don't consider the bridge TX forwarding offload
feature, which mt7530 doesn't support.

So for now, make the CPU port always stay in "consistent" mode to allow
software VLANs to be forwarded to their egress ports with the VLAN tag
intact, and not stripped.

Link: https://lore.kernel.org/netdev/trinity-e6294d28-636c-4c40-bb8b-b523521b00be-1674233135062@3c-app-gmx-bs36/
Fixes: e045124e93 ("net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode")
Reported-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230205140713.1609281-1-vladimir.oltean@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-02-07 11:42:04 +01:00
..
b53 net: dsa: modularize DSA_TAG_PROTO_NONE 2022-11-22 20:41:45 -08:00
hirschmann net: devlink: let the core report the driver name instead of the drivers 2022-11-30 21:49:38 -08:00
microchip net: dsa: microchip: fix probe of I2C-connected KSZ8563 2023-01-23 21:40:54 -08:00
mv88e6xxx net: dsa: mv88e6xxx: depend on PTP conditionally 2022-12-26 09:03:44 +00:00
ocelot net: mscc: ocelot: remove redundant stats_layout pointers 2022-11-22 15:36:43 +01:00
qca net: dsa: qca8k: improve mdio master read/write by using single lo/hi 2023-01-01 09:27:12 +00:00
realtek net: dsa: realtek: remove unnecessary set_drvdata() 2022-09-22 19:30:39 -07:00
sja1105 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-12-08 18:19:59 -08:00
xrs700x net: dsa: xrs700x: Convert to i2c's .probe_new() 2022-11-23 12:50:06 -08:00
Kconfig net: dsa: mt7530: fix tristate and help description 2023-01-27 22:33:49 -08:00
Makefile net: dsa: qca8k: move driver to qca dir 2022-07-15 11:57:13 +01:00
bcm_sf2.c net: dsa: bcm_sf2: remove unnecessary platform_set_drvdata() 2022-09-22 19:30:35 -07:00
bcm_sf2.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
bcm_sf2_cfp.c net: dsa: introduce dsa_port_get_master() 2022-09-20 10:32:35 +02:00
bcm_sf2_regs.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
dsa_loop.c net: dsa: Fix possible memory leaks in dsa_loop_init() 2022-10-28 10:32:59 +01:00
dsa_loop.h
dsa_loop_bdinfo.c
lan9303-core.c net: lan9303: Fix read error execution path 2022-12-12 12:53:56 -08:00
lan9303.h net: dsa: be compatible with masters which unregister on shutdown 2021-09-19 12:08:37 +01:00
lan9303_i2c.c net: dsa: lan9303: Convert to i2c's .probe_new() 2022-11-23 12:50:05 -08:00
lan9303_mdio.c net: dsa: lan9303: remove unnecessary dev_set_drvdata() 2022-09-22 19:30:36 -07:00
lantiq_gswip.c net: dsa: lantiq_gswip: remove unnecessary platform_set_drvdata() 2022-09-22 19:30:36 -07:00
lantiq_pce.h
mt7530.c net: dsa: mt7530: don't change PVC_EG_TAG when CPU port becomes VLAN-aware 2023-02-07 11:42:04 +01:00
mt7530.h net: dsa: mt7530: add support for in-band link status 2022-09-23 11:58:37 +01:00
mv88e6060.c net: dsa: mv88e6060: remove unnecessary dev_set_drvdata() 2022-09-22 19:30:37 -07:00
mv88e6060.h
rzn1_a5psw.c net: dsa: rzn1-a5psw: remove unnecessary platform_set_drvdata() 2022-09-22 19:30:39 -07:00
rzn1_a5psw.h net: dsa: rzn1-a5psw: add FDB support 2022-06-27 11:37:55 +01:00
vitesse-vsc73xx-core.c net: dsa: vsc73xxx: Get rid of duplicate of_node assignment 2021-12-03 14:13:02 +00:00
vitesse-vsc73xx-platform.c net: dsa: vitesse-vsc73xx: remove unnecessary set_drvdata() 2022-09-22 19:30:39 -07:00
vitesse-vsc73xx-spi.c net: dsa: vitesse-vsc73xx: remove unnecessary set_drvdata() 2022-09-22 19:30:39 -07:00
vitesse-vsc73xx.h net: dsa: vsc73xxx: Make vsc73xx_remove() return void 2021-11-15 13:15:07 +00:00