• Vladimir Oltean's avatar
    net: dsa: track unique bridge numbers across all DSA switch trees · f5e165e7
    Vladimir Oltean authored
    Right now, cross-tree bridging setups work somewhat by mistake.
    
    In the case of cross-tree bridging with sja1105, all switch instances
    need to agree upon a common VLAN ID for forwarding a packet that belongs
    to a certain bridging domain.
    
    With TX forwarding offload, the VLAN ID is the bridge VLAN for
    VLAN-aware bridging, and the tag_8021q TX forwarding offload VID
    (a VLAN which has non-zero VBID bits) for VLAN-unaware bridging.
    
    The VBID for VLAN-unaware bridging is derived from the dp->bridge_num
    value calculated by DSA independently for each switch tree.
    
    If ports from one tree join one bridge, and ports from another tree join
    another bridge, DSA will assign them the same bridge_num, even though
    the bridges are different. If cross-tree bridging is supported, this
    is an issue.
    
    Modify DSA to calculate the bridge_num globally across all switch trees.
    This has the implication for a driver that the dp->bridge_num value that
    DSA will assign to its ports might not be contiguous, if there are
    boards with multiple DSA drivers instantiated. Additionally, all
    bridge_num values eat up towards each switch's
    ds->num_fwd_offloading_bridges maximum, which is potentially unfortunate,
    and can be seen as a limitation introduced by this patch. However, that
    is the lesser evil for now.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    f5e165e7
port.c 31.2 KB