• Vladimir Oltean's avatar
    net: dsa: sja1105: implement cross-chip bridging operations · ac02a451
    Vladimir Oltean authored
    sja1105 uses dsa_8021q for DSA tagging, a format which is VLAN at heart
    and which is compatible with cascading. A complete description of this
    tagging format is in net/dsa/tag_8021q.c, but a quick summary is that
    each external-facing port tags incoming frames with a unique pvid, and
    this special VLAN is transmitted as tagged towards the inside of the
    system, and as untagged towards the exterior. The tag encodes the switch
    id and the source port index.
    
    This means that cross-chip bridging for dsa_8021q only entails adding
    the dsa_8021q pvids of one switch to the RX filter of the other
    switches. Everything else falls naturally into place, as long as the
    bottom-end of ports (the leaves in the tree) is comprised exclusively of
    dsa_8021q-compatible (i.e. sja1105 switches). Otherwise, there would be
    a chance that a front-panel switch transmits a packet tagged with a
    dsa_8021q header, header which it wouldn't be able to remove, and which
    would hence "leak" out.
    
    The only use case I tested (due to lack of board availability) was when
    the sja1105 switches are part of disjoint trees (however, this doesn't
    change the fact that multiple sja1105 switches still need unique switch
    identifiers in such a system). But in principle, even "true" single-tree
    setups (with DSA links) should work just as fine, except for a small
    change which I can't test: dsa_towards_port should be used instead of
    dsa_upstream_port (I made the assumption that the routing port that any
    sja1105 should use towards its neighbours is the CPU port. That might
    not hold true in other setups).
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    ac02a451
sja1105_main.c 75.5 KB