Skip to content

Commit 1566534

Browse files
committed
Merge branch 'Preparing-for-phylib-linkmodes'
Andrew Lunn says: ==================== Preparing for phylib linkmodes phylib currently makes us of a u32 bitmap for advertising, supported, and link partner capabilities. For a long time, this has been sufficient, for devices up to 1Gbps. With more MAC/PHY combinations now supporting speeds greater than 1Gbps, we have run out of bits. There is the need to replace this u32 with an __ETHTOOL_DECLARE_LINK_MODE_MASK, which makes use of linux's generic bitmaps. This patchset does some of the work preparing for this change. A few cleanups are applied to PHY drivers. Some MAC drivers directly access members of phydev which are going to change type. These patches adds some helpers and swaps MAC drivers to use them, mostly dealing with Pause configuration. v3: Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Add missing at in commit message Change Subject of patch 5 Fix return in from phy_set_asym_pause Fix kerneldoc in phy_set_pause v2: Fixup bad indentation in tg3.c Rename phy_support_pause() to phy_support_sym_pause() Also trigger autoneg if the advertising settings have changed. Rename phy_set_pause() to phy_set_sym_pause() Use the bcm63xx_enet.c logic, not fec_main.c for validating pause ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents eca09be + 22b7d29 commit 1566534

File tree

47 files changed

+259
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+259
-344
lines changed

drivers/net/ethernet/8390/ax88796.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,7 @@ static int ax_mii_probe(struct net_device *dev)
377377
return ret;
378378
}
379379

380-
/* mask with MAC supported features */
381-
phy_dev->supported &= PHY_BASIC_FEATURES;
382-
phy_dev->advertising = phy_dev->supported;
380+
phy_set_max_speed(phy_dev, SPEED_100);
383381

384382
netdev_info(dev, "PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
385383
phy_dev->drv->name, phydev_name(phy_dev), phy_dev->irq);

drivers/net/ethernet/aeroflex/greth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,9 +1279,9 @@ static int greth_mdio_probe(struct net_device *dev)
12791279
}
12801280

12811281
if (greth->gbit_mac)
1282-
phy->supported &= PHY_GBIT_FEATURES;
1282+
phy_set_max_speed(phy, SPEED_1000);
12831283
else
1284-
phy->supported &= PHY_BASIC_FEATURES;
1284+
phy_set_max_speed(phy, SPEED_100);
12851285

12861286
phy->advertising = phy->supported;
12871287

drivers/net/ethernet/agere/et131x.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,19 +3258,11 @@ static int et131x_mii_probe(struct net_device *netdev)
32583258
return PTR_ERR(phydev);
32593259
}
32603260

3261-
phydev->supported &= (SUPPORTED_10baseT_Half |
3262-
SUPPORTED_10baseT_Full |
3263-
SUPPORTED_100baseT_Half |
3264-
SUPPORTED_100baseT_Full |
3265-
SUPPORTED_Autoneg |
3266-
SUPPORTED_MII |
3267-
SUPPORTED_TP);
3261+
phy_set_max_speed(phydev, SPEED_100);
32683262

32693263
if (adapter->pdev->device != ET131X_PCI_DEVICE_ID_FAST)
3270-
phydev->supported |= SUPPORTED_1000baseT_Half |
3271-
SUPPORTED_1000baseT_Full;
3264+
phy_set_max_speed(phydev, SPEED_1000);
32723265

3273-
phydev->advertising = phydev->supported;
32743266
phydev->autoneg = AUTONEG_ENABLE;
32753267

32763268
phy_attached_info(phydev);

drivers/net/ethernet/allwinner/sun4i-emac.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ static int emac_mdio_probe(struct net_device *dev)
172172
}
173173

174174
/* mask with MAC supported features */
175-
phydev->supported &= PHY_BASIC_FEATURES;
176-
phydev->advertising = phydev->supported;
175+
phy_set_max_speed(phydev, SPEED_100);
177176

178177
db->link = 0;
179178
db->speed = 0;

drivers/net/ethernet/altera/altera_tse_main.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -835,13 +835,10 @@ static int init_phy(struct net_device *dev)
835835
}
836836

837837
/* Stop Advertising 1000BASE Capability if interface is not GMII
838-
* Note: Checkpatch throws CHECKs for the camel case defines below,
839-
* it's ok to ignore.
840838
*/
841839
if ((priv->phy_iface == PHY_INTERFACE_MODE_MII) ||
842840
(priv->phy_iface == PHY_INTERFACE_MODE_RMII))
843-
phydev->advertising &= ~(SUPPORTED_1000baseT_Half |
844-
SUPPORTED_1000baseT_Full);
841+
phy_set_max_speed(phydev, SPEED_100);
845842

