Re: [2.4.32 - 2.6.15.4] e1000 - Fix mii interface

Subsystems: networking drivers, the rest

2 messages, 2 authors, 2006-02-28 · open the first message on its own page

Re: [2.4.32 - 2.6.15.4] e1000 - Fix mii interface

From: Jesse Brandeburg <hidden>
Date: 2006-02-28 02:32:07

From: Paul Rolland <redacted>

Hello,

This patch is based on Linux 2.4.32, and I've verified the same problem
exists on 2.6.15.4.
Working on a machine with a 2.4.32 kernel, I was surprised to see the driver
complaining when setting the speed to 100FD using mii-tool, but accepting
the setting with ethtool.
Digging into the code, I found that there is some confusion with :
 - DUPLEX_FULL and FULL_DUPLEX,
 - DUPLEX_HALF and HALF_DUPLEX
in the code :
...
                           spddplx += (mii_reg & 0x100)
                                       ? FULL_DUPLEX :
                                       HALF_DUPLEX;
                           retval = e1000_set_spd_dplx(adapter,
                                                       spddplx);
Please try this patch:

e1000: fix mii-tool access to setting speed and duplex

Paul Rolland reported that e1000 was having a hard time using mii-tool to
set speed and duplex.  This patch fixes the issue on both newer hardware as
well as fixing the code issue that originally caused the problem.

Signed-off-by: Jesse Brandeburg <redacted>
CC: Paul Rolland <redacted>

---

  drivers/net/e1000/e1000_main.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 31e3329..9730c2e 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -4269,7 +4269,7 @@ e1000_mii_ioctl(struct net_device *netde
  			spin_unlock_irqrestore(&adapter->stats_lock, flags);
  			return -EIO;
  		}
-		if (adapter->hw.phy_type == e1000_phy_m88) {
+		if (adapter->hw.media_type == e1000_media_type_copper) {
  			switch (data->reg_num) {
  			case PHY_CTRL:
  				if (mii_reg & MII_CR_POWER_DOWN)
@@ -4285,8 +4285,8 @@ e1000_mii_ioctl(struct net_device *netde
  					else
  						spddplx = SPEED_10;
  					spddplx += (mii_reg & 0x100)
-						   ? FULL_DUPLEX :
-						   HALF_DUPLEX;
+						   ? DUPLEX_FULL :
+						   DUPLEX_HALF;
  					retval = e1000_set_spd_dplx(adapter,
  								    spddplx);
  					if (retval) {

Re: [2.4.32 - 2.6.15.4] e1000 - Fix mii interface

From: Paul Rolland <hidden>
Date: 2006-02-28 10:46:08

Hello Jesse,
  					spddplx += (mii_reg & 0x100)
-						   ? FULL_DUPLEX :
-						   HALF_DUPLEX;
+						   ? DUPLEX_FULL :
+						   DUPLEX_HALF;
As I said in my first mail, I didn't want to go that way as one of the
two DUPLEX_FULL or DUPLEX_HALF is defined as being 0, which prevents
detecting incorrect/incomplete initializations.

The problem I had came from :
mii-tool -F 100BaseTx-FD eth0
when at the same time the ethtool interface was OK.

But you are right, the change I made missed the second caller.

The correct change is yours, though for the reason I put above, I think
it'll make it harder to spot other bugs ;)

Well done,
Paul
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help