linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willy TARREAU <willy@w.ods.org>
To: Paul Rolland <rol@as2917.net>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux.nics@intel.com, cramerj@intel.com, john.ronciak@intel.com,
	Ganesh.Venkatesan@intel.com
Subject: Re: [2.4.32 - 2.6.15.4] e1000 - Fix mii interface
Date: Sun, 26 Feb 2006 11:42:07 +0100	[thread overview]
Message-ID: <20060226104206.GA11434@w.ods.org> (raw)
In-Reply-To: <007801c639f3$79388060$2001a8c0@cortex>

Hello Paul,

On Sat, Feb 25, 2006 at 11:08:49AM +0100, Paul Rolland wrote:
> Hello,
> 
> This patch is based on Linux 2.4.32, and I've verified the same problem
> exists on 2.6.15.4.

it's mangled, tabs have been turned into whitespaces. I fixed it so please
use the appended one.

> 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);
> ...
> and
> int
> e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
> {
>         adapter->hw.autoneg = 0;
> 
>         switch(spddplx) {
>         case SPEED_10 + DUPLEX_HALF:
>                 adapter->hw.forced_speed_duplex = e1000_10_half;
>                 break;
> ....
> when the constants don't have the same value.
> 
> This patch is simply changing the code in the e1000_set_spd_dplx to use the
> same constants as does the caller of the function : FULL_DUPLEX and
> HALF_DUPLEX
> whose values are not 0, to make sure we have had a successfull init
> (DUPLEX_HALF value is 0, and the DUPLEX_xxx are defined in ethtool.h, thus
> are probably not meant to be used in the mii interface).
> 
> Signed-off-by: Paul Rolland <rol@as2917.net>
> 
> diff -urN linux-2.4.32-orig/drivers/net/e1000/e1000_main.c
> linux-2.4.32/drivers/net/e1000/e1000_main.c
> --- linux-2.4.32-orig/drivers/net/e1000/e1000_main.c    Mon Apr  4 01:42:19
> 2005
> +++ linux-2.4.32/drivers/net/e1000/e1000_main.c Sat Feb 25 09:36:23 2006
> @@ -2944,23 +2944,23 @@
>         adapter->hw.autoneg = 0;
>  
>         switch(spddplx) {
> -       case SPEED_10 + DUPLEX_HALF:
> +       case SPEED_10 + HALF_DUPLEX:
>                 adapter->hw.forced_speed_duplex = e1000_10_half;
>                 break;
> -       case SPEED_10 + DUPLEX_FULL:
> +       case SPEED_10 + FULL_DUPLEX:
>                 adapter->hw.forced_speed_duplex = e1000_10_full;
>                 break;
> -       case SPEED_100 + DUPLEX_HALF:
> +       case SPEED_100 + HALF_DUPLEX:
>                 adapter->hw.forced_speed_duplex = e1000_100_half;
>                 break;
> -       case SPEED_100 + DUPLEX_FULL:
> +       case SPEED_100 + FULL_DUPLEX:
>                 adapter->hw.forced_speed_duplex = e1000_100_full;
>                 break;
> -       case SPEED_1000 + DUPLEX_FULL:
> +       case SPEED_1000 + FULL_DUPLEX:
>                 adapter->hw.autoneg = 1;
>                 adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
>                 break;
> -       case SPEED_1000 + DUPLEX_HALF: /* not supported */
> +       case SPEED_1000 + HALF_DUPLEX: /* not supported */
>         default:
>                 DPRINTK(PROBE, ERR, 
>                         "Unsupported Speed/Duplexity configuration\n");
> 
> 
> Paul Rolland, rol(at)as2917.net
> ex-AS2917 Network administrator and Peering Coordinator

Regards,
Willy


diff -urN linux-2.4.32-orig/drivers/net/e1000/e1000_main.c linux-2.4.32/drivers/net/e1000/e1000_main.c
--- linux-2.4.32-orig/drivers/net/e1000/e1000_main.c    Mon Apr  4 01:42:19 2005
+++ linux-2.4.32/drivers/net/e1000/e1000_main.c Sat Feb 25 09:36:23 2006
@@ -2944,23 +2944,23 @@
 	adapter->hw.autoneg = 0;
 
 	switch(spddplx) {
-	case SPEED_10 + DUPLEX_HALF:
+	case SPEED_10 + HALF_DUPLEX:
 		adapter->hw.forced_speed_duplex = e1000_10_half;
 		break;
-	case SPEED_10 + DUPLEX_FULL:
+	case SPEED_10 + FULL_DUPLEX:
 		adapter->hw.forced_speed_duplex = e1000_10_full;
 		break;
-	case SPEED_100 + DUPLEX_HALF:
+	case SPEED_100 + HALF_DUPLEX:
 		adapter->hw.forced_speed_duplex = e1000_100_half;
 		break;
-	case SPEED_100 + DUPLEX_FULL:
+	case SPEED_100 + FULL_DUPLEX:
 		adapter->hw.forced_speed_duplex = e1000_100_full;
 		break;
-	case SPEED_1000 + DUPLEX_FULL:
+	case SPEED_1000 + FULL_DUPLEX:
 		adapter->hw.autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
 		break;
-	case SPEED_1000 + DUPLEX_HALF: /* not supported */
+	case SPEED_1000 + HALF_DUPLEX: /* not supported */
 	default:
 		DPRINTK(PROBE, ERR, 
 			"Unsupported Speed/Duplexity configuration\n");




  reply	other threads:[~2006-02-26 10:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-23  3:19 [PATCH] Enable mprotect on huge pages Zhang, Yanmin
2006-02-24 22:28 ` Andrew Morton
2006-02-26 23:09   ` David Gibson
2006-02-27  5:36     ` Zhang, Yanmin
2006-02-27  6:33       ` Zhang, Yanmin
2006-02-28  1:34         ` Andrew Morton
2006-02-28  3:23           ` Zhang, Yanmin
2006-02-28  3:32             ` David Gibson
2006-02-28  3:37               ` Zhang, Yanmin
2006-02-28  8:24             ` David Gibson
2006-02-27  7:26       ` David Gibson
2006-02-25  8:54 ` Christoph Hellwig
2006-02-25 10:08   ` [2.4.32 - 2.6.15.4] e1000 - Fix mii interface Paul Rolland
2006-02-26 10:42     ` Willy TARREAU [this message]
2006-02-26 11:39       ` Paul Rolland
2006-02-26 12:59     ` Jesper Juhl
2006-02-26 14:55       ` Paul Rolland
2006-02-26 15:00         ` Jesper Juhl
2006-02-26 15:12           ` Paul Rolland
2006-02-27 19:26             ` Jesse Brandeburg
     [not found]     ` <4807377b0602271234v4b6cdeecpbcf8d4a6ac51cd20@mail.gmail.com>
2006-02-28  2:31       ` Jesse Brandeburg
2006-02-28 10:46         ` Paul Rolland
2006-02-27  5:09   ` [PATCH] Enable mprotect on huge pages Zhang, Yanmin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060226104206.GA11434@w.ods.org \
    --to=willy@w.ods.org \
    --cc=Ganesh.Venkatesan@intel.com \
    --cc=cramerj@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux.nics@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=rol@as2917.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).