846843
/* Broken HW is sometimes missing the pull-up resistor on the
847844
* MDIO line, which results in reads to non-existent devices returning

drivers/net/ethernet/amd/au1000_eth.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -564,17 +564,7 @@ static int au1000_mii_probe(struct net_device *dev)
564564
return PTR_ERR(phydev);
565565
}
566566

567-
/* mask with MAC supported features */
568-
phydev->supported &= (SUPPORTED_10baseT_Half
569-
| SUPPORTED_10baseT_Full
570-
| SUPPORTED_100baseT_Half
571-
| SUPPORTED_100baseT_Full
572-
| SUPPORTED_Autoneg
573-
/* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
574-
| SUPPORTED_MII
575-
| SUPPORTED_TP);
576-
577-
phydev->advertising = phydev->supported;
567+
phy_set_max_speed(phydev, SPEED_100);
578568

579569
aup->old_link = 0;
580570
aup->old_speed = 0;

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,8 @@ static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
879879
phy_write(phy_data->phydev, 0x00, 0x9140);
880880

881881
phy_data->phydev->supported = PHY_GBIT_FEATURES;
882-
phy_data->phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
883882
phy_data->phydev->advertising = phy_data->phydev->supported;
883+
phy_support_asym_pause(phy_data->phydev);
884884

885885
netif_dbg(pdata, drv, pdata->netdev,
886886
"Finisar PHY quirk in place\n");
@@ -951,8 +951,8 @@ static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata)
951951
phy_write(phy_data->phydev, 0x00, reg & ~0x00800);
952952

953953
phy_data->phydev->supported = PHY_GBIT_FEATURES;
954-
phy_data->phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
955954
phy_data->phydev->advertising = phy_data->phydev->supported;
955+
phy_support_asym_pause(phy_data->phydev);
956956

957957
netif_dbg(pdata, drv, pdata->netdev,
958958
"BelFuse PHY quirk in place\n");

drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -306,45 +306,25 @@ static int xgene_set_pauseparam(struct net_device *ndev,
306306
{
307307
struct xgene_enet_pdata *pdata = netdev_priv(ndev);
308308
struct phy_device *phydev = ndev->phydev;
309-
u32 oldadv, newadv;
310309

311310
if (phy_interface_mode_is_rgmii(pdata->phy_mode) ||
312311
pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) {
313312
if (!phydev)
314313
return -EINVAL;
315314

316-
if (!(phydev->supported & SUPPORTED_Pause) ||
317-
(!(phydev->supported & SUPPORTED_Asym_Pause) &&
318-
pp->rx_pause != pp->tx_pause))
315+
if (!phy_validate_pause(phydev, pp))
319316
return -EINVAL;
320317

321318
pdata->pause_autoneg = pp->autoneg;
322319
pdata->tx_pause = pp->tx_pause;
323320
pdata->rx_pause = pp->rx_pause;
324321

325-
oldadv = phydev->advertising;
326-
newadv = oldadv & ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause);
322+
phy_set_asym_pause(phydev, pp->rx_pause, pp->tx_pause);
327323

328-
if (pp->rx_pause)
329-
newadv |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
330-
331-
if (pp->tx_pause)
332-
newadv ^= ADVERTISED_Asym_Pause;
333-
334-
if (oldadv ^ newadv) {
335-
phydev->advertising = newadv;
336-
337-
if (phydev->autoneg)
338-
return phy_start_aneg(phydev);
339-
340-
if (!pp->autoneg) {
341-
pdata->mac_ops->flowctl_tx(pdata,
342-
pdata->tx_pause);
343-
pdata->mac_ops->flowctl_rx(pdata,
344-
pdata->rx_pause);
345-
}
324+
if (!pp->autoneg) {
325+
pdata->mac_ops->flowctl_tx(pdata, pdata->tx_pause);
326+
pdata->mac_ops->flowctl_rx(pdata, pdata->rx_pause);
346327
}
347-
348328
} else {
349329
if (pp->autoneg)
350330
return -EINVAL;

drivers/net/ethernet/apm/xgene/xgene_enet_hw.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -895,12 +895,10 @@ int xgene_enet_phy_connect(struct net_device *ndev)
895895
}
896896

897897
pdata->phy_speed = SPEED_UNKNOWN;
898-
phy_dev->supported &= ~SUPPORTED_10baseT_Half &
899-
~SUPPORTED_100baseT_Half &
900-
~SUPPORTED_1000baseT_Half;
901-
phy_dev->supported |= SUPPORTED_Pause |
902-
SUPPORTED_Asym_Pause;
903-
phy_dev->advertising = phy_dev->supported;
898+
phy_remove_link_mode(phy_dev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
899+
phy_remove_link_mode(phy_dev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
900+
phy_remove_link_mode(phy_dev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
901+
phy_support_asym_pause(phy_dev);
904902

905903
return 0;
906904
}

drivers/net/ethernet/aurora/nb8800.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,18 +935,11 @@ static void nb8800_pause_adv(struct net_device *dev)
935935
{
936936
struct nb8800_priv *priv = netdev_priv(dev);
937937
struct phy_device *phydev = dev->phydev;
938-
u32 adv = 0;
939938

940939
if (!phydev)
941940
return;
942941

943-
if (priv->pause_rx)
944-
adv |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
945-
if (priv->pause_tx)
946-
adv ^= ADVERTISED_Asym_Pause;
947-
948-
phydev->supported |= adv;
949-
phydev->advertising |= adv;
942+
phy_set_asym_pause(phydev, priv->pause_rx, priv->pause_tx);
950943
}
951944

952945
static int nb8800_open(struct net_device *dev)

0 commit comments

Comments
 (0)