• Vladimir Oltean's avatar
    net: dpaa2-mac: move rtnl_lock() only around phylink_{,dis}connect_phy() · 87db82cb
    Vladimir Oltean authored
    After the introduction of a private mac_lock that serializes access to
    priv->mac (and port_priv->mac in the switch), the only remaining purpose
    of rtnl_lock() is to satisfy the locking requirements of
    phylink_fwnode_phy_connect() and phylink_disconnect_phy().
    
    But the functions these live in, dpaa2_mac_connect() and
    dpaa2_mac_disconnect(), have contradictory locking requirements.
    While phylink_fwnode_phy_connect() wants rtnl_lock() to be held,
    phylink_create() wants it to not be held.
    
    Move the rtnl_lock() from top-level (in the dpaa2-eth and dpaa2-switch
    drivers) to only surround the phylink calls that require it, in the
    dpaa2-mac library code.
    
    This is possible because dpaa2_mac_connect() and dpaa2_mac_disconnect()
    run unlocked, and there isn't any danger of an AB/BA deadlock between
    the rtnl_mutex and other private locks.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
    Tested-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    87db82cb
dpaa2-switch.c 88.6 KB