Commit 42edc1fc authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 6985157c 860fe1f8
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -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 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw)
	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 @@ static int dpaa2_switch_probe(struct fsl_mc_device *sw_dev)
	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);