net: use SPEED_UNKNOWN and DUPLEX_UNKNOWN when appropriate
authorJiri Pirko <jiri@resnulli.us>
Fri, 6 Jun 2014 12:17:00 +0000 (14:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Jun 2014 23:24:07 +0000 (16:24 -0700)
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
25 files changed:
drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c
drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
drivers/net/ethernet/atheros/atlx/atl1.c
drivers/net/ethernet/atheros/atlx/atl2.c
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/brocade/bna/bnad_ethtool.c
drivers/net/ethernet/chelsio/cxgb/cxgb2.c
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
drivers/net/ethernet/cisco/enic/enic_ethtool.c
drivers/net/ethernet/dec/tulip/uli526x.c
drivers/net/ethernet/dlink/dl2k.c
drivers/net/ethernet/ibm/ehea/ehea_ethtool.c
drivers/net/ethernet/intel/e1000/e1000_ethtool.c
drivers/net/ethernet/intel/e1000e/ethtool.c
drivers/net/ethernet/intel/igb/igb_ethtool.c
drivers/net/ethernet/intel/igbvf/ethtool.c
drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbevf/ethtool.c
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
drivers/net/ethernet/neterion/s2io.c
drivers/net/ethernet/neterion/vxge/vxge-ethtool.c
drivers/net/ethernet/nvidia/forcedeth.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c
drivers/net/vmxnet3/vmxnet3_ethtool.c

index ecacaaeb2b92929caeeb12849b06c3d6b53707c9..48694c239d5cee024055731d2aa586e57fe529e5 100644 (file)
@@ -56,8 +56,8 @@ static int atl1c_get_settings(struct net_device *netdev,
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        ecmd->autoneg = AUTONEG_ENABLE;
index 206e9b7be43123911b80ab1d84478bd4412079fe..1be072f4afc2a261b5504302db5dba50b81ad268 100644 (file)
@@ -57,8 +57,8 @@ static int atl1e_get_settings(struct net_device *netdev,
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        ecmd->autoneg = AUTONEG_ENABLE;
index dfd0e91fa726852818b48b2853e9d60533d01dd7..b460db7919a28866c5f37db08c9a30b71a857840 100644 (file)
@@ -3258,8 +3258,8 @@ static int atl1_get_settings(struct net_device *netdev,
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
        if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR ||
            hw->media_type == MEDIA_TYPE_1000M_FULL)
index 2587fed7b02cbc3e93674ec73e053b0f50c28c46..6746bd7171460100a4d224e55bdcbe62a4efcecf 100644 (file)
@@ -1769,8 +1769,8 @@ static int atl2_get_settings(struct net_device *netdev,
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        ecmd->autoneg = AUTONEG_ENABLE;
index 0ab83708b6a11a66f1b3d98873d59071d578fcdb..67d2b00473718eec10b9f1fbdbf4f6a981aa02d0 100644 (file)
@@ -6916,8 +6916,8 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                }
        }
        else {
-               ethtool_cmd_speed_set(cmd, -1);
-               cmd->duplex = -1;
+               ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+               cmd->duplex = DUPLEX_UNKNOWN;
        }
        spin_unlock_bh(&bp->phy_lock);
 
index adca62b728371d9b9e1e70e68c8870c02398eb00..882cad71ad620004aff54832e6dd9758ec025a2c 100644 (file)
@@ -266,8 +266,8 @@ bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
                ethtool_cmd_speed_set(cmd, SPEED_10000);
                cmd->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(cmd, -1);
-               cmd->duplex = -1;
+               ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+               cmd->duplex = DUPLEX_UNKNOWN;
        }
        cmd->transceiver = XCVR_EXTERNAL;
        cmd->maxtxpkt = 0;
index c1b2c1dbf015accf381c1f010610dcac625f618e..3784a8bd1fdd463b1f088ba0eaec267b8df92a9d 100644 (file)
@@ -580,8 +580,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                ethtool_cmd_speed_set(cmd, p->link_config.speed);
                cmd->duplex = p->link_config.duplex;
        } else {
-               ethtool_cmd_speed_set(cmd, -1);
-               cmd->duplex = -1;
+               ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+               cmd->duplex = DUPLEX_UNKNOWN;
        }
 
        cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE;
