• Vladimir Oltean's avatar
    net: dpaa2-eth: connect to MAC before requesting the "endpoint changed" IRQ · 55f90a4d
    Vladimir Oltean authored
    dpaa2_eth_connect_mac() is called both from dpaa2_eth_probe() and from
    dpni_irq0_handler_thread().
    
    It could happen that the DPNI gets connected to a DPMAC on the fsl-mc
    bus exactly during probe, as soon as the "endpoint change" interrupt is
    requested in dpaa2_eth_setup_irqs(). This will cause the
    dpni_irq0_handler_thread() to register a phylink instance for that DPMAC.
    
    Then, the probing function will also try to register a phylink instance
    for the same DPMAC, operation which should fail (and this will fail the
    probing of the driver).
    
    Reorder dpaa2_eth_setup_irqs() and dpaa2_eth_connect_mac(), such that
    dpni_irq0_handler_thread() never races with the DPMAC-related portion of
    the probing path.
    
    Also reorder dpaa2_eth_disconnect_mac() to be in the mirror position of
    dpaa2_eth_connect_mac() in the teardown path.
    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>
    55f90a4d
dpaa2-eth.c 131 KB