diff options
author | Jiri Pirko <jiri@resnulli.us> | 2014-06-06 08:17:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-06 19:24:07 -0400 |
commit | d4f3cd49d2800dc037724efa9b33c485a1cc23d3 (patch) | |
tree | d04f2c9e6a07b9d8224be2cd303f6d3566993cad | |
parent | 537fae0101c8853abb52136788173dde74b9d1e9 (diff) |
net: use ethtool_cmd_speed_set helper to set ethtool speed value
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ethtool.c | 12 | ||||
-rw-r--r-- | drivers/net/ntb_netdev.c | 1 | ||||
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 19 |
3 files changed, 18 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index fca9a0e470c3..d3d2154ed9e1 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -141,6 +141,7 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
141 | struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; | 141 | struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; |
142 | struct e1000_sfp_flags *eth_flags = &dev_spec->eth_flags; | 142 | struct e1000_sfp_flags *eth_flags = &dev_spec->eth_flags; |
143 | u32 status; | 143 | u32 status; |
144 | u32 speed; | ||
144 | 145 | ||
145 | status = rd32(E1000_STATUS); | 146 | status = rd32(E1000_STATUS); |
146 | if (hw->phy.media_type == e1000_media_type_copper) { | 147 | if (hw->phy.media_type == e1000_media_type_copper) { |
@@ -215,13 +216,13 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
215 | if (status & E1000_STATUS_LU) { | 216 | if (status & E1000_STATUS_LU) { |
216 | if ((status & E1000_STATUS_2P5_SKU) && | 217 | if ((status & E1000_STATUS_2P5_SKU) && |
217 | !(status & E1000_STATUS_2P5_SKU_OVER)) { | 218 | !(status & E1000_STATUS_2P5_SKU_OVER)) { |
218 | ecmd->speed = SPEED_2500; | 219 | speed = SPEED_2500; |
219 | } else if (status & E1000_STATUS_SPEED_1000) { | 220 | } else if (status & E1000_STATUS_SPEED_1000) { |
220 | ecmd->speed = SPEED_1000; | 221 | speed = SPEED_1000; |
221 | } else if (status & E1000_STATUS_SPEED_100) { | 222 | } else if (status & E1000_STATUS_SPEED_100) { |
222 | ecmd->speed = SPEED_100; | 223 | speed = SPEED_100; |
223 | } else { | 224 | } else { |
224 | ecmd->speed = SPEED_10; | 225 | speed = SPEED_10; |
225 | } | 226 | } |
226 | if ((status & E1000_STATUS_FD) || | 227 | if ((status & E1000_STATUS_FD) || |
227 | hw->phy.media_type != e1000_media_type_copper) | 228 | hw->phy.media_type != e1000_media_type_copper) |
@@ -229,9 +230,10 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
229 | else | 230 | else |
230 | ecmd->duplex = DUPLEX_HALF; | 231 | ecmd->duplex = DUPLEX_HALF; |
231 | } else { | 232 | } else { |
232 | ecmd->speed = SPEED_UNKNOWN; | 233 | speed = SPEED_UNKNOWN; |
233 | ecmd->duplex = DUPLEX_UNKNOWN; | 234 | ecmd->duplex = DUPLEX_UNKNOWN; |
234 | } | 235 | } |
236 | ethtool_cmd_speed_set(ecmd, speed); | ||
235 | if ((hw->phy.media_type == e1000_media_type_fiber) || | 237 | if ((hw->phy.media_type == e1000_media_type_fiber) || |
236 | hw->mac.autoneg) | 238 | hw->mac.autoneg) |
237 | ecmd->autoneg = AUTONEG_ENABLE; | 239 | ecmd->autoneg = AUTONEG_ENABLE; |
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c index 27536aa89199..5a7e6397440a 100644 --- a/drivers/net/ntb_netdev.c +++ b/drivers/net/ntb_netdev.c | |||
@@ -298,7 +298,6 @@ static int ntb_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
298 | { | 298 | { |
299 | cmd->supported = SUPPORTED_Backplane; | 299 | cmd->supported = SUPPORTED_Backplane; |
300 | cmd->advertising = ADVERTISED_Backplane; | 300 | cmd->advertising = ADVERTISED_Backplane; |
301 | cmd->speed = SPEED_UNKNOWN; | ||
302 | ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN); | 301 | ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN); |
303 | cmd->duplex = DUPLEX_FULL; | 302 | cmd->duplex = DUPLEX_FULL; |
304 | cmd->port = PORT_OTHER; | 303 | cmd->port = PORT_OTHER; |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 549e9fd5bfdc..18ddb249c917 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -5726,6 +5726,7 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, | |||
5726 | struct qeth_card *card = netdev->ml_priv; | 5726 | struct qeth_card *card = netdev->ml_priv; |
5727 | enum qeth_link_types link_type; | 5727 | enum qeth_link_types link_type; |
5728 | struct carrier_info carrier_info; | 5728 | struct carrier_info carrier_info; |
5729 | u32 speed; | ||
5729 | 5730 | ||
5730 | if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) | 5731 | if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) |
5731 | link_type = QETH_LINK_TYPE_10GBIT_ETH; | 5732 | link_type = QETH_LINK_TYPE_10GBIT_ETH; |
@@ -5740,28 +5741,29 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, | |||
5740 | case QETH_LINK_TYPE_FAST_ETH: | 5741 | case QETH_LINK_TYPE_FAST_ETH: |
5741 | case QETH_LINK_TYPE_LANE_ETH100: | 5742 | case QETH_LINK_TYPE_LANE_ETH100: |
5742 | qeth_set_ecmd_adv_sup(ecmd, SPEED_100, PORT_TP); | 5743 | qeth_set_ecmd_adv_sup(ecmd, SPEED_100, PORT_TP); |
5743 | ecmd->speed = SPEED_100; | 5744 | speed = SPEED_100; |
5744 | ecmd->port = PORT_TP; | 5745 | ecmd->port = PORT_TP; |
5745 | break; | 5746 | break; |
5746 | 5747 | ||
5747 | case QETH_LINK_TYPE_GBIT_ETH: | 5748 | case QETH_LINK_TYPE_GBIT_ETH: |
5748 | case QETH_LINK_TYPE_LANE_ETH1000: | 5749 | case QETH_LINK_TYPE_LANE_ETH1000: |
5749 | qeth_set_ecmd_adv_sup(ecmd, SPEED_1000, PORT_FIBRE); | 5750 | qeth_set_ecmd_adv_sup(ecmd, SPEED_1000, PORT_FIBRE); |
5750 | ecmd->speed = SPEED_1000; | 5751 | speed = SPEED_1000; |
5751 | ecmd->port = PORT_FIBRE; | 5752 | ecmd->port = PORT_FIBRE; |
5752 | break; | 5753 | break; |
5753 | 5754 | ||
5754 | case QETH_LINK_TYPE_10GBIT_ETH: | 5755 | case QETH_LINK_TYPE_10GBIT_ETH: |
5755 | qeth_set_ecmd_adv_sup(ecmd, SPEED_10000, PORT_FIBRE); | 5756 | qeth_set_ecmd_adv_sup(ecmd, SPEED_10000, PORT_FIBRE); |
5756 | ecmd->speed = SPEED_10000; | 5757 | speed = SPEED_10000; |
5757 | ecmd->port = PORT_FIBRE; | 5758 | ecmd->port = PORT_FIBRE; |
5758 | break; | 5759 | break; |
5759 | 5760 | ||
5760 | default: | 5761 | default: |
5761 | qeth_set_ecmd_adv_sup(ecmd, SPEED_10, PORT_TP); | 5762 | qeth_set_ecmd_adv_sup(ecmd, SPEED_10, PORT_TP); |
5762 | ecmd->speed = SPEED_10; | 5763 | speed = SPEED_10; |
5763 | ecmd->port = PORT_TP; | 5764 | ecmd->port = PORT_TP; |
5764 | } | 5765 | } |
5766 | ethtool_cmd_speed_set(ecmd, speed); | ||
5765 | 5767 | ||
5766 | /* Check if we can obtain more accurate information. */ | 5768 | /* Check if we can obtain more accurate information. */ |
5767 | /* If QUERY_CARD_INFO command is not supported or fails, */ | 5769 | /* If QUERY_CARD_INFO command is not supported or fails, */ |
@@ -5806,18 +5808,19 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, | |||
5806 | 5808 | ||
5807 | switch (carrier_info.port_speed) { | 5809 | switch (carrier_info.port_speed) { |
5808 | case CARD_INFO_PORTS_10M: | 5810 | case CARD_INFO_PORTS_10M: |
5809 | ecmd->speed = SPEED_10; | 5811 | speed = SPEED_10; |
5810 | break; | 5812 | break; |
5811 | case CARD_INFO_PORTS_100M: | 5813 | case CARD_INFO_PORTS_100M: |
5812 | ecmd->speed = SPEED_100; | 5814 | speed = SPEED_100; |
5813 | break; | 5815 | break; |
5814 | case CARD_INFO_PORTS_1G: | 5816 | case CARD_INFO_PORTS_1G: |
5815 | ecmd->speed = SPEED_1000; | 5817 | speed = SPEED_1000; |
5816 | break; | 5818 | break; |
5817 | case CARD_INFO_PORTS_10G: | 5819 | case CARD_INFO_PORTS_10G: |
5818 | ecmd->speed = SPEED_10000; | 5820 | speed = SPEED_10000; |
5819 | break; | 5821 | break; |
5820 | } | 5822 | } |
5823 | ethtool_cmd_speed_set(ecmd, speed); | ||
5821 | 5824 | ||
5822 | return 0; | 5825 | return 0; |
5823 | } | 5826 | } |