• Vladimir Oltean's avatar
    net: dsa: automatically bring up DSA master when opening user port · 9d5ef190
    Vladimir Oltean authored
    DSA wants the master interface to be open before the user port is due to
    historical reasons. The promiscuity of interfaces that are down used to
    have issues, as referenced Lennert Buytenhek in commit df02c6ff
    ("dsa: fix master interface allmulti/promisc handling").
    
    The bugfix mentioned there, commit b6c40d68 ("net: only invoke
    dev->change_rx_flags when device is UP"), was basically a "don't do
    that" approach to working around the promiscuity while down issue.
    
    Further work done by Vlad Yasevich in commit d2615bf4 ("net: core:
    Always propagate flag changes to interfaces") has resolved the
    underlying issue, and it is strictly up to the DSA and 8021q drivers
    now, it is no longer mandated by the networking core that the master
    interface must be up when changing its promiscuity.
    
    From DSA's point of view, deciding to error out in dsa_slave_open
    because the master isn't up is
    (a) a bad user experience and
    (b) knocking at an open door.
    Even if there still was an issue with promiscuity while down, DSA could
    still just open the master and avoid it.
    
    Doing it this way has the additional benefit that user space can now
    remove DSA-specific workarounds, like systemd-networkd with BindCarrier:
    https://github.com/systemd/systemd/issues/7478
    
    And we can finally remove one of the 2 bullets in the "Common pitfalls
    using DSA setups" chapter.
    
    Tested with two cascaded DSA switches:
    
    $ ip link set sw0p2 up
    fsl_enetc 0000:00:00.2 eno2: configuring for fixed/internal link mode
    fsl_enetc 0000:00:00.2 eno2: Link is Up - 1Gbps/Full - flow control rx/tx
    mscc_felix 0000:00:00.5 swp0: configuring for fixed/sgmii link mode
    mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control off
    8021q: adding VLAN 0 to HW filter on device swp0
    sja1105 spi2.0 sw0p2: configuring for phy/rgmii-id link mode
    IPv6: ADDRCONF(NETDEV_CHANGE): eno2: link becomes ready
    IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
    Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    9d5ef190
slave.c 57.1 KB