net: qcom/emac: enable flow control if requested
authorTimur Tabi <timur@codeaurora.org>
Mon, 7 Nov 2016 16:51:41 +0000 (10:51 -0600)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Nov 2016 23:45:24 +0000 (18:45 -0500)
If the PHY has been configured to allow pause frames, then the MAC
should be configured to generate and/or accept those frames.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qualcomm/emac/emac-mac.c

index 70a55dcc431d16ad0c0d9e08dcf6daae67b25b38..0b4deb31e742fc4d48a2f91e865d7d750e0023c2 100644 (file)
@@ -575,10 +575,11 @@ void emac_mac_start(struct emac_adapter *adpt)
 
        mac |= TXEN | RXEN;     /* enable RX/TX */
 
-       /* We don't have ethtool support yet, so force flow-control mode
-        * to 'full' always.
-        */
-       mac |= TXFC | RXFC;
+       /* Configure MAC flow control to match the PHY's settings. */
+       if (phydev->pause)
+               mac |= RXFC;
+       if (phydev->pause != phydev->asym_pause)
+               mac |= TXFC;
 
        /* setup link speed */
        mac &= ~SPEED_MASK;