summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2021-08-20 16:34:49 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-20 16:34:49 +0300
commit42edc1fca4b5a000e8e2c1e38f4e08a6b9f7bcb7 (patch)
tree6a5f24642eb02efab99b2d8ad063eba5d0f93d7c
parent6985157ce8ee8a02e3899226ac4df351387c3f52 (diff)
parent860fe1f87eca4a2dad9ef8a703f2d046db43c2bb (diff)
downloadlinux-42edc1fca4b5a000e8e2c1e38f4e08a6b9f7bcb7.tar.xz
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 <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index 1419c8dccea2..175f15c46842 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -1508,10 +1508,12 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
}
if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) {
+ rtnl_lock();
if (dpaa2_switch_port_has_mac(port_priv))
dpaa2_switch_port_disconnect_mac(port_priv);
else
dpaa2_switch_port_connect_mac(port_priv);
+ rtnl_unlock();
}
out:
@@ -2923,6 +2925,18 @@ err_free_dpbp:
return err;
}
+static void dpaa2_switch_remove_port(struct ethsw_core *ethsw,
+ u16 port_idx)
+{
+ struct ethsw_port_priv *port_priv = ethsw->ports[port_idx];
+
+ rtnl_lock();
+ dpaa2_switch_port_disconnect_mac(port_priv);
+ rtnl_unlock();
+ free_netdev(port_priv->netdev);
+ ethsw->ports[port_idx] = NULL;
+}
+
static int dpaa2_switch_init(struct fsl_mc_device *sw_dev)
{
struct device *dev = &sw_dev->dev;
@@ -3201,8 +3215,7 @@ static int dpaa2_switch_remove(struct fsl_mc_device *sw_dev)
for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
port_priv = ethsw->ports[i];
unregister_netdev(port_priv->netdev);
- dpaa2_switch_port_disconnect_mac(port_priv);
- free_netdev(port_priv->netdev);
+ dpaa2_switch_remove_port(ethsw, i);
}
kfree(ethsw->fdbs);
@@ -3390,7 +3403,7 @@ err_stop:
dpsw_disable(ethsw->mc_io, 0, ethsw->dpsw_handle);
err_free_netdev:
for (i--; i >= 0; i--)
- free_netdev(ethsw->ports[i]->netdev);
+ dpaa2_switch_remove_port(ethsw, i);
kfree(ethsw->filter_blocks);
err_free_fdbs:
kfree(ethsw->fdbs);