netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 19/19] network: add the missing phy_device speed information to phy_mii_ioctl
@ 2007-03-06 10:42 akpm
  2007-03-06 11:21 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2007-03-06 10:42 UTC (permalink / raw)
  To: jeff; +Cc: netdev, akpm, shanlu

From: "Shan Lu" <shanlu@cs.uiuc.edu>

Function `phy_mii_ioctl' returns physical device's information based on
user requests.  When requested to return the basic mode control register
information (BMCR), the original implementation only returns the physical
device's duplex information and forgets to return speed information, which
should not be because BMCR register is used to hold both duplex and speed
information.

The patch checks the BMCR value against speed-related flags and fills the
return structure's speed field accordingly.

Signed-off-by: Shan <shanlu@cs.uiuc.edu>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/net/phy/phy.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff -puN drivers/net/phy/phy.c~network-add-the-missing-phy_device-speed-information-to-phy_mii_ioctl drivers/net/phy/phy.c
--- a/drivers/net/phy/phy.c~network-add-the-missing-phy_device-speed-information-to-phy_mii_ioctl
+++ a/drivers/net/phy/phy.c
@@ -382,6 +382,12 @@ int phy_mii_ioctl(struct phy_device *phy
 					phydev->duplex = DUPLEX_FULL;
 				else
 					phydev->duplex = DUPLEX_HALF;
+				if ((!phydev->autoneg) &&
+						(val & BMCR_SPEED1000))
+					phydev->speed = SPEED_1000;
+				else if ((!phydev->autoneg) &&
+						(val & BMCR_SPEED100))
+					phydev->speed = SPEED_100;
 				break;
 			case MII_ADVERTISE:
 				phydev->advertising = val;
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-06 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 10:42 [patch 19/19] network: add the missing phy_device speed information to phy_mii_ioctl akpm
2007-03-06 11:21 ` Jeff Garzik

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).