• Vladimir Oltean's avatar
    net: dsa: felix: add support for changing DSA master · eca70102
    Vladimir Oltean authored
    Changing the DSA master means different things depending on the tagging
    protocol in use.
    
    For NPI mode ("ocelot" and "seville"), there is a single port which can
    be configured as NPI, but DSA only permits changing the CPU port
    affinity of user ports one by one. So changing a user port to a
    different NPI port globally changes what the NPI port is, and breaks the
    user ports still using the old one.
    
    To address this while still permitting the change of the NPI port,
    require that the user ports which are still affine to the old NPI port
    are down, and cannot be brought up until they are all affine to the same
    NPI port.
    
    The tag_8021q mode ("ocelot-8021q") is more flexible, in that each user
    port can be freely assigned to one CPU port or to the other. This works
    by filtering host addresses towards both tag_8021q CPU ports, and then
    restricting the forwarding from a certain user port only to one of the
    two tag_8021q CPU ports.
    
    Additionally, the 2 tag_8021q CPU ports can be placed in a LAG. This
    works by enabling forwarding via PGID_SRC from a certain user port
    towards the logical port ID containing both tag_8021q CPU ports, but
    then restricting forwarding per packet, via the LAG hash codes in
    PGID_AGGR, to either one or the other.
    
    When we change the DSA master to a LAG device, DSA guarantees us that
    the LAG has at least one lower interface as a physical DSA master.
    But DSA masters can come and go as lowers of that LAG, and
    ds->ops->port_change_master() will not get called, because the DSA
    master is still the same (the LAG). So we need to hook into the
    ds->ops->port_lag_{join,leave} calls on the CPU ports and update the
    logical port ID of the LAG that user ports are assigned to.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    eca70102
ocelot.h 42.2 KB