Re: [RFC PATCH net-next 08/13] net: dsa: sja1105: Add support for VLAN operations
From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2019-03-26 02:41:52
On 3/23/2019 8:23 PM, Vladimir Oltean wrote:
VLAN filtering cannot be properly disabled in SJA1105. So in order to emulate the "no VLAN awareness" behavior (not dropping traffic that is tagged with a VID that isn't configured on the port), we need to hack another switch feature: programmable TPID (which is 0x8100 for 802.1Q). We are reprogramming the TPID to a bogus value (ETH_P_EDSA) which leaves the switch thinking that all traffic is untagged, and therefore accepts it. Under a vlan_filtering bridge, the proper TPID of ETH_P_8021Q is installed again, and the switch starts identifying 802.1Q-tagged traffic. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> ---
[snip]
+ for (i = 0; i < SJA1105_NUM_PORTS; i++) {
+ struct net_device *bridge_dev;
+
+ bridge_dev = dsa_to_port(ds, i)->bridge_dev;
+ if (bridge_dev &&
+ bridge_dev != dsa_to_port(ds, port)->bridge_dev &&
+ br_vlan_enabled(bridge_dev) != enabled) {
+ netdev_err(bridge_dev,
+ "VLAN filtering is global to the switch!\n");
+ return -EINVAL;
+ }We might want to move this to the DSA core at some point, I had some patches lying around for doing that but got side tracked with adding management support for b53/bcm_sf2. Not a big problem for now. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -- Florian