• Vladimir Oltean's avatar
    net: dsa: tag_8021q: replace the SVL bridging with VLAN-unaware IVL bridging · 91495f21
    Vladimir Oltean authored
    For VLAN-unaware bridging, tag_8021q uses something perhaps a bit too
    tied with the sja1105 switch: each port uses the same pvid which is also
    used for standalone operation (a unique one from which the source port
    and device ID can be retrieved when packets from that port are forwarded
    to the CPU). Since each port has a unique pvid when performing
    autonomous forwarding, the switch must be configured for Shared VLAN
    Learning (SVL) such that the VLAN ID itself is ignored when performing
    FDB lookups. Without SVL, packets would always be flooded, since FDB
    lookup in the source port's VLAN would never find any entry.
    
    First of all, to make tag_8021q more palatable to switches which might
    not support Shared VLAN Learning, let's just use a common VLAN for all
    ports that are under the same bridge.
    
    Secondly, using Shared VLAN Learning means that FDB isolation can never
    be enforced. But if all ports under the same VLAN-unaware bridge share
    the same VLAN ID, it can.
    
    The disadvantage is that the CPU port can no longer perform precise
    source port identification for these packets. But at least we have a
    mechanism which has proven to be adequate for that situation: imprecise
    RX (dsa_find_designated_bridge_port_by_vid), which is what we use for
    termination on VLAN-aware bridges.
    
    The VLAN ID that VLAN-unaware bridges will use with tag_8021q is the
    same one as we were previously using for imprecise TX (bridge TX
    forwarding offload). It is already allocated, it is just a matter of
    using it.
    
    Note that because now all ports under the same bridge share the same
    VLAN, the complexity of performing a tag_8021q bridge join decreases
    dramatically. We no longer have to install the RX VLAN of a newly
    joining port into the port membership of the existing bridge ports.
    The newly joining port just becomes a member of the VLAN corresponding
    to that bridge, and the other ports are already members of it from when
    they joined the bridge themselves. So forwarding works properly.
    
    This means that we can unhook dsa_tag_8021q_bridge_{join,leave} from the
    cross-chip notifier level dsa_switch_bridge_{join,leave}. We can put
    these calls directly into the sja1105 driver.
    
    With this new mode of operation, a port controlled by tag_8021q can have
    two pvids whereas before it could only have one. The pvid for standalone
    operation is different from the pvid used for VLAN-unaware bridging.
    This is done, again, so that FDB isolation can be enforced.
    Let tag_8021q manage this by deleting the standalone pvid when a port
    joins a bridge, and restoring it when it leaves it.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    91495f21
sja1105_main.c 95.8 KB