net: ethernet: Fix up drivers masking pause support
authorAndrew Lunn <andrew@lunn.ch>
Tue, 11 Sep 2018 23:53:13 +0000 (01:53 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Sep 2018 03:24:21 +0000 (20:24 -0700)
PHY drivers don't indicate they support pause. They expect MAC drivers
to enable its support if the MAC has the needed hardware. Thus MAC
drivers should not mask Pause support, but enable it.

Change a few ANDs to ORs.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/smsc/smsc911x.c
drivers/net/ethernet/smsc/smsc9420.c

index cdc32724c9d909b2faa72ded299efda2205fbfb6..eab00239a47a01fc2cd6222f3463d7654df6d5a3 100644 (file)
@@ -2123,14 +2123,14 @@ static int tg3_phy_init(struct tg3 *tp)
        case PHY_INTERFACE_MODE_RGMII:
                if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
                        phy_set_max_speed(phydev, SPEED_1000);
-                       phydev->supported &= (SUPPORTED_Pause |
+                       phydev->supported |= (SUPPORTED_Pause |
                                              SUPPORTED_Asym_Pause);
                        break;
                }
                /* fallthru */
        case PHY_INTERFACE_MODE_MII:
                phy_set_max_speed(phydev, SPEED_100);
-               phydev->supported &= (SUPPORTED_Pause |
+               phydev->supported |= (SUPPORTED_Pause |
                                      SUPPORTED_Asym_Pause);
                break;
        default:
index 398971a062f475202887ca5cbccccae653052bde..05b15d254e3227817aebeea02e43c86efdbaacb6 100644 (file)
@@ -10,8 +10,6 @@
 
 #define HCLGE_PHY_SUPPORTED_FEATURES   (SUPPORTED_Autoneg | \
                                         SUPPORTED_TP | \
-                                        SUPPORTED_Pause | \
-                                        SUPPORTED_Asym_Pause | \
                                         PHY_10BT_FEATURES | \
                                         PHY_100BT_FEATURES | \
                                         PHY_1000BT_FEATURES)
@@ -213,6 +211,8 @@ int hclge_mac_connect_phy(struct hclge_dev *hdev)
        }
 
        phydev->supported &= HCLGE_PHY_SUPPORTED_FEATURES;
+       phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
+
        phydev->advertising = phydev->supported;
 
        return 0;
index e93b5375504ba2da19588aae253b0b51305fee1f..db231bda7c2aa324f635ad77771736fb9ee9346e 100644 (file)
@@ -360,7 +360,7 @@ static int mtk_phy_connect(struct net_device *dev)
                SUPPORTED_Pause | SUPPORTED_Asym_Pause;
 
        phy_set_max_speed(dev->phydev, SPEED_1000);
-       dev->phydev->supported &= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
+       dev->phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
        dev->phydev->advertising = dev->phydev->supported |
                                    ADVERTISED_Autoneg;
        phy_start_aneg(dev->phydev);
index f84dbd0beb8e6284703be51e5f9e7dc3451da051..3e34bf53f0559611b474f65a7ab324031113898d 100644 (file)
@@ -1051,7 +1051,7 @@ static int smsc911x_mii_probe(struct net_device *dev)
        phy_set_max_speed(phydev, SPEED_100);
 
        /* mask with MAC supported features */
-       phydev->supported &= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
+       phydev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
        phydev->advertising = phydev->supported;
 
        pdata->last_duplex = -1;
index 795f60d92611ef15c129720c25c629d2ff39284e..326177384544963684f90acad925961752e09fe4 100644 (file)
@@ -1138,7 +1138,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
        phy_set_max_speed(phydev, SPEED_100);
 
        /* mask with MAC supported features */
-       phydev->supported &= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
+       phydev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
        phydev->advertising = phydev->supported;
 
        phy_attached_info(phydev);