netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.6.3 pcnet32.c fix link reporting for non-mii devices
@ 2004-02-20 19:55 Thomas Munck Steenholdt
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Munck Steenholdt @ 2004-02-20 19:55 UTC (permalink / raw)
  To: netdev

Hi Guys!

A lot of people have been experiencing problems with the pcnet32 nic 
driver that
always returns link down on some devices (including the VMware vlance 
adapter).

The patch makes sure that link is always reported as up (in contrast to 
always
being rported as down) if the device is not MII capable. Devices that 
ARE MII
capable will return whatever mii_link_ok() says.

Please let be know what you think and possible give me a hint as to how 
I can
make sure this fix gets included whereever such a patch should be included!

Thanks a lot!

diff -ur linux-2.6.2-1.87/drivers/net/pcnet32.c linux-2.6.2-1.87-tmus/drivers/net/pcnet32.c
--- linux-2.6.2-1.87/drivers/net/pcnet32.c	2004-02-19 00:27:36.033478624 +0100
+++ linux-2.6.2-1.87-tmus/drivers/net/pcnet32.c	2004-02-19 00:26:03.733510352 +0100
@@ -22,8 +22,8 @@
  *************************************************************************/
 
 #define DRV_NAME	"pcnet32"
-#define DRV_VERSION	"1.27b"
-#define DRV_RELDATE	"01.10.2002"
+#define DRV_VERSION	"1.27c"
+#define DRV_RELDATE	"02.19.2004"
 #define PFX		DRV_NAME ": "
 
 static const char *version =
@@ -213,6 +213,8 @@
  *	   clean up and using new mii module
  * v1.27b  Sep 30 2002 Kent Yoder <yoder1@us.ibm.com>
  * 	   Added timer for cable connection state changes.
+ * v1.27c  Feb 19 2004 Thomas M Steenholdt <tmus@tmus.dk>
+ *         fixed link status on non-mii capable devices.
  */
 
 
