* [PATCH 8/8] sfc: If AN is enabled, always read speed/duplex from the AN advertising bits
@ 2008-12-25 3:43 Ben Hutchings
2008-12-26 21:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2008-12-25 3:43 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
When AN is enabled and the link is down the speed/duplex control bits
will not be meaningful. Use the advertising bits instead, and mask
them with the LPA bits if and only if AN is complete (as before).
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/sfc/mdio_10g.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index f131ad2..f6a1642 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -368,13 +368,16 @@ void mdio_clause45_get_settings_ext(struct efx_nic *efx,
} else
ecmd->autoneg = AUTONEG_DISABLE;
- /* If AN is enabled and complete, report best common mode */
- if (ecmd->autoneg &&
- (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, MDIO_MMDREG_STAT1) &
- (1 << MDIO_AN_STATUS_AN_DONE_LBN))) {
- u32 common, lpa;
- lpa = mdio_clause45_get_an(efx, MDIO_AN_LPA, xnp_lpa);
- common = ecmd->advertising & lpa;
+ if (ecmd->autoneg) {
+ /* If AN is complete, report best common mode,
+ * otherwise report best advertised mode. */
+ u32 common = ecmd->advertising;
+ if (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
+ MDIO_MMDREG_STAT1) &
+ (1 << MDIO_AN_STATUS_AN_DONE_LBN)) {
+ common &= mdio_clause45_get_an(efx, MDIO_AN_LPA,
+ xnp_lpa);
+ }
if (common & ADVERTISED_10000baseT_Full) {
ecmd->speed = SPEED_10000;
ecmd->duplex = DUPLEX_FULL;
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 8/8] sfc: If AN is enabled, always read speed/duplex from the AN advertising bits
2008-12-25 3:43 [PATCH 8/8] sfc: If AN is enabled, always read speed/duplex from the AN advertising bits Ben Hutchings
@ 2008-12-26 21:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-12-26 21:49 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Thu, 25 Dec 2008 03:43:33 +0000
> When AN is enabled and the link is down the speed/duplex control bits
> will not be meaningful. Use the advertising bits instead, and mask
> them with the LPA bits if and only if AN is complete (as before).
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-26 21:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-25 3:43 [PATCH 8/8] sfc: If AN is enabled, always read speed/duplex from the AN advertising bits Ben Hutchings
2008-12-26 21:49 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).