diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-04-29 04:19:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-29 20:32:36 -0400 |
commit | af2a3eac2fe6a6d8e9fdf6927284b34466a7d808 (patch) | |
tree | 7ccb5fd4ab0b81a46535e251cb7a151efa0c39f8 /drivers/net/mdio.c | |
parent | a8c30832b5b12e5d4e9d1c20cdac3cc2880e08b8 (diff) |
mdio: Add mdio45_ethtool_spauseparam_an()
This implements the ETHTOOL_SPAUSEPARAM operation for MDIO (clause 45)
PHYs with auto-negotiation MMDs.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mdio.c')
-rw-r--r-- | drivers/net/mdio.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index 0604a25748ee..2fb0d16b61f7 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c | |||
@@ -275,6 +275,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
275 | EXPORT_SYMBOL(mdio45_ethtool_gset_npage); | 275 | EXPORT_SYMBOL(mdio45_ethtool_gset_npage); |
276 | 276 | ||
277 | /** | 277 | /** |
278 | * mdio45_ethtool_spauseparam_an - set auto-negotiated pause parameters | ||
279 | * @mdio: MDIO interface | ||
280 | * @ecmd: Ethtool request structure | ||
281 | * | ||
282 | * This function assumes that the PHY has an auto-negotiation MMD. It | ||
283 | * will enable and disable advertising of flow control as appropriate. | ||
284 | */ | ||
285 | void mdio45_ethtool_spauseparam_an(const struct mdio_if_info *mdio, | ||
286 | const struct ethtool_pauseparam *ecmd) | ||
287 | { | ||
288 | int adv, old_adv; | ||
289 | |||
290 | WARN_ON(!(mdio->mmds & MDIO_DEVS_AN)); | ||
291 | |||
292 | old_adv = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_AN, | ||
293 | MDIO_AN_ADVERTISE); | ||
294 | adv = old_adv & ~(ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); | ||
295 | if (ecmd->autoneg) | ||
296 | adv |= mii_advertise_flowctrl( | ||
297 | (ecmd->rx_pause ? FLOW_CTRL_RX : 0) | | ||
298 | (ecmd->tx_pause ? FLOW_CTRL_TX : 0)); | ||
299 | if (adv != old_adv) { | ||
300 | mdio->mdio_write(mdio->dev, mdio->prtad, MDIO_MMD_AN, | ||
301 | MDIO_AN_ADVERTISE, adv); | ||
302 | mdio45_nway_restart(mdio); | ||
303 | } | ||
304 | } | ||
305 | EXPORT_SYMBOL(mdio45_ethtool_spauseparam_an); | ||
306 | |||
307 | /** | ||
278 | * mdio_mii_ioctl - MII ioctl interface for MDIO (clause 22 or 45) PHYs | 308 | * mdio_mii_ioctl - MII ioctl interface for MDIO (clause 22 or 45) PHYs |
279 | * @mdio: MDIO interface | 309 | * @mdio: MDIO interface |
280 | * @mii_data: MII ioctl data structure | 310 | * @mii_data: MII ioctl data structure |