staging: dpaa2-ethsw: ignore state interrupts when the interface is not running
[linux-2.6-microblaze.git] / drivers / staging / fsl-dpaa2 / ethsw / ethsw.c
index 546ad37..b57bc70 100644 (file)
@@ -445,6 +445,12 @@ static int port_carrier_state_sync(struct net_device *netdev)
        struct dpsw_link_state state;
        int err;
 
+       /* Interrupts are received even though no one issued an 'ifconfig up'
+        * on the switch interface. Ignore these link state update interrupts
+        */
+       if (!netif_running(netdev))
+               return 0;
+
        err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0,
                                     port_priv->ethsw_data->dpsw_handle,
                                     port_priv->idx, &state);
@@ -473,6 +479,13 @@ static int port_open(struct net_device *netdev)
        /* No need to allow Tx as control interface is disabled */
        netif_tx_stop_all_queues(netdev);
 
+       /* Explicitly set carrier off, otherwise
+        * netif_carrier_ok() will return true and cause 'ip link show'
+        * to report the LOWER_UP flag, even though the link
+        * notification wasn't even received.
+        */
+       netif_carrier_off(netdev);
+
        err = dpsw_if_enable(port_priv->ethsw_data->mc_io, 0,
                             port_priv->ethsw_data->dpsw_handle,
                             port_priv->idx);