diff options
author | David Decotigny <decot@google.com> | 2011-04-27 14:32:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-29 17:03:01 -0400 |
commit | 707394972093e2056e1e8cc39be19cf9bcb3e7b3 (patch) | |
tree | f6dc95219bca6895adf304b79241e9d60561f8f5 /drivers/net/ehea | |
parent | 25db0338813a8915457636b1f6abe6a28fa73f8d (diff) |
ethtool: cosmetic: Use ethtool ethtool_cmd_speed API
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>
Diffstat (limited to 'drivers/net/ehea')
-rw-r--r-- | drivers/net/ehea/ehea_ethtool.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c index 5f13491cf2a..1df5f40c646 100644 --- a/drivers/net/ehea/ehea_ethtool.c +++ b/drivers/net/ehea/ehea_ethtool.c | |||
@@ -34,6 +34,7 @@ | |||
34 | static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 34 | static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
35 | { | 35 | { |
36 | struct ehea_port *port = netdev_priv(dev); | 36 | struct ehea_port *port = netdev_priv(dev); |
37 | u32 speed; | ||
37 | int ret; | 38 | int ret; |
38 | 39 | ||
39 | ret = ehea_sense_port_attr(port); | 40 | ret = ehea_sense_port_attr(port); |
@@ -43,17 +44,29 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
43 | 44 | ||
44 | if (netif_carrier_ok(dev)) { | 45 | if (netif_carrier_ok(dev)) { |
45 | switch (port->port_speed) { | 46 | switch (port->port_speed) { |
46 | case EHEA_SPEED_10M: cmd->speed = SPEED_10; break; | 47 | case EHEA_SPEED_10M: |
47 | case EHEA_SPEED_100M: cmd->speed = SPEED_100; break; | 48 | speed = SPEED_10; |
48 | case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break; | 49 | break; |
49 | case EHEA_SPEED_10G: cmd->speed = SPEED_10000; break; | 50 | case EHEA_SPEED_100M: |
51 | speed = SPEED_100; | ||
52 | break; | ||
53 | case EHEA_SPEED_1G: | ||
54 | speed = SPEED_1000; | ||
55 | break; | ||
56 | case EHEA_SPEED_10G: | ||
57 | speed = SPEED_10000; | ||
58 | break; | ||
59 | default: | ||
60 | speed = -1; | ||
61 | break; /* BUG */ | ||
50 | } | 62 | } |
51 | cmd->duplex = port->full_duplex == 1 ? | 63 | cmd->duplex = port->full_duplex == 1 ? |
52 | DUPLEX_FULL : DUPLEX_HALF; | 64 | DUPLEX_FULL : DUPLEX_HALF; |
53 | } else { | 65 | } else { |
54 | cmd->speed = -1; | 66 | speed = ~0; |
55 | cmd->duplex = -1; | 67 | cmd->duplex = -1; |
56 | } | 68 | } |
69 | ethtool_cmd_speed_set(cmd, speed); | ||
57 | 70 | ||
58 | cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full | 71 | cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full |
59 | | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half | 72 | | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half |