• Vladimir Oltean's avatar
    net: dsa: sja1105: enable address learning on cascade ports · 81d45898
    Vladimir Oltean authored
    Right now, address learning is disabled on DSA ports, which means that a
    packet received over a DSA port from a cross-chip switch will be flooded
    to unrelated ports.
    
    It is desirable to eliminate that, but for that we need a breakdown of
    the possibilities for the sja1105 driver. A DSA port can be:
    
    - a downstream-facing cascade port. This is simple because it will
      always receive packets from a downstream switch, and there should be
      no other route to reach that downstream switch in the first place,
      which means it should be safe to learn that MAC address towards that
      switch.
    
    - an upstream-facing cascade port. This receives packets either:
      * autonomously forwarded by an upstream switch (and therefore these
        packets belong to the data plane of a bridge, so address learning
        should be ok), or
      * injected from the CPU. This deserves further discussion, as normally,
        an upstream-facing cascade port is no different than the CPU port
        itself. But with "H" topologies (a DSA link towards a switch that
        has its own CPU port), these are more "laterally-facing" cascade
        ports than they are "upstream-facing". Here, there is a risk that
        the port might learn the host addresses on the wrong port (on the
        DSA port instead of on its own CPU port), but this is solved by
        DSA's RX filtering infrastructure, which installs the host addresses
        as static FDB entries on the CPU port of all switches in a "H" tree.
        So even if there will be an attempt from the switch to migrate the
        FDB entry from the CPU port to the laterally-facing cascade port, it
        will fail to do that, because the FDB entry that already exists is
        static and cannot migrate. So address learning should be safe for
        this configuration too.
    
    Ok, so what about other MAC addresses coming from the host, not
    necessarily the bridge local FDB entries? What about MAC addresses
    dynamically learned on foreign interfaces, isn't there a risk that
    cascade ports will learn these entries dynamically when they are
    supposed to be delivered towards the CPU port? Well, that is correct,
    and this is why we also need to enable the assisted learning feature, to
    snoop for these addresses and write them to hardware as static FDB
    entries towards the CPU, to make the switch's learning process on the
    cascade ports ineffective for them. With assisted learning enabled, the
    hardware learning on the CPU port must be disabled.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    81d45898
sja1105_main.c 92.2 KB