ethtool: cosmetic: Use ethtool ethtool_cmd_speed API
authorDavid Decotigny <decot@google.com>
Wed, 27 Apr 2011 18:32:40 +0000 (18:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Apr 2011 21:03:01 +0000 (14:03 -0700)
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>
76 files changed:
drivers/infiniband/hw/nes/nes_nic.c
drivers/net/3c509.c
drivers/net/acenic.c
drivers/net/arm/etherh.c
drivers/net/arm/ks8695net.c
drivers/net/atl1c/atl1c_ethtool.c
drivers/net/atl1e/atl1e_ethtool.c
drivers/net/atlx/atl1.c
drivers/net/atlx/atl2.c
drivers/net/b44.c
drivers/net/bcm63xx_enet.c
drivers/net/benet/be_ethtool.c
drivers/net/bna/bnad_ethtool.c
drivers/net/bnx2.c
drivers/net/cassini.c
drivers/net/chelsio/cxgb2.c
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb4/cxgb4_main.c
drivers/net/cxgb4vf/cxgb4vf_main.c
drivers/net/dl2k.c
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000e/ethtool.c
drivers/net/eepro.c
drivers/net/ehea/ehea_ethtool.c
drivers/net/enc28j60.c
drivers/net/enic/enic_main.c
drivers/net/ewrk3.c
drivers/net/forcedeth.c
drivers/net/ibmveth.c
drivers/net/igb/igb_ethtool.c
drivers/net/igbvf/ethtool.c
drivers/net/ixgb/ixgb_ethtool.c
drivers/net/ixgbe/ixgbe_ethtool.c
drivers/net/ixgbevf/ethtool.c
drivers/net/mdio.c
drivers/net/mii.c
drivers/net/mlx4/en_ethtool.c
drivers/net/mv643xx_eth.c
drivers/net/myri10ge/myri10ge.c
drivers/net/natsemi.c
drivers/net/netxen/netxen_nic_ethtool.c
drivers/net/niu.c
drivers/net/ns83820.c
drivers/net/pch_gbe/pch_gbe_phy.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/phy/phy.c
drivers/net/ps3_gelic_net.c
drivers/net/qla3xxx.c
drivers/net/qlcnic/qlcnic_ethtool.c
drivers/net/qlge/qlge_ethtool.c
drivers/net/r8169.c
drivers/net/s2io.c
drivers/net/sc92031.c
drivers/net/sfc/ethtool.c
drivers/net/sfc/mcdi_phy.c
drivers/net/sfc/tenxpress.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/smc911x.c
drivers/net/smc91x.c
drivers/net/spider_net_ethtool.c
drivers/net/sungem.c
drivers/net/sunhme.c
drivers/net/tehuti.c
drivers/net/tg3.c
drivers/net/tulip/de2104x.c
drivers/net/tulip/uli526x.c
drivers/net/tun.c
drivers/net/typhoon.c
drivers/net/usb/catc.c
drivers/net/usb/rtl8150.c
drivers/net/veth.c
drivers/net/via-velocity.c
drivers/net/vmxnet3/vmxnet3_ethtool.c
drivers/net/vxge/vxge-ethtool.c
net/batman-adv/soft-interface.c

index d2e67c4e3228ff1dd410ded1105f4d2e9f765e13..d3a1c41cfd279caafcac796fac4f415cf97ce268 100644 (file)
@@ -1493,7 +1493,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
        et_cmd->maxrxpkt = 511;
 
        if (nesadapter->OneG_Mode) {
-               et_cmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(et_cmd, SPEED_1000);
                if (phy_type == NES_PHY_TYPE_PUMA_1G) {
                        et_cmd->supported   = SUPPORTED_1000baseT_Full;
                        et_cmd->advertising = ADVERTISED_1000baseT_Full;
@@ -1532,7 +1532,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
                et_cmd->advertising = ADVERTISED_10000baseT_Full;
                et_cmd->phy_address = mac_index;
        }
-       et_cmd->speed = SPEED_10000;
+       ethtool_cmd_speed_set(et_cmd, SPEED_10000);
        et_cmd->autoneg = AUTONEG_DISABLE;
        return 0;
 }
index cb39dedf46bd1550dec087825c31f413064245de..5f25889e27efdafee0941407ab0c39c9f7b1ee36 100644 (file)
@@ -1207,7 +1207,7 @@ el3_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
                        ecmd->duplex = DUPLEX_FULL;
        }
 
-       ecmd->speed = SPEED_10;
+       ethtool_cmd_speed_set(ecmd, SPEED_10);
        EL3WINDOW(1);
        return 0;
 }
index 0b4d8d13c488026a6a4b660f6fdb54670e9580f0..a5798991c8b1da1fd6120838a5115740513f3b59 100644 (file)
@@ -2658,15 +2658,15 @@ static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 
        link = readl(&regs->GigLnkState);
        if (link & LNK_1000MB)
-               ecmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(ecmd, SPEED_1000);
        else {
                link = readl(&regs->FastLnkState);
                if (link & LNK_100MB)
-                       ecmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(ecmd, SPEED_100);
                else if (link & LNK_10MB)
-                       ecmd->speed = SPEED_10;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10);
                else
-                       ecmd->speed = 0;
+                       ethtool_cmd_speed_set(ecmd, 0);
        }
        if (link & LNK_FULL_DUPLEX)
                ecmd->duplex = DUPLEX_FULL;
index 4af235d41fda656990a7a280976ecd6e477d2a49..e252cd5950161c05aa2583f05f07b9f14bdeacf2 100644 (file)
@@ -591,10 +591,11 @@ static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i
 static int etherh_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        cmd->supported  = etherh_priv(dev)->supported;
-       cmd->speed      = SPEED_10;
+       ethtool_cmd_speed_set(cmd, SPEED_10);
        cmd->duplex     = DUPLEX_HALF;
        cmd->port       = dev->if_port == IF_PORT_10BASET ? PORT_TP : PORT_BNC;
-       cmd->autoneg    = dev->flags & IFF_AUTOMEDIA ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+       cmd->autoneg    = (dev->flags & IFF_AUTOMEDIA ?
+                          AUTONEG_ENABLE : AUTONEG_DISABLE);
        return 0;
 }
 
index aa07657744c3a8a5d1fff8437dbc04e0689dd115..a7b0caa1817966a34ea387a62e219a7961fd687e 100644 (file)
@@ -891,15 +891,16 @@ ks8695_wan_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
                        cmd->advertising |= ADVERTISED_Pause;
                cmd->autoneg = AUTONEG_ENABLE;
 