index 3ed50794724892979a969e7eefa33e6de2f074aa..5d9cce053cc9a90df1608d049212f639bf559e10 100644 (file)
@@ -1809,8 +1809,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                ethtool_cmd_speed_set(cmd, p->link_config.speed);
                cmd->duplex = p->link_config.duplex;
        } else {
-               ethtool_cmd_speed_set(cmd, -1);
-               cmd->duplex = -1;
+               ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+               cmd->duplex = DUPLEX_UNKNOWN;
        }
 
        cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE;
index 1882db230e139e506bfb1efc5248ac211ec76c2b..2e50b5489d204158e89b93dfdb7be09cfba2d8c9 100644 (file)
@@ -104,8 +104,8 @@ static int enic_get_settings(struct net_device *netdev,
                ethtool_cmd_speed_set(ecmd, vnic_dev_port_speed(enic->vdev));
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        ecmd->autoneg = AUTONEG_DISABLE;
index aa801a6af7b9904752c7f3acebc2d01940527128..80afec335a117fcee3645a8d8198b5f9c7df08d6 100644 (file)
@@ -962,8 +962,8 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
        }
        if(db->link_failed)
        {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        if (db->media_mode & ULI526X_AUTO)
index 2324f2ddfd4821b991006dffedf213a1dad61fcf..1274b6fdac8aace34559bb1fd1cae3ccca314a2e 100644 (file)
@@ -1185,8 +1185,8 @@ static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                ethtool_cmd_speed_set(cmd, np->speed);
                cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
        } else {
-               ethtool_cmd_speed_set(cmd, -1);
-               cmd->duplex = -1;
+               ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+               cmd->duplex = DUPLEX_UNKNOWN;
        }
        if ( np->an_enable)
                cmd->autoneg = AUTONEG_ENABLE;
index 6055e3eaf49c860eff05450d4135f11b9d52a0a4..85a3866459cf4a3bebc6bf6ee3fbe3ff254d48a4 100644 (file)
@@ -63,8 +63,8 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                cmd->duplex = port->full_duplex == 1 ?
                                                     DUPLEX_FULL : DUPLEX_HALF;
        } else {
-               speed = ~0;
-               cmd->duplex = -1;
+               speed = SPEED_UNKNOWN;
+               cmd->duplex = DUPLEX_UNKNOWN;
        }
        ethtool_cmd_speed_set(cmd, speed);
 
index 08b207df1459af9374365ac31d9a2ce18642040b..d50f78afb56d8715d8b90d936216d22bacaaa70e 100644 (file)
@@ -168,8 +168,8 @@ static int e1000_get_settings(struct net_device *netdev,
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) ||
index e9a48bb5caacb8e73e5ebb8eeb8baafbbf2f8679..815e26c6d34b85a54c554de5863e200302d6eacd 100644 (file)
@@ -159,8 +159,8 @@ static int e1000_get_settings(struct net_device *netdev,
                ecmd->transceiver = XCVR_EXTERNAL;
        }
 
