• Vladimir Oltean's avatar
    net: dsa: tag_8021q: merge RX and TX VLANs · 04b67e18
    Vladimir Oltean authored
    In the old Shared VLAN Learning mode of operation that tag_8021q
    previously used for forwarding, we needed to have distinct concepts for
    an RX and a TX VLAN.
    
    An RX VLAN could be installed on all ports that were members of a given
    bridge, so that autonomous forwarding could still work, while a TX VLAN
    was dedicated for precise packet steering, so it just contained the CPU
    port and one egress port.
    
    Now that tag_8021q uses Independent VLAN Learning and imprecise RX/TX
    all over, those lines have been blurred and we no longer have the need
    to do precise TX towards a port that is in a bridge. As for standalone
    ports, it is fine to use the same VLAN ID for both RX and TX.
    
    This patch changes the tag_8021q format by shifting the VLAN range it
    reserves, and halving it. Previously, our DIR bits were encoding the
    VLAN direction (RX/TX) and were set to either 1 or 2. This meant that
    tag_8021q reserved 2K VLANs, or 50% of the available range.
    
    Change the DIR bits to a hardcoded value of 3 now, which makes tag_8021q
    reserve only 1K VLANs, and a different range now (the last 1K). This is
    done so that we leave the old format in place in case we need to return
    to it.
    
    In terms of code, the vid_is_dsa_8021q_rxvlan and vid_is_dsa_8021q_txvlan
    functions go away. Any vid_is_dsa_8021q is both a TX and an RX VLAN, and
    they are no longer distinct. For example, felix which did different
    things for different VLAN types, now needs to handle the RX and the TX
    logic for the same VLAN.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    04b67e18
sja1105_main.c 95.8 KB