diff options
Diffstat (limited to 'drivers/net/ehea/ehea_ethtool.c')
-rw-r--r-- | drivers/net/ehea/ehea_ethtool.c | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c index 75b099ce49c9..7f642aef5e82 100644 --- a/drivers/net/ehea/ehea_ethtool.c +++ b/drivers/net/ehea/ehea_ethtool.c | |||
@@ -26,12 +26,15 @@ | |||
26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include "ehea.h" | 31 | #include "ehea.h" |
30 | #include "ehea_phyp.h" | 32 | #include "ehea_phyp.h" |
31 | 33 | ||
32 | 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) |
33 | { | 35 | { |
34 | struct ehea_port *port = netdev_priv(dev); | 36 | struct ehea_port *port = netdev_priv(dev); |
37 | u32 speed; | ||
35 | int ret; | 38 | int ret; |
36 | 39 | ||
37 | ret = ehea_sense_port_attr(port); | 40 | ret = ehea_sense_port_attr(port); |
@@ -41,27 +44,44 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
41 | 44 | ||
42 | if (netif_carrier_ok(dev)) { | 45 | if (netif_carrier_ok(dev)) { |
43 | switch (port->port_speed) { | 46 | switch (port->port_speed) { |
44 | case EHEA_SPEED_10M: cmd->speed = SPEED_10; break; | 47 | case EHEA_SPEED_10M: |
45 | case EHEA_SPEED_100M: cmd->speed = SPEED_100; break; | 48 | speed = SPEED_10; |
46 | case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break; | 49 | break; |
47 | 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 */ | ||
48 | } | 62 | } |
49 | cmd->duplex = port->full_duplex == 1 ? | 63 | cmd->duplex = port->full_duplex == 1 ? |
50 | DUPLEX_FULL : DUPLEX_HALF; | 64 | DUPLEX_FULL : DUPLEX_HALF; |
51 | } else { | 65 | } else { |
52 | cmd->speed = -1; | 66 | speed = ~0; |
53 | cmd->duplex = -1; | 67 | cmd->duplex = -1; |
54 | } | 68 | } |
69 | ethtool_cmd_speed_set(cmd, speed); | ||
55 | 70 | ||
56 | cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full | 71 | if (cmd->speed == SPEED_10000) { |
57 | | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half | 72 | cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); |
58 | | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half | 73 | cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE); |
59 | | SUPPORTED_Autoneg | SUPPORTED_FIBRE); | 74 | cmd->port = PORT_FIBRE; |
60 | 75 | } else { | |
61 | cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_Autoneg | 76 | cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full |
62 | | ADVERTISED_FIBRE); | 77 | | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full |
78 | | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg | ||
79 | | SUPPORTED_TP); | ||
80 | cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg | ||
81 | | ADVERTISED_TP); | ||
82 | cmd->port = PORT_TP; | ||
83 | } | ||
63 | 84 | ||
64 | cmd->port = PORT_FIBRE; | ||
65 | cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE; | 85 | cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE; |
66 | 86 | ||
67 | return 0; | 87 | return 0; |
@@ -118,10 +138,10 @@ doit: | |||
118 | ret = ehea_set_portspeed(port, sp); | 138 | ret = ehea_set_portspeed(port, sp); |
119 | 139 | ||
120 | if (!ret) | 140 | if (!ret) |
121 | ehea_info("%s: Port speed successfully set: %dMbps " | 141 | netdev_info(dev, |
122 | "%s Duplex", | 142 | "Port speed successfully set: %dMbps %s Duplex\n", |
123 | port->netdev->name, port->port_speed, | 143 | port->port_speed, |
124 | port->full_duplex == 1 ? "Full" : "Half"); | 144 | port->full_duplex == 1 ? "Full" : "Half"); |
125 | out: | 145 | out: |
126 | return ret; | 146 | return ret; |
127 | } | 147 | } |
@@ -134,10 +154,10 @@ static int ehea_nway_reset(struct net_device *dev) | |||
134 | ret = ehea_set_portspeed(port, EHEA_SPEED_AUTONEG); | 154 | ret = ehea_set_portspeed(port, EHEA_SPEED_AUTONEG); |
135 | 155 | ||
136 | if (!ret) | 156 | if (!ret) |
137 | ehea_info("%s: Port speed successfully set: %dMbps " | 157 | netdev_info(port->netdev, |
138 | "%s Duplex", | 158 | "Port speed successfully set: %dMbps %s Duplex\n", |
139 | port->netdev->name, port->port_speed, | 159 | port->port_speed, |
140 | port->full_duplex == 1 ? "Full" : "Half"); | 160 | port->full_duplex == 1 ? "Full" : "Half"); |
141 | return ret; | 161 | return ret; |
142 | } | 162 | } |
143 | 163 | ||
@@ -160,11 +180,6 @@ static void ehea_set_msglevel(struct net_device *dev, u32 value) | |||
160 | port->msg_enable = value; | 180 | port->msg_enable = value; |
161 | } | 181 | } |
162 | 182 | ||
163 | static u32 ehea_get_rx_csum(struct net_device *dev) | ||
164 | { | ||
165 | return 1; | ||
166 | } | ||
167 | |||
168 | static char ehea_ethtool_stats_keys[][ETH_GSTRING_LEN] = { | 183 | static char ehea_ethtool_stats_keys[][ETH_GSTRING_LEN] = { |
169 | {"sig_comp_iv"}, | 184 | {"sig_comp_iv"}, |
170 | {"swqe_refill_th"}, | 185 | {"swqe_refill_th"}, |
@@ -267,11 +282,9 @@ const struct ethtool_ops ehea_ethtool_ops = { | |||
267 | .get_msglevel = ehea_get_msglevel, | 282 | .get_msglevel = ehea_get_msglevel, |
268 | .set_msglevel = ehea_set_msglevel, | 283 | .set_msglevel = ehea_set_msglevel, |
269 | .get_link = ethtool_op_get_link, | 284 | .get_link = ethtool_op_get_link, |
270 | .set_tso = ethtool_op_set_tso, | ||
271 | .get_strings = ehea_get_strings, | 285 | .get_strings = ehea_get_strings, |
272 | .get_sset_count = ehea_get_sset_count, | 286 | .get_sset_count = ehea_get_sset_count, |
273 | .get_ethtool_stats = ehea_get_ethtool_stats, | 287 | .get_ethtool_stats = ehea_get_ethtool_stats, |
274 | .get_rx_csum = ehea_get_rx_csum, | ||
275 | .set_settings = ehea_set_settings, | 288 | .set_settings = ehea_set_settings, |
276 | .nway_reset = ehea_nway_reset, /* Restart autonegotiation */ | 289 | .nway_reset = ehea_nway_reset, /* Restart autonegotiation */ |
277 | }; | 290 | }; |