-       speed = -1;
-       ecmd->duplex = -1;
+       speed = SPEED_UNKNOWN;
+       ecmd->duplex = DUPLEX_UNKNOWN;
 
        if (netif_running(netdev)) {
                if (netif_carrier_ok(netdev)) {
index 80e376377c3d40e183a3d27848c4579c3303edb8..fca9a0e470c3cbcbb4072ed628f59cf24b88fee7 100644 (file)
@@ -229,8 +229,8 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ecmd->speed = -1;
-               ecmd->duplex = -1;
+               ecmd->speed = SPEED_UNKNOWN;
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
        if ((hw->phy.media_type == e1000_media_type_fiber) ||
            hw->mac.autoneg)
index 7d4e8559e2e9d93524ced2c9fc3881b234101f9a..2178f87e9f610f3a95222275978d2b68a9d7832d 100644 (file)
@@ -101,8 +101,8 @@ static int igbvf_get_settings(struct net_device *netdev,
                else
                        ecmd->duplex = DUPLEX_HALF;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        ecmd->autoneg = AUTONEG_DISABLE;
index 1da2d987d370b12c0dbb6b81490d83e958b4ba36..b311e9e710d2636ddc3a17ad4d1cc10ba917cfb1 100644 (file)
@@ -107,8 +107,8 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
                ethtool_cmd_speed_set(ecmd, SPEED_10000);
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        ecmd->autoneg = AUTONEG_DISABLE;
index 23e4e6a4b4b1b584a11ab37f7a4884d1c4607142..a452730a327864111d72d13679fc47c2be870b7c 100644 (file)
@@ -296,8 +296,8 @@ static int ixgbe_get_settings(struct net_device *netdev,
                }
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        return 0;
index a757f07347193efa8fcfd47705c614d1bc854805..d420f124633f046d5b61f6c357656c2a3b13b9f0 100644 (file)
@@ -135,8 +135,8 @@ static int ixgbevf_get_settings(struct net_device *netdev,
                ethtool_cmd_speed_set(ecmd, speed);
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
 
        return 0;
index c021c96294fb78d46f256c617801ffe4537eea81..fa1a069e14e6f3ef21485172d612548034e00262 100644 (file)
@@ -378,8 +378,8 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                ethtool_cmd_speed_set(cmd, priv->port_state.link_speed);
                cmd->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(cmd, -1);
-               cmd->duplex = -1;
+               ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+               cmd->duplex = DUPLEX_UNKNOWN;
        }
 
        if (trans_type > 0 && trans_type <= 0xC) {
index e3cf38e6ce3c11deb08676d0ee58ec4bf62412c7..be587647c70657a93f86608ba6e06e731e7aecb6 100644 (file)
@@ -5360,8 +5360,8 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
                ethtool_cmd_speed_set(info, SPEED_10000);
                info->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(info, -1);
-               info->duplex = -1;
+               ethtool_cmd_speed_set(info, SPEED_UNKNOWN);
+               info->duplex = DUPLEX_UNKNOWN;
        }
 
        info->autoneg = AUTONEG_DISABLE;
index ddcc81ad1ae1f3c2167f03859a436a8fc3938dc9..b07d552a27d4d486079b329b238235411a103e4e 100644 (file)
@@ -62,8 +62,8 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
                ethtool_cmd_speed_set(info, SPEED_10000);
                info->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(info, -1);
-               info->duplex = -1;
+               ethtool_cmd_speed_set(info, SPEED_UNKNOWN);
+               info->duplex = DUPLEX_UNKNOWN;
        }
 
        info->autoneg = AUTONEG_DISABLE;
index 6f255f534d250d36c905b9ccb9c2b6a52dd74c93..9afc536c5734ec264f0d084b88602444cb1b24bd 100644 (file)
@@ -4285,8 +4285,8 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
                if (np->duplex)
                        ecmd->duplex = DUPLEX_FULL;
        } else {
-               speed = -1;
-               ecmd->duplex = -1;
+               speed = SPEED_UNKNOWN;
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
        ethtool_cmd_speed_set(ecmd, speed);
        ecmd->autoneg = np->autoneg;
index 114d2fe52cc2d900bc469825d28b3e3d380ceeed..4fe8ea96bd25d24f1f2296d22230ceebda1e8f64 100644 (file)
@@ -91,7 +91,7 @@ static int pch_gbe_get_settings(struct net_device *netdev,
        ecmd->advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half);
 
        if (!netif_carrier_ok(adapter->netdev))
-               ethtool_cmd_speed_set(ecmd, -1);
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
        return ret;
 }
 
index 9396cca93b091b55c0a422300e843ba30d967caf..40c1c7b0d9e02adb9b25b6e16a15ad8e4fac3a7c 100644 (file)
@@ -431,8 +431,8 @@ vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
                ethtool_cmd_speed_set(ecmd, adapter->link_speed);
                ecmd->duplex = DUPLEX_FULL;
        } else {
-               ethtool_cmd_speed_set(ecmd, -1);
-               ecmd->duplex = -1;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
        }
        return 0;
 }