-               cmd->speed = (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10;
+               ethtool_cmd_speed_set(cmd,
+                                     (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10);
                cmd->duplex = (ctrl & WMC_WDS) ?
                        DUPLEX_FULL : DUPLEX_HALF;
        } else {
                /* auto-negotiation is disabled */
                cmd->autoneg = AUTONEG_DISABLE;
 
-               cmd->speed = (ctrl & WMC_WANF100) ?
-                       SPEED_100 : SPEED_10;
+               ethtool_cmd_speed_set(cmd, ((ctrl & WMC_WANF100) ?
+                                           SPEED_100 : SPEED_10));
                cmd->duplex = (ctrl & WMC_WANFF) ?
                        DUPLEX_FULL : DUPLEX_HALF;
        }
index b1eceee424aa601c040c2b0ac8414575a20e8b3e..7be884d0aaf6e36464a5908aefdd29c12a2dadab 100644 (file)
@@ -50,13 +50,13 @@ static int atl1c_get_settings(struct net_device *netdev,
        ecmd->transceiver = XCVR_INTERNAL;
 
        if (adapter->link_speed != SPEED_0) {
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                if (adapter->link_duplex == FULL_DUPLEX)
                        ecmd->duplex = DUPLEX_FULL;
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index 47783749d9fa6be18b1d508ce0fee1e1b0e487ad..6269438d365f9d413650611e8e06cccf8d3e9a5c 100644 (file)
@@ -51,13 +51,13 @@ static int atl1e_get_settings(struct net_device *netdev,
        ecmd->transceiver = XCVR_INTERNAL;
 
        if (adapter->link_speed != SPEED_0) {
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                if (adapter->link_duplex == FULL_DUPLEX)
                        ecmd->duplex = DUPLEX_FULL;
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index 37a092fa2ba64868368349469d54bdd28af6a255..c5298d1ab744ffd33f1dcfa558b1606222b3f4c1 100644 (file)
@@ -3231,13 +3231,13 @@ static int atl1_get_settings(struct net_device *netdev,
        if (netif_carrier_ok(adapter->netdev)) {
                u16 link_speed, link_duplex;
                atl1_get_speed_and_duplex(hw, &link_speed, &link_duplex);
-               ecmd->speed = link_speed;
+               ethtool_cmd_speed_set(ecmd, link_speed);
                if (link_duplex == FULL_DUPLEX)
                        ecmd->duplex = DUPLEX_FULL;
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
        if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR ||
index b75aa295d37e3c691228b03cef0bfdc09e56133a..16249e9b6b950a294916ce09b4e81af5233a0ca6 100644 (file)
@@ -1769,13 +1769,13 @@ static int atl2_get_settings(struct net_device *netdev,
        ecmd->transceiver = XCVR_INTERNAL;
 
        if (adapter->link_speed != SPEED_0) {
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                if (adapter->link_duplex == FULL_DUPLEX)
                        ecmd->duplex = DUPLEX_FULL;
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index 909cc4b2a2f38befe2b42bc2a0ae1cc71f1aa028..a69331e06b8dbed3039985f02e3f7c1bd2883880 100644 (file)
@@ -1807,8 +1807,8 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        if (bp->flags & B44_FLAG_ADV_100FULL)
                cmd->advertising |= ADVERTISED_100baseT_Full;
        cmd->advertising |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
-       cmd->speed = (bp->flags & B44_FLAG_100_BASE_T) ?
-               SPEED_100 : SPEED_10;
+       ethtool_cmd_speed_set(cmd, ((bp->flags & B44_FLAG_100_BASE_T) ?
+                                   SPEED_100 : SPEED_10));
        cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ?
                DUPLEX_FULL : DUPLEX_HALF;
        cmd->port = 0;
@@ -1820,7 +1820,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        if (cmd->autoneg == AUTONEG_ENABLE)
                cmd->advertising |= ADVERTISED_Autoneg;
        if (!netif_running(dev)){
-               cmd->speed = 0;
+               ethtool_cmd_speed_set(cmd, 0);
                cmd->duplex = 0xff;
        }
        cmd->maxtxpkt = 0;
index e68ffe622e690dcb04644f8fdb1e7fbf5151c0a4..f1573d492e90c1b886ed0b52d34b4e867649bb18 100644 (file)
@@ -1346,7 +1346,8 @@ static int bcm_enet_get_settings(struct net_device *dev,
                return phy_ethtool_gset(priv->phydev, cmd);
        } else {
                cmd->autoneg = 0;
-               cmd->speed = (priv->force_speed_100) ? SPEED_100 : SPEED_10;
+               ethtool_cmd_speed_set(cmd, ((priv->force_speed_100)
+                                           ? SPEED_100 : SPEED_10));
                cmd->duplex = (priv->force_duplex_full) ?
                        DUPLEX_FULL : DUPLEX_HALF;
                cmd->supported = ADVERTISED_10baseT_Half  |
index 6565f3e55b260a1315598d4e13c638e29a8c95c9..8e770e8275df23f9e7e41b47ba543b4bdf9605de 100644 (file)
@@ -381,23 +381,23 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
                be_link_status_update(adapter, link_up);
                /* link_speed is in units of 10 Mbps */
                if (link_speed) {
-                       ecmd->speed = link_speed*10;
+                       ethtool_cmd_speed_set(ecmd, link_speed*10);
                } else {
                        switch (mac_speed) {
                        case PHY_LINK_SPEED_10MBPS:
-                               ecmd->speed = SPEED_10;
+                               ethtool_cmd_speed_set(ecmd, SPEED_10);
                                break;
                        case PHY_LINK_SPEED_100MBPS:
-                               ecmd->speed = SPEED_100;
+                               ethtool_cmd_speed_set(ecmd, SPEED_100);
                                break;
                        case PHY_LINK_SPEED_1GBPS:
-                               ecmd->speed = SPEED_1000;
+                               ethtool_cmd_speed_set(ecmd, SPEED_1000);
                                break;
                        case PHY_LINK_SPEED_10GBPS:
-                               ecmd->speed = SPEED_10000;
+                               ethtool_cmd_speed_set(ecmd, SPEED_10000);
                                break;
                        case PHY_LINK_SPEED_ZERO:
-                               ecmd->speed = 0;
+                               ethtool_cmd_speed_set(ecmd, 0);
                                break;
                        }
                }
@@ -440,14 +440,14 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
                }
 
                /* Save for future use */
-               adapter->link_speed = ecmd->speed;
+               adapter->link_speed = ethtool_cmd_speed(ecmd);
                adapter->port_type = ecmd->port;
                adapter->transceiver = ecmd->transceiver;
                adapter->autoneg = ecmd->autoneg;
                dma_free_coherent(&adapter->pdev->dev, phy_cmd.size, phy_cmd.va,
                                  phy_cmd.dma);
        } else {
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                ecmd->port = adapter->port_type;
                ecmd->transceiver = adapter->transceiver;
                ecmd->autoneg = adapter->autoneg;
index ae1e118f9c3a52ab457c45ee50eedd22cef3d2f2..3330cd78da2c4ae88b479943e0bf540299c48080 100644 (file)
@@ -237,10 +237,10 @@ bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
        cmd->phy_address = 0;
 
        if (netif_carrier_ok(netdev)) {
-               cmd->speed = SPEED_10000;
+               ethtool_cmd_speed_set(cmd, SPEED_10000);
                cmd->duplex = DUPLEX_FULL;
        } else {
-               cmd->speed = -1;
+               ethtool_cmd_speed_set(cmd, -1);
                cmd->duplex = -1;
        }
        cmd->transceiver = XCVR_EXTERNAL;
index e43efd86425b3b2e48628855e8e1e2bce543ed1c..1bebdfb9679f90f658272c3ee783b70b35c92212 100644 (file)
@@ -6696,17 +6696,16 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        if (bp->autoneg & AUTONEG_SPEED) {
                cmd->autoneg = AUTONEG_ENABLE;
-       }
-       else {
+       } else {
                cmd->autoneg = AUTONEG_DISABLE;
        }
 
        if (netif_carrier_ok(dev)) {
-               cmd->speed = bp->line_speed;
+               ethtool_cmd_speed_set(cmd, bp->line_speed);
                cmd->duplex = bp->duplex;
        }
        else {
-               cmd->speed = -1;
+               ethtool_cmd_speed_set(cmd, -1);
                cmd->duplex = -1;
        }
        spin_unlock_bh(&bp->phy_lock);
index a6c3f8c8c302017f603de5b0fdbb8bbbfbac8de1..22ce03e55b835f15b1cb1c48f0d256f5a0572125 100644 (file)
@@ -4606,18 +4606,17 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        if (bmcr & BMCR_ANENABLE) {
                cmd->advertising |= ADVERTISED_Autoneg;
                cmd->autoneg = AUTONEG_ENABLE;
-               cmd->speed = ((speed == 10) ?
-                             SPEED_10 :
-                             ((speed == 1000) ?
-                              SPEED_1000 : SPEED_100));
+               ethtool_cmd_speed_set(cmd, ((speed == 10) ?
+                                           SPEED_10 :
+                                           ((speed == 1000) ?
+                                            SPEED_1000 : SPEED_100)));
                cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
        } else {
                cmd->autoneg = AUTONEG_DISABLE;
-               cmd->speed =
-                       (bmcr & CAS_BMCR_SPEED1000) ?
-                       SPEED_1000 :
-                       ((bmcr & BMCR_SPEED100) ? SPEED_100:
-                        SPEED_10);
+               ethtool_cmd_speed_set(cmd, ((bmcr & CAS_BMCR_SPEED1000) ?
+                                           SPEED_1000 :
+                                           ((bmcr & BMCR_SPEED100) ?
+                                            SPEED_100 : SPEED_10)));
                cmd->duplex =
                        (bmcr & BMCR_FULLDPLX) ?
                        DUPLEX_FULL : DUPLEX_HALF;
@@ -4634,14 +4633,14 @@ static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                 * settings that we configured.
                 */
                if (cp->link_cntl & BMCR_ANENABLE) {
-                       cmd->speed = 0;
+                       ethtool_cmd_speed_set(cmd, 0);
                        cmd->duplex = 0xff;
                } else {
-                       cmd->speed = SPEED_10;
+                       ethtool_cmd_speed_set(cmd, SPEED_10);
                        if (cp->link_cntl & BMCR_SPEED100) {
-                               cmd->speed = SPEED_100;
+                               ethtool_cmd_speed_set(cmd, SPEED_100);
                        } else if (cp->link_cntl & CAS_BMCR_SPEED1000) {
-                               cmd->speed = SPEED_1000;
+                               ethtool_cmd_speed_set(cmd, SPEED_1000);
                        }
                        cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)?
                                DUPLEX_FULL : DUPLEX_HALF;
index 8e14d652996b3d5639f8ce37d1e3d2cffc7d8dde..b422d83f5343c3edf1e55a0a43e6ff848d514567 100644 (file)
@@ -577,10 +577,10 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        cmd->advertising = p->link_config.advertising;
 
        if (netif_carrier_ok(dev)) {
-               cmd->speed = p->link_config.speed;
+               ethtool_cmd_speed_set(cmd, p->link_config.speed);
                cmd->duplex = p->link_config.duplex;
        } else {
-               cmd->speed = -1;
+               ethtool_cmd_speed_set(cmd, -1);
                cmd->duplex = -1;
        }
 
index 0526715cc8c7debbec325947875269560cf0ac4d..9081ce037149ce77cd231d8e77021cec641a3c52 100644 (file)
@@ -1759,10 +1759,10 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        cmd->advertising = p->link_config.advertising;
 
        if (netif_carrier_ok(dev)) {
-               cmd->speed = p->link_config.speed;
+               ethtool_cmd_speed_set(cmd, p->link_config.speed);
                cmd->duplex = p->link_config.duplex;
        } else {
-               cmd->speed = -1;
+               ethtool_cmd_speed_set(cmd, -1);
                cmd->duplex = -1;
        }
 
index c02b4d3b73fceedb3f0841b3f2dfa2c3b7747a45..7e3cfbe89e3b186597a44c9d1e88d617e28a6b62 100644 (file)
@@ -1436,7 +1436,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        cmd->supported = from_fw_linkcaps(p->port_type, p->link_cfg.supported);
        cmd->advertising = from_fw_linkcaps(p->port_type,
                                            p->link_cfg.advertising);
-       cmd->speed = netif_carrier_ok(dev) ? p->link_cfg.speed : 0;
+       ethtool_cmd_speed_set(cmd,
+                             netif_carrier_ok(dev) ? p->link_cfg.speed : 0);
        cmd->duplex = DUPLEX_FULL;
        cmd->autoneg = p->link_cfg.autoneg;
        cmd->maxtxpkt = 0;
index 8cf9890cafaf702289a7397613ce160ebe75d626..e71c08e547e4aa789eced9428244ad68c01b5fa4 100644 (file)
@@ -1167,7 +1167,8 @@ static int cxgb4vf_get_settings(struct net_device *dev,
 
        cmd->supported = pi->link_cfg.supported;
        cmd->advertising = pi->link_cfg.advertising;
-       cmd->speed = netif_carrier_ok(dev) ? pi->link_cfg.speed : -1;
+       ethtool_cmd_speed_set(cmd,
+                             netif_carrier_ok(dev) ? pi->link_cfg.speed : -1);
        cmd->duplex = DUPLEX_FULL;
 
        cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE;
index ab63989619d43d20782689e56f396d0102cc7bf6..c445457b66d53df856564a2d88895680249f49bf 100644 (file)
@@ -1189,10 +1189,10 @@ static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                cmd->transceiver = XCVR_INTERNAL;
        }
        if ( np->link_status ) {
-               cmd->speed = np->speed;
+               ethtool_cmd_speed_set(cmd, np->speed);
                cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
        } else {
-               cmd->speed = -1;
+               ethtool_cmd_speed_set(cmd, -1);
                cmd->duplex = -1;
        }
        if ( np->an_enable)
index a53629d9325d1e08543b505170a3f83138f16306..127fef4fce49dbdf3a4255b8ce8364012c882c06 100644 (file)
@@ -158,7 +158,7 @@ static int e1000_get_settings(struct net_device *netdev,
 
                e1000_get_speed_and_duplex(hw, &adapter->link_speed,
                                                   &adapter->link_duplex);
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
 
                /* unfortunately FULL_DUPLEX != DUPLEX_FULL
                 *          and HALF_DUPLEX != DUPLEX_HALF */
@@ -168,7 +168,7 @@ static int e1000_get_settings(struct net_device *netdev,
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index bc02c6b91f15e8e47e5a0daa0589f2e248b7a05e..12f1ee25052277a23df257e093316a6e49b312af 100644 (file)
@@ -122,6 +122,7 @@ static int e1000_get_settings(struct net_device *netdev,
 {
        struct e1000_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
+       u32 speed;
 
        if (hw->phy.media_type == e1000_media_type_copper) {
 
@@ -159,23 +160,23 @@ static int e1000_get_settings(struct net_device *netdev,
                ecmd->transceiver = XCVR_EXTERNAL;
        }
 
-       ecmd->speed = -1;
+       speed = -1;
        ecmd->duplex = -1;
 
        if (netif_running(netdev)) {
                if (netif_carrier_ok(netdev)) {
-                       ecmd->speed = adapter->link_speed;
+                       speed = adapter->link_speed;
                        ecmd->duplex = adapter->link_duplex - 1;
                }
        } else {
                u32 status = er32(STATUS);
                if (status & E1000_STATUS_LU) {
                        if (status & E1000_STATUS_SPEED_1000)
-                               ecmd->speed = 1000;
+                               speed = SPEED_1000;
                        else if (status & E1000_STATUS_SPEED_100)
-                               ecmd->speed = 100;
+                               speed = SPEED_100;
                        else
-                               ecmd->speed = 10;
+                               speed = SPEED_10;
 
                        if (status & E1000_STATUS_FD)
                                ecmd->duplex = DUPLEX_FULL;
@@ -184,6 +185,7 @@ static int e1000_get_settings(struct net_device *netdev,
                }
        }
 
+       ethtool_cmd_speed_set(ecmd, speed);
        ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
                         hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
 
index eb35951a2442266b8f5ed6c7f40f382dda31aa93..dfeb006035df60dd16add78680076e22caf566c4 100644 (file)
@@ -1703,7 +1703,7 @@ static int eepro_ethtool_get_settings(struct net_device *dev,
                cmd->advertising |= ADVERTISED_AUI;
        }
 
-       cmd->speed = SPEED_10;
+       ethtool_cmd_speed_set(cmd, SPEED_10);
 
        if (dev->if_port == TPE && lp->word[1] & ee_Duplex) {
                cmd->duplex = DUPLEX_FULL;
index 5f13491cf2a96c4241148bed2ee83c502e3a1364..1df5f40c646d4d54c1d7f058be92596c17d3898d 100644 (file)
@@ -34,6 +34,7 @@
 static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct ehea_port *port = netdev_priv(dev);
+       u32 speed;
        int ret;
 
        ret = ehea_sense_port_attr(port);
@@ -43,17 +44,29 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        if (netif_carrier_ok(dev)) {
                switch (port->port_speed) {
-               case EHEA_SPEED_10M: cmd->speed = SPEED_10; break;
-               case EHEA_SPEED_100M: cmd->speed = SPEED_100; break;
-               case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break;
-               case EHEA_SPEED_10G: cmd->speed = SPEED_10000; break;
+               case EHEA_SPEED_10M:
+                       speed = SPEED_10;
+                       break;
+               case EHEA_SPEED_100M:
+                       speed = SPEED_100;
+                       break;
+               case EHEA_SPEED_1G:
+                       speed = SPEED_1000;
+                       break;
+               case EHEA_SPEED_10G:
+                       speed = SPEED_10000;
+                       break;
+               default:
+                       speed = -1;
+                       break; /* BUG */
                }
                cmd->duplex = port->full_duplex == 1 ?
                                                     DUPLEX_FULL : DUPLEX_HALF;
        } else {
-               cmd->speed = -1;
+               speed = ~0;
                cmd->duplex = -1;
        }
+       ethtool_cmd_speed_set(cmd, speed);
 
        cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full
                       | SUPPORTED_100baseT_Full |  SUPPORTED_100baseT_Half
index 81a793747f2e88c9163fd86f5c47034956100122..2837ce209cd7df517119eba565dee34c64492b58 100644 (file)
@@ -1488,7 +1488,7 @@ enc28j60_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        cmd->supported  = SUPPORTED_10baseT_Half
                        | SUPPORTED_10baseT_Full
                        | SUPPORTED_TP;
-       cmd->speed      = SPEED_10;
+       ethtool_cmd_speed_set(cmd,  SPEED_10);
        cmd->duplex     = priv->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
        cmd->port       = PORT_TP;
        cmd->autoneg    = AUTONEG_DISABLE;
index b2245511c51aed55f1c1198df06fa55b17108705..3d99b0f1a236a240bde0e8ccd85ed9efc7b060e2 100644 (file)
@@ -180,10 +180,10 @@ static int enic_get_settings(struct net_device *netdev,
        ecmd->transceiver = XCVR_EXTERNAL;
 
        if (netif_carrier_ok(netdev)) {
-               ecmd->speed = vnic_dev_port_speed(enic->vdev);
+               ethtool_cmd_speed_set(ecmd, vnic_dev_port_speed(enic->vdev));
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index 17b6027d8be8a8231bbb6366040cbb8205c49d8b..b5f6173130f4cc815eebc2462f9624ad8cefbfaa 100644 (file)
@@ -1545,7 +1545,7 @@ static int ewrk3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
        }
 
        ecmd->supported |= SUPPORTED_10baseT_Half;
-       ecmd->speed = SPEED_10;
+       ethtool_cmd_speed_set(ecmd, SPEED_10);
        ecmd->duplex = DUPLEX_HALF;
        return 0;
 }
index d24b3f3e646bcaec37c0930edf9abd4f4f1615f4..d09e8b0add0105cd94489faac70f34ddc01d8bce 100644 (file)
@@ -3955,6 +3955,7 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
 static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
        struct fe_priv *np = netdev_priv(dev);
+       u32 speed;
        int adv;
 
        spin_lock_irq(&np->lock);
@@ -3974,23 +3975,26 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
        if (netif_carrier_ok(dev)) {
                switch (np->linkspeed & (NVREG_LINKSPEED_MASK)) {
                case NVREG_LINKSPEED_10:
-                       ecmd->speed = SPEED_10;
+                       speed = SPEED_10;
                        break;
                case NVREG_LINKSPEED_100:
-                       ecmd->speed = SPEED_100;
+                       speed = SPEED_100;
                        break;
                case NVREG_LINKSPEED_1000:
-                       ecmd->speed = SPEED_1000;
+                       speed = SPEED_1000;
+                       break;
+               default:
+                       speed = -1;
                        break;
                }
                ecmd->duplex = DUPLEX_HALF;
                if (np->duplex)
                        ecmd->duplex = DUPLEX_FULL;
        } else {
-               ecmd->speed = -1;
+               speed = -1;
                ecmd->duplex = -1;
        }
-
+       ethtool_cmd_speed_set(ecmd, speed);
        ecmd->autoneg = np->autoneg;
 
        ecmd->advertising = ADVERTISED_MII;
index be3fe71b9c908a28a2f9eae3430b4de60d4cca34..b388d782c7c40cbbd84cc4eca875daa4709b20d4 100644 (file)
@@ -710,7 +710,7 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                                SUPPORTED_FIBRE);
        cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg |
                                ADVERTISED_FIBRE);
-       cmd->speed = SPEED_1000;
+       ethtool_cmd_speed_set(cmd, SPEED_1000);
        cmd->duplex = DUPLEX_FULL;
        cmd->port = PORT_FIBRE;
        cmd->phy_address = 0;
index 2cc221b65cd4850b83d4fd256ca6afa90fc1a868..023aa9b1065427d0477b404cb179d83c727296e7 100644 (file)
@@ -178,11 +178,11 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 
                if ((status & E1000_STATUS_SPEED_1000) ||
                    hw->phy.media_type != e1000_media_type_copper)
-                       ecmd->speed = SPEED_1000;
+                       ethtool_cmd_speed_set(ecmd, SPEED_1000);
                else if (status & E1000_STATUS_SPEED_100)
-                       ecmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(ecmd, SPEED_100);
                else
-                       ecmd->speed = SPEED_10;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10);
 
                if ((status & E1000_STATUS_FD) ||
                    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)
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index 1d943aa7c7a62d6c88cadf73852285eb8171c2c9..112ae15b2d498e7bc7569cfa8b9c88d0ab3ade4d 100644 (file)
@@ -90,18 +90,18 @@ static int igbvf_get_settings(struct net_device *netdev,
        status = er32(STATUS);
        if (status & E1000_STATUS_LU) {
                if (status & E1000_STATUS_SPEED_1000)
-                       ecmd->speed = 1000;
+                       ethtool_cmd_speed_set(ecmd, SPEED_1000);
                else if (status & E1000_STATUS_SPEED_100)
-                       ecmd->speed = 100;
+                       ethtool_cmd_speed_set(ecmd, SPEED_100);
                else
-                       ecmd->speed = 10;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10);
 
                if (status & E1000_STATUS_FD)
                        ecmd->duplex = DUPLEX_FULL;
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index edb3d7eaf6d521dd2d2bdd55efc0c1e5eaee802b..5f224c387e0cb8f9b1c223ed327d0ff16eea02ed 100644 (file)
@@ -104,10 +104,10 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
        ecmd->transceiver = XCVR_EXTERNAL;
 
        if (netif_carrier_ok(adapter->netdev)) {
-               ecmd->speed = SPEED_10000;
+               ethtool_cmd_speed_set(ecmd, SPEED_10000);
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index c52243d67edcea84c896cdaa11331a1e04d4bc59..bcba057b510fb5dfcb627e1f34432670fbef3ed7 100644 (file)
@@ -288,20 +288,20 @@ static int ixgbe_get_settings(struct net_device *netdev,
        if (link_up) {
                switch (link_speed) {
                case IXGBE_LINK_SPEED_10GB_FULL:
-                       ecmd->speed = SPEED_10000;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10000);
                        break;
                case IXGBE_LINK_SPEED_1GB_FULL:
-                       ecmd->speed = SPEED_1000;
+                       ethtool_cmd_speed_set(ecmd, SPEED_1000);
                        break;
                case IXGBE_LINK_SPEED_100_FULL:
-                       ecmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(ecmd, SPEED_100);
                        break;
                default:
                        break;
                }
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index 0563ab29264e266b614bb4ebc7dce6c2febc35e8..deee3754b1f7a29e186c8b90549fb438c7d350a4 100644 (file)
@@ -104,11 +104,13 @@ static int ixgbevf_get_settings(struct net_device *netdev,
        hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
 
        if (link_up) {
-               ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
-                              SPEED_10000 : SPEED_1000;
+               ethtool_cmd_speed_set(
+                       ecmd,
+                       (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
+                       SPEED_10000 : SPEED_1000);
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index f2d10abd04035a7b4f05580ff363607396f8cc06..16fbb11d92aca1cf74369058ab373cf60555302b 100644 (file)
@@ -188,6 +188,7 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
                               u32 npage_adv, u32 npage_lpa)
 {
        int reg;
+       u32 speed;
 
        ecmd->transceiver = XCVR_INTERNAL;
        ecmd->phy_address = mdio->prtad;
@@ -290,33 +291,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
                if (modes & (ADVERTISED_10000baseT_Full |
                             ADVERTISED_10000baseKX4_Full |
                             ADVERTISED_10000baseKR_Full)) {
-                       ecmd->speed = SPEED_10000;
+                       speed = SPEED_10000;
                        ecmd->duplex = DUPLEX_FULL;
                } else if (modes & (ADVERTISED_1000baseT_Full |
                                    ADVERTISED_1000baseT_Half |
                                    ADVERTISED_1000baseKX_Full)) {
-                       ecmd->speed = SPEED_1000;
+                       speed = SPEED_1000;
                        ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half);
                } else if (modes & (ADVERTISED_100baseT_Full |
                                    ADVERTISED_100baseT_Half)) {
-                       ecmd->speed = SPEED_100;
+                       speed = SPEED_100;
                        ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full);
                } else {
-                       ecmd->speed = SPEED_10;
+                       speed = SPEED_10;
                        ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full);
                }
        } else {
                /* Report forced settings */
                reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
                                      MDIO_CTRL1);
-               ecmd->speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) *
-                              ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
+               speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1)
+                        * ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
                ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX ||
-                               ecmd->speed == SPEED_10000);
+                               speed == SPEED_10000);
        }
 
+       ethtool_cmd_speed_set(ecmd, speed);
+
        /* 10GBASE-T MDI/MDI-X */
-       if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) {
+       if (ecmd->port == PORT_TP
+           && (ethtool_cmd_speed(ecmd) == SPEED_10000)) {
                switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
                                        MDIO_PMA_10GBT_SWAPPOL)) {
                case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX:
index e8198edeaa761712aa7840ea290c19a9e8b5613c..4fbc816efee28078f2149b09a5af16db39d49267 100644 (file)
@@ -121,22 +121,25 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
 
                if (nego & (ADVERTISED_1000baseT_Full |
                            ADVERTISED_1000baseT_Half)) {
-                       ecmd->speed = SPEED_1000;
+                       ethtool_cmd_speed_set(ecmd, SPEED_1000);
                        ecmd->duplex = !!(nego & ADVERTISED_1000baseT_Full);
                } else if (nego & (ADVERTISED_100baseT_Full |
                                   ADVERTISED_100baseT_Half)) {
-                       ecmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(ecmd, SPEED_100);
                        ecmd->duplex = !!(nego & ADVERTISED_100baseT_Full);
                } else {
-                       ecmd->speed = SPEED_10;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10);
                        ecmd->duplex = !!(nego & ADVERTISED_10baseT_Full);
                }
        } else {
                ecmd->autoneg = AUTONEG_DISABLE;
 
-               ecmd->speed = ((bmcr & BMCR_SPEED1000 &&
-                               (bmcr & BMCR_SPEED100) == 0) ? SPEED_1000 :
-                              (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10);
+               ethtool_cmd_speed_set(ecmd,
+                                     ((bmcr & BMCR_SPEED1000 &&
+                                       (bmcr & BMCR_SPEED100) == 0) ?
+                                      SPEED_1000 :
+                                      ((bmcr & BMCR_SPEED100) ?
+                                       SPEED_100 : SPEED_10)));
                ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
        }
 
index be4a9e0b2406cfe1e39e2992664ad070184af016..2e858e4dcf4d821d2371c948de3c48b13cbc23c5 100644 (file)
@@ -265,10 +265,10 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        trans_type = priv->port_state.transciver;
        if (netif_carrier_ok(dev)) {
-               cmd->speed = priv->port_state.link_speed;
+               ethtool_cmd_speed_set(cmd, priv->port_state.link_speed);
                cmd->duplex = DUPLEX_FULL;
        } else {
-               cmd->speed = -1;
+               ethtool_cmd_speed_set(cmd, -1);
                cmd->duplex = -1;
        }
 
index 57c2ac04f9ffa2f03f12236626dd837f575e63e4..a5d9b1c310b38beb48f27b3828384be3e032a006 100644 (file)
@@ -1444,13 +1444,13 @@ mv643xx_eth_get_settings_phyless(struct mv643xx_eth_private *mp,
        cmd->advertising = ADVERTISED_MII;
        switch (port_status & PORT_SPEED_MASK) {
        case PORT_SPEED_10:
-               cmd->speed = SPEED_10;
+               ethtool_cmd_speed_set(cmd, SPEED_10);
                break;
        case PORT_SPEED_100:
-               cmd->speed = SPEED_100;
+               ethtool_cmd_speed_set(cmd, SPEED_100);
                break;
        case PORT_SPEED_1000:
-               cmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(cmd, SPEED_1000);
                break;
        default:
                cmd->speed = -1;
index e7f801643c12a8b370fbf35f4a8daaf26adf5c34..b1358f79ba0a9a1a0a4fcb4b07efbb012e9ffcad 100644 (file)
@@ -1644,7 +1644,7 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
        int i;
 
        cmd->autoneg = AUTONEG_DISABLE;
-       cmd->speed = SPEED_10000;
+       ethtool_cmd_speed_set(cmd, SPEED_10000);
        cmd->duplex = DUPLEX_FULL;
 
        /*
index 7633c67b7842fa8cc2f70d802287436dd931995b..b78be088c4ad53b54be4c61b37cb0cb7d93c9373 100644 (file)
@@ -2820,7 +2820,7 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
        u32 tmp;
 
        ecmd->port        = dev->if_port;
-       ecmd->speed       = np->speed;
+       ethtool_cmd_speed_set(ecmd, np->speed);
        ecmd->duplex      = np->duplex;
        ecmd->autoneg     = np->autoneg;
        ecmd->advertising = 0;
@@ -2878,9 +2878,9 @@ static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
                tmp = mii_nway_result(
                        np->advertising & mdio_read(dev, MII_LPA));
                if (tmp == LPA_100FULL || tmp == LPA_100HALF)
-                       ecmd->speed  = SPEED_100;
+                       ethtool_cmd_speed_set(ecmd, SPEED_100);
                else
-                       ecmd->speed  = SPEED_10;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10);
                if (tmp == LPA_100FULL || tmp == LPA_10FULL)
                        ecmd->duplex = DUPLEX_FULL;
                else
index e8d16f6f11e3d8a4370acd28c8ed85783325501f..b34fb74d07e3b4f91ad027d914ab3b2fbd260a14 100644 (file)
@@ -117,7 +117,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 
                ecmd->port = PORT_TP;
 
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                ecmd->duplex = adapter->link_duplex;
                ecmd->autoneg = adapter->link_autoneg;
 
@@ -134,7 +134,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
                }
 
                if (netif_running(dev) && adapter->has_link_events) {
-                       ecmd->speed = adapter->link_speed;
+                       ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                        ecmd->autoneg = adapter->link_autoneg;
                        ecmd->duplex = adapter->link_duplex;
                        goto skip;
@@ -146,10 +146,10 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
                        u16 pcifn = adapter->ahw.pci_func;
 
                        val = NXRD32(adapter, P3_LINK_SPEED_REG(pcifn));
-                       ecmd->speed = P3_LINK_SPEED_MHZ *
-                                       P3_LINK_SPEED_VAL(pcifn, val);
+                       ethtool_cmd_speed_set(ecmd, P3_LINK_SPEED_MHZ *
+                                             P3_LINK_SPEED_VAL(pcifn, val));
                } else
-                       ecmd->speed = SPEED_10000;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10000);
 
                ecmd->duplex = DUPLEX_FULL;
                ecmd->autoneg = AUTONEG_DISABLE;
index 524e800ddcf468f078189d6a5136372ecb801ed8..cc25bff0bd3b1fb610f53af8e21e2dc9f0624da9 100644 (file)
@@ -6844,7 +6844,7 @@ static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        cmd->supported = lp->supported;
        cmd->advertising = lp->active_advertising;
        cmd->autoneg = lp->active_autoneg;
-       cmd->speed = lp->active_speed;
+       ethtool_cmd_speed_set(cmd, lp->active_speed);
        cmd->duplex = lp->active_duplex;
        cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP;
        cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ?
index 6667e0667a88e15b82c8f0b65564046c9fe88202..3e4040f2f3cb2751b693f482a566bf89fc0a898d 100644 (file)
@@ -1251,7 +1251,7 @@ static int ns83820_get_settings(struct net_device *ndev,
        /*
         * Here's the list of available ethtool commands from other drivers:
         *      cmd->advertising =
-        *      cmd->speed =
+        *      ethtool_cmd_speed_set(cmd, ...)
         *      cmd->duplex =
         *      cmd->port = 0;
         *      cmd->phy_address =
@@ -1289,13 +1289,13 @@ static int ns83820_get_settings(struct net_device *ndev,
        cmd->duplex = fullduplex ? DUPLEX_FULL : DUPLEX_HALF;
        switch (cfg / CFG_SPDSTS0 & 3) {
        case 2:
-               cmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(cmd, SPEED_1000);
                break;
        case 1:
-               cmd->speed = SPEED_100;
+               ethtool_cmd_speed_set(cmd, SPEED_100);
                break;
        default:
-               cmd->speed = SPEED_10;
+               ethtool_cmd_speed_set(cmd, SPEED_10);
                break;
        }
        cmd->autoneg = (tbicr & TBICR_MR_AN_ENABLE)
index 9a8207f686fd41cc289dca79b0a6545f36b756b0..28bb9603d736cd11ad06e1efc9d96156fbcb3c1b 100644 (file)
@@ -256,7 +256,7 @@ void pch_gbe_phy_init_setting(struct pch_gbe_hw *hw)
        if (ret)
                pr_err("Error: mii_ethtool_gset\n");
 
-       cmd.speed = hw->mac.link_speed;
+       ethtool_cmd_speed_set(&cmd, hw->mac.link_speed);
        cmd.duplex = hw->mac.link_duplex;
        cmd.advertising = hw->phy.autoneg_advertised;
        cmd.autoneg = hw->mac.autoneg;
index bc71cb260ff4d5cbec771c68c824322b537c0faf..288e4f1317ee71943e417c55d6141cb3e0b5bf73 100644 (file)
@@ -1860,7 +1860,7 @@ static int smc_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
     tmp = inw(ioaddr + CONFIG);
     ecmd->port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP;
     ecmd->transceiver = XCVR_INTERNAL;
-    ecmd->speed = SPEED_10;
+    ethtool_cmd_speed_set(ecmd, SPEED_10);
     ecmd->phy_address = ioaddr + MGMT;
 
     SMC_SELECT_BANK(0);
index e3f3501d4347d26e7d2f3521a12fc3527779da74..a47595760751400766499e772ca63cbb3bb9b0c5 100644 (file)
@@ -288,7 +288,7 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd)
 
        cmd->advertising = phydev->advertising;
 
-       cmd->speed = phydev->speed;
+       ethtool_cmd_speed_set(cmd, phydev->speed);
        cmd->duplex = phydev->duplex;
        cmd->port = PORT_MII;
        cmd->phy_address = phydev->addr;
index 4383ed21813edceff1066ecbc01187a43e298505..b1f251da1535c6ff184d28e59807007d3b021864 100644 (file)
@@ -1243,17 +1243,17 @@ static int gelic_ether_get_settings(struct net_device *netdev,
 
        switch (card->ether_port_status & GELIC_LV1_ETHER_SPEED_MASK) {
        case GELIC_LV1_ETHER_SPEED_10:
-               cmd->speed = SPEED_10;
+               ethtool_cmd_speed_set(cmd, SPEED_10);
                break;
        case GELIC_LV1_ETHER_SPEED_100:
-               cmd->speed = SPEED_100;
+               ethtool_cmd_speed_set(cmd, SPEED_100);
                break;
        case GELIC_LV1_ETHER_SPEED_1000:
-               cmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(cmd, SPEED_1000);
                break;
        default:
                pr_info("%s: speed unknown\n", __func__);
-               cmd->speed = SPEED_10;
+               ethtool_cmd_speed_set(cmd, SPEED_10);
                break;
        }
 
index f3f737b9124847e96a998ba4ac1d58ea94cb0c96..d495a6859fd9ff37371bb2354319111e91f12c43 100644 (file)
@@ -1725,7 +1725,7 @@ static int ql_get_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
        }
        ecmd->advertising = ql_supported_modes(qdev);
        ecmd->autoneg = ql_get_auto_cfg_status(qdev);
-       ecmd->speed = ql_get_speed(qdev);
+       ethtool_cmd_speed_set(ecmd, ql_get_speed(qdev));
        ecmd->duplex = ql_get_full_dup(qdev);
        return 0;
 }
index 27726ebfba2aeb26a05fd2db7435265707fccef4..c541461bc12c021f84cc17779121fed8270df42d 100644 (file)
@@ -166,7 +166,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
                                     ADVERTISED_1000baseT_Half |
                                     ADVERTISED_1000baseT_Full);
 
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                ecmd->duplex = adapter->link_duplex;
                ecmd->autoneg = adapter->link_autoneg;
 
@@ -183,15 +183,15 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
                }
 
                if (netif_running(dev) && adapter->has_link_events) {
-                       ecmd->speed = adapter->link_speed;
+                       ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                        ecmd->autoneg = adapter->link_autoneg;
                        ecmd->duplex = adapter->link_duplex;
                        goto skip;
                }
 
                val = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn));
-               ecmd->speed = P3P_LINK_SPEED_MHZ *
-                       P3P_LINK_SPEED_VAL(pcifn, val);
+               ethtool_cmd_speed_set(ecmd, P3P_LINK_SPEED_MHZ *
+                                     P3P_LINK_SPEED_VAL(pcifn, val));
                ecmd->duplex = DUPLEX_FULL;
                ecmd->autoneg = AUTONEG_DISABLE;
        } else
index 78dc40c18c60efb7e244efe0017c1053542e45d3..19b00fa0eaf0205b7e5c901a738ff6b747d7eea9 100644 (file)
@@ -356,7 +356,7 @@ static int ql_get_settings(struct net_device *ndev,
                ecmd->port = PORT_FIBRE;
        }
 
-       ecmd->speed = SPEED_10000;
+       ethtool_cmd_speed_set(ecmd, SPEED_10000);
        ecmd->duplex = DUPLEX_FULL;
 
        return 0;
index b52ee17de74d30259ad19c2e7e77f7bbd468eaf7..a8976a75381434e8f590b5f0d30396176c9b8854 100644 (file)
@@ -1422,7 +1422,7 @@ static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
        cmd->advertising = (status & TBINwEnable) ?  ADVERTISED_Autoneg : 0;
        cmd->autoneg = !!(status & TBINwEnable);
 
-       cmd->speed = SPEED_1000;
+       ethtool_cmd_speed_set(cmd, SPEED_1000);
        cmd->duplex = DUPLEX_FULL; /* Always set */
 
        return 0;
index 5443985c019e514651dea6ffaf94fdea552eaf1e..89cfee7e864315eb119acee8dbbb34ce42ddaa2b 100644 (file)
@@ -5414,10 +5414,10 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
        info->transceiver = XCVR_EXTERNAL;
 
        if (netif_carrier_ok(sp->dev)) {
-               info->speed = 10000;
+               ethtool_cmd_speed_set(info, SPEED_10000);
                info->duplex = DUPLEX_FULL;
        } else {
-               info->speed = -1;
+               ethtool_cmd_speed_set(info, -1);
                info->duplex = -1;
        }
 
index f3ffc1df3b2decde6905c716111f69d1997f7475..fa74314ef789f73be1bd8399a250984090bfd521 100644 (file)
@@ -1173,7 +1173,8 @@ static int sc92031_ethtool_get_settings(struct net_device *dev,
        if (phy_ctrl & PhyCtrlAne)
                cmd->advertising |= ADVERTISED_Autoneg;
 
-       cmd->speed = (output_status & 0x2) ? SPEED_100 : SPEED_10;
+       ethtool_cmd_speed_set(cmd,
+                             (output_status & 0x2) ? SPEED_100 : SPEED_10);
        cmd->duplex = (output_status & 0x4) ? DUPLEX_FULL : DUPLEX_HALF;
        cmd->port = PORT_MII;
        cmd->phy_address = phy_address;
index 10b160a508f375de37ba0791bac37c586c7ea0be..8c5e0052c44aef836391aada06b4bc22829365d9 100644 (file)
@@ -219,7 +219,7 @@ static int efx_ethtool_get_settings(struct net_device *net_dev,
        ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
 
        if (LOOPBACK_INTERNAL(efx)) {
-               ecmd->speed = link_state->speed;
+               ethtool_cmd_speed_set(ecmd, link_state->speed);
                ecmd->duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF;
        }
 
index 6c5fccbdeca20b224d4152fcd0b59d612016924e..6c63ab0710af0bbdcc95c8b9c5267f92615ff20d 100644 (file)
@@ -513,7 +513,7 @@ static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *e
        ecmd->supported =
                mcdi_to_ethtool_cap(phy_cfg->media, phy_cfg->supported_cap);
        ecmd->advertising = efx->link_advertising;
-       ecmd->speed = efx->link_state.speed;
+       ethtool_cmd_speed_set(ecmd, efx->link_state.speed);
        ecmd->duplex = efx->link_state.fd;
        ecmd->port = mcdi_to_ethtool_media(phy_cfg->media);
        ecmd->phy_address = phy_cfg->port;
index 204ecdaac9ab65fda17a7b56818b70c55fedc300..7b0fd89e7b8597411b98cceae7f42e0ba0954f3d 100644 (file)
@@ -460,7 +460,7 @@ tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
        /* In loopback, the PHY automatically brings up the correct interface,
         * but doesn't advertise the correct speed. So override it */
        if (LOOPBACK_EXTERNAL(efx))
-               ecmd->speed = SPEED_10000;
+               ethtool_cmd_speed_set(ecmd, SPEED_10000);
 }
 
 static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
index a05e864de6744ff9872e1266eab85c8924b7a9ec..52a48cb75440abecaaf18b81f3aab26dd63b2169 100644 (file)
@@ -303,7 +303,7 @@ static int skge_get_settings(struct net_device *dev,
 
        ecmd->advertising = skge->advertising;
        ecmd->autoneg = skge->autoneg;
-       ecmd->speed = skge->speed;
+       ethtool_cmd_speed_set(ecmd, skge->speed);
        ecmd->duplex = skge->duplex;
        return 0;
 }
index 5c7e2d68df2a952450ea55ff82ea6cf087973338..3ee41da130c2e683063799421bb58019dfa4621e 100644 (file)
@@ -3413,10 +3413,10 @@ static int sky2_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
        ecmd->phy_address = PHY_ADDR_MARV;
        if (sky2_is_copper(hw)) {
                ecmd->port = PORT_TP;
-               ecmd->speed = sky2->speed;
+               ethtool_cmd_speed_set(ecmd, sky2->speed);
                ecmd->supported |=  SUPPORTED_Autoneg | SUPPORTED_TP;
        } else {
-               ecmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(ecmd, SPEED_1000);
                ecmd->port = PORT_FIBRE;
                ecmd->supported |=  SUPPORTED_Autoneg | SUPPORTED_FIBRE;
        }
index 66831f378396b1e910e79b74a0340499c7d3c5b5..053863aefb12f183b0095cd0d962bc1698db3580 100644 (file)
@@ -1488,9 +1488,9 @@ smc911x_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
                                SUPPORTED_TP | SUPPORTED_AUI;
 
                if (lp->ctl_rspeed == 10)
-                       cmd->speed = SPEED_10;
+                       ethtool_cmd_speed_set(cmd, SPEED_10);
                else if (lp->ctl_rspeed == 100)
-                       cmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(cmd, SPEED_100);
 
                cmd->autoneg = AUTONEG_DISABLE;
                if (lp->mii.phy_id==1)
index 43654a3bb0ec81591cb6d55302b984fab7782066..dc4805f473e33ee439ea00b884b4ab656b0b0c7b 100644 (file)
@@ -1565,9 +1565,9 @@ smc_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
                                 SUPPORTED_TP | SUPPORTED_AUI;
 
                if (lp->ctl_rspeed == 10)
-                       cmd->speed = SPEED_10;
+                       ethtool_cmd_speed_set(cmd, SPEED_10);
                else if (lp->ctl_rspeed == 100)
-                       cmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(cmd, SPEED_100);
 
                cmd->autoneg = AUTONEG_DISABLE;
                cmd->transceiver = XCVR_INTERNAL;
index d723fca872ced17fbbd28b6678ad33d4acb20bb1..9c288cd7d1718f4c444117313b2d6ac051266065 100644 (file)
@@ -58,7 +58,7 @@ spider_net_ethtool_get_settings(struct net_device *netdev,
        cmd->advertising = (ADVERTISED_1000baseT_Full |
                             ADVERTISED_FIBRE);
        cmd->port = PORT_FIBRE;
-       cmd->speed = card->phy.speed;
+       ethtool_cmd_speed_set(cmd, card->phy.speed);
        cmd->duplex = DUPLEX_FULL;
 
        return 0;
index 40a755dd1a26d86e5a13c69e13b52d38d5d1bdf5..ab5930099267ca55b3a0c7667de17a9e1ce3f5ce 100644 (file)
@@ -2642,7 +2642,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                /* Return current PHY settings */
                spin_lock_irq(&gp->lock);
                cmd->autoneg = gp->want_autoneg;
-               cmd->speed = gp->phy_mii.speed;
+               ethtool_cmd_speed_set(cmd, gp->phy_mii.speed);
                cmd->duplex = gp->phy_mii.duplex;
                cmd->advertising = gp->phy_mii.advertising;
 
@@ -2659,7 +2659,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                         SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
                         SUPPORTED_Autoneg);
                cmd->advertising = cmd->supported;
-               cmd->speed = 0;
+               ethtool_cmd_speed_set(cmd, 0);
                cmd->duplex = cmd->port = cmd->phy_address =
                        cmd->transceiver = cmd->autoneg = 0;
 
@@ -2673,7 +2673,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                        cmd->advertising = cmd->supported;
                        cmd->transceiver = XCVR_INTERNAL;
                        if (gp->lstate == link_up)
-                               cmd->speed = SPEED_1000;
+                               ethtool_cmd_speed_set(cmd, SPEED_1000);
                        cmd->duplex = DUPLEX_FULL;
                        cmd->autoneg = 1;
                }
index 8f3f02802427b8d58110745eb3163235e30cce30..d381a0f9ee1806d8d39d691a186e12e7938dda1c 100644 (file)
@@ -2401,6 +2401,7 @@ static void happy_meal_set_multicast(struct net_device *dev)
 static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct happy_meal *hp = netdev_priv(dev);
+       u32 speed;
 
        cmd->supported =
                (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
@@ -2420,10 +2421,9 @@ static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        if (hp->sw_bmcr & BMCR_ANENABLE) {
                cmd->autoneg = AUTONEG_ENABLE;
-               cmd->speed =
-                       (hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ?
-                       SPEED_100 : SPEED_10;
-               if (cmd->speed == SPEED_100)
+               speed = ((hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ?
+                        SPEED_100 : SPEED_10);
+               if (speed == SPEED_100)
                        cmd->duplex =
                                (hp->sw_lpa & (LPA_100FULL)) ?
                                DUPLEX_FULL : DUPLEX_HALF;
@@ -2433,13 +2433,12 @@ static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                                DUPLEX_FULL : DUPLEX_HALF;
        } else {
                cmd->autoneg = AUTONEG_DISABLE;
-               cmd->speed =
-                       (hp->sw_bmcr & BMCR_SPEED100) ?
-                       SPEED_100 : SPEED_10;
+               speed = (hp->sw_bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
                cmd->duplex =
                        (hp->sw_bmcr & BMCR_FULLDPLX) ?
                        DUPLEX_FULL : DUPLEX_HALF;
        }
+       ethtool_cmd_speed_set(cmd, speed);
        return 0;
 }
 
index 8be71de725e5bebeabc3f73e400d05e63269dddd..80fbee0d40af760f8e4dd4b794cd850edeb560e5 100644 (file)
@@ -2151,7 +2151,7 @@ static int bdx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 
        ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
        ecmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
-       ecmd->speed = SPEED_10000;
+       ethtool_cmd_speed_set(ecmd, SPEED_10000);
        ecmd->duplex = DUPLEX_FULL;
        ecmd->port = PORT_FIBRE;
        ecmd->transceiver = XCVR_EXTERNAL;      /* what does it mean? */
index 004f266e4352555ae968f5e9ec3f1d978648dabb..7c7c9a897c09477835bb849452941ee14ec5e29a 100644 (file)
@@ -10025,10 +10025,10 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        cmd->advertising = tp->link_config.advertising;
        if (netif_running(dev)) {
-               cmd->speed = tp->link_config.active_speed;
+               ethtool_cmd_speed_set(cmd, tp->link_config.active_speed);
                cmd->duplex = tp->link_config.active_duplex;
        } else {
-               cmd->speed = SPEED_INVALID;
+               ethtool_cmd_speed_set(cmd, SPEED_INVALID);
                cmd->duplex = DUPLEX_INVALID;
        }
        cmd->phy_address = tp->phy_addr;
index f8d26bf9b2c4666a8e22682a5f18b2a462a155c2..ab78e1d58cb68ce0c136945c61df47af8645496a 100644 (file)
@@ -1518,15 +1518,15 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
        switch (de->media_type) {
        case DE_MEDIA_AUI:
                ecmd->port = PORT_AUI;
-               ecmd->speed = 5;
+               ethtool_cmd_speed_set(ecmd, 5);
                break;
        case DE_MEDIA_BNC:
                ecmd->port = PORT_BNC;
-               ecmd->speed = 2;
+               ethtool_cmd_speed_set(ecmd, 2);
                break;
        default:
                ecmd->port = PORT_TP;
-               ecmd->speed = SPEED_10;
+               ethtool_cmd_speed_set(ecmd, SPEED_10);
                break;
        }
 
index 74217dbf014330fe3f545775b1481b7ff101fd7f..a4375c406b5f13b4ae0853f11ec52f674a08b3b5 100644 (file)
@@ -945,12 +945,12 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
 
        ecmd->transceiver = XCVR_EXTERNAL;
 
-       ecmd->speed = 10;
+       ethtool_cmd_speed_set(ecmd, SPEED_10);
        ecmd->duplex = DUPLEX_HALF;
 
        if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD)
        {
-               ecmd->speed = 100;
+               ethtool_cmd_speed_set(ecmd, SPEED_100);
        }
        if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD)
        {
@@ -958,7 +958,7 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
        }
        if(db->link_failed)
        {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
 
index ade3cf9cd32605913dd2e31f9ac4509a52a5d0a1..0636f70403259ac44b2faa6f4988f8e3c92327e8 100644 (file)
@@ -1553,7 +1553,7 @@ static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        cmd->supported          = 0;
        cmd->advertising        = 0;
-       cmd->speed              = SPEED_10;
+       ethtool_cmd_speed_set(cmd, SPEED_10);
        cmd->duplex             = DUPLEX_FULL;
        cmd->port               = PORT_TP;
        cmd->phy_address        = 0;
index 9f11c111b65dcf08bcd75dde34c8d732cf6a5e2b..3de4283344e9824f0a074ea2e0cffb3e8a05316e 100644 (file)
@@ -1050,7 +1050,7 @@ typhoon_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        /* need to get stats to make these link speed/duplex valid */
        typhoon_do_get_stats(tp);
-       cmd->speed = tp->speed;
+       ethtool_cmd_speed_set(cmd, tp->speed);
        cmd->duplex = tp->duplex;
        cmd->phy_address = 0;
        cmd->transceiver = XCVR_INTERNAL;
index 97687d335903148d7edfa6ba9f55bbd4e02331b0..d7221c4a5dcf97973b97ee50d93aec593a90b434 100644 (file)
@@ -686,7 +686,7 @@ static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        cmd->supported = SUPPORTED_10baseT_Half | SUPPORTED_TP;
        cmd->advertising = ADVERTISED_10baseT_Half | ADVERTISED_TP;
-       cmd->speed = SPEED_10;
+       ethtool_cmd_speed_set(cmd, SPEED_10);
        cmd->duplex = DUPLEX_HALF;
        cmd->port = PORT_TP; 
        cmd->phy_address = 0;
index e85c89c6706d1e05e15649c577accbed1a9797af..041fb7d43c4f7d077c8175c5d395901a1d92061c 100644 (file)
@@ -843,10 +843,11 @@ static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *e
        get_registers(dev, BMCR, 2, &bmcr);
        get_registers(dev, ANLP, 2, &lpa);
        if (bmcr & BMCR_ANENABLE) {
+               u32 speed = ((lpa & (LPA_100HALF | LPA_100FULL)) ?
+                            SPEED_100 : SPEED_10);
+               ethtool_cmd_speed_set(ecmd, speed);
                ecmd->autoneg = AUTONEG_ENABLE;
-               ecmd->speed = (lpa & (LPA_100HALF | LPA_100FULL)) ?
-                            SPEED_100 : SPEED_10;
-               if (ecmd->speed == SPEED_100)
+               if (speed == SPEED_100)
                        ecmd->duplex = (lpa & LPA_100FULL) ?
                            DUPLEX_FULL : DUPLEX_HALF;
                else
@@ -854,8 +855,8 @@ static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *e
                            DUPLEX_FULL : DUPLEX_HALF;
        } else {
                ecmd->autoneg = AUTONEG_DISABLE;
-               ecmd->speed = (bmcr & BMCR_SPEED100) ?
-                   SPEED_100 : SPEED_10;
+               ethtool_cmd_speed_set(ecmd, ((bmcr & BMCR_SPEED100) ?
+                                            SPEED_100 : SPEED_10));
                ecmd->duplex = (bmcr & BMCR_FULLDPLX) ?
                    DUPLEX_FULL : DUPLEX_HALF;
        }
index 654228849951e508f5a9d013b59f1ab190f09291..cbe953a5bf5a6a26b9323866e1d0544ba60a1c10 100644 (file)
@@ -52,7 +52,7 @@ static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        cmd->supported          = 0;
        cmd->advertising        = 0;
-       cmd->speed              = SPEED_10000;
+       ethtool_cmd_speed_set(cmd, SPEED_10000);
        cmd->duplex             = DUPLEX_FULL;
        cmd->port               = PORT_TP;
        cmd->phy_address        = 0;
index 9a8f116e6920137c573509ee472313488ca83bf0..06daa9d6fee82c3354ced149e533f22bb7d6709f 100644 (file)
@@ -3182,7 +3182,8 @@ static void velocity_ethtool_down(struct net_device *dev)
                pci_set_power_state(vptr->pdev, PCI_D3hot);
 }
 
-static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int velocity_get_settings(struct net_device *dev,
+                                struct ethtool_cmd *cmd)
 {
        struct velocity_info *vptr = netdev_priv(dev);
        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
                        break;
                }
        }
+
        if (status & VELOCITY_SPEED_1000)
-               cmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(cmd, SPEED_1000);
        else if (status & VELOCITY_SPEED_100)
-               cmd->speed = SPEED_100;
+               ethtool_cmd_speed_set(cmd, SPEED_100);
        else
-               cmd->speed = SPEED_10;
+               ethtool_cmd_speed_set(cmd, SPEED_10);
+
        cmd->autoneg = (status & VELOCITY_AUTONEG_ENABLE) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
        cmd->port = PORT_TP;
        cmd->transceiver = XCVR_INTERNAL;
index 70c1ab96ed27c12cb900a8296babf8e26295bbe6..64303eb3a5fc66ccdbe535f3f955be94c3bb6315 100644 (file)
@@ -424,10 +424,10 @@ vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
        ecmd->transceiver = XCVR_INTERNAL;
 
        if (adapter->link_speed) {
-               ecmd->speed = adapter->link_speed;
+               ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ecmd->speed = -1;
+               ethtool_cmd_speed_set(ecmd, -1);
                ecmd->duplex = -1;
        }
        return 0;
index a70874e64d0e03f84dcfec29dac2c1392309e431..92dd72d3f9de39a70bb141848614753e7c23b4ba 100644 (file)
@@ -59,10 +59,10 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
        info->transceiver = XCVR_EXTERNAL;
 
        if (netif_carrier_ok(dev)) {
-               info->speed = SPEED_10000;
+               ethtool_cmd_speed_set(info, SPEED_10000);
                info->duplex = DUPLEX_FULL;
        } else {
-               info->speed = -1;
+               ethtool_cmd_speed_set(info, -1);
                info->duplex = -1;
        }
 
index f4d80ad008c2e87c7120bea0f6e257db34eca8dd..eeabbb89172ca15f7271897bf08228e1739ae08f 100644 (file)
@@ -697,7 +697,7 @@ static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        cmd->supported = 0;
        cmd->advertising = 0;
-       cmd->speed = SPEED_10;
+       ethtool_cmd_speed_set(cmd, SPEED_10);
        cmd->duplex = DUPLEX_FULL;
        cmd->port = PORT_TP;
        cmd->phy_address = 0;