diff options
author | David Decotigny <decot@google.com> | 2011-04-27 14:32:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-29 17:03:01 -0400 |
commit | 707394972093e2056e1e8cc39be19cf9bcb3e7b3 (patch) | |
tree | f6dc95219bca6895adf304b79241e9d60561f8f5 /drivers | |
parent | 25db0338813a8915457636b1f6abe6a28fa73f8d (diff) |
ethtool: cosmetic: Use ethtool ethtool_cmd_speed API
This updates the network drivers so that they don't access the
ethtool_cmd::speed field directly, but use ethtool_cmd_speed()
instead.
For most of the drivers, these changes are purely cosmetic and don't
fix any problem, such as for those 1GbE/10GbE drivers that indirectly
call their own ethtool get_settings()/mii_ethtool_gset(). The changes
are meant to enforce code consistency and provide robustness with
future larger throughputs, at the expense of a few CPU cycles for each
ethtool operation.
All drivers compiled with make allyesconfig ion x86_64 have been
updated.
Tested: make allyesconfig on x86_64 + e1000e/bnx2x work
Signed-off-by: David Decotigny <decot@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
75 files changed, 231 insertions, 196 deletions
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index d2e67c4e3228..d3a1c41cfd27 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -1493,7 +1493,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd | |||
1493 | et_cmd->maxrxpkt = 511; | 1493 | et_cmd->maxrxpkt = 511; |
1494 | 1494 | ||
1495 | if (nesadapter->OneG_Mode) { | 1495 | if (nesadapter->OneG_Mode) { |
1496 | et_cmd->speed = SPEED_1000; | 1496 | ethtool_cmd_speed_set(et_cmd, SPEED_1000); |
1497 | if (phy_type == NES_PHY_TYPE_PUMA_1G) { | 1497 | if (phy_type == NES_PHY_TYPE_PUMA_1G) { |
1498 | et_cmd->supported = SUPPORTED_1000baseT_Full; | 1498 | et_cmd->supported = SUPPORTED_1000baseT_Full; |
1499 | et_cmd->advertising = ADVERTISED_1000baseT_Full; | 1499 | et_cmd->advertising = ADVERTISED_1000baseT_Full; |
@@ -1532,7 +1532,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd | |||
1532 | et_cmd->advertising = ADVERTISED_10000baseT_Full; | 1532 | et_cmd->advertising = ADVERTISED_10000baseT_Full; |
1533 | et_cmd->phy_address = mac_index; | 1533 | et_cmd->phy_address = mac_index; |
1534 | } | 1534 | } |
1535 | et_cmd->speed = SPEED_10000; | 1535 | ethtool_cmd_speed_set(et_cmd, SPEED_10000); |
1536 | et_cmd->autoneg = AUTONEG_DISABLE; | 1536 | et_cmd->autoneg = AUTONEG_DISABLE; |
1537 | return 0; | 1537 | return 0; |
1538 | } | 1538 | } |
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index cb39dedf46bd..5f25889e27ef 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -1207,7 +1207,7 @@ el3_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1207 | ecmd->duplex = DUPLEX_FULL; | 1207 | ecmd->duplex = DUPLEX_FULL; |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | ecmd->speed = SPEED_10; | 1210 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
1211 | EL3WINDOW(1); | 1211 | EL3WINDOW(1); |
1212 | return 0; | 1212 | return 0; |
1213 | } | 1213 | } |
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index 0b4d8d13c488..a5798991c8b1 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
@@ -2658,15 +2658,15 @@ static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
2658 | 2658 | ||
2659 | link = readl(®s->GigLnkState); | 2659 | link = readl(®s->GigLnkState); |
2660 | if (link & LNK_1000MB) | 2660 | if (link & LNK_1000MB) |
2661 | ecmd->speed = SPEED_1000; | 2661 | ethtool_cmd_speed_set(ecmd, SPEED_1000); |
2662 | else { | 2662 | else { |
2663 | link = readl(®s->FastLnkState); | 2663 | link = readl(®s->FastLnkState); |
2664 | if (link & LNK_100MB) | 2664 | if (link & LNK_100MB) |
2665 | ecmd->speed = SPEED_100; | 2665 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
2666 | else if (link & LNK_10MB) | 2666 | else if (link & LNK_10MB) |
2667 | ecmd->speed = SPEED_10; | 2667 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
2668 | else | 2668 | else |
2669 | ecmd->speed = 0; | 2669 | ethtool_cmd_speed_set(ecmd, 0); |
2670 | } | 2670 | } |
2671 | if (link & LNK_FULL_DUPLEX) | 2671 | if (link & LNK_FULL_DUPLEX) |
2672 | ecmd->duplex = DUPLEX_FULL; | 2672 | ecmd->duplex = DUPLEX_FULL; |
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index 4af235d41fda..e252cd595016 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
@@ -591,10 +591,11 @@ static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i | |||
591 | static int etherh_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 591 | static int etherh_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
592 | { | 592 | { |
593 | cmd->supported = etherh_priv(dev)->supported; | 593 | cmd->supported = etherh_priv(dev)->supported; |
594 | cmd->speed = SPEED_10; | 594 | ethtool_cmd_speed_set(cmd, SPEED_10); |
595 | cmd->duplex = DUPLEX_HALF; | 595 | cmd->duplex = DUPLEX_HALF; |
596 | cmd->port = dev->if_port == IF_PORT_10BASET ? PORT_TP : PORT_BNC; | 596 | cmd->port = dev->if_port == IF_PORT_10BASET ? PORT_TP : PORT_BNC; |
597 | cmd->autoneg = dev->flags & IFF_AUTOMEDIA ? AUTONEG_ENABLE : AUTONEG_DISABLE; | 597 | cmd->autoneg = (dev->flags & IFF_AUTOMEDIA ? |
598 | AUTONEG_ENABLE : AUTONEG_DISABLE); | ||
598 | return 0; | 599 | return 0; |
599 | } | 600 | } |
600 | 601 | ||
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c index aa07657744c3..a7b0caa18179 100644 --- a/drivers/net/arm/ks8695net.c +++ b/drivers/net/arm/ks8695net.c | |||
@@ -891,15 +891,16 @@ ks8695_wan_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd) | |||
891 | cmd->advertising |= ADVERTISED_Pause; | 891 | cmd->advertising |= ADVERTISED_Pause; |
892 | cmd->autoneg = AUTONEG_ENABLE; | 892 | cmd->autoneg = AUTONEG_ENABLE; |
893 | 893 | ||
894 | cmd->speed = (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10; | 894 | ethtool_cmd_speed_set(cmd, |
895 | (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10); | ||
895 | cmd->duplex = (ctrl & WMC_WDS) ? | 896 | cmd->duplex = (ctrl & WMC_WDS) ? |
896 | DUPLEX_FULL : DUPLEX_HALF; | 897 | DUPLEX_FULL : DUPLEX_HALF; |
897 | } else { | 898 | } else { |
898 | /* auto-negotiation is disabled */ | 899 | /* auto-negotiation is disabled */ |
899 | cmd->autoneg = AUTONEG_DISABLE; | 900 | cmd->autoneg = AUTONEG_DISABLE; |
900 | 901 | ||
901 | cmd->speed = (ctrl & WMC_WANF100) ? | 902 | ethtool_cmd_speed_set(cmd, ((ctrl & WMC_WANF100) ? |
902 | SPEED_100 : SPEED_10; | 903 | SPEED_100 : SPEED_10)); |
903 | cmd->duplex = (ctrl & WMC_WANFF) ? | 904 | cmd->duplex = (ctrl & WMC_WANFF) ? |
904 | DUPLEX_FULL : DUPLEX_HALF; | 905 | DUPLEX_FULL : DUPLEX_HALF; |
905 | } | 906 | } |
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c index b1eceee424aa..7be884d0aaf6 100644 --- a/drivers/net/atl1c/atl1c_ethtool.c +++ b/drivers/net/atl1c/atl1c_ethtool.c | |||
@@ -50,13 +50,13 @@ static int atl1c_get_settings(struct net_device *netdev, | |||
50 | ecmd->transceiver = XCVR_INTERNAL; | 50 | ecmd->transceiver = XCVR_INTERNAL; |
51 | 51 | ||
52 | if (adapter->link_speed != SPEED_0) { | 52 | if (adapter->link_speed != SPEED_0) { |
53 | ecmd->speed = adapter->link_speed; | 53 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
54 | if (adapter->link_duplex == FULL_DUPLEX) | 54 | if (adapter->link_duplex == FULL_DUPLEX) |
55 | ecmd->duplex = DUPLEX_FULL; | 55 | ecmd->duplex = DUPLEX_FULL; |
56 | else | 56 | else |
57 | ecmd->duplex = DUPLEX_HALF; | 57 | ecmd->duplex = DUPLEX_HALF; |
58 | } else { | 58 | } else { |
59 | ecmd->speed = -1; | 59 | ethtool_cmd_speed_set(ecmd, -1); |
60 | ecmd->duplex = -1; | 60 | ecmd->duplex = -1; |
61 | } | 61 | } |
62 | 62 | ||
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c index 47783749d9fa..6269438d365f 100644 --- a/drivers/net/atl1e/atl1e_ethtool.c +++ b/drivers/net/atl1e/atl1e_ethtool.c | |||
@@ -51,13 +51,13 @@ static int atl1e_get_settings(struct net_device *netdev, | |||
51 | ecmd->transceiver = XCVR_INTERNAL; | 51 | ecmd->transceiver = XCVR_INTERNAL; |
52 | 52 | ||
53 | if (adapter->link_speed != SPEED_0) { | 53 | if (adapter->link_speed != SPEED_0) { |
54 | ecmd->speed = adapter->link_speed; | 54 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
55 | if (adapter->link_duplex == FULL_DUPLEX) | 55 | if (adapter->link_duplex == FULL_DUPLEX) |
56 | ecmd->duplex = DUPLEX_FULL; | 56 | ecmd->duplex = DUPLEX_FULL; |
57 | else | 57 | else |
58 | ecmd->duplex = DUPLEX_HALF; | 58 | ecmd->duplex = DUPLEX_HALF; |
59 | } else { | 59 | } else { |
60 | ecmd->speed = -1; | 60 | ethtool_cmd_speed_set(ecmd, -1); |
61 | ecmd->duplex = -1; | 61 | ecmd->duplex = -1; |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 37a092fa2ba6..c5298d1ab744 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -3231,13 +3231,13 @@ static int atl1_get_settings(struct net_device *netdev, | |||
3231 | if (netif_carrier_ok(adapter->netdev)) { | 3231 | if (netif_carrier_ok(adapter->netdev)) { |
3232 | u16 link_speed, link_duplex; | 3232 | u16 link_speed, link_duplex; |
3233 | atl1_get_speed_and_duplex(hw, &link_speed, &link_duplex); | 3233 | atl1_get_speed_and_duplex(hw, &link_speed, &link_duplex); |
3234 | ecmd->speed = link_speed; | 3234 | ethtool_cmd_speed_set(ecmd, link_speed); |
3235 | if (link_duplex == FULL_DUPLEX) | 3235 | if (link_duplex == FULL_DUPLEX) |
3236 | ecmd->duplex = DUPLEX_FULL; | 3236 | ecmd->duplex = DUPLEX_FULL; |
3237 | else | 3237 | else |
3238 | ecmd->duplex = DUPLEX_HALF; | 3238 | ecmd->duplex = DUPLEX_HALF; |
3239 | } else { | 3239 | } else { |
3240 | ecmd->speed = -1; | 3240 | ethtool_cmd_speed_set(ecmd, -1); |
3241 | ecmd->duplex = -1; | 3241 | ecmd->duplex = -1; |
3242 | } | 3242 | } |
3243 | if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR || | 3243 | if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR || |
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index b75aa295d37e..16249e9b6b95 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -1769,13 +1769,13 @@ static int atl2_get_settings(struct net_device *netdev, | |||
1769 | ecmd->transceiver = XCVR_INTERNAL; | 1769 | ecmd->transceiver = XCVR_INTERNAL; |
1770 | 1770 | ||
1771 | if (adapter->link_speed != SPEED_0) { | 1771 | if (adapter->link_speed != SPEED_0) { |
1772 | ecmd->speed = adapter->link_speed; | 1772 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
1773 | if (adapter->link_duplex == FULL_DUPLEX) | 1773 | if (adapter->link_duplex == FULL_DUPLEX) |
1774 | ecmd->duplex = DUPLEX_FULL; | 1774 | ecmd->duplex = DUPLEX_FULL; |
1775 | else | 1775 | else |
1776 | ecmd->duplex = DUPLEX_HALF; | 1776 | ecmd->duplex = DUPLEX_HALF; |
1777 | } else { | 1777 | } else { |
1778 | ecmd->speed = -1; | 1778 | ethtool_cmd_speed_set(ecmd, -1); |
1779 | ecmd->duplex = -1; | 1779 | ecmd->duplex = -1; |
1780 | } | 1780 | } |
1781 | 1781 | ||
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 909cc4b2a2f3..a69331e06b8d 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -1807,8 +1807,8 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1807 | if (bp->flags & B44_FLAG_ADV_100FULL) | 1807 | if (bp->flags & B44_FLAG_ADV_100FULL) |
1808 | cmd->advertising |= ADVERTISED_100baseT_Full; | 1808 | cmd->advertising |= ADVERTISED_100baseT_Full; |
1809 | cmd->advertising |= ADVERTISED_Pause | ADVERTISED_Asym_Pause; | 1809 | cmd->advertising |= ADVERTISED_Pause | ADVERTISED_Asym_Pause; |
1810 | cmd->speed = (bp->flags & B44_FLAG_100_BASE_T) ? | 1810 | ethtool_cmd_speed_set(cmd, ((bp->flags & B44_FLAG_100_BASE_T) ? |
1811 | SPEED_100 : SPEED_10; | 1811 | SPEED_100 : SPEED_10)); |
1812 | cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ? | 1812 | cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ? |
1813 | DUPLEX_FULL : DUPLEX_HALF; | 1813 | DUPLEX_FULL : DUPLEX_HALF; |
1814 | cmd->port = 0; | 1814 | cmd->port = 0; |
@@ -1820,7 +1820,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1820 | if (cmd->autoneg == AUTONEG_ENABLE) | 1820 | if (cmd->autoneg == AUTONEG_ENABLE) |
1821 | cmd->advertising |= ADVERTISED_Autoneg; | 1821 | cmd->advertising |= ADVERTISED_Autoneg; |
1822 | if (!netif_running(dev)){ | 1822 | if (!netif_running(dev)){ |
1823 | cmd->speed = 0; | 1823 | ethtool_cmd_speed_set(cmd, 0); |
1824 | cmd->duplex = 0xff; | 1824 | cmd->duplex = 0xff; |
1825 | } | 1825 | } |
1826 | cmd->maxtxpkt = 0; | 1826 | cmd->maxtxpkt = 0; |
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c index e68ffe622e69..f1573d492e90 100644 --- a/drivers/net/bcm63xx_enet.c +++ b/drivers/net/bcm63xx_enet.c | |||
@@ -1346,7 +1346,8 @@ static int bcm_enet_get_settings(struct net_device *dev, | |||
1346 | return phy_ethtool_gset(priv->phydev, cmd); | 1346 | return phy_ethtool_gset(priv->phydev, cmd); |
1347 | } else { | 1347 | } else { |
1348 | cmd->autoneg = 0; | 1348 | cmd->autoneg = 0; |
1349 | cmd->speed = (priv->force_speed_100) ? SPEED_100 : SPEED_10; | 1349 | ethtool_cmd_speed_set(cmd, ((priv->force_speed_100) |
1350 | ? SPEED_100 : SPEED_10)); | ||
1350 | cmd->duplex = (priv->force_duplex_full) ? | 1351 | cmd->duplex = (priv->force_duplex_full) ? |
1351 | DUPLEX_FULL : DUPLEX_HALF; | 1352 | DUPLEX_FULL : DUPLEX_HALF; |
1352 | cmd->supported = ADVERTISED_10baseT_Half | | 1353 | cmd->supported = ADVERTISED_10baseT_Half | |
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 6565f3e55b26..8e770e8275df 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -381,23 +381,23 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
381 | be_link_status_update(adapter, link_up); | 381 | be_link_status_update(adapter, link_up); |
382 | /* link_speed is in units of 10 Mbps */ | 382 | /* link_speed is in units of 10 Mbps */ |
383 | if (link_speed) { | 383 | if (link_speed) { |
384 | ecmd->speed = link_speed*10; | 384 | ethtool_cmd_speed_set(ecmd, link_speed*10); |
385 | } else { | 385 | } else { |
386 | switch (mac_speed) { | 386 | switch (mac_speed) { |
387 | case PHY_LINK_SPEED_10MBPS: | 387 | case PHY_LINK_SPEED_10MBPS: |
388 | ecmd->speed = SPEED_10; | 388 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
389 | break; | 389 | break; |
390 | case PHY_LINK_SPEED_100MBPS: | 390 | case PHY_LINK_SPEED_100MBPS: |
391 | ecmd->speed = SPEED_100; | 391 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
392 | break; | 392 | break; |
393 | case PHY_LINK_SPEED_1GBPS: | 393 | case PHY_LINK_SPEED_1GBPS: |
394 | ecmd->speed = SPEED_1000; | 394 | ethtool_cmd_speed_set(ecmd, SPEED_1000); |
395 | break; | 395 | break; |
396 | case PHY_LINK_SPEED_10GBPS: | 396 | case PHY_LINK_SPEED_10GBPS: |
397 | ecmd->speed = SPEED_10000; | 397 | ethtool_cmd_speed_set(ecmd, SPEED_10000); |
398 | break; | 398 | break; |
399 | case PHY_LINK_SPEED_ZERO: | 399 | case PHY_LINK_SPEED_ZERO: |
400 | ecmd->speed = 0; | 400 | ethtool_cmd_speed_set(ecmd, 0); |
401 | break; | 401 | break; |
402 | } | 402 | } |
403 | } | 403 | } |
@@ -440,14 +440,14 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
440 | } | 440 | } |
441 | 441 | ||
442 | /* Save for future use */ | 442 | /* Save for future use */ |
443 | adapter->link_speed = ecmd->speed; | 443 | adapter->link_speed = ethtool_cmd_speed(ecmd); |
444 | adapter->port_type = ecmd->port; | 444 | adapter->port_type = ecmd->port; |
445 | adapter->transceiver = ecmd->transceiver; | 445 | adapter->transceiver = ecmd->transceiver; |
446 | adapter->autoneg = ecmd->autoneg; | 446 | adapter->autoneg = ecmd->autoneg; |
447 | dma_free_coherent(&adapter->pdev->dev, phy_cmd.size, phy_cmd.va, | 447 | dma_free_coherent(&adapter->pdev->dev, phy_cmd.size, phy_cmd.va, |
448 | phy_cmd.dma); | 448 | phy_cmd.dma); |
449 | } else { | 449 | } else { |
450 | ecmd->speed = adapter->link_speed; | 450 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
451 | ecmd->port = adapter->port_type; | 451 | ecmd->port = adapter->port_type; |
452 | ecmd->transceiver = adapter->transceiver; | 452 | ecmd->transceiver = adapter->transceiver; |
453 | ecmd->autoneg = adapter->autoneg; | 453 | ecmd->autoneg = adapter->autoneg; |
diff --git a/drivers/net/bna/bnad_ethtool.c b/drivers/net/bna/bnad_ethtool.c index ae1e118f9c3a..3330cd78da2c 100644 --- a/drivers/net/bna/bnad_ethtool.c +++ b/drivers/net/bna/bnad_ethtool.c | |||
@@ -237,10 +237,10 @@ bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | |||
237 | cmd->phy_address = 0; | 237 | cmd->phy_address = 0; |
238 | 238 | ||
239 | if (netif_carrier_ok(netdev)) { | 239 | if (netif_carrier_ok(netdev)) { |
240 | cmd->speed = SPEED_10000; | 240 | ethtool_cmd_speed_set(cmd, SPEED_10000); |
241 | cmd->duplex = DUPLEX_FULL; | 241 | cmd->duplex = DUPLEX_FULL; |
242 | } else { | 242 | } else { |
243 | cmd->speed = -1; | 243 | ethtool_cmd_speed_set(cmd, -1); |
244 | cmd->duplex = -1; | 244 | cmd->duplex = -1; |
245 | } | 245 | } |
246 | cmd->transceiver = XCVR_EXTERNAL; | 246 | cmd->transceiver = XCVR_EXTERNAL; |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index e43efd86425b..1bebdfb9679f 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -6696,17 +6696,16 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
6696 | 6696 | ||
6697 | if (bp->autoneg & AUTONEG_SPEED) { | 6697 | if (bp->autoneg & AUTONEG_SPEED) { |
6698 | cmd->autoneg = AUTONEG_ENABLE; | 6698 | cmd->autoneg = AUTONEG_ENABLE; |
6699 | } | 6699 | } else { |
6700 | else { | ||
6701 | cmd->autoneg = AUTONEG_DISABLE; | 6700 | cmd->autoneg = AUTONEG_DISABLE; |
6702 | } | 6701 | } |
6703 | 6702 | ||
6704 | if (netif_carrier_ok(dev)) { | 6703 | if (netif_carrier_ok(dev)) { |
6705 | cmd->speed = bp->line_speed; | 6704 | ethtool_cmd_speed_set(cmd, bp->line_speed); |
6706 | cmd->duplex = bp->duplex; | 6705 | cmd->duplex = bp->duplex; |
6707 | } | 6706 | } |
6708 | else { | 6707 | else { |
6709 | cmd->speed = -1; | 6708 | ethtool_cmd_speed_set(cmd, -1); |
6710 | cmd->duplex = -1; | 6709 | cmd->duplex = -1; |
6711 | } | 6710 | } |
6712 | spin_unlock_bh(&bp->phy_lock); | 6711 | spin_unlock_bh(&bp->phy_lock); |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index a6c3f8c8c302..22ce03e55b83 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -4606,18 +4606,17 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
4606 | if (bmcr & BMCR_ANENABLE) { | 4606 | if (bmcr & BMCR_ANENABLE) { |
4607 | cmd->advertising |= ADVERTISED_Autoneg; | 4607 | cmd->advertising |= ADVERTISED_Autoneg; |
4608 | cmd->autoneg = AUTONEG_ENABLE; | 4608 | cmd->autoneg = AUTONEG_ENABLE; |
4609 | cmd->speed = ((speed == 10) ? | 4609 | ethtool_cmd_speed_set(cmd, ((speed == 10) ? |
4610 | SPEED_10 : | 4610 | SPEED_10 : |
4611 | ((speed == 1000) ? | 4611 | ((speed == 1000) ? |
4612 | SPEED_1000 : SPEED_100)); | 4612 | SPEED_1000 : SPEED_100))); |
4613 | cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; | 4613 | cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; |
4614 | } else { | 4614 | } else { |
4615 | cmd->autoneg = AUTONEG_DISABLE; | 4615 | cmd->autoneg = AUTONEG_DISABLE; |
4616 | cmd->speed = | 4616 | ethtool_cmd_speed_set(cmd, ((bmcr & CAS_BMCR_SPEED1000) ? |
4617 | (bmcr & CAS_BMCR_SPEED1000) ? | 4617 | SPEED_1000 : |
4618 | SPEED_1000 : | 4618 | ((bmcr & BMCR_SPEED100) ? |
4619 | ((bmcr & BMCR_SPEED100) ? SPEED_100: | 4619 | SPEED_100 : SPEED_10))); |
4620 | SPEED_10); | ||
4621 | cmd->duplex = | 4620 | cmd->duplex = |
4622 | (bmcr & BMCR_FULLDPLX) ? | 4621 | (bmcr & BMCR_FULLDPLX) ? |
4623 | DUPLEX_FULL : DUPLEX_HALF; | 4622 | DUPLEX_FULL : DUPLEX_HALF; |
@@ -4634,14 +4633,14 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
4634 | * settings that we configured. | 4633 | * settings that we configured. |
4635 | */ | 4634 | */ |
4636 | if (cp->link_cntl & BMCR_ANENABLE) { | 4635 | if (cp->link_cntl & BMCR_ANENABLE) { |
4637 | cmd->speed = 0; | 4636 | ethtool_cmd_speed_set(cmd, 0); |
4638 | cmd->duplex = 0xff; | 4637 | cmd->duplex = 0xff; |
4639 | } else { | 4638 | } else { |
4640 | cmd->speed = SPEED_10; | 4639 | ethtool_cmd_speed_set(cmd, SPEED_10); |
4641 | if (cp->link_cntl & BMCR_SPEED100) { | 4640 | if (cp->link_cntl & BMCR_SPEED100) { |
4642 | cmd->speed = SPEED_100; | 4641 | ethtool_cmd_speed_set(cmd, SPEED_100); |
4643 | } else if (cp->link_cntl & CAS_BMCR_SPEED1000) { | 4642 | } else if (cp->link_cntl & CAS_BMCR_SPEED1000) { |
4644 | cmd->speed = SPEED_1000; | 4643 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
4645 | } | 4644 | } |
4646 | cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)? | 4645 | cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)? |
4647 | DUPLEX_FULL : DUPLEX_HALF; | 4646 | DUPLEX_FULL : DUPLEX_HALF; |
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 8e14d652996b..b422d83f5343 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c | |||
@@ -577,10 +577,10 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
577 | cmd->advertising = p->link_config.advertising; | 577 | cmd->advertising = p->link_config.advertising; |
578 | 578 | ||
579 | if (netif_carrier_ok(dev)) { | 579 | if (netif_carrier_ok(dev)) { |
580 | cmd->speed = p->link_config.speed; | 580 | ethtool_cmd_speed_set(cmd, p->link_config.speed); |
581 | cmd->duplex = p->link_config.duplex; | 581 | cmd->duplex = p->link_config.duplex; |
582 | } else { | 582 | } else { |
583 | cmd->speed = -1; | 583 | ethtool_cmd_speed_set(cmd, -1); |
584 | cmd->duplex = -1; | 584 | cmd->duplex = -1; |
585 | } | 585 | } |
586 | 586 | ||
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 0526715cc8c7..9081ce037149 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -1759,10 +1759,10 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1759 | cmd->advertising = p->link_config.advertising; | 1759 | cmd->advertising = p->link_config.advertising; |
1760 | 1760 | ||
1761 | if (netif_carrier_ok(dev)) { | 1761 | if (netif_carrier_ok(dev)) { |
1762 | cmd->speed = p->link_config.speed; | 1762 | ethtool_cmd_speed_set(cmd, p->link_config.speed); |
1763 | cmd->duplex = p->link_config.duplex; | 1763 | cmd->duplex = p->link_config.duplex; |
1764 | } else { | 1764 | } else { |
1765 | cmd->speed = -1; | 1765 | ethtool_cmd_speed_set(cmd, -1); |
1766 | cmd->duplex = -1; | 1766 | cmd->duplex = -1; |
1767 | } | 1767 | } |
1768 | 1768 | ||
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index c02b4d3b73fc..7e3cfbe89e3b 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -1436,7 +1436,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1436 | cmd->supported = from_fw_linkcaps(p->port_type, p->link_cfg.supported); | 1436 | cmd->supported = from_fw_linkcaps(p->port_type, p->link_cfg.supported); |
1437 | cmd->advertising = from_fw_linkcaps(p->port_type, | 1437 | cmd->advertising = from_fw_linkcaps(p->port_type, |
1438 | p->link_cfg.advertising); | 1438 | p->link_cfg.advertising); |
1439 | cmd->speed = netif_carrier_ok(dev) ? p->link_cfg.speed : 0; | 1439 | ethtool_cmd_speed_set(cmd, |
1440 | netif_carrier_ok(dev) ? p->link_cfg.speed : 0); | ||
1440 | cmd->duplex = DUPLEX_FULL; | 1441 | cmd->duplex = DUPLEX_FULL; |
1441 | cmd->autoneg = p->link_cfg.autoneg; | 1442 | cmd->autoneg = p->link_cfg.autoneg; |
1442 | cmd->maxtxpkt = 0; | 1443 | cmd->maxtxpkt = 0; |
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c index 8cf9890cafaf..e71c08e547e4 100644 --- a/drivers/net/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c | |||
@@ -1167,7 +1167,8 @@ static int cxgb4vf_get_settings(struct net_device *dev, | |||
1167 | 1167 | ||
1168 | cmd->supported = pi->link_cfg.supported; | 1168 | cmd->supported = pi->link_cfg.supported; |
1169 | cmd->advertising = pi->link_cfg.advertising; | 1169 | cmd->advertising = pi->link_cfg.advertising; |
1170 | cmd->speed = netif_carrier_ok(dev) ? pi->link_cfg.speed : -1; | 1170 | ethtool_cmd_speed_set(cmd, |
1171 | netif_carrier_ok(dev) ? pi->link_cfg.speed : -1); | ||
1171 | cmd->duplex = DUPLEX_FULL; | 1172 | cmd->duplex = DUPLEX_FULL; |
1172 | 1173 | ||
1173 | cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE; | 1174 | cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE; |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index ab63989619d4..c445457b66d5 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -1189,10 +1189,10 @@ static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1189 | cmd->transceiver = XCVR_INTERNAL; | 1189 | cmd->transceiver = XCVR_INTERNAL; |
1190 | } | 1190 | } |
1191 | if ( np->link_status ) { | 1191 | if ( np->link_status ) { |
1192 | cmd->speed = np->speed; | 1192 | ethtool_cmd_speed_set(cmd, np->speed); |
1193 | cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; | 1193 | cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; |
1194 | } else { | 1194 | } else { |
1195 | cmd->speed = -1; | 1195 | ethtool_cmd_speed_set(cmd, -1); |
1196 | cmd->duplex = -1; | 1196 | cmd->duplex = -1; |
1197 | } | 1197 | } |
1198 | if ( np->an_enable) | 1198 | if ( np->an_enable) |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index a53629d9325d..127fef4fce49 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -158,7 +158,7 @@ static int e1000_get_settings(struct net_device *netdev, | |||
158 | 158 | ||
159 | e1000_get_speed_and_duplex(hw, &adapter->link_speed, | 159 | e1000_get_speed_and_duplex(hw, &adapter->link_speed, |
160 | &adapter->link_duplex); | 160 | &adapter->link_duplex); |
161 | ecmd->speed = adapter->link_speed; | 161 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
162 | 162 | ||
163 | /* unfortunately FULL_DUPLEX != DUPLEX_FULL | 163 | /* unfortunately FULL_DUPLEX != DUPLEX_FULL |
164 | * and HALF_DUPLEX != DUPLEX_HALF */ | 164 | * and HALF_DUPLEX != DUPLEX_HALF */ |
@@ -168,7 +168,7 @@ static int e1000_get_settings(struct net_device *netdev, | |||
168 | else | 168 | else |
169 | ecmd->duplex = DUPLEX_HALF; | 169 | ecmd->duplex = DUPLEX_HALF; |
170 | } else { | 170 | } else { |
171 | ecmd->speed = -1; | 171 | ethtool_cmd_speed_set(ecmd, -1); |
172 | ecmd->duplex = -1; | 172 | ecmd->duplex = -1; |
173 | } | 173 | } |
174 | 174 | ||
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index bc02c6b91f15..12f1ee250522 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -122,6 +122,7 @@ static int e1000_get_settings(struct net_device *netdev, | |||
122 | { | 122 | { |
123 | struct e1000_adapter *adapter = netdev_priv(netdev); | 123 | struct e1000_adapter *adapter = netdev_priv(netdev); |
124 | struct e1000_hw *hw = &adapter->hw; | 124 | struct e1000_hw *hw = &adapter->hw; |
125 | u32 speed; | ||
125 | 126 | ||
126 | if (hw->phy.media_type == e1000_media_type_copper) { | 127 | if (hw->phy.media_type == e1000_media_type_copper) { |
127 | 128 | ||
@@ -159,23 +160,23 @@ static int e1000_get_settings(struct net_device *netdev, | |||
159 | ecmd->transceiver = XCVR_EXTERNAL; | 160 | ecmd->transceiver = XCVR_EXTERNAL; |
160 | } | 161 | } |
161 | 162 | ||
162 | ecmd->speed = -1; | 163 | speed = -1; |
163 | ecmd->duplex = -1; | 164 | ecmd->duplex = -1; |
164 | 165 | ||
165 | if (netif_running(netdev)) { | 166 | if (netif_running(netdev)) { |
166 | if (netif_carrier_ok(netdev)) { | 167 | if (netif_carrier_ok(netdev)) { |
167 | ecmd->speed = adapter->link_speed; | 168 | speed = adapter->link_speed; |
168 | ecmd->duplex = adapter->link_duplex - 1; | 169 | ecmd->duplex = adapter->link_duplex - 1; |
169 | } | 170 | } |
170 | } else { | 171 | } else { |
171 | u32 status = er32(STATUS); | 172 | u32 status = er32(STATUS); |
172 | if (status & E1000_STATUS_LU) { | 173 | if (status & E1000_STATUS_LU) { |
173 | if (status & E1000_STATUS_SPEED_1000) | 174 | if (status & E1000_STATUS_SPEED_1000) |
174 | ecmd->speed = 1000; | 175 | speed = SPEED_1000; |
175 | else if (status & E1000_STATUS_SPEED_100) | 176 | else if (status & E1000_STATUS_SPEED_100) |
176 | ecmd->speed = 100; | 177 | speed = SPEED_100; |
177 | else | 178 | else |
178 | ecmd->speed = 10; | 179 | speed = SPEED_10; |
179 | 180 | ||
180 | if (status & E1000_STATUS_FD) | 181 | if (status & E1000_STATUS_FD) |
181 | ecmd->duplex = DUPLEX_FULL; | 182 | ecmd->duplex = DUPLEX_FULL; |
@@ -184,6 +185,7 @@ static int e1000_get_settings(struct net_device *netdev, | |||
184 | } | 185 | } |
185 | } | 186 | } |
186 | 187 | ||
188 | ethtool_cmd_speed_set(ecmd, speed); | ||
187 | ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || | 189 | ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || |
188 | hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; | 190 | hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; |
189 | 191 | ||
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index eb35951a2442..dfeb006035df 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -1703,7 +1703,7 @@ static int eepro_ethtool_get_settings(struct net_device *dev, | |||
1703 | cmd->advertising |= ADVERTISED_AUI; | 1703 | cmd->advertising |= ADVERTISED_AUI; |
1704 | } | 1704 | } |
1705 | 1705 | ||
1706 | cmd->speed = SPEED_10; | 1706 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1707 | 1707 | ||
1708 | if (dev->if_port == TPE && lp->word[1] & ee_Duplex) { | 1708 | if (dev->if_port == TPE && lp->word[1] & ee_Duplex) { |
1709 | cmd->duplex = DUPLEX_FULL; | 1709 | cmd->duplex = DUPLEX_FULL; |
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c index 5f13491cf2a9..1df5f40c646d 100644 --- a/drivers/net/ehea/ehea_ethtool.c +++ b/drivers/net/ehea/ehea_ethtool.c | |||
@@ -34,6 +34,7 @@ | |||
34 | static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 34 | static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
35 | { | 35 | { |
36 | struct ehea_port *port = netdev_priv(dev); | 36 | struct ehea_port *port = netdev_priv(dev); |
37 | u32 speed; | ||
37 | int ret; | 38 | int ret; |
38 | 39 | ||
39 | ret = ehea_sense_port_attr(port); | 40 | ret = ehea_sense_port_attr(port); |
@@ -43,17 +44,29 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
43 | 44 | ||
44 | if (netif_carrier_ok(dev)) { | 45 | if (netif_carrier_ok(dev)) { |
45 | switch (port->port_speed) { | 46 | switch (port->port_speed) { |
46 | case EHEA_SPEED_10M: cmd->speed = SPEED_10; break; | 47 | case EHEA_SPEED_10M: |
47 | case EHEA_SPEED_100M: cmd->speed = SPEED_100; break; | 48 | speed = SPEED_10; |
48 | case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break; | 49 | break; |
49 | case EHEA_SPEED_10G: cmd->speed = SPEED_10000; break; | 50 | case EHEA_SPEED_100M: |
51 | speed = SPEED_100; | ||
52 | break; | ||
53 | case EHEA_SPEED_1G: | ||
54 | speed = SPEED_1000; | ||
55 | break; | ||
56 | case EHEA_SPEED_10G: | ||
57 | speed = SPEED_10000; | ||
58 | break; | ||
59 | default: | ||
60 | speed = -1; | ||
61 | break; /* BUG */ | ||
50 | } | 62 | } |
51 | cmd->duplex = port->full_duplex == 1 ? | 63 | cmd->duplex = port->full_duplex == 1 ? |
52 | DUPLEX_FULL : DUPLEX_HALF; | 64 | DUPLEX_FULL : DUPLEX_HALF; |
53 | } else { | 65 | } else { |
54 | cmd->speed = -1; | 66 | speed = ~0; |
55 | cmd->duplex = -1; | 67 | cmd->duplex = -1; |
56 | } | 68 | } |
69 | ethtool_cmd_speed_set(cmd, speed); | ||
57 | 70 | ||
58 | cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full | 71 | cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full |
59 | | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half | 72 | | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half |
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 81a793747f2e..2837ce209cd7 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c | |||
@@ -1488,7 +1488,7 @@ enc28j60_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1488 | cmd->supported = SUPPORTED_10baseT_Half | 1488 | cmd->supported = SUPPORTED_10baseT_Half |
1489 | | SUPPORTED_10baseT_Full | 1489 | | SUPPORTED_10baseT_Full |
1490 | | SUPPORTED_TP; | 1490 | | SUPPORTED_TP; |
1491 | cmd->speed = SPEED_10; | 1491 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1492 | cmd->duplex = priv->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; | 1492 | cmd->duplex = priv->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; |
1493 | cmd->port = PORT_TP; | 1493 | cmd->port = PORT_TP; |
1494 | cmd->autoneg = AUTONEG_DISABLE; | 1494 | cmd->autoneg = AUTONEG_DISABLE; |
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index b2245511c51a..3d99b0f1a236 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
@@ -180,10 +180,10 @@ static int enic_get_settings(struct net_device *netdev, | |||
180 | ecmd->transceiver = XCVR_EXTERNAL; | 180 | ecmd->transceiver = XCVR_EXTERNAL; |
181 | 181 | ||
182 | if (netif_carrier_ok(netdev)) { | 182 | if (netif_carrier_ok(netdev)) { |
183 | ecmd->speed = vnic_dev_port_speed(enic->vdev); | 183 | ethtool_cmd_speed_set(ecmd, vnic_dev_port_speed(enic->vdev)); |
184 | ecmd->duplex = DUPLEX_FULL; | 184 | ecmd->duplex = DUPLEX_FULL; |
185 | } else { | 185 | } else { |
186 | ecmd->speed = -1; | 186 | ethtool_cmd_speed_set(ecmd, -1); |
187 | ecmd->duplex = -1; | 187 | ecmd->duplex = -1; |
188 | } | 188 | } |
189 | 189 | ||
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c index 17b6027d8be8..b5f6173130f4 100644 --- a/drivers/net/ewrk3.c +++ b/drivers/net/ewrk3.c | |||
@@ -1545,7 +1545,7 @@ static int ewrk3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | ecmd->supported |= SUPPORTED_10baseT_Half; | 1547 | ecmd->supported |= SUPPORTED_10baseT_Half; |
1548 | ecmd->speed = SPEED_10; | 1548 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
1549 | ecmd->duplex = DUPLEX_HALF; | 1549 | ecmd->duplex = DUPLEX_HALF; |
1550 | return 0; | 1550 | return 0; |
1551 | } | 1551 | } |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index d24b3f3e646b..d09e8b0add01 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3955,6 +3955,7 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) | |||
3955 | static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 3955 | static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
3956 | { | 3956 | { |
3957 | struct fe_priv *np = netdev_priv(dev); | 3957 | struct fe_priv *np = netdev_priv(dev); |
3958 | u32 speed; | ||
3958 | int adv; | 3959 | int adv; |
3959 | 3960 | ||
3960 | spin_lock_irq(&np->lock); | 3961 | spin_lock_irq(&np->lock); |
@@ -3974,23 +3975,26 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
3974 | if (netif_carrier_ok(dev)) { | 3975 | if (netif_carrier_ok(dev)) { |
3975 | switch (np->linkspeed & (NVREG_LINKSPEED_MASK)) { | 3976 | switch (np->linkspeed & (NVREG_LINKSPEED_MASK)) { |
3976 | case NVREG_LINKSPEED_10: | 3977 | case NVREG_LINKSPEED_10: |
3977 | ecmd->speed = SPEED_10; | 3978 | speed = SPEED_10; |
3978 | break; | 3979 | break; |
3979 | case NVREG_LINKSPEED_100: | 3980 | case NVREG_LINKSPEED_100: |
3980 | ecmd->speed = SPEED_100; | 3981 | speed = SPEED_100; |
3981 | break; | 3982 | break; |
3982 | case NVREG_LINKSPEED_1000: | 3983 | case NVREG_LINKSPEED_1000: |
3983 | ecmd->speed = SPEED_1000; | 3984 | speed = SPEED_1000; |
3985 | break; | ||
3986 | default: | ||
3987 | speed = -1; | ||
3984 | break; | 3988 | break; |
3985 | } | 3989 | } |
3986 | ecmd->duplex = DUPLEX_HALF; | 3990 | ecmd->duplex = DUPLEX_HALF; |
3987 | if (np->duplex) | 3991 | if (np->duplex) |
3988 | ecmd->duplex = DUPLEX_FULL; | 3992 | ecmd->duplex = DUPLEX_FULL; |
3989 | } else { | 3993 | } else { |
3990 | ecmd->speed = -1; | 3994 | speed = -1; |
3991 | ecmd->duplex = -1; | 3995 | ecmd->duplex = -1; |
3992 | } | 3996 | } |
3993 | 3997 | ethtool_cmd_speed_set(ecmd, speed); | |
3994 | ecmd->autoneg = np->autoneg; | 3998 | ecmd->autoneg = np->autoneg; |
3995 | 3999 | ||
3996 | ecmd->advertising = ADVERTISED_MII; | 4000 | ecmd->advertising = ADVERTISED_MII; |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index be3fe71b9c90..b388d782c7c4 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -710,7 +710,7 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
710 | SUPPORTED_FIBRE); | 710 | SUPPORTED_FIBRE); |
711 | cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg | | 711 | cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg | |
712 | ADVERTISED_FIBRE); | 712 | ADVERTISED_FIBRE); |
713 | cmd->speed = SPEED_1000; | 713 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
714 | cmd->duplex = DUPLEX_FULL; | 714 | cmd->duplex = DUPLEX_FULL; |
715 | cmd->port = PORT_FIBRE; | 715 | cmd->port = PORT_FIBRE; |
716 | cmd->phy_address = 0; | 716 | cmd->phy_address = 0; |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index 2cc221b65cd4..023aa9b10654 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -178,11 +178,11 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
178 | 178 | ||
179 | if ((status & E1000_STATUS_SPEED_1000) || | 179 | if ((status & E1000_STATUS_SPEED_1000) || |
180 | hw->phy.media_type != e1000_media_type_copper) | 180 | hw->phy.media_type != e1000_media_type_copper) |
181 | ecmd->speed = SPEED_1000; | 181 | ethtool_cmd_speed_set(ecmd, SPEED_1000); |
182 | else if (status & E1000_STATUS_SPEED_100) | 182 | else if (status & E1000_STATUS_SPEED_100) |
183 | ecmd->speed = SPEED_100; | 183 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
184 | else | 184 | else |
185 | ecmd->speed = SPEED_10; | 185 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
186 | 186 | ||
187 | if ((status & E1000_STATUS_FD) || | 187 | if ((status & E1000_STATUS_FD) || |
188 | hw->phy.media_type != e1000_media_type_copper) | 188 | hw->phy.media_type != e1000_media_type_copper) |
@@ -190,7 +190,7 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
190 | else | 190 | else |
191 | ecmd->duplex = DUPLEX_HALF; | 191 | ecmd->duplex = DUPLEX_HALF; |
192 | } else { | 192 | } else { |
193 | ecmd->speed = -1; | 193 | ethtool_cmd_speed_set(ecmd, -1); |
194 | ecmd->duplex = -1; | 194 | ecmd->duplex = -1; |
195 | } | 195 | } |
196 | 196 | ||
diff --git a/drivers/net/igbvf/ethtool.c b/drivers/net/igbvf/ethtool.c index 1d943aa7c7a6..112ae15b2d49 100644 --- a/drivers/net/igbvf/ethtool.c +++ b/drivers/net/igbvf/ethtool.c | |||
@@ -90,18 +90,18 @@ static int igbvf_get_settings(struct net_device *netdev, | |||
90 | status = er32(STATUS); | 90 | status = er32(STATUS); |
91 | if (status & E1000_STATUS_LU) { | 91 | if (status & E1000_STATUS_LU) { |
92 | if (status & E1000_STATUS_SPEED_1000) | 92 | if (status & E1000_STATUS_SPEED_1000) |
93 | ecmd->speed = 1000; | 93 | ethtool_cmd_speed_set(ecmd, SPEED_1000); |
94 | else if (status & E1000_STATUS_SPEED_100) | 94 | else if (status & E1000_STATUS_SPEED_100) |
95 | ecmd->speed = 100; | 95 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
96 | else | 96 | else |
97 | ecmd->speed = 10; | 97 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
98 | 98 | ||
99 | if (status & E1000_STATUS_FD) | 99 | if (status & E1000_STATUS_FD) |
100 | ecmd->duplex = DUPLEX_FULL; | 100 | ecmd->duplex = DUPLEX_FULL; |
101 | else | 101 | else |
102 | ecmd->duplex = DUPLEX_HALF; | 102 | ecmd->duplex = DUPLEX_HALF; |
103 | } else { | 103 | } else { |
104 | ecmd->speed = -1; | 104 | ethtool_cmd_speed_set(ecmd, -1); |
105 | ecmd->duplex = -1; | 105 | ecmd->duplex = -1; |
106 | } | 106 | } |
107 | 107 | ||
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c index edb3d7eaf6d5..5f224c387e0c 100644 --- a/drivers/net/ixgb/ixgb_ethtool.c +++ b/drivers/net/ixgb/ixgb_ethtool.c | |||
@@ -104,10 +104,10 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
104 | ecmd->transceiver = XCVR_EXTERNAL; | 104 | ecmd->transceiver = XCVR_EXTERNAL; |
105 | 105 | ||
106 | if (netif_carrier_ok(adapter->netdev)) { | 106 | if (netif_carrier_ok(adapter->netdev)) { |
107 | ecmd->speed = SPEED_10000; | 107 | ethtool_cmd_speed_set(ecmd, SPEED_10000); |
108 | ecmd->duplex = DUPLEX_FULL; | 108 | ecmd->duplex = DUPLEX_FULL; |
109 | } else { | 109 | } else { |
110 | ecmd->speed = -1; | 110 | ethtool_cmd_speed_set(ecmd, -1); |
111 | ecmd->duplex = -1; | 111 | ecmd->duplex = -1; |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index c52243d67edc..bcba057b510f 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -288,20 +288,20 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
288 | if (link_up) { | 288 | if (link_up) { |
289 | switch (link_speed) { | 289 | switch (link_speed) { |
290 | case IXGBE_LINK_SPEED_10GB_FULL: | 290 | case IXGBE_LINK_SPEED_10GB_FULL: |
291 | ecmd->speed = SPEED_10000; | 291 | ethtool_cmd_speed_set(ecmd, SPEED_10000); |
292 | break; | 292 | break; |
293 | case IXGBE_LINK_SPEED_1GB_FULL: | 293 | case IXGBE_LINK_SPEED_1GB_FULL: |
294 | ecmd->speed = SPEED_1000; | 294 | ethtool_cmd_speed_set(ecmd, SPEED_1000); |
295 | break; | 295 | break; |
296 | case IXGBE_LINK_SPEED_100_FULL: | 296 | case IXGBE_LINK_SPEED_100_FULL: |
297 | ecmd->speed = SPEED_100; | 297 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
298 | break; | 298 | break; |
299 | default: | 299 | default: |
300 | break; | 300 | break; |
301 | } | 301 | } |
302 | ecmd->duplex = DUPLEX_FULL; | 302 | ecmd->duplex = DUPLEX_FULL; |
303 | } else { | 303 | } else { |
304 | ecmd->speed = -1; | 304 | ethtool_cmd_speed_set(ecmd, -1); |
305 | ecmd->duplex = -1; | 305 | ecmd->duplex = -1; |
306 | } | 306 | } |
307 | 307 | ||
diff --git a/drivers/net/ixgbevf/ethtool.c b/drivers/net/ixgbevf/ethtool.c index 0563ab29264e..deee3754b1f7 100644 --- a/drivers/net/ixgbevf/ethtool.c +++ b/drivers/net/ixgbevf/ethtool.c | |||
@@ -104,11 +104,13 @@ static int ixgbevf_get_settings(struct net_device *netdev, | |||
104 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); | 104 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); |
105 | 105 | ||
106 | if (link_up) { | 106 | if (link_up) { |
107 | ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ? | 107 | ethtool_cmd_speed_set( |
108 | SPEED_10000 : SPEED_1000; | 108 | ecmd, |
109 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ? | ||
110 | SPEED_10000 : SPEED_1000); | ||
109 | ecmd->duplex = DUPLEX_FULL; | 111 | ecmd->duplex = DUPLEX_FULL; |
110 | } else { | 112 | } else { |
111 | ecmd->speed = -1; | 113 | ethtool_cmd_speed_set(ecmd, -1); |
112 | ecmd->duplex = -1; | 114 | ecmd->duplex = -1; |
113 | } | 115 | } |
114 | 116 | ||
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index f2d10abd0403..16fbb11d92ac 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c | |||
@@ -188,6 +188,7 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
188 | u32 npage_adv, u32 npage_lpa) | 188 | u32 npage_adv, u32 npage_lpa) |
189 | { | 189 | { |
190 | int reg; | 190 | int reg; |
191 | u32 speed; | ||
191 | 192 | ||
192 | ecmd->transceiver = XCVR_INTERNAL; | 193 | ecmd->transceiver = XCVR_INTERNAL; |
193 | ecmd->phy_address = mdio->prtad; | 194 | ecmd->phy_address = mdio->prtad; |
@@ -290,33 +291,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
290 | if (modes & (ADVERTISED_10000baseT_Full | | 291 | if (modes & (ADVERTISED_10000baseT_Full | |
291 | ADVERTISED_10000baseKX4_Full | | 292 | ADVERTISED_10000baseKX4_Full | |
292 | ADVERTISED_10000baseKR_Full)) { | 293 | ADVERTISED_10000baseKR_Full)) { |
293 | ecmd->speed = SPEED_10000; | 294 | speed = SPEED_10000; |
294 | ecmd->duplex = DUPLEX_FULL; | 295 | ecmd->duplex = DUPLEX_FULL; |
295 | } else if (modes & (ADVERTISED_1000baseT_Full | | 296 | } else if (modes & (ADVERTISED_1000baseT_Full | |
296 | ADVERTISED_1000baseT_Half | | 297 | ADVERTISED_1000baseT_Half | |
297 | ADVERTISED_1000baseKX_Full)) { | 298 | ADVERTISED_1000baseKX_Full)) { |
298 | ecmd->speed = SPEED_1000; | 299 | speed = SPEED_1000; |
299 | ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half); | 300 | ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half); |
300 | } else if (modes & (ADVERTISED_100baseT_Full | | 301 | } else if (modes & (ADVERTISED_100baseT_Full | |
301 | ADVERTISED_100baseT_Half)) { | 302 | ADVERTISED_100baseT_Half)) { |
302 | ecmd->speed = SPEED_100; | 303 | speed = SPEED_100; |
303 | ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full); | 304 | ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full); |
304 | } else { | 305 | } else { |
305 | ecmd->speed = SPEED_10; | 306 | speed = SPEED_10; |
306 | ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full); | 307 | ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full); |
307 | } | 308 | } |
308 | } else { | 309 | } else { |
309 | /* Report forced settings */ | 310 | /* Report forced settings */ |
310 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | 311 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, |
311 | MDIO_CTRL1); | 312 | MDIO_CTRL1); |
312 | ecmd->speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) * | 313 | speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) |
313 | ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10)); | 314 | * ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10)); |
314 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || | 315 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || |
315 | ecmd->speed == SPEED_10000); | 316 | speed == SPEED_10000); |
316 | } | 317 | } |
317 | 318 | ||
319 | ethtool_cmd_speed_set(ecmd, speed); | ||
320 | |||
318 | /* 10GBASE-T MDI/MDI-X */ | 321 | /* 10GBASE-T MDI/MDI-X */ |
319 | if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) { | 322 | if (ecmd->port == PORT_TP |
323 | && (ethtool_cmd_speed(ecmd) == SPEED_10000)) { | ||
320 | switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | 324 | switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, |
321 | MDIO_PMA_10GBT_SWAPPOL)) { | 325 | MDIO_PMA_10GBT_SWAPPOL)) { |
322 | case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: | 326 | case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: |
diff --git a/drivers/net/mii.c b/drivers/net/mii.c index e8198edeaa76..4fbc816efee2 100644 --- a/drivers/net/mii.c +++ b/drivers/net/mii.c | |||
@@ -121,22 +121,25 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) | |||
121 | 121 | ||
122 | if (nego & (ADVERTISED_1000baseT_Full | | 122 | if (nego & (ADVERTISED_1000baseT_Full | |
123 | ADVERTISED_1000baseT_Half)) { | 123 | ADVERTISED_1000baseT_Half)) { |
124 | ecmd->speed = SPEED_1000; | 124 | ethtool_cmd_speed_set(ecmd, SPEED_1000); |
125 | ecmd->duplex = !!(nego & ADVERTISED_1000baseT_Full); | 125 | ecmd->duplex = !!(nego & ADVERTISED_1000baseT_Full); |
126 | } else if (nego & (ADVERTISED_100baseT_Full | | 126 | } else if (nego & (ADVERTISED_100baseT_Full | |
127 | ADVERTISED_100baseT_Half)) { | 127 | ADVERTISED_100baseT_Half)) { |
128 | ecmd->speed = SPEED_100; | 128 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
129 | ecmd->duplex = !!(nego & ADVERTISED_100baseT_Full); | 129 | ecmd->duplex = !!(nego & ADVERTISED_100baseT_Full); |
130 | } else { | 130 | } else { |
131 | ecmd->speed = SPEED_10; | 131 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
132 | ecmd->duplex = !!(nego & ADVERTISED_10baseT_Full); | 132 | ecmd->duplex = !!(nego & ADVERTISED_10baseT_Full); |
133 | } | 133 | } |
134 | } else { | 134 | } else { |
135 | ecmd->autoneg = AUTONEG_DISABLE; | 135 | ecmd->autoneg = AUTONEG_DISABLE; |
136 | 136 | ||
137 | ecmd->speed = ((bmcr & BMCR_SPEED1000 && | 137 | ethtool_cmd_speed_set(ecmd, |
138 | (bmcr & BMCR_SPEED100) == 0) ? SPEED_1000 : | 138 | ((bmcr & BMCR_SPEED1000 && |
139 | (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10); | 139 | (bmcr & BMCR_SPEED100) == 0) ? |
140 | SPEED_1000 : | ||
141 | ((bmcr & BMCR_SPEED100) ? | ||
142 | SPEED_100 : SPEED_10))); | ||
140 | ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF; | 143 | ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF; |
141 | } | 144 | } |
142 | 145 | ||
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c index be4a9e0b2406..2e858e4dcf4d 100644 --- a/drivers/net/mlx4/en_ethtool.c +++ b/drivers/net/mlx4/en_ethtool.c | |||
@@ -265,10 +265,10 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
265 | 265 | ||
266 | trans_type = priv->port_state.transciver; | 266 | trans_type = priv->port_state.transciver; |
267 | if (netif_carrier_ok(dev)) { | 267 | if (netif_carrier_ok(dev)) { |
268 | cmd->speed = priv->port_state.link_speed; | 268 | ethtool_cmd_speed_set(cmd, priv->port_state.link_speed); |
269 | cmd->duplex = DUPLEX_FULL; | 269 | cmd->duplex = DUPLEX_FULL; |
270 | } else { | 270 | } else { |
271 | cmd->speed = -1; | 271 | ethtool_cmd_speed_set(cmd, -1); |
272 | cmd->duplex = -1; | 272 | cmd->duplex = -1; |
273 | } | 273 | } |
274 | 274 | ||
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 57c2ac04f9ff..a5d9b1c310b3 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1444,13 +1444,13 @@ mv643xx_eth_get_settings_phyless(struct mv643xx_eth_private *mp, | |||
1444 | cmd->advertising = ADVERTISED_MII; | 1444 | cmd->advertising = ADVERTISED_MII; |
1445 | switch (port_status & PORT_SPEED_MASK) { | 1445 | switch (port_status & PORT_SPEED_MASK) { |
1446 | case PORT_SPEED_10: | 1446 | case PORT_SPEED_10: |
1447 | cmd->speed = SPEED_10; | 1447 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1448 | break; | 1448 | break; |
1449 | case PORT_SPEED_100: | 1449 | case PORT_SPEED_100: |
1450 | cmd->speed = SPEED_100; | 1450 | ethtool_cmd_speed_set(cmd, SPEED_100); |
1451 | break; | 1451 | break; |
1452 | case PORT_SPEED_1000: | 1452 | case PORT_SPEED_1000: |
1453 | cmd->speed = SPEED_1000; | 1453 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
1454 | break; | 1454 | break; |
1455 | default: | 1455 | default: |
1456 | cmd->speed = -1; | 1456 | cmd->speed = -1; |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index e7f801643c12..b1358f79ba0a 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -1644,7 +1644,7 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | |||
1644 | int i; | 1644 | int i; |
1645 | 1645 | ||
1646 | cmd->autoneg = AUTONEG_DISABLE; | 1646 | cmd->autoneg = AUTONEG_DISABLE; |
1647 | cmd->speed = SPEED_10000; | 1647 | ethtool_cmd_speed_set(cmd, SPEED_10000); |
1648 | cmd->duplex = DUPLEX_FULL; | 1648 | cmd->duplex = DUPLEX_FULL; |
1649 | 1649 | ||
1650 | /* | 1650 | /* |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 7633c67b7842..b78be088c4ad 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -2820,7 +2820,7 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
2820 | u32 tmp; | 2820 | u32 tmp; |
2821 | 2821 | ||
2822 | ecmd->port = dev->if_port; | 2822 | ecmd->port = dev->if_port; |
2823 | ecmd->speed = np->speed; | 2823 | ethtool_cmd_speed_set(ecmd, np->speed); |
2824 | ecmd->duplex = np->duplex; | 2824 | ecmd->duplex = np->duplex; |
2825 | ecmd->autoneg = np->autoneg; | 2825 | ecmd->autoneg = np->autoneg; |
2826 | ecmd->advertising = 0; | 2826 | ecmd->advertising = 0; |
@@ -2878,9 +2878,9 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
2878 | tmp = mii_nway_result( | 2878 | tmp = mii_nway_result( |
2879 | np->advertising & mdio_read(dev, MII_LPA)); | 2879 | np->advertising & mdio_read(dev, MII_LPA)); |
2880 | if (tmp == LPA_100FULL || tmp == LPA_100HALF) | 2880 | if (tmp == LPA_100FULL || tmp == LPA_100HALF) |
2881 | ecmd->speed = SPEED_100; | 2881 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
2882 | else | 2882 | else |
2883 | ecmd->speed = SPEED_10; | 2883 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
2884 | if (tmp == LPA_100FULL || tmp == LPA_10FULL) | 2884 | if (tmp == LPA_100FULL || tmp == LPA_10FULL) |
2885 | ecmd->duplex = DUPLEX_FULL; | 2885 | ecmd->duplex = DUPLEX_FULL; |
2886 | else | 2886 | else |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index e8d16f6f11e3..b34fb74d07e3 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -117,7 +117,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
117 | 117 | ||
118 | ecmd->port = PORT_TP; | 118 | ecmd->port = PORT_TP; |
119 | 119 | ||
120 | ecmd->speed = adapter->link_speed; | 120 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
121 | ecmd->duplex = adapter->link_duplex; | 121 | ecmd->duplex = adapter->link_duplex; |
122 | ecmd->autoneg = adapter->link_autoneg; | 122 | ecmd->autoneg = adapter->link_autoneg; |
123 | 123 | ||
@@ -134,7 +134,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | if (netif_running(dev) && adapter->has_link_events) { | 136 | if (netif_running(dev) && adapter->has_link_events) { |
137 | ecmd->speed = adapter->link_speed; | 137 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
138 | ecmd->autoneg = adapter->link_autoneg; | 138 | ecmd->autoneg = adapter->link_autoneg; |
139 | ecmd->duplex = adapter->link_duplex; | 139 | ecmd->duplex = adapter->link_duplex; |
140 | goto skip; | 140 | goto skip; |
@@ -146,10 +146,10 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
146 | u16 pcifn = adapter->ahw.pci_func; | 146 | u16 pcifn = adapter->ahw.pci_func; |
147 | 147 | ||
148 | val = NXRD32(adapter, P3_LINK_SPEED_REG(pcifn)); | 148 | val = NXRD32(adapter, P3_LINK_SPEED_REG(pcifn)); |
149 | ecmd->speed = P3_LINK_SPEED_MHZ * | 149 | ethtool_cmd_speed_set(ecmd, P3_LINK_SPEED_MHZ * |
150 | P3_LINK_SPEED_VAL(pcifn, val); | 150 | P3_LINK_SPEED_VAL(pcifn, val)); |
151 | } else | 151 | } else |
152 | ecmd->speed = SPEED_10000; | 152 | ethtool_cmd_speed_set(ecmd, SPEED_10000); |
153 | 153 | ||
154 | ecmd->duplex = DUPLEX_FULL; | 154 | ecmd->duplex = DUPLEX_FULL; |
155 | ecmd->autoneg = AUTONEG_DISABLE; | 155 | ecmd->autoneg = AUTONEG_DISABLE; |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 524e800ddcf4..cc25bff0bd3b 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -6844,7 +6844,7 @@ static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
6844 | cmd->supported = lp->supported; | 6844 | cmd->supported = lp->supported; |
6845 | cmd->advertising = lp->active_advertising; | 6845 | cmd->advertising = lp->active_advertising; |
6846 | cmd->autoneg = lp->active_autoneg; | 6846 | cmd->autoneg = lp->active_autoneg; |
6847 | cmd->speed = lp->active_speed; | 6847 | ethtool_cmd_speed_set(cmd, lp->active_speed); |
6848 | cmd->duplex = lp->active_duplex; | 6848 | cmd->duplex = lp->active_duplex; |
6849 | cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP; | 6849 | cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP; |
6850 | cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ? | 6850 | cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ? |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 6667e0667a88..3e4040f2f3cb 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -1251,7 +1251,7 @@ static int ns83820_get_settings(struct net_device *ndev, | |||
1251 | /* | 1251 | /* |
1252 | * Here's the list of available ethtool commands from other drivers: | 1252 | * Here's the list of available ethtool commands from other drivers: |
1253 | * cmd->advertising = | 1253 | * cmd->advertising = |
1254 | * cmd->speed = | 1254 | * ethtool_cmd_speed_set(cmd, ...) |
1255 | * cmd->duplex = | 1255 | * cmd->duplex = |
1256 | * cmd->port = 0; | 1256 | * cmd->port = 0; |
1257 | * cmd->phy_address = | 1257 | * cmd->phy_address = |
@@ -1289,13 +1289,13 @@ static int ns83820_get_settings(struct net_device *ndev, | |||
1289 | cmd->duplex = fullduplex ? DUPLEX_FULL : DUPLEX_HALF; | 1289 | cmd->duplex = fullduplex ? DUPLEX_FULL : DUPLEX_HALF; |
1290 | switch (cfg / CFG_SPDSTS0 & 3) { | 1290 | switch (cfg / CFG_SPDSTS0 & 3) { |
1291 | case 2: | 1291 | case 2: |
1292 | cmd->speed = SPEED_1000; | 1292 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
1293 | break; | 1293 | break; |
1294 | case 1: | 1294 | case 1: |
1295 | cmd->speed = SPEED_100; | 1295 | ethtool_cmd_speed_set(cmd, SPEED_100); |
1296 | break; | 1296 | break; |
1297 | default: | 1297 | default: |
1298 | cmd->speed = SPEED_10; | 1298 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1299 | break; | 1299 | break; |
1300 | } | 1300 | } |
1301 | cmd->autoneg = (tbicr & TBICR_MR_AN_ENABLE) | 1301 | cmd->autoneg = (tbicr & TBICR_MR_AN_ENABLE) |
diff --git a/drivers/net/pch_gbe/pch_gbe_phy.c b/drivers/net/pch_gbe/pch_gbe_phy.c index 9a8207f686fd..28bb9603d736 100644 --- a/drivers/net/pch_gbe/pch_gbe_phy.c +++ b/drivers/net/pch_gbe/pch_gbe_phy.c | |||
@@ -256,7 +256,7 @@ void pch_gbe_phy_init_setting(struct pch_gbe_hw *hw) | |||
256 | if (ret) | 256 | if (ret) |
257 | pr_err("Error: mii_ethtool_gset\n"); | 257 | pr_err("Error: mii_ethtool_gset\n"); |
258 | 258 | ||
259 | cmd.speed = hw->mac.link_speed; | 259 | ethtool_cmd_speed_set(&cmd, hw->mac.link_speed); |
260 | cmd.duplex = hw->mac.link_duplex; | 260 | cmd.duplex = hw->mac.link_duplex; |
261 | cmd.advertising = hw->phy.autoneg_advertised; | 261 | cmd.advertising = hw->phy.autoneg_advertised; |
262 | cmd.autoneg = hw->mac.autoneg; | 262 | cmd.autoneg = hw->mac.autoneg; |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index bc71cb260ff4..288e4f1317ee 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -1860,7 +1860,7 @@ static int smc_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1860 | tmp = inw(ioaddr + CONFIG); | 1860 | tmp = inw(ioaddr + CONFIG); |
1861 | ecmd->port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP; | 1861 | ecmd->port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP; |
1862 | ecmd->transceiver = XCVR_INTERNAL; | 1862 | ecmd->transceiver = XCVR_INTERNAL; |
1863 | ecmd->speed = SPEED_10; | 1863 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
1864 | ecmd->phy_address = ioaddr + MGMT; | 1864 | ecmd->phy_address = ioaddr + MGMT; |
1865 | 1865 | ||
1866 | SMC_SELECT_BANK(0); | 1866 | SMC_SELECT_BANK(0); |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e3f3501d4347..a47595760751 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -288,7 +288,7 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) | |||
288 | 288 | ||
289 | cmd->advertising = phydev->advertising; | 289 | cmd->advertising = phydev->advertising; |
290 | 290 | ||
291 | cmd->speed = phydev->speed; | 291 | ethtool_cmd_speed_set(cmd, phydev->speed); |
292 | cmd->duplex = phydev->duplex; | 292 | cmd->duplex = phydev->duplex; |
293 | cmd->port = PORT_MII; | 293 | cmd->port = PORT_MII; |
294 | cmd->phy_address = phydev->addr; | 294 | cmd->phy_address = phydev->addr; |
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c index 4383ed21813e..b1f251da1535 100644 --- a/drivers/net/ps3_gelic_net.c +++ b/drivers/net/ps3_gelic_net.c | |||
@@ -1243,17 +1243,17 @@ static int gelic_ether_get_settings(struct net_device *netdev, | |||
1243 | 1243 | ||
1244 | switch (card->ether_port_status & GELIC_LV1_ETHER_SPEED_MASK) { | 1244 | switch (card->ether_port_status & GELIC_LV1_ETHER_SPEED_MASK) { |
1245 | case GELIC_LV1_ETHER_SPEED_10: | 1245 | case GELIC_LV1_ETHER_SPEED_10: |
1246 | cmd->speed = SPEED_10; | 1246 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1247 | break; | 1247 | break; |
1248 | case GELIC_LV1_ETHER_SPEED_100: | 1248 | case GELIC_LV1_ETHER_SPEED_100: |
1249 | cmd->speed = SPEED_100; | 1249 | ethtool_cmd_speed_set(cmd, SPEED_100); |
1250 | break; | 1250 | break; |
1251 | case GELIC_LV1_ETHER_SPEED_1000: | 1251 | case GELIC_LV1_ETHER_SPEED_1000: |
1252 | cmd->speed = SPEED_1000; | 1252 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
1253 | break; | 1253 | break; |
1254 | default: | 1254 | default: |
1255 | pr_info("%s: speed unknown\n", __func__); | 1255 | pr_info("%s: speed unknown\n", __func__); |
1256 | cmd->speed = SPEED_10; | 1256 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1257 | break; | 1257 | break; |
1258 | } | 1258 | } |
1259 | 1259 | ||
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index f3f737b91248..d495a6859fd9 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -1725,7 +1725,7 @@ static int ql_get_settings(struct net_device *ndev, struct ethtool_cmd *ecmd) | |||
1725 | } | 1725 | } |
1726 | ecmd->advertising = ql_supported_modes(qdev); | 1726 | ecmd->advertising = ql_supported_modes(qdev); |
1727 | ecmd->autoneg = ql_get_auto_cfg_status(qdev); | 1727 | ecmd->autoneg = ql_get_auto_cfg_status(qdev); |
1728 | ecmd->speed = ql_get_speed(qdev); | 1728 | ethtool_cmd_speed_set(ecmd, ql_get_speed(qdev)); |
1729 | ecmd->duplex = ql_get_full_dup(qdev); | 1729 | ecmd->duplex = ql_get_full_dup(qdev); |
1730 | return 0; | 1730 | return 0; |
1731 | } | 1731 | } |
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c index 27726ebfba2a..c541461bc12c 100644 --- a/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/qlcnic/qlcnic_ethtool.c | |||
@@ -166,7 +166,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
166 | ADVERTISED_1000baseT_Half | | 166 | ADVERTISED_1000baseT_Half | |
167 | ADVERTISED_1000baseT_Full); | 167 | ADVERTISED_1000baseT_Full); |
168 | 168 | ||
169 | ecmd->speed = adapter->link_speed; | 169 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
170 | ecmd->duplex = adapter->link_duplex; | 170 | ecmd->duplex = adapter->link_duplex; |
171 | ecmd->autoneg = adapter->link_autoneg; | 171 | ecmd->autoneg = adapter->link_autoneg; |
172 | 172 | ||
@@ -183,15 +183,15 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
183 | } | 183 | } |
184 | 184 | ||
185 | if (netif_running(dev) && adapter->has_link_events) { | 185 | if (netif_running(dev) && adapter->has_link_events) { |
186 | ecmd->speed = adapter->link_speed; | 186 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
187 | ecmd->autoneg = adapter->link_autoneg; | 187 | ecmd->autoneg = adapter->link_autoneg; |
188 | ecmd->duplex = adapter->link_duplex; | 188 | ecmd->duplex = adapter->link_duplex; |
189 | goto skip; | 189 | goto skip; |
190 | } | 190 | } |
191 | 191 | ||
192 | val = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn)); | 192 | val = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn)); |
193 | ecmd->speed = P3P_LINK_SPEED_MHZ * | 193 | ethtool_cmd_speed_set(ecmd, P3P_LINK_SPEED_MHZ * |
194 | P3P_LINK_SPEED_VAL(pcifn, val); | 194 | P3P_LINK_SPEED_VAL(pcifn, val)); |
195 | ecmd->duplex = DUPLEX_FULL; | 195 | ecmd->duplex = DUPLEX_FULL; |
196 | ecmd->autoneg = AUTONEG_DISABLE; | 196 | ecmd->autoneg = AUTONEG_DISABLE; |
197 | } else | 197 | } else |
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c index 78dc40c18c60..19b00fa0eaf0 100644 --- a/drivers/net/qlge/qlge_ethtool.c +++ b/drivers/net/qlge/qlge_ethtool.c | |||
@@ -356,7 +356,7 @@ static int ql_get_settings(struct net_device *ndev, | |||
356 | ecmd->port = PORT_FIBRE; | 356 | ecmd->port = PORT_FIBRE; |
357 | } | 357 | } |
358 | 358 | ||
359 | ecmd->speed = SPEED_10000; | 359 | ethtool_cmd_speed_set(ecmd, SPEED_10000); |
360 | ecmd->duplex = DUPLEX_FULL; | 360 | ecmd->duplex = DUPLEX_FULL; |
361 | 361 | ||
362 | return 0; | 362 | return 0; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index b52ee17de74d..a8976a753814 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1422,7 +1422,7 @@ static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1422 | cmd->advertising = (status & TBINwEnable) ? ADVERTISED_Autoneg : 0; | 1422 | cmd->advertising = (status & TBINwEnable) ? ADVERTISED_Autoneg : 0; |
1423 | cmd->autoneg = !!(status & TBINwEnable); | 1423 | cmd->autoneg = !!(status & TBINwEnable); |
1424 | 1424 | ||
1425 | cmd->speed = SPEED_1000; | 1425 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
1426 | cmd->duplex = DUPLEX_FULL; /* Always set */ | 1426 | cmd->duplex = DUPLEX_FULL; /* Always set */ |
1427 | 1427 | ||
1428 | return 0; | 1428 | return 0; |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 5443985c019e..89cfee7e8643 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -5414,10 +5414,10 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info) | |||
5414 | info->transceiver = XCVR_EXTERNAL; | 5414 | info->transceiver = XCVR_EXTERNAL; |
5415 | 5415 | ||
5416 | if (netif_carrier_ok(sp->dev)) { | 5416 | if (netif_carrier_ok(sp->dev)) { |
5417 | info->speed = 10000; | 5417 | ethtool_cmd_speed_set(info, SPEED_10000); |
5418 | info->duplex = DUPLEX_FULL; | 5418 | info->duplex = DUPLEX_FULL; |
5419 | } else { | 5419 | } else { |
5420 | info->speed = -1; | 5420 | ethtool_cmd_speed_set(info, -1); |
5421 | info->duplex = -1; | 5421 | info->duplex = -1; |
5422 | } | 5422 | } |
5423 | 5423 | ||
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c index f3ffc1df3b2d..fa74314ef789 100644 --- a/drivers/net/sc92031.c +++ b/drivers/net/sc92031.c | |||
@@ -1173,7 +1173,8 @@ static int sc92031_ethtool_get_settings(struct net_device *dev, | |||
1173 | if (phy_ctrl & PhyCtrlAne) | 1173 | if (phy_ctrl & PhyCtrlAne) |
1174 | cmd->advertising |= ADVERTISED_Autoneg; | 1174 | cmd->advertising |= ADVERTISED_Autoneg; |
1175 | 1175 | ||
1176 | cmd->speed = (output_status & 0x2) ? SPEED_100 : SPEED_10; | 1176 | ethtool_cmd_speed_set(cmd, |
1177 | (output_status & 0x2) ? SPEED_100 : SPEED_10); | ||
1177 | cmd->duplex = (output_status & 0x4) ? DUPLEX_FULL : DUPLEX_HALF; | 1178 | cmd->duplex = (output_status & 0x4) ? DUPLEX_FULL : DUPLEX_HALF; |
1178 | cmd->port = PORT_MII; | 1179 | cmd->port = PORT_MII; |
1179 | cmd->phy_address = phy_address; | 1180 | cmd->phy_address = phy_address; |
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 10b160a508f3..8c5e0052c44a 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -219,7 +219,7 @@ static int efx_ethtool_get_settings(struct net_device *net_dev, | |||
219 | ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; | 219 | ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; |
220 | 220 | ||
221 | if (LOOPBACK_INTERNAL(efx)) { | 221 | if (LOOPBACK_INTERNAL(efx)) { |
222 | ecmd->speed = link_state->speed; | 222 | ethtool_cmd_speed_set(ecmd, link_state->speed); |
223 | ecmd->duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; | 223 | ecmd->duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; |
224 | } | 224 | } |
225 | 225 | ||
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c index 6c5fccbdeca2..6c63ab0710af 100644 --- a/drivers/net/sfc/mcdi_phy.c +++ b/drivers/net/sfc/mcdi_phy.c | |||
@@ -513,7 +513,7 @@ static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *e | |||
513 | ecmd->supported = | 513 | ecmd->supported = |
514 | mcdi_to_ethtool_cap(phy_cfg->media, phy_cfg->supported_cap); | 514 | mcdi_to_ethtool_cap(phy_cfg->media, phy_cfg->supported_cap); |
515 | ecmd->advertising = efx->link_advertising; | 515 | ecmd->advertising = efx->link_advertising; |
516 | ecmd->speed = efx->link_state.speed; | 516 | ethtool_cmd_speed_set(ecmd, efx->link_state.speed); |
517 | ecmd->duplex = efx->link_state.fd; | 517 | ecmd->duplex = efx->link_state.fd; |
518 | ecmd->port = mcdi_to_ethtool_media(phy_cfg->media); | 518 | ecmd->port = mcdi_to_ethtool_media(phy_cfg->media); |
519 | ecmd->phy_address = phy_cfg->port; | 519 | ecmd->phy_address = phy_cfg->port; |
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index 204ecdaac9ab..7b0fd89e7b85 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -460,7 +460,7 @@ tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) | |||
460 | /* In loopback, the PHY automatically brings up the correct interface, | 460 | /* In loopback, the PHY automatically brings up the correct interface, |
461 | * but doesn't advertise the correct speed. So override it */ | 461 | * but doesn't advertise the correct speed. So override it */ |
462 | if (LOOPBACK_EXTERNAL(efx)) | 462 | if (LOOPBACK_EXTERNAL(efx)) |
463 | ecmd->speed = SPEED_10000; | 463 | ethtool_cmd_speed_set(ecmd, SPEED_10000); |
464 | } | 464 | } |
465 | 465 | ||
466 | static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) | 466 | static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index a05e864de674..52a48cb75440 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -303,7 +303,7 @@ static int skge_get_settings(struct net_device *dev, | |||
303 | 303 | ||
304 | ecmd->advertising = skge->advertising; | 304 | ecmd->advertising = skge->advertising; |
305 | ecmd->autoneg = skge->autoneg; | 305 | ecmd->autoneg = skge->autoneg; |
306 | ecmd->speed = skge->speed; | 306 | ethtool_cmd_speed_set(ecmd, skge->speed); |
307 | ecmd->duplex = skge->duplex; | 307 | ecmd->duplex = skge->duplex; |
308 | return 0; | 308 | return 0; |
309 | } | 309 | } |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 5c7e2d68df2a..3ee41da130c2 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3413,10 +3413,10 @@ static int sky2_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
3413 | ecmd->phy_address = PHY_ADDR_MARV; | 3413 | ecmd->phy_address = PHY_ADDR_MARV; |
3414 | if (sky2_is_copper(hw)) { | 3414 | if (sky2_is_copper(hw)) { |
3415 | ecmd->port = PORT_TP; | 3415 | ecmd->port = PORT_TP; |
3416 | ecmd->speed = sky2->speed; | 3416 | ethtool_cmd_speed_set(ecmd, sky2->speed); |
3417 | ecmd->supported |= SUPPORTED_Autoneg | SUPPORTED_TP; | 3417 | ecmd->supported |= SUPPORTED_Autoneg | SUPPORTED_TP; |
3418 | } else { | 3418 | } else { |
3419 | ecmd->speed = SPEED_1000; | 3419 | ethtool_cmd_speed_set(ecmd, SPEED_1000); |
3420 | ecmd->port = PORT_FIBRE; | 3420 | ecmd->port = PORT_FIBRE; |
3421 | ecmd->supported |= SUPPORTED_Autoneg | SUPPORTED_FIBRE; | 3421 | ecmd->supported |= SUPPORTED_Autoneg | SUPPORTED_FIBRE; |
3422 | } | 3422 | } |
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 66831f378396..053863aefb12 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -1488,9 +1488,9 @@ smc911x_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1488 | SUPPORTED_TP | SUPPORTED_AUI; | 1488 | SUPPORTED_TP | SUPPORTED_AUI; |
1489 | 1489 | ||
1490 | if (lp->ctl_rspeed == 10) | 1490 | if (lp->ctl_rspeed == 10) |
1491 | cmd->speed = SPEED_10; | 1491 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1492 | else if (lp->ctl_rspeed == 100) | 1492 | else if (lp->ctl_rspeed == 100) |
1493 | cmd->speed = SPEED_100; | 1493 | ethtool_cmd_speed_set(cmd, SPEED_100); |
1494 | 1494 | ||
1495 | cmd->autoneg = AUTONEG_DISABLE; | 1495 | cmd->autoneg = AUTONEG_DISABLE; |
1496 | if (lp->mii.phy_id==1) | 1496 | if (lp->mii.phy_id==1) |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 43654a3bb0ec..dc4805f473e3 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -1565,9 +1565,9 @@ smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1565 | SUPPORTED_TP | SUPPORTED_AUI; | 1565 | SUPPORTED_TP | SUPPORTED_AUI; |
1566 | 1566 | ||
1567 | if (lp->ctl_rspeed == 10) | 1567 | if (lp->ctl_rspeed == 10) |
1568 | cmd->speed = SPEED_10; | 1568 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1569 | else if (lp->ctl_rspeed == 100) | 1569 | else if (lp->ctl_rspeed == 100) |
1570 | cmd->speed = SPEED_100; | 1570 | ethtool_cmd_speed_set(cmd, SPEED_100); |
1571 | 1571 | ||
1572 | cmd->autoneg = AUTONEG_DISABLE; | 1572 | cmd->autoneg = AUTONEG_DISABLE; |
1573 | cmd->transceiver = XCVR_INTERNAL; | 1573 | cmd->transceiver = XCVR_INTERNAL; |
diff --git a/drivers/net/spider_net_ethtool.c b/drivers/net/spider_net_ethtool.c index d723fca872ce..9c288cd7d171 100644 --- a/drivers/net/spider_net_ethtool.c +++ b/drivers/net/spider_net_ethtool.c | |||
@@ -58,7 +58,7 @@ spider_net_ethtool_get_settings(struct net_device *netdev, | |||
58 | cmd->advertising = (ADVERTISED_1000baseT_Full | | 58 | cmd->advertising = (ADVERTISED_1000baseT_Full | |
59 | ADVERTISED_FIBRE); | 59 | ADVERTISED_FIBRE); |
60 | cmd->port = PORT_FIBRE; | 60 | cmd->port = PORT_FIBRE; |
61 | cmd->speed = card->phy.speed; | 61 | ethtool_cmd_speed_set(cmd, card->phy.speed); |
62 | cmd->duplex = DUPLEX_FULL; | 62 | cmd->duplex = DUPLEX_FULL; |
63 | 63 | ||
64 | return 0; | 64 | return 0; |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 40a755dd1a26..ab5930099267 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2642,7 +2642,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
2642 | /* Return current PHY settings */ | 2642 | /* Return current PHY settings */ |
2643 | spin_lock_irq(&gp->lock); | 2643 | spin_lock_irq(&gp->lock); |
2644 | cmd->autoneg = gp->want_autoneg; | 2644 | cmd->autoneg = gp->want_autoneg; |
2645 | cmd->speed = gp->phy_mii.speed; | 2645 | ethtool_cmd_speed_set(cmd, gp->phy_mii.speed); |
2646 | cmd->duplex = gp->phy_mii.duplex; | 2646 | cmd->duplex = gp->phy_mii.duplex; |
2647 | cmd->advertising = gp->phy_mii.advertising; | 2647 | cmd->advertising = gp->phy_mii.advertising; |
2648 | 2648 | ||
@@ -2659,7 +2659,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
2659 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | | 2659 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | |
2660 | SUPPORTED_Autoneg); | 2660 | SUPPORTED_Autoneg); |
2661 | cmd->advertising = cmd->supported; | 2661 | cmd->advertising = cmd->supported; |
2662 | cmd->speed = 0; | 2662 | ethtool_cmd_speed_set(cmd, 0); |
2663 | cmd->duplex = cmd->port = cmd->phy_address = | 2663 | cmd->duplex = cmd->port = cmd->phy_address = |
2664 | cmd->transceiver = cmd->autoneg = 0; | 2664 | cmd->transceiver = cmd->autoneg = 0; |
2665 | 2665 | ||
@@ -2673,7 +2673,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
2673 | cmd->advertising = cmd->supported; | 2673 | cmd->advertising = cmd->supported; |
2674 | cmd->transceiver = XCVR_INTERNAL; | 2674 | cmd->transceiver = XCVR_INTERNAL; |
2675 | if (gp->lstate == link_up) | 2675 | if (gp->lstate == link_up) |
2676 | cmd->speed = SPEED_1000; | 2676 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
2677 | cmd->duplex = DUPLEX_FULL; | 2677 | cmd->duplex = DUPLEX_FULL; |
2678 | cmd->autoneg = 1; | 2678 | cmd->autoneg = 1; |
2679 | } | 2679 | } |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index 8f3f02802427..d381a0f9ee18 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -2401,6 +2401,7 @@ static void happy_meal_set_multicast(struct net_device *dev) | |||
2401 | static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 2401 | static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
2402 | { | 2402 | { |
2403 | struct happy_meal *hp = netdev_priv(dev); | 2403 | struct happy_meal *hp = netdev_priv(dev); |
2404 | u32 speed; | ||
2404 | 2405 | ||
2405 | cmd->supported = | 2406 | cmd->supported = |
2406 | (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | | 2407 | (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | |
@@ -2420,10 +2421,9 @@ static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
2420 | 2421 | ||
2421 | if (hp->sw_bmcr & BMCR_ANENABLE) { | 2422 | if (hp->sw_bmcr & BMCR_ANENABLE) { |
2422 | cmd->autoneg = AUTONEG_ENABLE; | 2423 | cmd->autoneg = AUTONEG_ENABLE; |
2423 | cmd->speed = | 2424 | speed = ((hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ? |
2424 | (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ? | 2425 | SPEED_100 : SPEED_10); |
2425 | SPEED_100 : SPEED_10; | 2426 | if (speed == SPEED_100) |
2426 | if (cmd->speed == SPEED_100) | ||
2427 | cmd->duplex = | 2427 | cmd->duplex = |
2428 | (hp->sw_lpa & (LPA_100FULL)) ? | 2428 | (hp->sw_lpa & (LPA_100FULL)) ? |
2429 | DUPLEX_FULL : DUPLEX_HALF; | 2429 | DUPLEX_FULL : DUPLEX_HALF; |
@@ -2433,13 +2433,12 @@ static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
2433 | DUPLEX_FULL : DUPLEX_HALF; | 2433 | DUPLEX_FULL : DUPLEX_HALF; |
2434 | } else { | 2434 | } else { |
2435 | cmd->autoneg = AUTONEG_DISABLE; | 2435 | cmd->autoneg = AUTONEG_DISABLE; |
2436 | cmd->speed = | 2436 | speed = (hp->sw_bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10; |
2437 | (hp->sw_bmcr & BMCR_SPEED100) ? | ||
2438 | SPEED_100 : SPEED_10; | ||
2439 | cmd->duplex = | 2437 | cmd->duplex = |
2440 | (hp->sw_bmcr & BMCR_FULLDPLX) ? | 2438 | (hp->sw_bmcr & BMCR_FULLDPLX) ? |
2441 | DUPLEX_FULL : DUPLEX_HALF; | 2439 | DUPLEX_FULL : DUPLEX_HALF; |
2442 | } | 2440 | } |
2441 | ethtool_cmd_speed_set(cmd, speed); | ||
2443 | return 0; | 2442 | return 0; |
2444 | } | 2443 | } |
2445 | 2444 | ||
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 8be71de725e5..80fbee0d40af 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -2151,7 +2151,7 @@ static int bdx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
2151 | 2151 | ||
2152 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); | 2152 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); |
2153 | ecmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE); | 2153 | ecmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE); |
2154 | ecmd->speed = SPEED_10000; | 2154 | ethtool_cmd_speed_set(ecmd, SPEED_10000); |
2155 | ecmd->duplex = DUPLEX_FULL; | 2155 | ecmd->duplex = DUPLEX_FULL; |
2156 | ecmd->port = PORT_FIBRE; | 2156 | ecmd->port = PORT_FIBRE; |
2157 | ecmd->transceiver = XCVR_EXTERNAL; /* what does it mean? */ | 2157 | ecmd->transceiver = XCVR_EXTERNAL; /* what does it mean? */ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 004f266e4352..7c7c9a897c09 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -10025,10 +10025,10 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
10025 | 10025 | ||
10026 | cmd->advertising = tp->link_config.advertising; | 10026 | cmd->advertising = tp->link_config.advertising; |
10027 | if (netif_running(dev)) { | 10027 | if (netif_running(dev)) { |
10028 | cmd->speed = tp->link_config.active_speed; | 10028 | ethtool_cmd_speed_set(cmd, tp->link_config.active_speed); |
10029 | cmd->duplex = tp->link_config.active_duplex; | 10029 | cmd->duplex = tp->link_config.active_duplex; |
10030 | } else { | 10030 | } else { |
10031 | cmd->speed = SPEED_INVALID; | 10031 | ethtool_cmd_speed_set(cmd, SPEED_INVALID); |
10032 | cmd->duplex = DUPLEX_INVALID; | 10032 | cmd->duplex = DUPLEX_INVALID; |
10033 | } | 10033 | } |
10034 | cmd->phy_address = tp->phy_addr; | 10034 | cmd->phy_address = tp->phy_addr; |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index f8d26bf9b2c4..ab78e1d58cb6 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -1518,15 +1518,15 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd) | |||
1518 | switch (de->media_type) { | 1518 | switch (de->media_type) { |
1519 | case DE_MEDIA_AUI: | 1519 | case DE_MEDIA_AUI: |
1520 | ecmd->port = PORT_AUI; | 1520 | ecmd->port = PORT_AUI; |
1521 | ecmd->speed = 5; | 1521 | ethtool_cmd_speed_set(ecmd, 5); |
1522 | break; | 1522 | break; |
1523 | case DE_MEDIA_BNC: | 1523 | case DE_MEDIA_BNC: |
1524 | ecmd->port = PORT_BNC; | 1524 | ecmd->port = PORT_BNC; |
1525 | ecmd->speed = 2; | 1525 | ethtool_cmd_speed_set(ecmd, 2); |
1526 | break; | 1526 | break; |
1527 | default: | 1527 | default: |
1528 | ecmd->port = PORT_TP; | 1528 | ecmd->port = PORT_TP; |
1529 | ecmd->speed = SPEED_10; | 1529 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
1530 | break; | 1530 | break; |
1531 | } | 1531 | } |
1532 | 1532 | ||
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 74217dbf0143..a4375c406b5f 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -945,12 +945,12 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd) | |||
945 | 945 | ||
946 | ecmd->transceiver = XCVR_EXTERNAL; | 946 | ecmd->transceiver = XCVR_EXTERNAL; |
947 | 947 | ||
948 | ecmd->speed = 10; | 948 | ethtool_cmd_speed_set(ecmd, SPEED_10); |
949 | ecmd->duplex = DUPLEX_HALF; | 949 | ecmd->duplex = DUPLEX_HALF; |
950 | 950 | ||
951 | if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) | 951 | if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD) |
952 | { | 952 | { |
953 | ecmd->speed = 100; | 953 | ethtool_cmd_speed_set(ecmd, SPEED_100); |
954 | } | 954 | } |
955 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) | 955 | if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD) |
956 | { | 956 | { |
@@ -958,7 +958,7 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd) | |||
958 | } | 958 | } |
959 | if(db->link_failed) | 959 | if(db->link_failed) |
960 | { | 960 | { |
961 | ecmd->speed = -1; | 961 | ethtool_cmd_speed_set(ecmd, -1); |
962 | ecmd->duplex = -1; | 962 | ecmd->duplex = -1; |
963 | } | 963 | } |
964 | 964 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index ade3cf9cd326..0636f7040325 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1553,7 +1553,7 @@ static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1553 | { | 1553 | { |
1554 | cmd->supported = 0; | 1554 | cmd->supported = 0; |
1555 | cmd->advertising = 0; | 1555 | cmd->advertising = 0; |
1556 | cmd->speed = SPEED_10; | 1556 | ethtool_cmd_speed_set(cmd, SPEED_10); |
1557 | cmd->duplex = DUPLEX_FULL; | 1557 | cmd->duplex = DUPLEX_FULL; |
1558 | cmd->port = PORT_TP; | 1558 | cmd->port = PORT_TP; |
1559 | cmd->phy_address = 0; | 1559 | cmd->phy_address = 0; |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 9f11c111b65d..3de4283344e9 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -1050,7 +1050,7 @@ typhoon_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1050 | 1050 | ||
1051 | /* need to get stats to make these link speed/duplex valid */ | 1051 | /* need to get stats to make these link speed/duplex valid */ |
1052 | typhoon_do_get_stats(tp); | 1052 | typhoon_do_get_stats(tp); |
1053 | cmd->speed = tp->speed; | 1053 | ethtool_cmd_speed_set(cmd, tp->speed); |
1054 | cmd->duplex = tp->duplex; | 1054 | cmd->duplex = tp->duplex; |
1055 | cmd->phy_address = 0; | 1055 | cmd->phy_address = 0; |
1056 | cmd->transceiver = XCVR_INTERNAL; | 1056 | cmd->transceiver = XCVR_INTERNAL; |
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index 97687d335903..d7221c4a5dcf 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -686,7 +686,7 @@ static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
686 | 686 | ||
687 | cmd->supported = SUPPORTED_10baseT_Half | SUPPORTED_TP; | 687 | cmd->supported = SUPPORTED_10baseT_Half | SUPPORTED_TP; |
688 | cmd->advertising = ADVERTISED_10baseT_Half | ADVERTISED_TP; | 688 | cmd->advertising = ADVERTISED_10baseT_Half | ADVERTISED_TP; |
689 | cmd->speed = SPEED_10; | 689 | ethtool_cmd_speed_set(cmd, SPEED_10); |
690 | cmd->duplex = DUPLEX_HALF; | 690 | cmd->duplex = DUPLEX_HALF; |
691 | cmd->port = PORT_TP; | 691 | cmd->port = PORT_TP; |
692 | cmd->phy_address = 0; | 692 | cmd->phy_address = 0; |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index e85c89c6706d..041fb7d43c4f 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -843,10 +843,11 @@ static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *e | |||
843 | get_registers(dev, BMCR, 2, &bmcr); | 843 | get_registers(dev, BMCR, 2, &bmcr); |
844 | get_registers(dev, ANLP, 2, &lpa); | 844 | get_registers(dev, ANLP, 2, &lpa); |
845 | if (bmcr & BMCR_ANENABLE) { | 845 | if (bmcr & BMCR_ANENABLE) { |
846 | u32 speed = ((lpa & (LPA_100HALF | LPA_100FULL)) ? | ||
847 | SPEED_100 : SPEED_10); | ||
848 | ethtool_cmd_speed_set(ecmd, speed); | ||
846 | ecmd->autoneg = AUTONEG_ENABLE; | 849 | ecmd->autoneg = AUTONEG_ENABLE; |
847 | ecmd->speed = (lpa & (LPA_100HALF | LPA_100FULL)) ? | 850 | if (speed == SPEED_100) |
848 | SPEED_100 : SPEED_10; | ||
849 | if (ecmd->speed == SPEED_100) | ||
850 | ecmd->duplex = (lpa & LPA_100FULL) ? | 851 | ecmd->duplex = (lpa & LPA_100FULL) ? |
851 | DUPLEX_FULL : DUPLEX_HALF; | 852 | DUPLEX_FULL : DUPLEX_HALF; |
852 | else | 853 | else |
@@ -854,8 +855,8 @@ static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *e | |||
854 | DUPLEX_FULL : DUPLEX_HALF; | 855 | DUPLEX_FULL : DUPLEX_HALF; |
855 | } else { | 856 | } else { |
856 | ecmd->autoneg = AUTONEG_DISABLE; | 857 | ecmd->autoneg = AUTONEG_DISABLE; |
857 | ecmd->speed = (bmcr & BMCR_SPEED100) ? | 858 | ethtool_cmd_speed_set(ecmd, ((bmcr & BMCR_SPEED100) ? |
858 | SPEED_100 : SPEED_10; | 859 | SPEED_100 : SPEED_10)); |
859 | ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? | 860 | ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? |
860 | DUPLEX_FULL : DUPLEX_HALF; | 861 | DUPLEX_FULL : DUPLEX_HALF; |
861 | } | 862 | } |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 654228849951..cbe953a5bf5a 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -52,7 +52,7 @@ static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
52 | { | 52 | { |
53 | cmd->supported = 0; | 53 | cmd->supported = 0; |
54 | cmd->advertising = 0; | 54 | cmd->advertising = 0; |
55 | cmd->speed = SPEED_10000; | 55 | ethtool_cmd_speed_set(cmd, SPEED_10000); |
56 | cmd->duplex = DUPLEX_FULL; | 56 | cmd->duplex = DUPLEX_FULL; |
57 | cmd->port = PORT_TP; | 57 | cmd->port = PORT_TP; |
58 | cmd->phy_address = 0; | 58 | cmd->phy_address = 0; |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 9a8f116e6920..06daa9d6fee8 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -3182,7 +3182,8 @@ static void velocity_ethtool_down(struct net_device *dev) | |||
3182 | pci_set_power_state(vptr->pdev, PCI_D3hot); | 3182 | pci_set_power_state(vptr->pdev, PCI_D3hot); |
3183 | } | 3183 | } |
3184 | 3184 | ||
3185 | static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 3185 | static int velocity_get_settings(struct net_device *dev, |
3186 | struct ethtool_cmd *cmd) | ||
3186 | { | 3187 | { |
3187 | struct velocity_info *vptr = netdev_priv(dev); | 3188 | struct velocity_info *vptr = netdev_priv(dev); |
3188 | struct mac_regs __iomem *regs = vptr->mac_regs; | 3189 | struct mac_regs __iomem *regs = vptr->mac_regs; |
@@ -3228,12 +3229,14 @@ static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd | |||
3228 | break; | 3229 | break; |
3229 | } | 3230 | } |
3230 | } | 3231 | } |
3232 | |||
3231 | if (status & VELOCITY_SPEED_1000) | 3233 | if (status & VELOCITY_SPEED_1000) |
3232 | cmd->speed = SPEED_1000; | 3234 | ethtool_cmd_speed_set(cmd, SPEED_1000); |
3233 | else if (status & VELOCITY_SPEED_100) | 3235 | else if (status & VELOCITY_SPEED_100) |
3234 | cmd->speed = SPEED_100; | 3236 | ethtool_cmd_speed_set(cmd, SPEED_100); |
3235 | else | 3237 | else |
3236 | cmd->speed = SPEED_10; | 3238 | ethtool_cmd_speed_set(cmd, SPEED_10); |
3239 | |||
3237 | cmd->autoneg = (status & VELOCITY_AUTONEG_ENABLE) ? AUTONEG_ENABLE : AUTONEG_DISABLE; | 3240 | cmd->autoneg = (status & VELOCITY_AUTONEG_ENABLE) ? AUTONEG_ENABLE : AUTONEG_DISABLE; |
3238 | cmd->port = PORT_TP; | 3241 | cmd->port = PORT_TP; |
3239 | cmd->transceiver = XCVR_INTERNAL; | 3242 | cmd->transceiver = XCVR_INTERNAL; |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 70c1ab96ed27..64303eb3a5fc 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
@@ -424,10 +424,10 @@ vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
424 | ecmd->transceiver = XCVR_INTERNAL; | 424 | ecmd->transceiver = XCVR_INTERNAL; |
425 | 425 | ||
426 | if (adapter->link_speed) { | 426 | if (adapter->link_speed) { |
427 | ecmd->speed = adapter->link_speed; | 427 | ethtool_cmd_speed_set(ecmd, adapter->link_speed); |
428 | ecmd->duplex = DUPLEX_FULL; | 428 | ecmd->duplex = DUPLEX_FULL; |
429 | } else { | 429 | } else { |
430 | ecmd->speed = -1; | 430 | ethtool_cmd_speed_set(ecmd, -1); |
431 | ecmd->duplex = -1; | 431 | ecmd->duplex = -1; |
432 | } | 432 | } |
433 | return 0; | 433 | return 0; |
diff --git a/drivers/net/vxge/vxge-ethtool.c b/drivers/net/vxge/vxge-ethtool.c index a70874e64d0e..92dd72d3f9de 100644 --- a/drivers/net/vxge/vxge-ethtool.c +++ b/drivers/net/vxge/vxge-ethtool.c | |||
@@ -59,10 +59,10 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info) | |||
59 | info->transceiver = XCVR_EXTERNAL; | 59 | info->transceiver = XCVR_EXTERNAL; |
60 | 60 | ||
61 | if (netif_carrier_ok(dev)) { | 61 | if (netif_carrier_ok(dev)) { |
62 | info->speed = SPEED_10000; | 62 | ethtool_cmd_speed_set(info, SPEED_10000); |
63 | info->duplex = DUPLEX_FULL; | 63 | info->duplex = DUPLEX_FULL; |
64 | } else { | 64 | } else { |
65 | info->speed = -1; | 65 | ethtool_cmd_speed_set(info, -1); |
66 | info->duplex = -1; | 66 | info->duplex = -1; |
67 | } | 67 | } |
68 | 68 | ||