2008-01-25 21:44:00

by Santiago Garcia Mantinan

[permalink] [raw]
Subject: dl2k stopped working on 2.6.24

Hi!

I have just updated my server to 2.6.24 and the dl2k driver has stopped
working.

The problem seems to be when autoselecting the media, the driver says that
the card is set as "Auto 1000 Mbps, Half duplex" instead of the usual "Auto
1000 Mbps, Full duplex", I have tried setting "options dl2k
media=1000mbps_fd" but that didn't seem to change anything (the driver still
said "Auto 1000 Mbps, Half duplex").

I've been playing with ethtools and got it to work at 100FD by setting it
manually, but if afterwards I set it to auto it again goes 1000 HD and thus
not working again.

I'm not getting any special messages from the kernel, the ifconfig shows
this when the card is failing:

eth0 Link encap:Ethernet HWaddr 00:05:5D:79:5B:56
inet addr:192.168.1.90 Bcast:192.168.1.255 Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:99 dropped:0 overruns:0 frame:99
TX packets:54 errors:54 dropped:0 overruns:0 carrier:54
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:6536 (6.3 KiB)
Interrupt:11 Base address:0xe800

lspci for my card shows:

00:09.0 0200: 1186:4000 (rev 0c)
Subsystem: 1186:4000
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32 (20000ns min, 2500ns max), Cache Line Size: 32 bytes
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at e800 [size=256]
Region 1: Memory at e7015000 (32-bit, non-prefetchable) [size=512]
[virtual] Expansion ROM at 20000000 [disabled] [size=64K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1+,D2+,D3hot+,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=2 PME-

The machine is a PIII with a via chipset and the card was working perfectly
at 2.6.23 and before.

If you need any more info don't hesitate to ask.

Regards...
--
Manty/BestiaTester -> http://manty.net


2008-01-28 23:33:47

by Santiago Garcia Mantinan

[permalink] [raw]
Subject: Re: dl2k stopped working on 2.6.24

> I've been playing with ethtools and got it to work at 100FD by setting it
> manually, but if afterwards I set it to auto it again goes 1000 HD and thus
> not working again.

I have changed my gigabit switch for a 100Mb wrt and the dl2k sets the link
right at 100FD and works much better than when using it at the forced 100FD
on the gigabit switch, in this last configuration the card was strugling a
lot, with tranfers under the megabyte/s.

I don't believe this is anything on my side as the e1000 cards and Nforce4
forcedeth I have all work ok at 1000FD with 2.4.24. Besides, the dl2k works
ok on the same environment with 2.4.23.

If there is a better list or anybody to contact about the dl2k so that I can
send this info please let me know.

As I said on my previous mail, if any other info is needed or testing any
special stuff, don't hesitate to ask.

Regards...
--
Manty/BestiaTester -> http://manty.net

2008-01-31 21:55:57

by Santiago Garcia Mantinan

[permalink] [raw]
Subject: Re: dl2k stopped working on 2.6.24

As I didn't get any ideas on what to do to help find the problem with the
dl2k driver, I'm doing some tests to get to know what has broken it.

I have today compiled dl2k from git, the version with the 2007-12-23 patches
from Al Viro: dl2k endianness fixes (.24 fodder?) Right before the Al Viro
patches. This seems to be working perfectly on my system.

I'm wondering if I can apply the patches by Al Viro one by one to know which
one broke it.

Regards...
--
Manty/BestiaTester -> http://manty.net

2008-01-31 22:18:27

by Willy Tarreau

[permalink] [raw]
Subject: Re: dl2k stopped working on 2.6.24

Hi Santiago,

On Thu, Jan 31, 2008 at 10:55:41PM +0100, Santiago Garcia Mantinan wrote:
> As I didn't get any ideas on what to do to help find the problem with the
> dl2k driver, I'm doing some tests to get to know what has broken it.
>
> I have today compiled dl2k from git, the version with the 2007-12-23 patches
> from Al Viro: dl2k endianness fixes (.24 fodder?) Right before the Al Viro
> patches. This seems to be working perfectly on my system.

I thought about those patches when you reported your problem but they
looked correct at first glance, and generally Al is known for pushing
clean and valid work.

> I'm wondering if I can apply the patches by Al Viro one by one to know which
> one broke it.

Yes it should be possible, people generally try to push incrementally
valid patches. Please CC Al with your findings. Maybe you'll get him
caught with a bug in his fixes, but get prepared to get fried on your
chair if you're wrong :-)

It is also possible that the code he fixed was really buggy but worked
because of another bug remaining somewhere else.

Regards,
Willy

2008-02-01 00:05:24

by Santiago Garcia Mantinan

[permalink] [raw]
Subject: Re: dl2k stopped working on 2.6.24

> I have today compiled dl2k from git, the version with the 2007-12-23 patches
> from Al Viro: dl2k endianness fixes (.24 fodder?) Right before the Al Viro
> patches. This seems to be working perfectly on my system.

Ok, I've been applying Al's patches one by one, everything went fine till I
applied the "dl2k: MSCR, MSSR, ESR, PHY_SCR fixes" patch. With this patch I
experimented the behaviour I commented on my first message.

I don't know what else to try now, any ideas?

Regards...
--
Manty/BestiaTester -> http://manty.net

2008-02-01 05:33:18

by Al Viro

[permalink] [raw]
Subject: Re: dl2k stopped working on 2.6.24

On Fri, Feb 01, 2008 at 01:04:42AM +0100, Santiago Garcia Mantinan wrote:
> > I have today compiled dl2k from git, the version with the 2007-12-23 patches
> > from Al Viro: dl2k endianness fixes (.24 fodder?) Right before the Al Viro
> > patches. This seems to be working perfectly on my system.
>
> Ok, I've been applying Al's patches one by one, everything went fine till I
> applied the "dl2k: MSCR, MSSR, ESR, PHY_SCR fixes" patch. With this patch I
> experimented the behaviour I commented on my first message.
>
> I don't know what else to try now, any ideas?
>
> Regards...

Very interesting. Relevant part seems to be
- mscr.image = mii_read (dev, phy_addr, MII_MSCR);
- mssr.image = mii_read (dev, phy_addr, MII_MSSR);
- if (mscr.bits.media_1000BT_FD & mssr.bits.lp_1000BT_FD) {
+ mscr = mii_read (dev, phy_addr, MII_MSCR);
+ mssr = mii_read (dev, phy_addr, MII_MSSR);
+ if (mscr & MII_MSCR_1000BT_FD && mssr & MII_MSSR_LP_1000BT_FD) {
np->speed = 1000;
np->full_duplex = 1;
printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n");
- } else if (mscr.bits.media_1000BT_HD & mssr.bits.lp_1000BT_HD) {
+ } else if (mscr & MII_MSCR_1000BT_HD && mssr & MII_MSSR_LP_1000BT_HD) {
np->speed = 1000;
np->full_duplex = 0;
printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n");

More specifically, this:
- if (mscr.bits.media_1000BT_FD & mssr.bits.lp_1000BT_FD) {
+ if (mscr & MII_MSCR_1000BT_FD && mssr & MII_MSSR_LP_1000BT_FD) {

We used to have mscr declared as
typedef union t_MII_MSCR {
u16 image;
struct {
u16 _bit_7_0:8; // bit 7:0
u16 media_1000BT_HD:1; // bit 8
u16 media_1000BT_FD:1; // bit 9
u16 port_type:1; // bit 10
u16 cfg_value:1; // bit 11
u16 cfg_enable:1; // bit 12
u16 test_mode:3; // bit 15:13
} bits;
} MSCR_t, *PMSCR_t;

and mssr as
typedef union t_MII_MSSR {
u16 image;
struct {
u16 idle_err_count:8; // bit 7:0
u16 _bit_9_8:2; // bit 9:8
u16 lp_1000BT_HD:1; // bit 10
u16 lp_1000BT_FD:1; // bit 11
u16 remote_rcv_status:1; // bit 12
u16 local_rcv_status:1; // bit 13
u16 cfg_resolution:1; // bit 14
u16 cfg_fault:1; // bit 15
} bits;
} MSSR_t, *PMSSR_t;

so it looks like these constants had not been right... Damn right, they
had not -
MII_MSSR_LP_1000BT_HD = 0x0800,
MII_MSSR_LP_1000BT_FD = 0x0400,
and that has HD at bit 11 and FD at bit 10 - swapped, IOW. Driver had them
defined wrong all along, but they were not used until now, so bug had not been
noticed.

See if the patch below takes care of all of that:

diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index d66c605..266ec87 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -388,8 +388,8 @@ enum _mii_mssr {
MII_MSSR_CFG_RES = 0x4000,
MII_MSSR_LOCAL_RCV_STATUS = 0x2000,
MII_MSSR_REMOTE_RCVR = 0x1000,
- MII_MSSR_LP_1000BT_HD = 0x0800,
- MII_MSSR_LP_1000BT_FD = 0x0400,
+ MII_MSSR_LP_1000BT_FD = 0x0800,
+ MII_MSSR_LP_1000BT_HD = 0x0400,
MII_MSSR_IDLE_ERR_COUNT = 0x00ff,
};

2008-02-01 16:43:32

by Santiago Garcia Mantinan

[permalink] [raw]
Subject: Re: dl2k stopped working on 2.6.24

> See if the patch below takes care of all of that:

Yes, the patch seems to fix the problem, I have applied it over 2.6.24 and
now the machine is at 1000FD working ok.

Thanks for the fix.

Regards...
--
Manty/BestiaTester -> http://manty.net