Commit 365d0371 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by David S. Miller
Browse files

dpaa2-switch: set interface MAC address only on endpoint change



There is no point in updating the MAC address of a switch interface each
time the link state changes, this only needs to happen in case the
endpoint changes (the switch interface is [dis]connected from/to a MAC).

Just move the call to dpaa2_switch_port_set_mac_addr() under
DPSW_IRQ_EVENT_ENDPOINT_CHANGED.

Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d11db8ad
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1523,12 +1523,11 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
	if_id = (status & 0xFFFF0000) >> 16;
	port_priv = ethsw->ports[if_id];

	if (status & DPSW_IRQ_EVENT_LINK_CHANGED) {
	if (status & DPSW_IRQ_EVENT_LINK_CHANGED)
		dpaa2_switch_port_link_state_update(port_priv->netdev);
		dpaa2_switch_port_set_mac_addr(port_priv);
	}

	if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) {
		dpaa2_switch_port_set_mac_addr(port_priv);
		/* We can avoid locking because the "endpoint changed" IRQ
		 * handler is the only one who changes priv->mac at runtime,
		 * so we are not racing with anyone.