提交 537fae01 编写于 作者: J Jiri Pirko 提交者: David S. Miller

net: use SPEED_UNKNOWN and DUPLEX_UNKNOWN when appropriate

Signed-off-by: NJiri Pirko <jiri@resnulli.us>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1caaab63
...@@ -56,8 +56,8 @@ static int atl1c_get_settings(struct net_device *netdev, ...@@ -56,8 +56,8 @@ static int atl1c_get_settings(struct net_device *netdev,
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ecmd->autoneg = AUTONEG_ENABLE; ecmd->autoneg = AUTONEG_ENABLE;
......
...@@ -57,8 +57,8 @@ static int atl1e_get_settings(struct net_device *netdev, ...@@ -57,8 +57,8 @@ static int atl1e_get_settings(struct net_device *netdev,
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ecmd->autoneg = AUTONEG_ENABLE; ecmd->autoneg = AUTONEG_ENABLE;
......
...@@ -3258,8 +3258,8 @@ static int atl1_get_settings(struct net_device *netdev, ...@@ -3258,8 +3258,8 @@ static int atl1_get_settings(struct net_device *netdev,
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR || if (hw->media_type == MEDIA_TYPE_AUTO_SENSOR ||
hw->media_type == MEDIA_TYPE_1000M_FULL) hw->media_type == MEDIA_TYPE_1000M_FULL)
......
...@@ -1769,8 +1769,8 @@ static int atl2_get_settings(struct net_device *netdev, ...@@ -1769,8 +1769,8 @@ static int atl2_get_settings(struct net_device *netdev,
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ecmd->autoneg = AUTONEG_ENABLE; ecmd->autoneg = AUTONEG_ENABLE;
......
...@@ -6916,8 +6916,8 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -6916,8 +6916,8 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
} }
} }
else { else {
ethtool_cmd_speed_set(cmd, -1); ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
cmd->duplex = -1; cmd->duplex = DUPLEX_UNKNOWN;
} }
spin_unlock_bh(&bp->phy_lock); spin_unlock_bh(&bp->phy_lock);
......
...@@ -266,8 +266,8 @@ bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) ...@@ -266,8 +266,8 @@ bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
ethtool_cmd_speed_set(cmd, SPEED_10000); ethtool_cmd_speed_set(cmd, SPEED_10000);
cmd->duplex = DUPLEX_FULL; cmd->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(cmd, -1); ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
cmd->duplex = -1; cmd->duplex = DUPLEX_UNKNOWN;
} }
cmd->transceiver = XCVR_EXTERNAL; cmd->transceiver = XCVR_EXTERNAL;
cmd->maxtxpkt = 0; cmd->maxtxpkt = 0;
......
...@@ -580,8 +580,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -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); ethtool_cmd_speed_set(cmd, p->link_config.speed);
cmd->duplex = p->link_config.duplex; cmd->duplex = p->link_config.duplex;
} else { } else {
ethtool_cmd_speed_set(cmd, -1); ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
cmd->duplex = -1; cmd->duplex = DUPLEX_UNKNOWN;
} }
cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE; cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE;
......
...@@ -1809,8 +1809,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -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); ethtool_cmd_speed_set(cmd, p->link_config.speed);
cmd->duplex = p->link_config.duplex; cmd->duplex = p->link_config.duplex;
} else { } else {
ethtool_cmd_speed_set(cmd, -1); ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
cmd->duplex = -1; cmd->duplex = DUPLEX_UNKNOWN;
} }
cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE; cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE;
......
...@@ -104,8 +104,8 @@ static int enic_get_settings(struct net_device *netdev, ...@@ -104,8 +104,8 @@ static int enic_get_settings(struct net_device *netdev,
ethtool_cmd_speed_set(ecmd, vnic_dev_port_speed(enic->vdev)); ethtool_cmd_speed_set(ecmd, vnic_dev_port_speed(enic->vdev));
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ecmd->autoneg = AUTONEG_DISABLE; ecmd->autoneg = AUTONEG_DISABLE;
......
...@@ -962,8 +962,8 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd) ...@@ -962,8 +962,8 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
} }
if(db->link_failed) if(db->link_failed)
{ {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
if (db->media_mode & ULI526X_AUTO) if (db->media_mode & ULI526X_AUTO)
......
...@@ -1185,8 +1185,8 @@ static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -1185,8 +1185,8 @@ static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
ethtool_cmd_speed_set(cmd, np->speed); ethtool_cmd_speed_set(cmd, np->speed);
cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(cmd, -1); ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
cmd->duplex = -1; cmd->duplex = DUPLEX_UNKNOWN;
} }
if ( np->an_enable) if ( np->an_enable)
cmd->autoneg = AUTONEG_ENABLE; cmd->autoneg = AUTONEG_ENABLE;
......
...@@ -63,8 +63,8 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -63,8 +63,8 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->duplex = port->full_duplex == 1 ? cmd->duplex = port->full_duplex == 1 ?
DUPLEX_FULL : DUPLEX_HALF; DUPLEX_FULL : DUPLEX_HALF;
} else { } else {
speed = ~0; speed = SPEED_UNKNOWN;
cmd->duplex = -1; cmd->duplex = DUPLEX_UNKNOWN;
} }
ethtool_cmd_speed_set(cmd, speed); ethtool_cmd_speed_set(cmd, speed);
......
...@@ -168,8 +168,8 @@ static int e1000_get_settings(struct net_device *netdev, ...@@ -168,8 +168,8 @@ static int e1000_get_settings(struct net_device *netdev,
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) || ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) ||
......
...@@ -159,8 +159,8 @@ static int e1000_get_settings(struct net_device *netdev, ...@@ -159,8 +159,8 @@ static int e1000_get_settings(struct net_device *netdev,
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
} }
speed = -1; speed = SPEED_UNKNOWN;
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
if (netif_running(netdev)) { if (netif_running(netdev)) {
if (netif_carrier_ok(netdev)) { if (netif_carrier_ok(netdev)) {
......
...@@ -229,8 +229,8 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -229,8 +229,8 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ecmd->speed = -1; ecmd->speed = SPEED_UNKNOWN;
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
if ((hw->phy.media_type == e1000_media_type_fiber) || if ((hw->phy.media_type == e1000_media_type_fiber) ||
hw->mac.autoneg) hw->mac.autoneg)
......
...@@ -101,8 +101,8 @@ static int igbvf_get_settings(struct net_device *netdev, ...@@ -101,8 +101,8 @@ static int igbvf_get_settings(struct net_device *netdev,
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ecmd->autoneg = AUTONEG_DISABLE; ecmd->autoneg = AUTONEG_DISABLE;
......
...@@ -107,8 +107,8 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -107,8 +107,8 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ethtool_cmd_speed_set(ecmd, SPEED_10000); ethtool_cmd_speed_set(ecmd, SPEED_10000);
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ecmd->autoneg = AUTONEG_DISABLE; ecmd->autoneg = AUTONEG_DISABLE;
......
...@@ -296,8 +296,8 @@ static int ixgbe_get_settings(struct net_device *netdev, ...@@ -296,8 +296,8 @@ static int ixgbe_get_settings(struct net_device *netdev,
} }
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
return 0; return 0;
......
...@@ -135,8 +135,8 @@ static int ixgbevf_get_settings(struct net_device *netdev, ...@@ -135,8 +135,8 @@ static int ixgbevf_get_settings(struct net_device *netdev,
ethtool_cmd_speed_set(ecmd, speed); ethtool_cmd_speed_set(ecmd, speed);
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
return 0; return 0;
......
...@@ -378,8 +378,8 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -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); ethtool_cmd_speed_set(cmd, priv->port_state.link_speed);
cmd->duplex = DUPLEX_FULL; cmd->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(cmd, -1); ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
cmd->duplex = -1; cmd->duplex = DUPLEX_UNKNOWN;
} }
if (trans_type > 0 && trans_type <= 0xC) { if (trans_type > 0 && trans_type <= 0xC) {
......
...@@ -5360,8 +5360,8 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info) ...@@ -5360,8 +5360,8 @@ static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
ethtool_cmd_speed_set(info, SPEED_10000); ethtool_cmd_speed_set(info, SPEED_10000);
info->duplex = DUPLEX_FULL; info->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(info, -1); ethtool_cmd_speed_set(info, SPEED_UNKNOWN);
info->duplex = -1; info->duplex = DUPLEX_UNKNOWN;
} }
info->autoneg = AUTONEG_DISABLE; info->autoneg = AUTONEG_DISABLE;
......
...@@ -62,8 +62,8 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info) ...@@ -62,8 +62,8 @@ static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
ethtool_cmd_speed_set(info, SPEED_10000); ethtool_cmd_speed_set(info, SPEED_10000);
info->duplex = DUPLEX_FULL; info->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(info, -1); ethtool_cmd_speed_set(info, SPEED_UNKNOWN);
info->duplex = -1; info->duplex = DUPLEX_UNKNOWN;
} }
info->autoneg = AUTONEG_DISABLE; info->autoneg = AUTONEG_DISABLE;
......
...@@ -4285,8 +4285,8 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -4285,8 +4285,8 @@ static int nv_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
if (np->duplex) if (np->duplex)
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
} else { } else {
speed = -1; speed = SPEED_UNKNOWN;
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
ethtool_cmd_speed_set(ecmd, speed); ethtool_cmd_speed_set(ecmd, speed);
ecmd->autoneg = np->autoneg; ecmd->autoneg = np->autoneg;
......
...@@ -91,7 +91,7 @@ static int pch_gbe_get_settings(struct net_device *netdev, ...@@ -91,7 +91,7 @@ static int pch_gbe_get_settings(struct net_device *netdev,
ecmd->advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half); ecmd->advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half);
if (!netif_carrier_ok(adapter->netdev)) if (!netif_carrier_ok(adapter->netdev))
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
return ret; return ret;
} }
......
...@@ -431,8 +431,8 @@ vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -431,8 +431,8 @@ vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ethtool_cmd_speed_set(ecmd, adapter->link_speed); ethtool_cmd_speed_set(ecmd, adapter->link_speed);
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
} else { } else {
ethtool_cmd_speed_set(ecmd, -1); ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = -1; ecmd->duplex = DUPLEX_UNKNOWN;
} }
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册