Skip to content

Commit 42edc1f

Browse files
committed
Merge branch 'dpaa2-switch-phylikn-fixes'
Vladimir Oltean says: ==================== dpaa2-switch phylink fixes This is fixing two regressions introduced by the recent conversion of the dpaa2-switch driver to phylink. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 6985157 + 860fe1f commit 42edc1f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,10 +1508,12 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
15081508
}
15091509

15101510
if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) {
1511+
rtnl_lock();
15111512
if (dpaa2_switch_port_has_mac(port_priv))
15121513
dpaa2_switch_port_disconnect_mac(port_priv);
15131514
else
15141515
dpaa2_switch_port_connect_mac(port_priv);
1516+
rtnl_unlock();
15151517
}
15161518

15171519
out:
@@ -2923,6 +2925,18 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw)
29232925
return err;
29242926
}
29252927

2928+
static void dpaa2_switch_remove_port(struct ethsw_core *ethsw,
2929+
u16 port_idx)
2930+
{
2931+
struct ethsw_port_priv *port_priv = ethsw->ports[port_idx];
2932+
2933+
rtnl_lock();
2934+
dpaa2_switch_port_disconnect_mac(port_priv);
2935+
rtnl_unlock();
2936+
free_netdev(port_priv->netdev);
2937+
ethsw->ports[port_idx] = NULL;
2938+
}
2939+
29262940
static int dpaa2_switch_init(struct fsl_mc_device *sw_dev)
29272941
{
29282942
struct device *dev = &sw_dev->dev;
@@ -3201,8 +3215,7 @@ static int dpaa2_switch_remove(struct fsl_mc_device *sw_dev)
32013215
for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
32023216
port_priv = ethsw->ports[i];
32033217
unregister_netdev(port_priv->netdev);
3204-
dpaa2_switch_port_disconnect_mac(port_priv);
3205-
free_netdev(port_priv->netdev);
3218+
dpaa2_switch_remove_port(ethsw, i);
32063219
}
32073220

32083221
kfree(ethsw->fdbs);
@@ -3390,7 +3403,7 @@ static int dpaa2_switch_probe(struct fsl_mc_device *sw_dev)
33903403
dpsw_disable(ethsw->mc_io, 0, ethsw->dpsw_handle);
33913404
err_free_netdev:
33923405
for (i--; i >= 0; i--)
3393-
free_netdev(ethsw->ports[i]->netdev);
3406+
dpaa2_switch_remove_port(ethsw, i);
33943407
kfree(ethsw->filter_blocks);
33953408
err_free_fdbs:
33963409
kfree(ethsw->fdbs);

0 commit comments

Comments
 (0)