net: use SPEED_UNKNOWN and DUPLEX_UNKNOWN when appropriate
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
1caaab63d3
Коммит
537fae0101
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) ||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче