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/mdio.c | |
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/mdio.c')
-rw-r--r-- | drivers/net/mdio.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index f2d10abd0403..16fbb11d92ac 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c | |||
@@ -188,6 +188,7 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
188 | u32 npage_adv, u32 npage_lpa) | 188 | u32 npage_adv, u32 npage_lpa) |
189 | { | 189 | { |
190 | int reg; | 190 | int reg; |
191 | u32 speed; | ||
191 | 192 | ||
192 | ecmd->transceiver = XCVR_INTERNAL; | 193 | ecmd->transceiver = XCVR_INTERNAL; |
193 | ecmd->phy_address = mdio->prtad; | 194 | ecmd->phy_address = mdio->prtad; |
@@ -290,33 +291,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
290 | if (modes & (ADVERTISED_10000baseT_Full | | 291 | if (modes & (ADVERTISED_10000baseT_Full | |
291 | ADVERTISED_10000baseKX4_Full | | 292 | ADVERTISED_10000baseKX4_Full | |
292 | ADVERTISED_10000baseKR_Full)) { | 293 | ADVERTISED_10000baseKR_Full)) { |
293 | ecmd->speed = SPEED_10000; | 294 | speed = SPEED_10000; |
294 | ecmd->duplex = DUPLEX_FULL; | 295 | ecmd->duplex = DUPLEX_FULL; |
295 | } else if (modes & (ADVERTISED_1000baseT_Full | | 296 | } else if (modes & (ADVERTISED_1000baseT_Full | |
296 | ADVERTISED_1000baseT_Half | | 297 | ADVERTISED_1000baseT_Half | |
297 | ADVERTISED_1000baseKX_Full)) { | 298 | ADVERTISED_1000baseKX_Full)) { |
298 | ecmd->speed = SPEED_1000; | 299 | speed = SPEED_1000; |
299 | ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half); | 300 | ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half); |
300 | } else if (modes & (ADVERTISED_100baseT_Full | | 301 | } else if (modes & (ADVERTISED_100baseT_Full | |
301 | ADVERTISED_100baseT_Half)) { | 302 | ADVERTISED_100baseT_Half)) { |
302 | ecmd->speed = SPEED_100; | 303 | speed = SPEED_100; |
303 | ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full); | 304 | ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full); |
304 | } else { | 305 | } else { |
305 | ecmd->speed = SPEED_10; | 306 | speed = SPEED_10; |
306 | ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full); | 307 | ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full); |
307 | } | 308 | } |
308 | } else { | 309 | } else { |
309 | /* Report forced settings */ | 310 | /* Report forced settings */ |
310 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | 311 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, |
311 | MDIO_CTRL1); | 312 | MDIO_CTRL1); |
312 | ecmd->speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) * | 313 | speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) |
313 | ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10)); | 314 | * ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10)); |
314 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || | 315 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || |
315 | ecmd->speed == SPEED_10000); | 316 | speed == SPEED_10000); |
316 | } | 317 | } |
317 | 318 | ||
319 | ethtool_cmd_speed_set(ecmd, speed); | ||
320 | |||
318 | /* 10GBASE-T MDI/MDI-X */ | 321 | /* 10GBASE-T MDI/MDI-X */ |
319 | if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) { | 322 | if (ecmd->port == PORT_TP |
323 | && (ethtool_cmd_speed(ecmd) == SPEED_10000)) { | ||
320 | switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | 324 | switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, |
321 | MDIO_PMA_10GBT_SWAPPOL)) { | 325 | MDIO_PMA_10GBT_SWAPPOL)) { |
322 | case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: | 326 | case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: |