@@ -1630,7 +1632,10 @@
 	/* get link status */
 	case ETHTOOL_GLINK: {
 		struct ethtool_value edata = {ETHTOOL_GLINK};
-		edata.data = mii_link_ok(&lp->mii_if);
+                /* read link status  */
+		if(lp->mii) edata.data = mii_link_ok(&lp->mii_if);
+                /* always return link ok for non-mii devices */
+                else edata.data = 1;
 		if (copy_to_user(useraddr, &edata, sizeof(edata)))
 			return -EFAULT;
 		return 0;

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

* Re: [PATCH] 2.6.3 pcnet32.c fix link reporting for non-mii devices
@ 2004-02-21  7:27 Thomas Munck Steenholdt
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Munck Steenholdt @ 2004-02-21  7:27 UTC (permalink / raw)
  To: netdev

Don Fry wrote:
> Thomas,
> 
> Thanks for the input.  I am the unofficial maintainer, sort of.  I don't
> have a card without an mii, so I can't test some of the changes.  Do
> you know of a way to determine the link state so I can correctly return
> the state?
> 
> By the way, are you running 2.4 or 2.6?
> 
> 

This patch was made against 2.6.3 but it seems that at least Linus'
kernel tree has been pretty much untouched for at least a little while,
so i think it'll patch very nicely against some of the newer 2.4 kernels.

If you can test my patch on som NICs with mii and it works I guess it's
okay! The only NIC that doesn't have mii that I have personaly
experience with is the virtual device found in VMware. Thats also the
one I used to test the patch and it works fine.

Perhaps check this comment posted to a redhat kernel bug for info:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=100527#c5

The guy suggests taking a peek at the LED status register to figure out
if there's a link or not. However I have no idea if that will work for
the VMware NIC anyway and that's the reason for doing it the way I did!

Thomas

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

* Re: [PATCH] 2.6.3 pcnet32.c fix link reporting for non-mii devices
       [not found] <200402202232.i1KMWqD07369@DYN318364BLD.beaverton.ibm.com>
@ 2004-02-21 21:57 ` Thomas Munck Steenholdt
  2004-02-24  5:31   ` Thomas Munck Steenholdt
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Munck Steenholdt @ 2004-02-21 21:57 UTC (permalink / raw)
  To: Don Fry, netdev

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

Don Fry wrote:
> Thomas,
> 
> Thanks for the input.  I am the unofficial maintainer, sort of.  I don't
> have a card without an mii, so I can't test some of the changes.  Do
> you know of a way to determine the link state so I can correctly return
> the state?
> 
> By the way, are you running 2.4 or 2.6?
> 

Hi again!

Decided to do some research and get this thing implemented right!
I've created a new patch against the 2.6.3-bk3 version of pcnet32.c

What this patch does is that in the event that mii is not supported, 
link status is read directly from device's lnktst bcr register.

Works without any problem with the virtual nic under vmware. So if all 
the other non-mii pcnet32 devices have the link status register in the 
same place, things should be just fine!

Could you please test this and let me know what you think?

Best regards

Thomas


[-- Attachment #2: pcnet32_real_link_detect_fix.patch --]
[-- Type: text/plain, Size: 620 bytes --]

--- drivers/net/pcnet32.c.tmus	2004-02-19 15:24:31.238513096 +0100
+++ drivers/net/pcnet32.c	2004-02-19 15:27:28.265600888 +0100
@@ -1644,7 +1644,9 @@
 	case ETHTOOL_GLINK: {
 		struct ethtool_value edata = {ETHTOOL_GLINK};
 		spin_lock_irq(&lp->lock);
-		edata.data = mii_link_ok(&lp->mii_if);
+		if(lp->mii) edata.data = mii_link_ok(&lp->mii_if);
+                /* read the LNKTST BCR register for link status on non-mii capable devices */
+                else edata.data = (lp->a.read_bcr(ioaddr,4) != 0xc0);
 		spin_unlock_irq(&lp->lock);
 		if (copy_to_user(useraddr, &edata, sizeof(edata)))
 			return -EFAULT;

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

* Re: [PATCH] 2.6.3 pcnet32.c fix link reporting for non-mii devices
  2004-02-21 21:57 ` Thomas Munck Steenholdt
@ 2004-02-24  5:31   ` Thomas Munck Steenholdt
  2004-02-24  5:34     ` Thomas Munck Steenholdt
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Munck Steenholdt @ 2004-02-24  5:31 UTC (permalink / raw)
  Cc: Don Fry, netdev

Thomas Munck Steenholdt wrote:
  > Hi again!
> 
> Decided to do some research and get this thing implemented right!
> I've created a new patch against the 2.6.3-bk3 version of pcnet32.c
> 
> What this patch does is that in the event that mii is not supported, 
> link status is read directly from device's lnktst bcr register.
> 
> Works without any problem with the virtual nic under vmware. So if all 
> the other non-mii pcnet32 devices have the link status register in the 
> same place, things should be just fine!
> 
> Could you please test this and let me know what you think?
> 
> Best regards
> 
> Thomas
> 
> 
> ------------------------------------------------------------------------
> 
> --- drivers/net/pcnet32.c.tmus	2004-02-19 15:24:31.238513096 +0100
> +++ drivers/net/pcnet32.c	2004-02-19 15:27:28.265600888 +0100
> @@ -1644,7 +1644,9 @@
>  	case ETHTOOL_GLINK: {
>  		struct ethtool_value edata = {ETHTOOL_GLINK};
>  		spin_lock_irq(&lp->lock);
> -		edata.data = mii_link_ok(&lp->mii_if);
> +		if(lp->mii) edata.data = mii_link_ok(&lp->mii_if);
> +                /* read the LNKTST BCR register for link status on non-mii capable devices */
> +                else edata.data = (lp->a.read_bcr(ioaddr,4) != 0xc0);
>  		spin_unlock_irq(&lp->lock);
>  		if (copy_to_user(useraddr, &edata, sizeof(edata)))
>  			return -EFAULT;

Hi there

If this is a repost, then i'm sorry! I didn't get it myself!

I'd like to make sure we get this patched in the pcnet32 driver!

If you'll need me to do the patch for another version of the pcnet32.c 
file, let me know!

Best regards

Thomas

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

* Re: [PATCH] 2.6.3 pcnet32.c fix link reporting for non-mii devices
  2004-02-24  5:31   ` Thomas Munck Steenholdt
@ 2004-02-24  5:34     ` Thomas Munck Steenholdt
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Munck Steenholdt @ 2004-02-24  5:34 UTC (permalink / raw)
  Cc: Don Fry, netdev

Thomas Munck Steenholdt wrote:
> 
> 
> Hi there
> 
> If this is a repost, then i'm sorry! I didn't get it myself!
> 
> I'd like to make sure we get this patched in the pcnet32 driver!
> 
> If you'll need me to do the patch for another version of the pcnet32.c 
> file, let me know!
> 
> Best regards
> 
> Thomas

Oh, and if I should submit the patch somewhere else to get it in, please 
let me know where/how to submit!

Thomas

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

end of thread, other threads:[~2004-02-24  5:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-21  7:27 [PATCH] 2.6.3 pcnet32.c fix link reporting for non-mii devices Thomas Munck Steenholdt
     [not found] <200402202232.i1KMWqD07369@DYN318364BLD.beaverton.ibm.com>
2004-02-21 21:57 ` Thomas Munck Steenholdt
2004-02-24  5:31   ` Thomas Munck Steenholdt
2004-02-24  5:34     ` Thomas Munck Steenholdt
  -- strict thread matches above, loose matches on Subject: below --
2004-02-20 19:55 Thomas Munck Steenholdt

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