net: mvpp2: improve the link management function
authorAntoine Tenart <antoine.tenart@free-electrons.com>
Wed, 30 Aug 2017 08:29:17 +0000 (10:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Aug 2017 22:17:46 +0000 (15:17 -0700)
When the link status changes, the phylib calls the link_event function
in the mvpp2 driver. Before this patch only the egress/ingress transmit
was enabled/disabled. This patch adds more functionality to the link
status management code by enabling/disabling the port per-cpu
interrupts, and the port itself. The queues are now stopped as well, and
the netif carrier helpers are called.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvpp2.c

index cacbd881cebd34cea30ad7a11513c1f50dd69f78..0fe146f2bc8c028ab5079dc203547edd39491119 100644 (file)
@@ -5777,14 +5777,25 @@ static void mvpp2_link_event(struct net_device *dev)
                        val |= (MVPP2_GMAC_FORCE_LINK_PASS |
                                MVPP2_GMAC_FORCE_LINK_DOWN);
                        writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
+
+                       mvpp2_interrupts_enable(port);
+                       mvpp2_port_enable(port);
+
                        mvpp2_egress_enable(port);
                        mvpp2_ingress_enable(port);
+                       netif_carrier_on(dev);
+                       netif_tx_wake_all_queues(dev);
                } else {
                        port->duplex = -1;
                        port->speed = 0;
 
+                       netif_tx_stop_all_queues(dev);
+                       netif_carrier_off(dev);
                        mvpp2_ingress_disable(port);
                        mvpp2_egress_disable(port);
+
+                       mvpp2_port_disable(port);
+                       mvpp2_interrupts_disable(port);
                }
 
                phy_print_status(phydev);