* [PROBLEM] sundance on d-link dfe-580tx
@ 2002-06-11 12:43 Matthew Hall
2002-06-12 3:39 ` Donald Becker
2002-06-14 10:15 ` Marcus Sundberg
0 siblings, 2 replies; 12+ messages in thread
From: Matthew Hall @ 2002-06-11 12:43 UTC (permalink / raw)
To: Kernel; +Cc: becker, jgarzik
[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]
Hello lkml, jeff and donald,
I have been testing the D-Link DFE-580TX Quad channel server card (4
port nic), on kernel 2.4.18 with little success.
Attached are the appropriate results of dmesg, ifconfig, lspci and
modules.conf; aswell as the results of the pci-testing tool found on
scyld.com, however the card does not support mii testing, claiming to
have no MII transceiver.
Specifically, the sundance module can be modprobe'd, and the interfaces
of the 4port nic (eth2->eth5) can be brought up with ifconfig, and to
all intents and purposes *should* be working, however the results of
`tail dmesg` and `tail messages` show a transmit timeout on all the
nic's interfaces and testing the interfaces with ping returns host
unreachable (only on this card, the onboard nic and single port pci card
both work properly).
I would appreciate being informed if there is a fix in a later
version,or if any more debugging information is required I would be
happy to oblige.
Matthew Hall
--
Matthew Hall -- matt@ecsc.co.uk -- http://people.ecsc.co.uk/~matt/
Sig: When I was a boy I was told that anybody could become President. Now I'm
beginning to believe it. - Clarence Darrow
[-- Attachment #2: ifconfig --]
[-- Type: text/plain, Size: 3333 bytes --]
eth0 Link encap:Ethernet HWaddr 00:C0:9F:05:B5:75
inet addr:192.168.0.153 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:253 errors:0 dropped:0 overruns:0 frame:0
TX packets:102 errors:0 dropped:0 overruns:4 carrier:0
collisions:0 txqueuelen:100
RX bytes:31707 (30.9 Kb) TX bytes:15077 (14.7 Kb)
Interrupt:20 Base address:0xd000
eth1 Link encap:Ethernet HWaddr 00:02:B3:9E:62:D6
inet addr:192.168.0.152 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:12 carrier:0
collisions:0 txqueuelen:100
RX bytes:632 (632.0 b) TX bytes:1064 (1.0 Kb)
Interrupt:30 Base address:0xf000
eth2 Link encap:Ethernet HWaddr FE:AB:FE:AB:FE:AB
inet addr:192.168.0.151 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7434240 errors:0 dropped:28919 overruns:0 frame:0
TX packets:7908923 errors:10 dropped:0 overruns:0 carrier:0
collisions:58080 txqueuelen:100
RX bytes:1886929406 (1799.5 Mb) TX bytes:1886957115 (1799.5 Mb)
Interrupt:28 Base address:0x5000
eth3 Link encap:Ethernet HWaddr FE:AB:FE:AB:FE:AB
inet addr:192.168.0.150 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7188480 errors:0 dropped:27963 overruns:0 frame:0
TX packets:7647471 errors:0 dropped:0 overruns:0 carrier:0
collisions:56160 txqueuelen:100
RX bytes:2960410694 (2823.2 Mb) TX bytes:2960437487 (2823.2 Mb)
Interrupt:29 Base address:0x7000
eth4 Link encap:Ethernet HWaddr FE:AB:FE:AB:FE:AB
inet addr:192.168.0.149 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7188480 errors:0 dropped:27963 overruns:0 frame:0
TX packets:7647471 errors:0 dropped:0 overruns:0 carrier:0
collisions:56160 txqueuelen:100
RX bytes:2960410694 (2823.2 Mb) TX bytes:2960437487 (2823.2 Mb)
Interrupt:28 Base address:0x9000
eth5 Link encap:Ethernet HWaddr FE:AB:FE:AB:FE:AB
inet addr:192.168.0.148 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7188480 errors:0 dropped:27963 overruns:0 frame:0
TX packets:7647471 errors:0 dropped:0 overruns:0 carrier:0
collisions:56160 txqueuelen:100
RX bytes:2960410694 (2823.2 Mb) TX bytes:2960437487 (2823.2 Mb)
Interrupt:29 Base address:0xb000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:410 errors:0 dropped:0 overruns:0 frame:0
TX packets:410 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:49480 (48.3 Kb) TX bytes:49480 (48.3 Kb)
[-- Attachment #3: lspci --]
[-- Type: text/plain, Size: 8255 bytes --]
00:00.0 Host bridge: ServerWorks CNB20LE Host Bridge (rev 06)
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: 48, cache line size 08
00:00.1 Host bridge: ServerWorks CNB20LE Host Bridge (rev 06)
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: 48, cache line size 08
00:02.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08)
Subsystem: Dell Computer Corporation: Unknown device 010b
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 (2000ns min, 14000ns max), cache line size 08
Interrupt: pin A routed to IRQ 20
Region 0: Memory at fe123000 (32-bit, non-prefetchable) [size=4K]
Region 1: I/O ports at dcc0 [size=64]
Region 2: Memory at fe000000 (32-bit, non-prefetchable) [size=1M]
Capabilities: [dc] 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-
00:09.0 PCI bridge: Digital Equipment Corporation DECchip 21152 (rev 03) (prog-if 00 [Normal decode])
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, cache line size 08
Bus: primary=00, secondary=01, subordinate=01, sec-latency=32
I/O behind bridge: 0000e000-0000efff
Memory behind bridge: fd000000-fdffffff
Prefetchable memory behind bridge: 00000000fa000000-00000000faf00000
BridgeCtl: Parity- SERR+ NoISA+ VGA- MAbort- >Reset- FastB2B-
Capabilities: [dc] Power Management version 1
Flags: PMEClk- DSI- D1- D2- AuxCurrent=220mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Bridge: PM- B3+
00:0a.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 0d)
Subsystem: Intel Corporation: Unknown device 1050
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 (2000ns min, 14000ns max), cache line size 08
Interrupt: pin A routed to IRQ 30
Region 0: Memory at fe122000 (32-bit, non-prefetchable) [size=4K]
Region 1: I/O ports at dc80 [size=64]
Region 2: Memory at fe100000 (32-bit, non-prefetchable) [size=128K]
Capabilities: [dc] 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-
00:0b.0 VGA compatible controller: ATI Technologies Inc Rage XL (rev 27) (prog-if 00 [VGA])
Subsystem: Dell Computer Corporation: Unknown device 010b
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 (2000ns min), cache line size 08
Region 0: Memory at fb000000 (32-bit, non-prefetchable) [size=16M]
Region 1: I/O ports at d800 [size=256]
Region 2: Memory at fe121000 (32-bit, non-prefetchable) [size=4K]
Expansion ROM at <unassigned> [disabled] [size=128K]
Capabilities: [5c] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:0f.0 ISA bridge: ServerWorks CSB5 South Bridge (rev 92)
Subsystem: ServerWorks CSB5 South Bridge
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
00:0f.1 IDE interface: ServerWorks CSB5 IDE Controller (rev 92) (prog-if 8a [Master SecP PriP])
Subsystem: Dell Computer Corporation: Unknown device c10b
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: 64, cache line size 08
Region 0: I/O ports at 01f0 [size=8]
Region 1: I/O ports at 03f4
Region 2: I/O ports at 0170 [size=8]
Region 3: I/O ports at 0374
Region 4: I/O ports at 08b0 [size=16]
Region 5: I/O ports at 08c0 [size=4]
00:0f.2 USB Controller: ServerWorks OSB4/CSB5 OHCI USB Controller (rev 05) (prog-if 10 [OHCI])
Subsystem: ServerWorks OSB4/CSB5 OHCI USB Controller
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 max), cache line size 08
Interrupt: pin A routed to IRQ 5
Region 0: Memory at fe120000 (32-bit, non-prefetchable) [size=4K]
00:0f.3 Host bridge: ServerWorks: Unknown device 0230
Subsystem: ServerWorks: Unknown device 0230
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: 0
Interrupt: pin A routed to IRQ 0
01:04.0 Ethernet controller: D-Link System Inc: Unknown device 1002 (rev 12)
Subsystem: D-Link System Inc: Unknown device 1012
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 (2500ns min, 2500ns max), cache line size 08
Interrupt: pin A routed to IRQ 28
Region 0: I/O ports at ec80 [size=128]
Expansion ROM at fd000000 [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-
01:05.0 Ethernet controller: D-Link System Inc: Unknown device 1002 (rev 12)
Subsystem: D-Link System Inc: Unknown device 1012
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 (2500ns min, 2500ns max), cache line size 08
Interrupt: pin A routed to IRQ 29
Region 0: I/O ports at ec00 [size=128]
Expansion ROM at fd000000 [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-
01:06.0 Ethernet controller: D-Link System Inc: Unknown device 1002 (rev 12)
Subsystem: D-Link System Inc: Unknown device 1012
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 (2500ns min, 2500ns max), cache line size 08
Interrupt: pin A routed to IRQ 28
Region 0: I/O ports at e880 [size=128]
Expansion ROM at fd000000 [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-
01:07.0 Ethernet controller: D-Link System Inc: Unknown device 1002 (rev 12)
Subsystem: D-Link System Inc: Unknown device 1012
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 (2500ns min, 2500ns max), cache line size 08
Interrupt: pin A routed to IRQ 29
Region 0: I/O ports at e800 [size=128]
Expansion ROM at fd000000 [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-
[-- Attachment #4: modules.conf --]
[-- Type: text/plain, Size: 161 bytes --]
alias parport_lowlevel parport_pc
alias eth0 eepro100
alias eth1 eepro100
alias eth2 sundance
alias eth3 sundance
alias eth4 sundance
alias eth5 sundance
[-- Attachment #5: pci-config --]
[-- Type: text/plain, Size: 618 bytes --]
pci-config.c:v2.02 1/8/2001 Donald Becker (becker@scyld.com)
http://www.scyld.com/diag/index.html
Device #1 at bus 0 device/function 0/0, 00091166.
Device #2 at bus 0 device/function 0/1, 00091166.
Device #3 at bus 0 device/function 2/0, 12298086.
Device #4 at bus 0 device/function 9/0, 00241011.
Device #5 at bus 0 device/function 10/0, 12298086.
Device #6 at bus 0 device/function 11/0, 47521002.
Device #7 at bus 0 device/function 15/0, 02011166.
Device #8 at bus 0 device/function 15/1, 02121166.
Device #9 at bus 0 device/function 15/2, 02201166.
Device #10 at bus 0 device/function 15/3, 02301166.
[-- Attachment #6: dmesg --]
[-- Type: text/plain, Size: 718 bytes --]
eth2: D-Link DFE-580TX 4 port Server Adapter at 0xc8cbb000, fe:ab:fe:ab:fe:ab, IRQ 29.
eth2: No MII transceiver found!, ASIC status 7fabfe
Override speed=100, Full duplex
NETDEV WATCHDOG: eth2: transmit timed out
eth2: Transmit timed out, status 00, resetting...
Rx ring c53bd000: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Tx ring c5384000: 80008001 80008005 80008009 8000800d 80008011 80008015 80008019 8000801d 80008021 0000 0000 0000 0000 0000 0000 0000
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-11 12:43 [PROBLEM] sundance on d-link dfe-580tx Matthew Hall
@ 2002-06-12 3:39 ` Donald Becker
2002-06-13 14:57 ` Matthew Hall
2002-07-12 2:41 ` kwijibo
2002-06-14 10:15 ` Marcus Sundberg
1 sibling, 2 replies; 12+ messages in thread
From: Donald Becker @ 2002-06-12 3:39 UTC (permalink / raw)
To: Matthew Hall; +Cc: Kernel, jgarzik
On 11 Jun 2002, Matthew Hall wrote:
> To: Kernel <linux-kernel@vger.kernel.org>
> Cc: becker@scyld.com, jgarzik@mandrakesoft.com
...
> I have been testing the D-Link DFE-580TX Quad channel server card (4
> port nic), on kernel 2.4.18 with little success.
>
> Attached are the appropriate results of dmesg, ifconfig, lspci and
> modules.conf; aswell as the results of the pci-testing tool found on
> scyld.com, however the card does not support mii testing, claiming to
> have no MII transceiver.
Please provide the full detection message.
It appears that you are using a driver that doesn't correctly read the
EEPROM, and has additional problems. Try a current driver from
http://www.scyld.com/network/ethercard.html
ftp://www.scyld.com/pub/network/sundance.c
http://www.scyld.com/network/updates.html
and run diagnostic program from
http://www.scyld.com/diag/index.html
--
Donald Becker becker@scyld.com
Scyld Computing Corporation http://www.scyld.com
410 Severn Ave. Suite 210 Second Generation Beowulf Clusters
Annapolis MD 21403 410-990-9993
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-12 3:39 ` Donald Becker
@ 2002-06-13 14:57 ` Matthew Hall
2002-06-13 15:34 ` Ben Greear
` (2 more replies)
2002-07-12 2:41 ` kwijibo
1 sibling, 3 replies; 12+ messages in thread
From: Matthew Hall @ 2002-06-13 14:57 UTC (permalink / raw)
To: Donald Becker; +Cc: Kernel, jgarzik
[-- Attachment #1: Type: text/plain, Size: 2827 bytes --]
Thanks for your reply Donald,
I have tried and tested the sundance.c file as you indicated, and the
netdrivers packages with a recompiled kernel, yet we still cannot get
this (damn) card working :)
We're still getting these transmit timeouts:
NETDEV WATCHDOG: eth5: transmit timed out
eth5: Transmit timed out, status 00, resetting...
Rx ring c71d4000: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
Tx ring c71d5000: 80008001 80008005 80008009 8000800d 80008011
80008015 80008019 8000801d 80008021 0000 0000 0000 0000 0000 0000 0000
(it is still in the back of my head whether the card works at all...)
Just in case you can provide any more insight into this I compiled the
alta-diag tool, for debugging purposes, the results of -aa, -ee and -mm
are attached, aswell as the full detection message from dmesg after
modprob'ing the module.
Thanks in advance,
Matthew Hall
On Wed, 2002-06-12 at 04:39, Donald Becker wrote:
> On 11 Jun 2002, Matthew Hall wrote:
>
> > To: Kernel <linux-kernel@vger.kernel.org>
> > Cc: becker@scyld.com, jgarzik@mandrakesoft.com
> ...
> > I have been testing the D-Link DFE-580TX Quad channel server card (4
> > port nic), on kernel 2.4.18 with little success.
> >
> > Attached are the appropriate results of dmesg, ifconfig, lspci and
> > modules.conf; aswell as the results of the pci-testing tool found on
> > scyld.com, however the card does not support mii testing, claiming to
> > have no MII transceiver.
>
> Please provide the full detection message.
>
> It appears that you are using a driver that doesn't correctly read the
> EEPROM, and has additional problems. Try a current driver from
> http://www.scyld.com/network/ethercard.html
> ftp://www.scyld.com/pub/network/sundance.c
> http://www.scyld.com/network/updates.html
>
> and run diagnostic program from
> http://www.scyld.com/diag/index.html
>
>
> --
> Donald Becker becker@scyld.com
> Scyld Computing Corporation http://www.scyld.com
> 410 Severn Ave. Suite 210 Second Generation Beowulf Clusters
> Annapolis MD 21403 410-990-9993
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Matthew Hall -- matt@ecsc.co.uk -- http://people.ecsc.co.uk/~matt/
Sig: When I was a boy I was told that anybody could become President. Now I'm
beginning to believe it. - Clarence Darrow
[-- Attachment #2: alta-diag_aa --]
[-- Type: text/plain, Size: 2917 bytes --]
[root@installed root]# alta-diag -aa
alta-diag.c:v2.00 4/19/2000 Donald Becker (becker@scyld.com)
http://www.scyld.com/diag/index.html
Index #1: Found a Sundance Technology Alta adapter at 0xec80.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:21.
Sundance Technology Alta chip registers at 0xec80
0x00: 0000 0000 0000 0000 0408 0000 0000 0000
0x10: 0000 0000 0408 0000 5c37 0000 0000 0000
0x20: 0000 0000 0000 0000 0000 0000 0000 0000
0x30: 4063 0000 19f5 02ff 0000 0000 1ffc 1ffc
0x40: 0000 0000 fbfb 0000 0000 ---- 0000 0100
0x50: 0000 0000 0500 e65d 2109 05ea 0800 0001
0x60: 0000 0000 0000 0000 0000 0000 0000 0000
0x70: 0000 0000 0000 0000 0000 0000 0000 0000
Index #2: Found a Sundance Technology Alta adapter at 0xec00.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:22.
Sundance Technology Alta chip registers at 0xec00
0x00: 0000 0000 0000 0000 0408 0000 0000 0000
0x10: 0000 0000 0408 0000 49a0 0000 0000 0000
0x20: 0000 0000 0000 0000 0000 0000 0000 0000
0x30: 4063 0000 f67c 02ff 0000 0000 1ffc 1ffc
0x40: 0000 0000 fbfb 0000 0000 ---- 0000 0100
0x50: 0000 0000 0500 e65d 2209 05ea 0800 0000
0x60: 0000 0000 0000 0000 0000 0000 0000 0000
0x70: 0000 0000 0000 0000 0000 0000 0000 0000
Index #3: Found a Sundance Technology Alta adapter at 0xe880.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:23.
Sundance Technology Alta chip registers at 0xe880
0x00: 0000 0000 0000 0000 0408 0000 0000 0000
0x10: 0000 0000 0408 0000 376b 0000 0000 0000
0x20: 0000 0000 0000 0000 0000 0000 0000 0000
0x30: 4063 0000 acfb 02ff 0000 0000 1ffc 1ffc
0x40: 0000 0000 fbfb 0000 0000 ---- 0000 0100
0x50: 0000 0000 0500 e65d 2309 05ea 0800 0000
0x60: 0000 0000 0000 0000 0000 0000 0000 0000
0x70: 0000 0000 0000 0000 0000 0000 0000 0000
Index #4: Found a Sundance Technology Alta adapter at 0xe800.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:24.
Sundance Technology Alta chip registers at 0xe800
0x00: 0000 0000 0000 0000 0408 0000 0000 0000
0x10: 0000 0000 0408 0000 2526 0000 0000 0000
0x20: 0000 0000 0000 0000 0000 0000 0000 0000
0x30: 4063 0000 f21f 02ff 0000 0000 1ffc 1ffc
0x40: 0000 0000 fbfb 0000 0000 ---- 0000 0100
0x50: 0000 0000 0500 e65d 2409 05ea 0800 0000
0x60: 0000 0000 0000 0000 0000 0000 0000 0000
0x70: 0000 0000 0000 0000 0000 0000 0000 0000
[-- Attachment #3: alta-diag_ee --]
[-- Type: text/plain, Size: 8071 bytes --]
[root@installed root]# alta-diag -ee
alta-diag.c:v2.00 4/19/2000 Donald Becker (becker@scyld.com)
http://www.scyld.com/diag/index.html
Index #1: Found a Sundance Technology Alta adapter at 0xec80.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:21.
EEPROM contents:
0x000: 2afc c063 1186 1012 0000 0000 0000 0000
0x008: 0000 0000 0000 0000 0000 0000 0000 0000
0x010: 0500 e65d 2109 0064 0000 0000 0000 0000
0x018: 3400 0100 3702 0300 083a 3f04 0303 0103
0x020: 0000 0000 0000 0000 0000 0000 0000 0000
0x028: 0000 0000 0000 0000 0000 0000 0000 0000
0x030: 0000 0000 0000 0000 0000 0000 0000 0000
0x038: 0000 0000 0000 0000 0000 0000 0000 0000
0x040: 0000 0000 0000 0000 0000 0000 0000 0000
0x048: 0000 0000 0000 0000 0000 0000 0000 0000
0x050: 0000 0000 0000 0000 0000 0000 0000 0000
0x058: 0000 0000 0000 0000 0000 0000 0000 0000
0x060: 0000 0000 0000 0000 0000 0000 0000 0000
0x068: 0000 0000 0000 0000 0000 0000 0000 0000
0x070: 0000 0000 0000 0000 0000 0000 0000 0000
0x078: 0000 0000 0000 0000 cc20 4e0d cc9a 19f5
0x080: 2afc c063 1186 1012 0000 0000 0000 0000
0x088: 0000 0000 0000 0000 0000 0000 0000 0000
0x090: 0500 e65d 2109 0064 0000 0000 0000 0000
0x098: 3400 0100 3702 0300 083a 3f04 0303 0103
0x0a0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0a8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f8: 0000 0000 0000 0000 cc20 4e0d cc9a 19f5
EEPROM Subsystem IDs, Vendor 1186 Device 1012.
EEPROM Station address is 00:05:5d:e6:09:21.
Configuration 2afc, ASIC Control c063.
Index #2: Found a Sundance Technology Alta adapter at 0xec00.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:22.
EEPROM contents:
0x000: 2afc c063 1186 1012 0000 0000 0000 0000
0x008: 0000 0000 0000 0000 0000 0000 0000 0000
0x010: 0500 e65d 2209 0064 0000 0000 0000 0000
0x018: 3400 0100 3702 0300 083a 3f04 0303 0103
0x020: 0000 0000 0000 0000 0000 0000 0000 0000
0x028: 0000 0000 0000 0000 0000 0000 0000 0000
0x030: 0000 0000 0000 0000 0000 0000 0000 0000
0x038: 0000 0000 0000 0000 0000 0000 0000 0000
0x040: 0000 0000 0000 0000 0000 0000 0000 0000
0x048: 0000 0000 0000 0000 0000 0000 0000 0000
0x050: 0000 0000 0000 0000 0000 0000 0000 0000
0x058: 0000 0000 0000 0000 0000 0000 0000 0000
0x060: 0000 0000 0000 0000 0000 0000 0000 0000
0x068: 0000 0000 0000 0000 0000 0000 0000 0000
0x070: 0000 0000 0000 0000 0000 0000 0000 0000
0x078: 0000 0000 0000 0000 e1e3 fd99 a941 f67c
0x080: 2afc c063 1186 1012 0000 0000 0000 0000
0x088: 0000 0000 0000 0000 0000 0000 0000 0000
0x090: 0500 e65d 2209 0064 0000 0000 0000 0000
0x098: 3400 0100 3702 0300 083a 3f04 0303 0103
0x0a0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0a8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f8: 0000 0000 0000 0000 e1e3 fd99 a941 f67c
EEPROM Subsystem IDs, Vendor 1186 Device 1012.
EEPROM Station address is 00:05:5d:e6:09:22.
Configuration 2afc, ASIC Control c063.
Index #3: Found a Sundance Technology Alta adapter at 0xe880.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:23.
EEPROM contents:
0x000: 2afc c063 1186 1012 0000 0000 0000 0000
0x008: 0000 0000 0000 0000 0000 0000 0000 0000
0x010: 0500 e65d 2309 0064 0000 0000 0000 0000
0x018: 3400 0100 3702 0300 083a 3f04 0303 0103
0x020: 0000 0000 0000 0000 0000 0000 0000 0000
0x028: 0000 0000 0000 0000 0000 0000 0000 0000
0x030: 0000 0000 0000 0000 0000 0000 0000 0000
0x038: 0000 0000 0000 0000 0000 0000 0000 0000
0x040: 0000 0000 0000 0000 0000 0000 0000 0000
0x048: 0000 0000 0000 0000 0000 0000 0000 0000
0x050: 0000 0000 0000 0000 0000 0000 0000 0000
0x058: 0000 0000 0000 0000 0000 0000 0000 0000
0x060: 0000 0000 0000 0000 0000 0000 0000 0000
0x068: 0000 0000 0000 0000 0000 0000 0000 0000
0x070: 0000 0000 0000 0000 0000 0000 0000 0000
0x078: 0000 0000 0000 0000 faa2 9315 8a08 acfb
0x080: 2afc c063 1186 1012 0000 0000 0000 0000
0x088: 0000 0000 0000 0000 0000 0000 0000 0000
0x090: 0500 e65d 2309 0064 0000 0000 0000 0000
0x098: 3400 0100 3702 0300 083a 3f04 0303 0103
0x0a0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0a8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f8: 0000 0000 0000 0000 faa2 9315 8a08 acfb
EEPROM Subsystem IDs, Vendor 1186 Device 1012.
EEPROM Station address is 00:05:5d:e6:09:23.
Configuration 2afc, ASIC Control c063.
Index #4: Found a Sundance Technology Alta adapter at 0xe800.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:24.
EEPROM contents:
0x000: 2afc c063 1186 1012 0000 0000 0000 0000
0x008: 0000 0000 0000 0000 0000 0000 0000 0000
0x010: 0500 e65d 2409 0064 0000 0000 0000 0000
0x018: 3400 0100 3702 0300 083a 3f04 0303 0103
0x020: 0000 0000 0000 0000 0000 0000 0000 0000
0x028: 0000 0000 0000 0000 0000 0000 0000 0000
0x030: 0000 0000 0000 0000 0000 0000 0000 0000
0x038: 0000 0000 0000 0000 0000 0000 0000 0000
0x040: 0000 0000 0000 0000 0000 0000 0000 0000
0x048: 0000 0000 0000 0000 0000 0000 0000 0000
0x050: 0000 0000 0000 0000 0000 0000 0000 0000
0x058: 0000 0000 0000 0000 0000 0000 0000 0000
0x060: 0000 0000 0000 0000 0000 0000 0000 0000
0x068: 0000 0000 0000 0000 0000 0000 0000 0000
0x070: 0000 0000 0000 0000 0000 0000 0000 0000
0x078: 0000 0000 0000 0000 bc24 41c0 64b6 f21f
0x080: 2afc c063 1186 1012 0000 0000 0000 0000
0x088: 0000 0000 0000 0000 0000 0000 0000 0000
0x090: 0500 e65d 2409 0064 0000 0000 0000 0000
0x098: 3400 0100 3702 0300 083a 3f04 0303 0103
0x0a0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0a8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0b8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0c8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0d8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0e8: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0f8: 0000 0000 0000 0000 bc24 41c0 64b6 f21f
EEPROM Subsystem IDs, Vendor 1186 Device 1012.
EEPROM Station address is 00:05:5d:e6:09:24.
Configuration 2afc, ASIC Control c063.
[-- Attachment #4: alta-diag_mm --]
[-- Type: text/plain, Size: 1812 bytes --]
root@installed root]# alta-diag -mm
alta-diag.c:v2.00 4/19/2000 Donald Becker (becker@scyld.com)
http://www.scyld.com/diag/index.html
Index #1: Found a Sundance Technology Alta adapter at 0xec80.
Receive mode is 0x00: Unknown/invalid.
MAC mode is 0000: half duplex.
Tx status 00, threshold 8188.
Interrupt status is 0100: Link status changed
Station address 00:05:5d:e6:09:21.
MII PHY found at address 0, status 0x7809.
MII PHY found at address 1, status 0x7809.
MII PHY #0 transceiver registers:
1100 7809 0022 1630 01e1 0040 0004 2001
1100 7809 0022 1630 01e1 0040 0004 2001
1100 7809 0022 1630 01e1 0040 0004 2001
0000 0000 0000 0000 0000 0000 0000 0000.
MII PHY #1 transceiver registers:
1100 7809 0022 1630 01e1 0040 0004 2001
1100 7809 0022 1630 01e1 0040 0004 2001
1100 7809 0022 1630 01e1 0040 0004 2001
0000 0000 0000 0000 0000 0000 0000 0000.
MII PHY #0 transceiver registers:
1100 7809 0022 1630 01e1 0040 0004 2001
1100 7809 0022 1630 01e1 0040 0004 2001
1100 7809 0022 1630 01e1 0040 0004 2001
0000 0000 0000 0000 0000 0000 0000 0000.
Basic mode control register 0x1100: Auto-negotiation enabled.
Basic mode status register 0x7809 ... 7809.
Link status: not established.
Capable of 100baseTx-FD 100baseTx 10baseT-FD 10baseT.
Able to perform Auto-negotiation, negotiation not complete.
Vendor ID is 00:08:85:--:--:--, model 35 rev. 0.
No specific information is known about this transceiver type.
I'm advertising 01e1: 100baseTx-FD 100baseTx 10baseT-FD 10baseT
Advertising no additional info pages.
IEEE 802.3 CSMA/CD protocol.
Link partner capability is 0040: 10baseT-FD.
Negotiation did not complete.
15:51:21.000 Baseline value of MII BMSR (basic mode status register) is 7809.
[-- Attachment #5: detectionmessage --]
[-- Type: text/plain, Size: 5269 bytes --]
root@installed root]# lsmod
Module Size Used by Not tainted
iptable_mangle 2080 0 (autoclean) (unused)
iptable_nat 15028 0 (autoclean) (unused)
iptable_filter 1696 0 (autoclean) (unused)
ip_conntrack 15532 1 (autoclean) [iptable_nat]
ip_tables 11616 5 [iptable_mangle iptable_nat iptable_filter]
eepro100 17584 1
[root@installed root]# modprobe sundance
[root@installed root]# dmesg |tail -n 18
NETDEV WATCHDOG: eth5: transmit timed out
eth5: Transmit timed out, status 00, resetting...
Rx ring c71d4000: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Tx ring c71d5000: 80008001 80008005 80008009 8000800d 80008011 80008015 80008019 8000801d 80008021 0000 0000 0000 0000 0000 0000 0000
sundance.c:v1.01b 17-Jan-2002 Written by Donald Becker
http://www.scyld.com/network/sundance.html
eth2: D-Link DFE-580TX 4 port Server Adapter at 0xc8cb3000, fe:ab:fe:ab:fe:ab, IRQ 28.
eth2: No MII transceiver found!, ASIC status 7fabfe
Override speed=100, Full duplex
eth3: D-Link DFE-580TX 4 port Server Adapter at 0xc8cdd000, fe:ab:fe:ab:fe:ab, IRQ 29.
eth3: No MII transceiver found!, ASIC status 7fabfe
Override speed=100, Full duplex
eth4: D-Link DFE-580TX 4 port Server Adapter at 0xc8cdf000, fe:ab:fe:ab:fe:ab, IRQ 28.
eth4: No MII transceiver found!, ASIC status 7fabfe
Override speed=100, Full duplex
eth5: D-Link DFE-580TX 4 port Server Adapter at 0xc8ce1000, fe:ab:fe:ab:fe:ab, IRQ 29.
eth5: No MII transceiver found!, ASIC status 7fabfe
Override speed=100, Full duplex
[root@installed root]# ifconfig eth5 up 192.168.0.100
[root@installed root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:C0:9F:05:B5:75
inet addr:192.168.0.153 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1520 errors:0 dropped:0 overruns:0 frame:0
TX packets:1100 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:132864 (129.7 Kb) TX bytes:246982 (241.1 Kb)
Interrupt:20 Base address:0xd000
eth5 Link encap:Ethernet HWaddr FE:AB:FE:AB:FE:AB
inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:245760 errors:0 dropped:956 overruns:0 frame:0
TX packets:261452 errors:0 dropped:0 overruns:0 carrier:0
collisions:1920 txqueuelen:100
RX bytes:3221486008 (3072.2 Mb) TX bytes:3221486924 (3072.2 Mb)
Interrupt:29 Base address:0x10
[root@installed root]# lsmod
Module Size Used by Not tainted
sundance 11264 1
iptable_mangle 2080 0 (autoclean) (unused)
iptable_nat 15028 0 (autoclean) (unused)
iptable_filter 1696 0 (autoclean) (unused)
ip_conntrack 15532 1 (autoclean) [iptable_nat]
ip_tables 11616 5 [iptable_mangle iptable_nat iptable_filter]
eepro100 17584 1
[root@installed root]# tail -n 20 /var/log/messages
Jun 13 15:39:40 installed sshd(pam_unix)[2275]: session opened for user root by (uid=0)
Jun 13 15:49:23 installed login(pam_unix)[1947]: session closed for user root
Jun 13 15:53:29 installed sshd(pam_unix)[2275]: session closed for user root
Jun 13 15:55:55 installed sshd(pam_unix)[2373]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=matt.dark.lan user=root
Jun 13 15:56:40 installed sshd(pam_unix)[2373]: session opened for user root by (uid=0)
Jun 13 15:57:08 installed firewall: Shutting down Packet filtering: succeeded
Jun 13 15:57:53 installed kernel: sundance.c:v1.01b 17-Jan-2002 Written by Donald Becker
Jun 13 15:57:53 installed kernel: http://www.scyld.com/network/sundance.html
Jun 13 15:57:53 installed kernel: eth2: D-Link DFE-580TX 4 port Server Adapter at 0xc8cb3000, fe:ab:fe:ab:fe:ab, IRQ 28.
Jun 13 15:57:53 installed kernel: eth2: No MII transceiver found!, ASIC status 7fabfe
Jun 13 15:57:53 installed kernel: Override speed=100, Full duplex
Jun 13 15:57:53 installed kernel: eth3: D-Link DFE-580TX 4 port Server Adapter at 0xc8cdd000, fe:ab:fe:ab:fe:ab, IRQ 29.
Jun 13 15:57:53 installed kernel: eth3: No MII transceiver found!, ASIC status 7fabfe
Jun 13 15:57:53 installed kernel: Override speed=100, Full duplex
Jun 13 15:57:53 installed kernel: eth4: D-Link DFE-580TX 4 port Server Adapter at 0xc8cdf000, fe:ab:fe:ab:fe:ab, IRQ 28.
Jun 13 15:57:53 installed kernel: eth4: No MII transceiver found!, ASIC status 7fabfe
Jun 13 15:57:53 installed kernel: Override speed=100, Full duplex
Jun 13 15:57:53 installed kernel: eth5: D-Link DFE-580TX 4 port Server Adapter at 0xc8ce1000, fe:ab:fe:ab:fe:ab, IRQ 29.
Jun 13 15:57:53 installed kernel: eth5: No MII transceiver found!, ASIC status 7fabfe
Jun 13 15:57:53 installed kernel: Override speed=100, Full duplex
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-13 14:57 ` Matthew Hall
@ 2002-06-13 15:34 ` Ben Greear
2002-06-13 16:12 ` Donald Becker
2002-06-21 5:27 ` Jeff Garzik
2 siblings, 0 replies; 12+ messages in thread
From: Ben Greear @ 2002-06-13 15:34 UTC (permalink / raw)
To: Matthew Hall; +Cc: Donald Becker, Kernel, jgarzik
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
Dlink has driver source on their web page (somewhere) that
evidently works. I'll attach a copy, but I have not had
a chance to test it yet.
Matthew Hall wrote:
> Thanks for your reply Donald,
> I have tried and tested the sundance.c file as you indicated, and the
> netdrivers packages with a recompiled kernel, yet we still cannot get
> this (damn) card working :)
--
Ben Greear <greearb@candelatech.com> <Ben_Greear AT excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear
[-- Attachment #2: sundance.c --]
[-- Type: application/vnd.sun.xml.calc, Size: 44390 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-13 14:57 ` Matthew Hall
2002-06-13 15:34 ` Ben Greear
@ 2002-06-13 16:12 ` Donald Becker
2002-06-14 16:06 ` Matthew Hall
2002-06-21 5:27 ` Jeff Garzik
2 siblings, 1 reply; 12+ messages in thread
From: Donald Becker @ 2002-06-13 16:12 UTC (permalink / raw)
To: Matthew Hall; +Cc: Kernel
On 13 Jun 2002, Matthew Hall wrote:
> Subject: Re: [PROBLEM] sundance on d-link dfe-580tx
>
> I have tried and tested the sundance.c file as you indicated, and the
> netdrivers packages with a recompiled kernel, yet we still cannot get
> this (damn) card working :)
You are still running the old driver, not the driver at
http://www.scyld.com/network/ethercard.html
ftp://www.scyld.com/pub/network/sundance.c
> Just in case you can provide any more insight into this I compiled the
> alta-diag tool, for debugging purposes, the results of -aa, -ee and -mm
> are attached, aswell as the full detection message from dmesg after
> modprob'ing the module.
I never released a "1.01b" driver in January 2002. The 1.01a driver was
released about two years ago. The current version is
sundance.c:v1.06 1/28/2002
The diagnostic program is reading the correct station address, however
the driver you are using is reading a bogus address. I believe that
that my driver release should correctly work with this card.
--
Donald Becker becker@scyld.com
Scyld Computing Corporation http://www.scyld.com
410 Severn Ave. Suite 210 Second Generation Beowulf Clusters
Annapolis MD 21403 410-990-9993
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-11 12:43 [PROBLEM] sundance on d-link dfe-580tx Matthew Hall
2002-06-12 3:39 ` Donald Becker
@ 2002-06-14 10:15 ` Marcus Sundberg
[not found] ` <1024070521.973.48.camel@smelly.dark.lan>
1 sibling, 1 reply; 12+ messages in thread
From: Marcus Sundberg @ 2002-06-14 10:15 UTC (permalink / raw)
To: Matthew Hall; +Cc: Kernel, jgarzik
Matthew Hall <matt@ecsc.co.uk> writes:
> I have been testing the D-Link DFE-580TX Quad channel server card (4
> port nic), on kernel 2.4.18 with little success.
[snip]
> I would appreciate being informed if there is a fix in a later
> version,or if any more debugging information is required I would be
> happy to oblige.
I have to define USE_IO_OPS to get the sundance driver to work with
the DFE-580TX. I haven't investigated why.
//Marcus
--
---------------------------------------+--------------------------
Marcus Sundberg <marcus@ingate.com> | Firewalls with SIP & NAT
Firewall Developer, Ingate Systems AB | http://www.ingate.com/
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-13 16:12 ` Donald Becker
@ 2002-06-14 16:06 ` Matthew Hall
2002-06-14 21:52 ` Donald Becker
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Hall @ 2002-06-14 16:06 UTC (permalink / raw)
To: Donald Becker; +Cc: Kernel
Sorry to bother you again Donald, but I'm still having problems,
The following error comes up when I make modules with the 1.06 version:
sundance.c: In function `sundance_probe1':
sundance.c:464: `pci_tbl' undeclared (first use in this function)
sundance.c:464: (Each undeclared identifier is reported only once
sundance.c:464: for each function it appears in.)
sundance.c: In function `cleanup_module':
sundance.c:1372: `pci_tbl' undeclared (first use in this function)
make[2]: *** [sundance.o] Error 1
make[2]: Leaving directory `/usr/src/linux/drivers/net'
make[1]: *** [_modsubdir_net] Error 2
make[1]: Leaving directory `/usr/src/linux/drivers'
make: *** [_mod_drivers] Error 2
I've checked the code of sundance.c, pci-scan.h and kern_compat.c and
pci_tbl isn't defined or declared anywhere in these files, am I missing
something else, or going crazy?
Thanks in advance,
Matthew Hall
On Thu, 2002-06-13 at 17:12, Donald Becker wrote:
> You are still running the old driver, not the driver at
> http://www.scyld.com/network/ethercard.html
> ftp://www.scyld.com/pub/network/sundance.c
>
> > Just in case you can provide any more insight into this I compiled the
> > alta-diag tool, for debugging purposes, the results of -aa, -ee and -mm
> > are attached, aswell as the full detection message from dmesg after
> > modprob'ing the module.
>
> I never released a "1.01b" driver in January 2002. The 1.01a driver was
> released about two years ago. The current version is
> sundance.c:v1.06 1/28/2002
>
> The diagnostic program is reading the correct station address, however
> the driver you are using is reading a bogus address. I believe that
> that my driver release should correctly work with this card.
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-14 16:06 ` Matthew Hall
@ 2002-06-14 21:52 ` Donald Becker
0 siblings, 0 replies; 12+ messages in thread
From: Donald Becker @ 2002-06-14 21:52 UTC (permalink / raw)
To: Matthew Hall; +Cc: Kernel
On 14 Jun 2002, Matthew Hall wrote:
> Sorry to bother you again Donald, but I'm still having problems,
> The following error comes up when I make modules with the 1.06 version:
>
> sundance.c: In function `sundance_probe1':
> sundance.c:464: `pci_tbl' undeclared (first use in this function)
The line before these said that 'pci-scan.h' couldn't be found.
ftp://www.scyld.com/pub/network/pci-scan.h
Read
http://www.scyld.com/network/updates.html
> I've checked the code of sundance.c, pci-scan.h and kern_compat.c and
> pci_tbl isn't defined or declared anywhere in these files, am I missing
> something else, or going crazy?
--
Donald Becker becker@scyld.com
Scyld Computing Corporation http://www.scyld.com
410 Severn Ave. Suite 210 Second Generation Beowulf Clusters
Annapolis MD 21403 410-990-9993
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
[not found] ` <vevg8l25uq.fsf@inigo.ingate.se>
@ 2002-06-17 14:58 ` Matthew Hall
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Hall @ 2002-06-17 14:58 UTC (permalink / raw)
To: Marcus Sundberg; +Cc: Kernel
[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]
Hi Marcus,
Thanks for your help, I managed to fix some of the compilation errors
this one brought up with my limited c/kernel code knowledge and as far
as I can see, this (attached) version seems a little more stable
(crosses fingers). Hope you can put it to good use.
Cheers,
Matthew Hall
On Fri, 2002-06-14 at 17:16, Marcus Sundberg wrote:
> Matthew Hall <matt@ecsc.co.uk> writes:
>
> > Hi,
> > I don't suppose you could do me a favour? If at all possible, could you
> > send me the sundance.c, kern_compat.h and pci-scan.h files you used to
> > get this card working? I'm at my wits end and my boss needs this working
> > :)
>
> Hi!
>
> Well, I got it working, but not really usable...
> See http://marc.theaimsgroup.com/?l=linux-kernel&m=102269899408145&w=2
> for the problems I'm seeing.
>
> But here's the driver I've been testing in any case. I'm not using
> Donald Becker's driver so you don't need a kern_compat.h or pci-scan.h.
>
> //Marcus
>
>
> ______________________________________________________________________
>
> --
> ---------------------------------------+--------------------------
> Marcus Sundberg <marcus@ingate.com> | Firewalls with SIP & NAT
> Firewall Developer, Ingate Systems AB | http://www.ingate.com/
--
Matthew Hall -- matt@ecsc.co.uk -- http://people.ecsc.co.uk/~matt/
Sig: When I was a boy I was told that anybody could become President. Now I'm
beginning to believe it. - Clarence Darrow
[-- Attachment #2: sundance.c --]
[-- Type: text/x-c, Size: 48551 bytes --]
#define USE_IO_OPS 1
/* sundance.c: A Linux device driver for the Sundance ST201 "Alta". */
/*
Written 1999-2000 by Donald Becker.
This software may be used and distributed according to the terms of
the GNU General Public License (GPL), incorporated herein by reference.
Drivers based on or derived from this code fall under the GPL and must
retain the authorship, copyright and license notice. This file is not
a complete program and may only be used when the entire operating
system is licensed under the GPL.
The author may be reached as becker@scyld.com, or C/O
Scyld Computing Corporation
410 Severn Ave., Suite 210
Annapolis MD 21403
Support and updates available at
http://www.scyld.com/network/sundance.html
Version 1.01a (jgarzik):
- Replace some MII-related magic numbers with constants
Version 1.02 (D-Link):
- Add new board to PCI ID list
- Fix multicast bug
*/
#define DRV_NAME "sundance"
#define DRV_VERSION "1.02"
#define DRV_RELDATE "17-Jan-2002"
/* The user-configurable values.
These may be modified when a driver module is loaded.*/
static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
static int max_interrupt_work = 30;
static int mtu;
/* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
Typical is a 64 element hash table based on the Ethernet CRC. */
static int multicast_filter_limit = 32;
/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
Setting to > 1518 effectively disables this feature.
This chip can receive into offset buffers, so the Alpha does not
need a copy-align. */
static int rx_copybreak;
/* media[] specifies the media type the NIC operates at.
autosense Autosensing active media.
10mbps_hd 10Mbps half duplex.
10mbps_fd 10Mbps full duplex.
100mbps_hd 100Mbps half duplex.
100mbps_fd 100Mbps full duplex.
0 Autosensing active media.
1 10Mbps half duplex.
2 10Mbps full duplex.
3 100Mbps half duplex.
4 100Mbps full duplex.
*/
#define MAX_UNITS 8
static char *media[MAX_UNITS];
/* Operational parameters that are set at compile time. */
/* Keep the ring sizes a power of two for compile efficiency.
The compiler will convert <unsigned>'%'<2^N> into a bit mask.
Making the Tx ring too large decreases the effectiveness of channel
bonding and packet priority, and more than 128 requires modifying the
Tx error recovery.
Large receive rings merely waste memory. */
#define TX_RING_SIZE 16
#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */
#define RX_RING_SIZE 32
#define TX_TOTAL_SIZE TX_RING_SIZE*sizeof(struct netdev_desc)
#define RX_TOTAL_SIZE RX_RING_SIZE*sizeof(struct netdev_desc)
/* Operational parameters that usually are not changed. */
/* Time in jiffies before concluding the transmitter is hung. */
#define TX_TIMEOUT (4*HZ)
#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/
#ifndef __KERNEL__
#define __KERNEL__
#endif
#if !defined(__OPTIMIZE__)
#warning You must compile this file with the correct options!
#warning See the last lines of the source file.
#error You must compile this driver with "-O".
#endif
/* Include files, designed to support most kernel versions 2.0.0 and later. */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/crc32.h>
#include <asm/uaccess.h>
#include <asm/processor.h> /* Processor type for cache alignment. */
#include <asm/bitops.h>
#include <asm/io.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#ifndef __devexit_p
#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL
#endif
#endif
/* These identify the driver base version and may not be removed. */
static char version[] __devinitdata =
KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n"
KERN_INFO " http://www.scyld.com/network/sundance.html\n";
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Sundance Alta Ethernet driver");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(mtu, "i");
MODULE_PARM(debug, "i");
MODULE_PARM(rx_copybreak, "i");
MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "s");
MODULE_PARM_DESC(max_interrupt_work, "Sundance Alta maximum events handled per interrupt");
MODULE_PARM_DESC(mtu, "Sundance Alta MTU (all boards)");
MODULE_PARM_DESC(debug, "Sundance Alta debug level (0-5)");
MODULE_PARM_DESC(rx_copybreak, "Sundance Alta copy breakpoint for copy-only-tiny-frames");
/*
Theory of Operation
I. Board Compatibility
This driver is designed for the Sundance Technologies "Alta" ST201 chip.
II. Board-specific settings
III. Driver operation
IIIa. Ring buffers
This driver uses two statically allocated fixed-size descriptor lists
formed into rings by a branch from the final descriptor to the beginning of
the list. The ring sizes are set at compile time by RX/TX_RING_SIZE.
Some chips explicitly use only 2^N sized rings, while others use a
'next descriptor' pointer that the driver forms into rings.
IIIb/c. Transmit/Receive Structure
This driver uses a zero-copy receive and transmit scheme.
The driver allocates full frame size skbuffs for the Rx ring buffers at
open() time and passes the skb->data field to the chip as receive data
buffers. When an incoming frame is less than RX_COPYBREAK bytes long,
a fresh skbuff is allocated and the frame is copied to the new skbuff.
When the incoming frame is larger, the skbuff is passed directly up the
protocol stack. Buffers consumed this way are replaced by newly allocated
skbuffs in a later phase of receives.
The RX_COPYBREAK value is chosen to trade-off the memory wasted by
using a full-sized skbuff for small frames vs. the copying costs of larger
frames. New boards are typically used in generously configured machines
and the underfilled buffers have negligible impact compared to the benefit of
a single allocation size, so the default value of zero results in never
copying packets. When copying is done, the cost is usually mitigated by using
a combined copy/checksum routine. Copying also preloads the cache, which is
most useful with small frames.
A subtle aspect of the operation is that the IP header at offset 14 in an
ethernet frame isn't longword aligned for further processing.
Unaligned buffers are permitted by the Sundance hardware, so
frames are received into the skbuff at an offset of "+2", 16-byte aligning
the IP header.
IIId. Synchronization
The driver runs as two independent, single-threaded flows of control. One
is the send-packet routine, which enforces single-threaded use by the
dev->tbusy flag. The other thread is the interrupt handler, which is single
threaded by the hardware and interrupt handling software.
The send packet thread has partial control over the Tx ring and 'dev->tbusy'
flag. It sets the tbusy flag whenever it's queuing a Tx packet. If the next
queue slot is empty, it clears the tbusy flag when finished otherwise it sets
the 'lp->tx_full' flag.
The interrupt handler has exclusive control over the Rx ring and records stats
from the Tx ring. After reaping the stats, it marks the Tx queue entry as
empty by incrementing the dirty_tx mark. Iff the 'lp->tx_full' flag is set, it
clears both the tx_full and tbusy flags.
IV. Notes
IVb. References
The Sundance ST201 datasheet, preliminary version.
http://cesdis.gsfc.nasa.gov/linux/misc/100mbps.html
http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html
IVc. Errata
*/
\f
enum pci_id_flags_bits {
/* Set PCI command register bits before calling probe1(). */
PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
/* Read and map the single following PCI BAR. */
PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4,
PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400,
};
enum chip_capability_flags {CanHaveMII=1, };
#ifdef USE_IO_OPS
#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0)
#else
#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1)
#endif
static struct pci_device_id sundance_pci_tbl[] __devinitdata = {
{0x1186, 0x1002, 0x1186, 0x1002, 0, 0, 0},
{0x1186, 0x1002, 0x1186, 0x1003, 0, 0, 1},
{0x1186, 0x1002, 0x1186, 0x1012, 0, 0, 2},
{0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3},
{0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
{0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
{0,}
};
MODULE_DEVICE_TABLE(pci, sundance_pci_tbl);
struct pci_id_info {
const char *name;
struct match_info {
int pci, pci_mask, subsystem, subsystem_mask;
int revision, revision_mask; /* Only 8 bits. */
} id;
enum pci_id_flags_bits pci_flags;
int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
};
static struct pci_id_info pci_id_tbl[] = {
{"D-Link DFE-550TX FAST Ethernet Adapter", {0x10021186, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
{"D-Link DFE-550FX 100Mbps Fiber-optics Adapter",
{0x10031186, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
{"D-Link DFE-580TX 4 port Server Adapter", {0x10121186, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
{"D-Link DFE-530TXS FAST Ethernet Adapter", {0x10021186, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
{"D-Link DL10050-based FAST Ethernet Adapter",
{0x10021186, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
{"Sundance Technology Alta", {0x020113F0, 0xffffffff,},
PCI_IOTYPE, 128, CanHaveMII},
{0,}, /* 0 terminated list. */
};
/* This driver was written to use PCI memory space, however x86-oriented
hardware often uses I/O space accesses. */
#ifdef USE_IO_OPS
#undef readb
#undef readw
#undef readl
#undef writeb
#undef writew
#undef writel
#define readb inb
#define readw inw
#define readl inl
#define writeb outb
#define writew outw
#define writel outl
#endif
/* Offsets to the device registers.
Unlike software-only systems, device drivers interact with complex hardware.
It's not useful to define symbolic names for every register bit in the
device. The name can only partially document the semantics and make
the driver longer and more difficult to read.
In general, only the important configuration values or bits changed
multiple times should be defined symbolically.
*/
enum alta_offsets {
DMACtrl = 0x00,
TxListPtr = 0x04,
TxDMACtrl = 0x08,
TxDescPoll = 0x0a,
RxDMAStatus = 0x0c,
RxListPtr = 0x10,
RxDMACtrl = 0x14,
RxDescPoll = 0x16,
LEDCtrl = 0x1a,
ASICCtrl = 0x30,
EEData = 0x34,
EECtrl = 0x36,
TxThreshold = 0x3c,
FlashAddr = 0x40,
FlashData = 0x44,
TxStatus = 0x46,
DownCounter = 0x18,
IntrClear = 0x4a,
IntrEnable = 0x4c,
IntrStatus = 0x4e,
MACCtrl0 = 0x50,
MACCtrl1 = 0x52,
StationAddr = 0x54,
MaxTxSize = 0x5A,
RxMode = 0x5c,
MIICtrl = 0x5e,
MulticastFilter0 = 0x60,
MulticastFilter1 = 0x64,
RxOctetsLow = 0x68,
RxOctetsHigh = 0x6a,
TxOctetsLow = 0x6c,
TxOctetsHigh = 0x6e,
TxFramesOK = 0x70,
RxFramesOK = 0x72,
StatsCarrierError = 0x74,
StatsLateColl = 0x75,
StatsMultiColl = 0x76,
StatsOneColl = 0x77,
StatsTxDefer = 0x78,
RxMissed = 0x79,
StatsTxXSDefer = 0x7a,
StatsTxAbort = 0x7b,
StatsBcastTx = 0x7c,
StatsBcastRx = 0x7d,
StatsMcastTx = 0x7e,
StatsMcastRx = 0x7f,
/* Aliased and bogus values! */
RxStatus = 0x0c,
};
/* Bits in the interrupt status/mask registers. */
enum intr_status_bits {
IntrSummary=0x0001, IntrPCIErr=0x0002, IntrMACCtrl=0x0008,
IntrTxDone=0x0004, IntrRxDone=0x0010, IntrRxStart=0x0020,
IntrDrvRqst=0x0040,
StatsMax=0x0080, LinkChange=0x0100,
IntrTxDMADone=0x0200, IntrRxDMADone=0x0400,
};
/* Bits in the RxMode register. */
enum rx_mode_bits {
AcceptAllIPMulti=0x20, AcceptMultiHash=0x10, AcceptAll=0x08,
AcceptBroadcast=0x04, AcceptMulticast=0x02, AcceptMyPhys=0x01,
};
/* Bits in MACCtrl. */
enum mac_ctrl0_bits {
EnbFullDuplex=0x20, EnbRcvLargeFrame=0x40,
EnbFlowCtrl=0x100, EnbPassRxCRC=0x200,
};
enum mac_ctrl1_bits {
StatsEnable=0x0020, StatsDisable=0x0040, StatsEnabled=0x0080,
TxEnable=0x0100, TxDisable=0x0200, TxEnabled=0x0400,
RxEnable=0x0800, RxDisable=0x1000, RxEnabled=0x2000,
};
/* The Rx and Tx buffer descriptors. */
/* Note that using only 32 bit fields simplifies conversion to big-endian
architectures. */
struct netdev_desc {
u32 next_desc;
u32 status;
struct desc_frag { u32 addr, length; } frag[1];
};
/* Bits in netdev_desc.status */
enum desc_status_bits {
DescOwn=0x8000,
DescEndPacket=0x4000,
DescEndRing=0x2000,
LastFrag=0x80000000,
DescIntrOnTx=0x8000,
DescIntrOnDMADone=0x80000000,
DisableAlign = 0x00000001,
};
#define PRIV_ALIGN 15 /* Required alignment mask */
/* Use __attribute__((aligned (L1_CACHE_BYTES))) to maintain alignment
within the structure. */
#define MII_CNT 4
struct netdev_private {
/* Descriptor rings first for alignment. */
struct netdev_desc *rx_ring;
struct netdev_desc *tx_ring;
struct sk_buff* rx_skbuff[RX_RING_SIZE];
struct sk_buff* tx_skbuff[TX_RING_SIZE];
dma_addr_t tx_ring_dma;
dma_addr_t rx_ring_dma;
struct net_device_stats stats;
struct timer_list timer; /* Media monitoring timer. */
/* Frequently used values: keep some adjacent for cache effect. */
spinlock_t lock;
int chip_id, drv_flags;
unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */
unsigned int rx_buf_sz; /* Based on MTU+slack. */
spinlock_t txlock; /* Group with Tx control cache line. */
struct netdev_desc *last_tx; /* Last Tx descriptor used. */
unsigned int cur_tx, dirty_tx;
unsigned int tx_full:1; /* The Tx queue is full. */
/* These values are keep track of the transceiver/media in use. */
unsigned int full_duplex:1; /* Full-duplex operation requested. */
unsigned int medialock:1; /* Do not sense media. */
unsigned int default_port:4; /* Last dev->if_port value. */
unsigned int an_enable:1;
unsigned int speed;
/* Multicast and receive mode. */
spinlock_t mcastlock; /* SMP lock multicast updates. */
u16 mcast_filter[4];
/* MII transceiver section. */
int mii_cnt; /* MII device addresses. */
u16 advertising; /* NWay media advertisement */
unsigned char phys[MII_CNT]; /* MII device addresses, only first one used. */
struct pci_dev *pci_dev;
};
/* The station address location in the EEPROM. */
#define EEPROM_SA_OFFSET 0x10
static int eeprom_read(long ioaddr, int location);
static int mdio_read(struct net_device *dev, int phy_id, int location);
static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
static int netdev_open(struct net_device *dev);
static void check_duplex(struct net_device *dev);
static void netdev_timer(unsigned long data);
static void tx_timeout(struct net_device *dev);
static void init_ring(struct net_device *dev);
static int start_tx(struct sk_buff *skb, struct net_device *dev);
static void intr_handler(int irq, void *dev_instance, struct pt_regs *regs);
static void netdev_error(struct net_device *dev, int intr_status);
static int netdev_rx(struct net_device *dev);
static void netdev_error(struct net_device *dev, int intr_status);
static void set_rx_mode(struct net_device *dev);
static struct net_device_stats *get_stats(struct net_device *dev);
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int netdev_close(struct net_device *dev);
\f
static int __devinit sundance_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct net_device *dev;
struct netdev_private *np;
static int card_idx;
int chip_idx = ent->driver_data;
int irq;
int i;
long ioaddr;
u16 mii_ctl;
void *ring_space;
dma_addr_t ring_dma;
/* when built into the kernel, we only print version if device is found */
#ifndef MODULE
static int printed_version;
if (!printed_version++)
printk(version);
#endif
if (pci_enable_device(pdev))
return -EIO;
pci_set_master(pdev);
irq = pdev->irq;
dev = alloc_etherdev(sizeof(*np));
if (!dev)
return -ENOMEM;
SET_MODULE_OWNER(dev);
if (pci_request_regions(pdev, DRV_NAME))
goto err_out_netdev;
#ifdef USE_IO_OPS
ioaddr = pci_resource_start(pdev, 0);
#else
ioaddr = pci_resource_start(pdev, 1);
ioaddr = (long) ioremap (ioaddr, pci_id_tbl[chip_idx].io_size);
if (!ioaddr)
goto err_out_res;
#endif
for (i = 0; i < 3; i++)
((u16 *)dev->dev_addr)[i] =
le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
dev->base_addr = ioaddr;
dev->irq = irq;
np = dev->priv;
np->chip_id = chip_idx;
np->drv_flags = pci_id_tbl[chip_idx].drv_flags;
np->pci_dev = pdev;
spin_lock_init(&np->lock);
ring_space = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
if (!ring_space)
goto err_out_cleardev;
np->tx_ring = (struct netdev_desc *)ring_space;
np->tx_ring_dma = ring_dma;
ring_space = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
if (!ring_space)
goto err_out_unmap_tx;
np->rx_ring = (struct netdev_desc *)ring_space;
np->rx_ring_dma = ring_dma;
/* The chip-specific entries in the device structure. */
dev->open = &netdev_open;
dev->hard_start_xmit = &start_tx;
dev->stop = &netdev_close;
dev->get_stats = &get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &netdev_ioctl;
dev->tx_timeout = &tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
pci_set_drvdata(pdev, dev);
if (mtu)
dev->mtu = mtu;
i = register_netdev(dev);
if (i)
goto err_out_unmap_rx;
printk(KERN_INFO "%s: %s at 0x%lx, ",
dev->name, pci_id_tbl[chip_idx].name, ioaddr);
for (i = 0; i < 5; i++)
printk("%2.2x:", dev->dev_addr[i]);
printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq);
if (1) {
int phy, phy_idx = 0;
np->phys[0] = 1; /* Default setting */
for (phy = 0; phy < 32 && phy_idx < MII_CNT; phy++) {
int mii_status = mdio_read(dev, phy, 1);
if (mii_status != 0xffff && mii_status != 0x0000) {
np->phys[phy_idx++] = phy;
np->advertising = mdio_read(dev, phy, 4);
printk(KERN_INFO "%s: MII PHY found at address %d, status "
"0x%4.4x advertising %4.4x.\n",
dev->name, phy, mii_status, np->advertising);
}
}
np->mii_cnt = phy_idx;
if (phy_idx == 0)
printk(KERN_INFO "%s: No MII transceiver found!, ASIC status %x\n",
dev->name, readl(ioaddr + ASICCtrl));
}
/* Parse override configuration */
np->an_enable = 1;
if (card_idx < MAX_UNITS) {
if (media[card_idx] != NULL) {
np->an_enable = 0;
if (strcmp (media[card_idx], "100mbps_fd") == 0 ||
strcmp (media[card_idx], "4") == 0) {
np->speed = 100;
np->full_duplex = 1;
} else if (strcmp (media[card_idx], "100mbps_hd") == 0
|| strcmp (media[card_idx], "3") == 0) {
np->speed = 100;
np->full_duplex = 0;
} else if (strcmp (media[card_idx], "10mbps_fd") == 0 ||
strcmp (media[card_idx], "2") == 0) {
np->speed = 10;
np->full_duplex = 1;
} else if (strcmp (media[card_idx], "10mbps_hd") == 0 ||
strcmp (media[card_idx], "1") == 0) {
np->speed = 10;
np->full_duplex = 0;
} else {
np->an_enable = 1;
}
}
}
/* Fibre PHY? */
if (readl (ioaddr + ASICCtrl) & 0x80) {
/* Default 100Mbps Full */
if (np->an_enable) {
np->speed = 100;
np->full_duplex = 1;
np->an_enable = 0;
}
}
/* Reset PHY */
mdio_write (dev, np->phys[0], MII_BMCR, BMCR_RESET);
mdelay (300);
mdio_write (dev, np->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART);
/* Force media type */
if (!np->an_enable) {
mii_ctl = 0;
mii_ctl |= (np->speed == 100) ? BMCR_SPEED100 : 0;
mii_ctl |= (np->full_duplex) ? BMCR_FULLDPLX : 0;
mdio_write (dev, np->phys[0], MII_BMCR, mii_ctl);
printk (KERN_INFO "Override speed=%d, %s duplex\n",
np->speed, np->full_duplex ? "Full" : "Half");
}
/* Perhaps move the reset here? */
/* Reset the chip to erase previous misconfiguration. */
if (debug > 1)
printk("ASIC Control is %x.\n", readl(ioaddr + ASICCtrl));
writew(0x007f, ioaddr + ASICCtrl + 2);
if (debug > 1)
printk("ASIC Control is now %x.\n", readl(ioaddr + ASICCtrl));
card_idx++;
return 0;
err_out_unmap_rx:
pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring, np->rx_ring_dma);
err_out_unmap_tx:
pci_free_consistent(pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma);
err_out_cleardev:
pci_set_drvdata(pdev, NULL);
#ifndef USE_IO_OPS
iounmap((void *)ioaddr);
err_out_res:
#endif
pci_release_regions(pdev);
err_out_netdev:
kfree (dev);
return -ENODEV;
}
\f
/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. */
static int __devinit eeprom_read(long ioaddr, int location)
{
int boguscnt = 1000; /* Typical 190 ticks. */
writew(0x0200 | (location & 0xff), ioaddr + EECtrl);
do {
if (! (readw(ioaddr + EECtrl) & 0x8000)) {
return readw(ioaddr + EEData);
}
} while (--boguscnt > 0);
return 0;
}
/* MII transceiver control section.
Read and write the MII registers using software-generated serial
MDIO protocol. See the MII specifications or DP83840A data sheet
for details.
The maximum data clock rate is 2.5 Mhz. The minimum timing is usually
met by back-to-back 33Mhz PCI cycles. */
#define mdio_delay() readb(mdio_addr)
/* Set iff a MII transceiver on any interface requires mdio preamble.
This only set with older tranceivers, so the extra
code size of a per-interface flag is not worthwhile. */
static const char mii_preamble_required = 1;
enum mii_reg_bits {
MDIO_ShiftClk=0x0001, MDIO_Data=0x0002, MDIO_EnbOutput=0x0004,
};
#define MDIO_EnbIn (0)
#define MDIO_WRITE0 (MDIO_EnbOutput)
#define MDIO_WRITE1 (MDIO_Data | MDIO_EnbOutput)
/* Generate the preamble required for initial synchronization and
a few older transceivers. */
static void mdio_sync(long mdio_addr)
{
int bits = 32;
/* Establish sync by sending at least 32 logic ones. */
while (--bits >= 0) {
writeb(MDIO_WRITE1, mdio_addr);
mdio_delay();
writeb(MDIO_WRITE1 | MDIO_ShiftClk, mdio_addr);
mdio_delay();
}
}
static int mdio_read(struct net_device *dev, int phy_id, int location)
{
long mdio_addr = dev->base_addr + MIICtrl;
int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location;
int i, retval = 0;
if (mii_preamble_required)
mdio_sync(mdio_addr);
/* Shift the read command bits out. */
for (i = 15; i >= 0; i--) {
int dataval = (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0;
writeb(dataval, mdio_addr);
mdio_delay();
writeb(dataval | MDIO_ShiftClk, mdio_addr);
mdio_delay();
}
/* Read the two transition, 16 data, and wire-idle bits. */
for (i = 19; i > 0; i--) {
writeb(MDIO_EnbIn, mdio_addr);
mdio_delay();
retval = (retval << 1) | ((readb(mdio_addr) & MDIO_Data) ? 1 : 0);
writeb(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr);
mdio_delay();
}
return (retval>>1) & 0xffff;
}
static void mdio_write(struct net_device *dev, int phy_id, int location, int value)
{
long mdio_addr = dev->base_addr + MIICtrl;
int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value;
int i;
if (mii_preamble_required)
mdio_sync(mdio_addr);
/* Shift the command bits out. */
for (i = 31; i >= 0; i--) {
int dataval = (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0;
writeb(dataval, mdio_addr);
mdio_delay();
writeb(dataval | MDIO_ShiftClk, mdio_addr);
mdio_delay();
}
/* Clear out extra bits. */
for (i = 2; i > 0; i--) {
writeb(MDIO_EnbIn, mdio_addr);
mdio_delay();
writeb(MDIO_EnbIn | MDIO_ShiftClk, mdio_addr);
mdio_delay();
}
return;
}
\f
static int netdev_open(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
long ioaddr = dev->base_addr;
int i;
/* Do we need to reset the chip??? */
i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev);
if (i)
return i;
if (debug > 1)
printk(KERN_DEBUG "%s: netdev_open() irq %d.\n",
dev->name, dev->irq);
init_ring(dev);
writel(np->rx_ring_dma, ioaddr + RxListPtr);
/* The Tx list pointer is written as packets are queued. */
for (i = 0; i < 6; i++)
writeb(dev->dev_addr[i], ioaddr + StationAddr + i);
/* Initialize other registers. */
/* Configure the PCI bus bursts and FIFO thresholds. */
if (dev->if_port == 0)
dev->if_port = np->default_port;
np->mcastlock = (spinlock_t) SPIN_LOCK_UNLOCKED;
set_rx_mode(dev);
writew(0, ioaddr + IntrEnable);
writew(0, ioaddr + DownCounter);
/* Set the chip to poll every N*320nsec. */
writeb(100, ioaddr + RxDescPoll);
writeb(127, ioaddr + TxDescPoll);
netif_start_queue(dev);
/* Enable interrupts by setting the interrupt mask. */
writew(IntrRxDone | IntrRxDMADone | IntrPCIErr | IntrDrvRqst | IntrTxDone
| StatsMax | LinkChange, ioaddr + IntrEnable);
writew(StatsEnable | RxEnable | TxEnable, ioaddr + MACCtrl1);
if (debug > 2)
printk(KERN_DEBUG "%s: Done netdev_open(), status: Rx %x Tx %x "
"MAC Control %x, %4.4x %4.4x.\n",
dev->name, readl(ioaddr + RxStatus), readb(ioaddr + TxStatus),
readl(ioaddr + MACCtrl0),
readw(ioaddr + MACCtrl1), readw(ioaddr + MACCtrl0));
/* Set the timer to check for link beat. */
init_timer(&np->timer);
np->timer.expires = jiffies + 3*HZ;
np->timer.data = (unsigned long)dev;
np->timer.function = &netdev_timer; /* timer handler */
add_timer(&np->timer);
return 0;
}
static void check_duplex(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
long ioaddr = dev->base_addr;
int mii_lpa = mdio_read(dev, np->phys[0], MII_LPA);
int negotiated = mii_lpa & np->advertising;
int duplex;
/* Force media */
if (!np->an_enable || mii_lpa == 0xffff) {
if (np->full_duplex)
writew (readw (ioaddr + MACCtrl0) | EnbFullDuplex,
ioaddr + MACCtrl0);
return;
}
/* Autonegotiation */
duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040;
if (np->full_duplex != duplex) {
np->full_duplex = duplex;
if (debug)
printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d "
"negotiated capability %4.4x.\n", dev->name,
duplex ? "full" : "half", np->phys[0], negotiated);
writew(duplex ? 0x20 : 0, ioaddr + MACCtrl0);
}
}
static void netdev_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv;
long ioaddr = dev->base_addr;
int next_tick = 10*HZ;
if (debug > 3) {
printk(KERN_DEBUG "%s: Media selection timer tick, intr status %4.4x, "
"Tx %x Rx %x.\n",
dev->name, readw(ioaddr + IntrEnable),
readb(ioaddr + TxStatus), readl(ioaddr + RxStatus));
}
check_duplex(dev);
np->timer.expires = jiffies + next_tick;
add_timer(&np->timer);
}
static void tx_timeout(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
long ioaddr = dev->base_addr;
printk(KERN_WARNING "%s: Transmit timed out, status %2.2x,"
" resetting...\n", dev->name, readb(ioaddr + TxStatus));
{
int i;
printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring);
for (i = 0; i < RX_RING_SIZE; i++)
printk(" %8.8x", (unsigned int)np->rx_ring[i].status);
printk("\n"KERN_DEBUG" Tx ring %p: ", np->tx_ring);
for (i = 0; i < TX_RING_SIZE; i++)
printk(" %4.4x", np->tx_ring[i].status);
printk("\n");
}
/* Perhaps we should reinitialize the hardware here. */
dev->if_port = 0;
/* Stop and restart the chip's Tx processes . */
/* Trigger an immediate transmit demand. */
writew(IntrRxDone | IntrRxDMADone | IntrPCIErr | IntrDrvRqst | IntrTxDone
| StatsMax | LinkChange, ioaddr + IntrEnable);
dev->trans_start = jiffies;
np->stats.tx_errors++;
if (!np->tx_full)
netif_wake_queue(dev);
}
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void init_ring(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
int i;
np->tx_full = 0;
np->cur_rx = np->cur_tx = 0;
np->dirty_rx = np->dirty_tx = 0;
np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
/* Initialize all Rx descriptors. */
for (i = 0; i < RX_RING_SIZE; i++) {
np->rx_ring[i].next_desc = cpu_to_le32(np->rx_ring_dma +
((i+1)%RX_RING_SIZE)*sizeof(*np->rx_ring));
np->rx_ring[i].status = 0;
np->rx_ring[i].frag[0].length = 0;
np->rx_skbuff[i] = 0;
}
/* Fill in the Rx buffers. Handle allocation failure gracefully. */
for (i = 0; i < RX_RING_SIZE; i++) {
struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz);
np->rx_skbuff[i] = skb;
if (skb == NULL)
break;
skb->dev = dev; /* Mark as being used by this device. */
skb_reserve(skb, 2); /* 16 byte align the IP header. */
np->rx_ring[i].frag[0].addr = cpu_to_le32(
pci_map_single(np->pci_dev, skb->tail, np->rx_buf_sz,
PCI_DMA_FROMDEVICE));
np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag);
}
np->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
for (i = 0; i < TX_RING_SIZE; i++) {
np->tx_skbuff[i] = 0;
np->tx_ring[i].status = 0;
}
return;
}
static int start_tx(struct sk_buff *skb, struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_desc *txdesc;
unsigned entry;
/* Note: Ordering is important here, set the field with the
"ownership" bit last, and only then increment cur_tx. */
/* Calculate the next Tx descriptor entry. */
entry = np->cur_tx % TX_RING_SIZE;
np->tx_skbuff[entry] = skb;
txdesc = &np->tx_ring[entry];
txdesc->next_desc = 0;
/* Note: disable the interrupt generation here before releasing. */
txdesc->status =
cpu_to_le32((entry<<2) | DescIntrOnDMADone | DescIntrOnTx | DisableAlign);
txdesc->frag[0].addr = cpu_to_le32(pci_map_single(np->pci_dev,
skb->data, skb->len, PCI_DMA_TODEVICE));
txdesc->frag[0].length = cpu_to_le32(skb->len | LastFrag);
if (np->last_tx)
np->last_tx->next_desc = cpu_to_le32(np->tx_ring_dma +
entry*sizeof(struct netdev_desc));
np->last_tx = txdesc;
np->cur_tx++;
/* On some architectures: explicitly flush cache lines here. */
if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 1) {
/* do nothing */
} else {
np->tx_full = 1;
netif_stop_queue(dev);
}
/* Side effect: The read wakes the potentially-idle transmit channel. */
if (readl(dev->base_addr + TxListPtr) == 0)
writel(np->tx_ring_dma + entry*sizeof(*np->tx_ring),
dev->base_addr + TxListPtr);
dev->trans_start = jiffies;
if (debug > 4) {
printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
dev->name, np->cur_tx, entry);
}
return 0;
}
/* The interrupt handler does all of the Rx thread work and cleans up
after the Tx thread. */
static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
{
struct net_device *dev = (struct net_device *)dev_instance;
struct netdev_private *np;
long ioaddr;
int boguscnt = max_interrupt_work;
ioaddr = dev->base_addr;
np = dev->priv;
spin_lock(&np->lock);
do {
int intr_status = readw(ioaddr + IntrStatus);
writew(intr_status & (IntrRxDone | IntrRxDMADone | IntrPCIErr |
IntrDrvRqst | IntrTxDone | IntrTxDMADone | StatsMax |
LinkChange), ioaddr + IntrStatus);
if (debug > 4)
printk(KERN_DEBUG "%s: Interrupt, status %4.4x.\n",
dev->name, intr_status);
if (intr_status == 0)
break;
if (intr_status & (IntrRxDone|IntrRxDMADone))
netdev_rx(dev);
if (intr_status & IntrTxDone) {
int boguscnt = 32;
int tx_status = readw(ioaddr + TxStatus);
while (tx_status & 0x80) {
if (debug > 4)
printk("%s: Transmit status is %2.2x.\n",
dev->name, tx_status);
if (tx_status & 0x1e) {
np->stats.tx_errors++;
if (tx_status & 0x10) np->stats.tx_fifo_errors++;
#ifdef ETHER_STATS
if (tx_status & 0x08) np->stats.collisions16++;
#else
if (tx_status & 0x08) np->stats.collisions++;
#endif
if (tx_status & 0x04) np->stats.tx_fifo_errors++;
if (tx_status & 0x02) np->stats.tx_window_errors++;
/* This reset has not been verified!. */
if (tx_status & 0x10) { /* Reset the Tx. */
writew(0x001c, ioaddr + ASICCtrl + 2);
#if 0 /* Do we need to reset the Tx pointer here? */
writel(np->tx_ring_dma
+ np->dirty_tx*sizeof(*np->tx_ring),
dev->base_addr + TxListPtr);
#endif
}
if (tx_status & 0x1e) /* Restart the Tx. */
writew(TxEnable, ioaddr + MACCtrl1);
}
/* Yup, this is a documentation bug. It cost me *hours*. */
writew(0, ioaddr + TxStatus);
tx_status = readb(ioaddr + TxStatus);
if (--boguscnt < 0)
break;
}
}
for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) {
int entry = np->dirty_tx % TX_RING_SIZE;
struct sk_buff *skb;
if ( ! (np->tx_ring[entry].status & 0x00010000))
break;
skb = np->tx_skbuff[entry];
/* Free the original skb. */
pci_unmap_single(np->pci_dev,
np->tx_ring[entry].frag[0].addr,
skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb_irq(skb);
np->tx_skbuff[entry] = 0;
}
if (np->tx_full
&& np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
/* The ring is no longer full, clear tbusy. */
np->tx_full = 0;
netif_wake_queue(dev);
}
/* Abnormal error summary/uncommon events handlers. */
if (intr_status & (IntrDrvRqst | IntrPCIErr | LinkChange | StatsMax))
netdev_error(dev, intr_status);
if (--boguscnt < 0) {
get_stats(dev);
if (debug > 1)
printk(KERN_WARNING "%s: Too much work at interrupt, "
"status=0x%4.4x / 0x%4.4x.\n",
dev->name, intr_status, readw(ioaddr + IntrClear));
#if 0
/* Re-enable us in 3.2msec. */
writew(0, ioaddr + IntrEnable);
writew(1000, ioaddr + DownCounter);
writew(IntrDrvRqst, ioaddr + IntrEnable);
#endif
break;
}
} while (1);
if (debug > 3)
printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
dev->name, readw(ioaddr + IntrStatus));
spin_unlock(&np->lock);
}
/* This routine is logically part of the interrupt handler, but separated
for clarity and better register allocation. */
static int netdev_rx(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
int entry = np->cur_rx % RX_RING_SIZE;
int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
if (debug > 4) {
printk(KERN_DEBUG " In netdev_rx(), entry %d status %4.4x.\n",
entry, np->rx_ring[entry].status);
}
/* If EOP is set on the next entry, it's a new packet. Send it up. */
while (1) {
struct netdev_desc *desc = &(np->rx_ring[entry]);
u32 frame_status;
int pkt_len;
if (!(desc->status & DescOwn))
break;
frame_status = le32_to_cpu(desc->status);
pkt_len = frame_status & 0x1fff; /* Chip omits the CRC. */
if (debug > 4)
printk(KERN_DEBUG " netdev_rx() status was %8.8x.\n",
frame_status);
if (--boguscnt < 0)
break;
pci_dma_sync_single(np->pci_dev, desc->frag[0].addr,
np->rx_buf_sz, PCI_DMA_FROMDEVICE);
if (frame_status & 0x001f4000) {
/* There was a error. */
if (debug > 2)
printk(KERN_DEBUG " netdev_rx() Rx error was %8.8x.\n",
frame_status);
np->stats.rx_errors++;
if (frame_status & 0x00100000) np->stats.rx_length_errors++;
if (frame_status & 0x00010000) np->stats.rx_fifo_errors++;
if (frame_status & 0x00060000) np->stats.rx_frame_errors++;
if (frame_status & 0x00080000) np->stats.rx_crc_errors++;
if (frame_status & 0x00100000) {
printk(KERN_WARNING "%s: Oversized Ethernet frame,"
" status %8.8x.\n",
dev->name, frame_status);
}
} else {
struct sk_buff *skb;
#ifndef final_version
if (debug > 4)
printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d"
", bogus_cnt %d.\n",
pkt_len, boguscnt);
#endif
/* Check if the packet is long enough to accept without copying
to a minimally-sized skbuff. */
if (pkt_len < rx_copybreak
&& (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
skb->dev = dev;
skb_reserve(skb, 2); /* 16 byte align the IP header */
eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0);
skb_put(skb, pkt_len);
} else {
pci_unmap_single(np->pci_dev,
desc->frag[0].addr,
np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
skb_put(skb = np->rx_skbuff[entry], pkt_len);
np->rx_skbuff[entry] = NULL;
}
skb->protocol = eth_type_trans(skb, dev);
/* Note: checksum -> skb->ip_summed = CHECKSUM_UNNECESSARY; */
netif_rx(skb);
dev->last_rx = jiffies;
}
entry = (++np->cur_rx) % RX_RING_SIZE;
}
/* Refill the Rx ring buffers. */
for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) {
struct sk_buff *skb;
entry = np->dirty_rx % RX_RING_SIZE;
if (np->rx_skbuff[entry] == NULL) {
skb = dev_alloc_skb(np->rx_buf_sz);
np->rx_skbuff[entry] = skb;
if (skb == NULL)
break; /* Better luck next round. */
skb->dev = dev; /* Mark as being used by this device. */
skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
np->rx_ring[entry].frag[0].addr = cpu_to_le32(
pci_map_single(np->pci_dev, skb->tail,
np->rx_buf_sz, PCI_DMA_FROMDEVICE));
}
/* Perhaps we need not reset this field. */
np->rx_ring[entry].frag[0].length =
cpu_to_le32(np->rx_buf_sz | LastFrag);
np->rx_ring[entry].status = 0;
}
/* No need to restart Rx engine, it will poll. */
return 0;
}
static void netdev_error(struct net_device *dev, int intr_status)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
u16 mii_ctl, mii_advertise, mii_lpa;
int speed;
if (intr_status & IntrDrvRqst) {
/* Stop the down counter and turn interrupts back on. */
if (debug > 1)
printk("%s: Turning interrupts back on.\n", dev->name);
writew(0, ioaddr + IntrEnable);
writew(0, ioaddr + DownCounter);
writew(IntrRxDone | IntrRxDMADone | IntrPCIErr | IntrDrvRqst |
IntrTxDone | StatsMax | LinkChange, ioaddr + IntrEnable);
/* Ack buggy InRequest */
writew (IntrDrvRqst, ioaddr + IntrStatus);
}
if (intr_status & LinkChange) {
if (np->an_enable) {
mii_advertise = mdio_read (dev, np->phys[0], MII_ADVERTISE);
mii_lpa= mdio_read (dev, np->phys[0], MII_LPA);
mii_advertise &= mii_lpa;
printk (KERN_INFO "%s: Link changed: ", dev->name);
if (mii_advertise & ADVERTISE_100FULL)
printk ("100Mbps, full duplex\n");
else if (mii_advertise & ADVERTISE_100HALF)
printk ("100Mbps, half duplex\n");
else if (mii_advertise & ADVERTISE_10FULL)
printk ("10Mbps, full duplex\n");
else if (mii_advertise & ADVERTISE_10HALF)
printk ("10Mbps, half duplex\n");
else
printk ("\n");
} else {
mii_ctl = mdio_read (dev, np->phys[0], MII_BMCR);
speed = (mii_ctl & BMCR_SPEED100) ? 100 : 10;
printk (KERN_INFO "%s: Link changed: %dMbps ,",
dev->name, speed);
printk ("%s duplex.\n", (mii_ctl & BMCR_FULLDPLX) ?
"full" : "half");
}
check_duplex (dev);
}
if (intr_status & StatsMax) {
get_stats(dev);
}
if (intr_status & IntrPCIErr) {
printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n",
dev->name, intr_status);
/* We must do a global reset of DMA to continue. */
}
}
static struct net_device_stats *get_stats(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
int i;
/* We should lock this segment of code for SMP eventually, although
the vulnerability window is very small and statistics are
non-critical. */
/* The chip only need report frame silently dropped. */
np->stats.rx_missed_errors += readb(ioaddr + RxMissed);
np->stats.tx_packets += readw(ioaddr + TxFramesOK);
np->stats.rx_packets += readw(ioaddr + RxFramesOK);
np->stats.collisions += readb(ioaddr + StatsLateColl);
np->stats.collisions += readb(ioaddr + StatsMultiColl);
np->stats.collisions += readb(ioaddr + StatsOneColl);
readb(ioaddr + StatsCarrierError);
readb(ioaddr + StatsTxDefer);
for (i = StatsTxDefer; i <= StatsMcastRx; i++)
readb(ioaddr + i);
np->stats.tx_bytes += readw(ioaddr + TxOctetsLow);
np->stats.tx_bytes += readw(ioaddr + TxOctetsHigh) << 16;
np->stats.rx_bytes += readw(ioaddr + RxOctetsLow);
np->stats.rx_bytes += readw(ioaddr + RxOctetsHigh) << 16;
return &np->stats;
}
static unsigned const ethernet_polynomial_le = 0xedb88320U;
static inline unsigned ether_crc_le(int length, unsigned char *data)
{
unsigned int crc = 0xffffffff; /* Initial value. */
while(--length >= 0) {
unsigned char current_octet = *data++;
int bit;
for (bit = 8; --bit >= 0; current_octet >>= 1) {
if ((crc ^ current_octet) & 1) {
crc >>= 1;
crc ^= ethernet_polynomial_le;
} else
crc >>= 1;
}
}
return crc;
}
static void set_rx_mode(struct net_device *dev)
{
long ioaddr = dev->base_addr;
u16 mc_filter[4]; /* Multicast hash filter */
u32 rx_mode;
int i;
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
/* Unconditionally log net taps. */
printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
memset(mc_filter, 0xff, sizeof(mc_filter));
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptAll | AcceptMyPhys;
} else if ((dev->mc_count > multicast_filter_limit)
|| (dev->flags & IFF_ALLMULTI)) {
/* Too many to match, or accept all multicasts. */
memset(mc_filter, 0xff, sizeof(mc_filter));
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
} else if (dev->mc_count) {
struct dev_mc_list *mclist;
int bit;
int index;
int crc;
memset (mc_filter, 0, sizeof (mc_filter));
for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
i++, mclist = mclist->next) {
crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr);
for (index=0, bit=0; bit < 6; bit++, crc <<= 1)
if (crc & 0x80000000) index |= 1 << bit;
mc_filter[index/16] |= (1 << (index % 16));
}
rx_mode = AcceptBroadcast | AcceptMultiHash | AcceptMyPhys;
} else {
writeb(AcceptBroadcast | AcceptMyPhys, ioaddr + RxMode);
return;
}
for (i = 0; i < 4; i++)
writew(mc_filter[i], ioaddr + MulticastFilter0 + i*2);
writeb(rx_mode, ioaddr + RxMode);
}
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
{
struct netdev_private *np = dev->priv;
u32 ethcmd;
if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
return -EFAULT;
switch (ethcmd) {
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strcpy(info.driver, DRV_NAME);
strcpy(info.version, DRV_VERSION);
strcpy(info.bus_info, np->pci_dev->slot_name);
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;
}
}
return -EOPNOTSUPP;
}
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
switch(cmd) {
case SIOCETHTOOL:
return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
case SIOCGMIIPHY: /* Get address of MII PHY in use. */
case SIOCDEVPRIVATE: /* for binary compat, remove in 2.5 */
data->phy_id = ((struct netdev_private *)dev->priv)->phys[0] & 0x1f;
/* Fall Through */
case SIOCGMIIREG: /* Read MII PHY register. */
case SIOCDEVPRIVATE+1: /* for binary compat, remove in 2.5 */
data->val_out = mdio_read(dev, data->phy_id & 0x1f, data->reg_num & 0x1f);
return 0;
case SIOCSMIIREG: /* Write MII PHY register. */
case SIOCDEVPRIVATE+2: /* for binary compat, remove in 2.5 */
if (!capable(CAP_NET_ADMIN))
return -EPERM;
mdio_write(dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
return 0;
default:
return -EOPNOTSUPP;
}
}
static int netdev_close(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
struct sk_buff *skb;
int i;
netif_stop_queue(dev);
if (debug > 1) {
printk(KERN_DEBUG "%s: Shutting down ethercard, status was Tx %2.2x "
"Rx %4.4x Int %2.2x.\n",
dev->name, readb(ioaddr + TxStatus),
readl(ioaddr + RxStatus), readw(ioaddr + IntrStatus));
printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n",
dev->name, np->cur_tx, np->dirty_tx, np->cur_rx, np->dirty_rx);
}
/* Disable interrupts by clearing the interrupt mask. */
writew(0x0000, ioaddr + IntrEnable);
/* Stop the chip's Tx and Rx processes. */
writew(TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl1);
#ifdef __i386__
if (debug > 2) {
printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n",
(int)(np->tx_ring_dma));
for (i = 0; i < TX_RING_SIZE; i++)
printk(" #%d desc. %4.4x %8.8x %8.8x.\n",
i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr,
np->tx_ring[i].frag[0].length);
printk("\n"KERN_DEBUG " Rx ring %8.8x:\n",
(int)(np->rx_ring_dma));
for (i = 0; i < /*RX_RING_SIZE*/4 ; i++) {
printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n",
i, np->rx_ring[i].status, np->rx_ring[i].frag[0].addr,
np->rx_ring[i].frag[0].length);
}
}
#endif /* __i386__ debugging only */
free_irq(dev->irq, dev);
del_timer_sync(&np->timer);
/* Free all the skbuffs in the Rx queue. */
for (i = 0; i < RX_RING_SIZE; i++) {
np->rx_ring[i].status = 0;
np->rx_ring[i].frag[0].addr = 0xBADF00D0; /* An invalid address. */
skb = np->rx_skbuff[i];
if (skb) {
pci_unmap_single(np->pci_dev,
np->rx_ring[i].frag[0].addr, np->rx_buf_sz,
PCI_DMA_FROMDEVICE);
dev_kfree_skb(skb);
np->rx_skbuff[i] = 0;
}
}
for (i = 0; i < TX_RING_SIZE; i++) {
skb = np->tx_skbuff[i];
if (skb) {
pci_unmap_single(np->pci_dev,
np->tx_ring[i].frag[0].addr, skb->len,
PCI_DMA_TODEVICE);
dev_kfree_skb(skb);
np->tx_skbuff[i] = 0;
}
}
return 0;
}
static void __devexit sundance_remove1 (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
/* No need to check MOD_IN_USE, as sys_delete_module() checks. */
if (dev) {
struct netdev_private *np = dev->priv;
unregister_netdev(dev);
pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring,
np->rx_ring_dma);
pci_free_consistent(pdev, TX_TOTAL_SIZE, np->tx_ring,
np->tx_ring_dma);
pci_release_regions(pdev);
#ifndef USE_IO_OPS
iounmap((char *)(dev->base_addr));
#endif
kfree(dev);
pci_set_drvdata(pdev, NULL);
}
}
static struct pci_driver sundance_driver = {
name: DRV_NAME,
id_table: sundance_pci_tbl,
probe: sundance_probe1,
remove: __devexit_p(sundance_remove1),
};
static int __init sundance_init(void)
{
/* when a module, this is printed whether or not devices are found in probe */
#ifdef MODULE
printk(version);
#endif
return pci_module_init(&sundance_driver);
}
static void __exit sundance_exit(void)
{
pci_unregister_driver(&sundance_driver);
}
module_init(sundance_init);
module_exit(sundance_exit);
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-13 14:57 ` Matthew Hall
2002-06-13 15:34 ` Ben Greear
2002-06-13 16:12 ` Donald Becker
@ 2002-06-21 5:27 ` Jeff Garzik
2002-06-21 12:17 ` Matthew Hall
2 siblings, 1 reply; 12+ messages in thread
From: Jeff Garzik @ 2002-06-21 5:27 UTC (permalink / raw)
To: Matthew Hall; +Cc: Donald Becker, Kernel
[-- Attachment #1: Type: text/plain, Size: 124 bytes --]
Matthew,
This patch just arrived from D-Link. It includes fixes specifically for
DFX-580TX. Does this fix your problem?
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 16739 bytes --]
--- /tmp/sundance.c Fri Jun 21 00:48:54 2002
+++ sundance.c Fri Jun 21 17:57:27 2002
@@ -24,19 +24,23 @@
Version 1.02 (D-Link):
- Add new board to PCI ID list
- Fix multicast bug
+
+ Version 1.03 (D-Link):
+ - New Rx scheme, reduce Rx congestion
+ - Option to disable flow control
*/
#define DRV_NAME "sundance"
-#define DRV_VERSION "1.02"
-#define DRV_RELDATE "17-Jan-2002"
+#define DRV_VERSION "1.03"
+#define DRV_RELDATE "21-Jun-2002"
/* The user-configurable values.
These may be modified when a driver module is loaded.*/
static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
-static int max_interrupt_work = 30;
+static int max_interrupt_work = 0;
static int mtu;
/* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
Typical is a 64 element hash table based on the Ethernet CRC. */
@@ -47,6 +51,8 @@
This chip can receive into offset buffers, so the Alpha does not
need a copy-align. */
static int rx_copybreak;
+static int tx_coalesce=1;
+static int flowctrl=1;
/* media[] specifies the media type the NIC operates at.
autosense Autosensing active media.
@@ -70,9 +76,10 @@
bonding and packet priority, and more than 128 requires modifying the
Tx error recovery.
Large receive rings merely waste memory. */
-#define TX_RING_SIZE 16
-#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */
-#define RX_RING_SIZE 32
+#define TX_RING_SIZE 64
+#define TX_QUEUE_LEN (TX_RING_SIZE - 1) /* Limit ring entries actually used. */
+#define RX_RING_SIZE 64
+#define RX_BUDGET 32
#define TX_TOTAL_SIZE TX_RING_SIZE*sizeof(struct netdev_desc)
#define RX_TOTAL_SIZE RX_RING_SIZE*sizeof(struct netdev_desc)
@@ -129,10 +136,12 @@
MODULE_PARM(debug, "i");
MODULE_PARM(rx_copybreak, "i");
MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "s");
+MODULE_PARM(flowctrl, "i");
MODULE_PARM_DESC(max_interrupt_work, "Sundance Alta maximum events handled per interrupt");
MODULE_PARM_DESC(mtu, "Sundance Alta MTU (all boards)");
MODULE_PARM_DESC(debug, "Sundance Alta debug level (0-5)");
MODULE_PARM_DESC(rx_copybreak, "Sundance Alta copy breakpoint for copy-only-tiny-frames");
+MODULE_PARM_DESC(flowctrl, "Sundance Alta flow control [0|1]");
/*
Theory of Operation
@@ -207,7 +216,6 @@
*/
-\f
enum pci_id_flags_bits {
/* Set PCI command register bits before calling probe1(). */
@@ -399,19 +407,20 @@
struct timer_list timer; /* Media monitoring timer. */
/* Frequently used values: keep some adjacent for cache effect. */
spinlock_t lock;
+ spinlock_t rx_lock; /* Group with Tx control cache line. */
int chip_id, drv_flags;
unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */
unsigned int rx_buf_sz; /* Based on MTU+slack. */
- spinlock_t txlock; /* Group with Tx control cache line. */
struct netdev_desc *last_tx; /* Last Tx descriptor used. */
unsigned int cur_tx, dirty_tx;
- unsigned int tx_full:1; /* The Tx queue is full. */
/* These values are keep track of the transceiver/media in use. */
unsigned int full_duplex:1; /* Full-duplex operation requested. */
- unsigned int medialock:1; /* Do not sense media. */
+ unsigned int flowctrl:1;
unsigned int default_port:4; /* Last dev->if_port value. */
unsigned int an_enable:1;
unsigned int speed;
+ struct tasklet_struct rx_tasklet;
+ int budget;
/* Multicast and receive mode. */
spinlock_t mcastlock; /* SMP lock multicast updates. */
u16 mcast_filter[4];
@@ -424,6 +433,9 @@
/* The station address location in the EEPROM. */
#define EEPROM_SA_OFFSET 0x10
+#define DEFAULT_INTR (IntrRxDMADone | IntrPCIErr | \
+ IntrDrvRqst | IntrTxDone | StatsMax | \
+ LinkChange)
static int eeprom_read(long ioaddr, int location);
static int mdio_read(struct net_device *dev, int phy_id, int location);
@@ -435,8 +447,9 @@
static void init_ring(struct net_device *dev);
static int start_tx(struct sk_buff *skb, struct net_device *dev);
static void intr_handler(int irq, void *dev_instance, struct pt_regs *regs);
+static void rx_poll(unsigned long data);
+static void refill_rx (struct net_device *dev);
static void netdev_error(struct net_device *dev, int intr_status);
-static int netdev_rx(struct net_device *dev);
static void netdev_error(struct net_device *dev, int intr_status);
static void set_rx_mode(struct net_device *dev);
static struct net_device_stats *get_stats(struct net_device *dev);
@@ -502,6 +515,7 @@
np->drv_flags = pci_id_tbl[chip_idx].drv_flags;
np->pci_dev = pdev;
spin_lock_init(&np->lock);
+ tasklet_init(&np->rx_tasklet, rx_poll, (unsigned long)dev);
ring_space = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
if (!ring_space)
@@ -582,6 +596,12 @@
np->an_enable = 1;
}
}
+ if (tx_coalesce < 1)
+ tx_coalesce = 1;
+ else if (tx_coalesce > TX_QUEUE_LEN - 1)
+ tx_coalesce = TX_QUEUE_LEN - 1;
+ if (flowctrl == 0)
+ np->flowctrl = 0;
}
/* Fibre PHY? */
@@ -742,7 +762,6 @@
return;
}
-\f
static int netdev_open(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
@@ -784,8 +803,7 @@
netif_start_queue(dev);
/* Enable interrupts by setting the interrupt mask. */
- writew(IntrRxDone | IntrRxDMADone | IntrPCIErr | IntrDrvRqst | IntrTxDone
- | StatsMax | LinkChange, ioaddr + IntrEnable);
+ writew(DEFAULT_INTR, ioaddr + IntrEnable);
writew(StatsEnable | RxEnable | TxEnable, ioaddr + MACCtrl1);
@@ -881,7 +899,7 @@
dev->trans_start = jiffies;
np->stats.tx_errors++;
- if (!np->tx_full)
+ if (!netif_queue_stopped(dev))
netif_wake_queue(dev);
}
@@ -892,7 +910,6 @@
struct netdev_private *np = dev->priv;
int i;
- np->tx_full = 0;
np->cur_rx = np->cur_tx = 0;
np->dirty_rx = np->dirty_tx = 0;
@@ -929,15 +946,16 @@
return;
}
-static int start_tx(struct sk_buff *skb, struct net_device *dev)
+static int
+start_tx (struct sk_buff *skb, struct net_device *dev)
{
- struct netdev_private *np = dev->priv;
+ struct netdev_private *np = (struct netdev_private *) dev->priv;
struct netdev_desc *txdesc;
unsigned entry;
+ long ioaddr = dev->base_addr;
/* Note: Ordering is important here, set the field with the
"ownership" bit last, and only then increment cur_tx. */
-
/* Calculate the next Tx descriptor entry. */
entry = np->cur_tx % TX_RING_SIZE;
np->tx_skbuff[entry] = skb;
@@ -945,11 +963,17 @@
txdesc->next_desc = 0;
/* Note: disable the interrupt generation here before releasing. */
- txdesc->status =
- cpu_to_le32((entry<<2) | DescIntrOnDMADone | DescIntrOnTx | DisableAlign);
- txdesc->frag[0].addr = cpu_to_le32(pci_map_single(np->pci_dev,
- skb->data, skb->len, PCI_DMA_TODEVICE));
- txdesc->frag[0].length = cpu_to_le32(skb->len | LastFrag);
+ if (entry % tx_coalesce == 0) {
+ txdesc->status = cpu_to_le32 ((entry << 2) |
+ DescIntrOnTx | DisableAlign);
+
+ } else {
+ txdesc->status = cpu_to_le32 ((entry << 2) | DisableAlign);
+ }
+ txdesc->frag[0].addr = cpu_to_le32 (pci_map_single (np->pci_dev, skb->data,
+ skb->len,
+ PCI_DMA_TODEVICE));
+ txdesc->frag[0].length = cpu_to_le32 (skb->len | LastFrag);
if (np->last_tx)
np->last_tx->next_desc = cpu_to_le32(np->tx_ring_dma +
entry*sizeof(struct netdev_desc));
@@ -957,24 +981,26 @@
np->cur_tx++;
/* On some architectures: explicitly flush cache lines here. */
-
- if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 1) {
+ if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 1
+ && !netif_queue_stopped(dev)) {
/* do nothing */
} else {
- np->tx_full = 1;
- netif_stop_queue(dev);
+ netif_stop_queue (dev);
}
/* Side effect: The read wakes the potentially-idle transmit channel. */
- if (readl(dev->base_addr + TxListPtr) == 0)
- writel(np->tx_ring_dma + entry*sizeof(*np->tx_ring),
+ if (readl (dev->base_addr + TxListPtr) == 0)
+ writel (np->tx_ring_dma + entry*sizeof(*np->tx_ring),
dev->base_addr + TxListPtr);
dev->trans_start = jiffies;
if (debug > 4) {
- printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
- dev->name, np->cur_tx, entry);
+ printk (KERN_DEBUG
+ "%s: Transmit frame #%d queued in slot %d.\n",
+ dev->name, np->cur_tx, entry);
}
+ if (tx_coalesce > 1)
+ writel (1000, ioaddr + DownCounter);
return 0;
}
@@ -989,56 +1015,61 @@
ioaddr = dev->base_addr;
np = dev->priv;
- spin_lock(&np->lock);
do {
int intr_status = readw(ioaddr + IntrStatus);
- writew(intr_status & (IntrRxDone | IntrRxDMADone | IntrPCIErr |
- IntrDrvRqst | IntrTxDone | IntrTxDMADone | StatsMax |
- LinkChange), ioaddr + IntrStatus);
+ writew(intr_status, ioaddr + IntrStatus);
if (debug > 4)
printk(KERN_DEBUG "%s: Interrupt, status %4.4x.\n",
dev->name, intr_status);
- if (intr_status == 0)
+ if (!(intr_status & DEFAULT_INTR))
break;
- if (intr_status & (IntrRxDone|IntrRxDMADone))
- netdev_rx(dev);
+ if (intr_status & (IntrRxDMADone)) {
+ writew(DEFAULT_INTR & ~(IntrRxDone|IntrRxDMADone),
+ ioaddr + IntrEnable);
+ if (np->budget < 0)
+ np->budget = RX_BUDGET;
+ tasklet_schedule(&np->rx_tasklet);
+ }
- if (intr_status & IntrTxDone) {
+ if (intr_status & (IntrTxDone | IntrDrvRqst)) {
int boguscnt = 32;
- int tx_status = readw(ioaddr + TxStatus);
+ int tx_status = readw (ioaddr + TxStatus);
while (tx_status & 0x80) {
if (debug > 4)
- printk("%s: Transmit status is %2.2x.\n",
- dev->name, tx_status);
+ printk
+ ("%s: Transmit status is %2.2x.\n",
+ dev->name, tx_status);
if (tx_status & 0x1e) {
np->stats.tx_errors++;
- if (tx_status & 0x10) np->stats.tx_fifo_errors++;
+ if (tx_status & 0x10)
+ np->stats.tx_fifo_errors++;
#ifdef ETHER_STATS
- if (tx_status & 0x08) np->stats.collisions16++;
+ if (tx_status & 0x08)
+ np->stats.collisions16++;
#else
- if (tx_status & 0x08) np->stats.collisions++;
+ if (tx_status & 0x08)
+ np->stats.collisions++;
#endif
- if (tx_status & 0x04) np->stats.tx_fifo_errors++;
- if (tx_status & 0x02) np->stats.tx_window_errors++;
+ if (tx_status & 0x04)
+ np->stats.tx_fifo_errors++;
+ if (tx_status & 0x02)
+ np->stats.tx_window_errors++;
/* This reset has not been verified!. */
- if (tx_status & 0x10) { /* Reset the Tx. */
- writew(0x001c, ioaddr + ASICCtrl + 2);
-#if 0 /* Do we need to reset the Tx pointer here? */
- writel(np->tx_ring_dma
- + np->dirty_tx*sizeof(*np->tx_ring),
- dev->base_addr + TxListPtr);
-#endif
+ if (tx_status & 0x10) { /* Reset the Tx. */
+ writew (0x001c,
+ ioaddr + ASICCtrl + 2);
}
- if (tx_status & 0x1e) /* Restart the Tx. */
- writew(TxEnable, ioaddr + MACCtrl1);
+ if (tx_status & 0x1e) /* Restart the Tx. */
+ writew (TxEnable,
+ ioaddr + MACCtrl1);
}
/* Yup, this is a documentation bug. It cost me *hours*. */
- writew(0, ioaddr + TxStatus);
- tx_status = readb(ioaddr + TxStatus);
+ writew (0, ioaddr + TxStatus);
+ tx_status = readw (ioaddr + TxStatus);
if (--boguscnt < 0)
break;
}
@@ -1046,26 +1077,24 @@
for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) {
int entry = np->dirty_tx % TX_RING_SIZE;
struct sk_buff *skb;
-
- if ( ! (np->tx_ring[entry].status & 0x00010000))
+ if (!(np->tx_ring[entry].status & 0x00010000))
break;
skb = np->tx_skbuff[entry];
/* Free the original skb. */
pci_unmap_single(np->pci_dev,
np->tx_ring[entry].frag[0].addr,
skb->len, PCI_DMA_TODEVICE);
- dev_kfree_skb_irq(skb);
+ dev_kfree_skb_irq (np->tx_skbuff[entry]);
np->tx_skbuff[entry] = 0;
}
- if (np->tx_full
- && np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
+ if (netif_queue_stopped(dev) &&
+ np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
/* The ring is no longer full, clear tbusy. */
- np->tx_full = 0;
- netif_wake_queue(dev);
+ netif_wake_queue (dev);
}
/* Abnormal error summary/uncommon events handlers. */
- if (intr_status & (IntrDrvRqst | IntrPCIErr | LinkChange | StatsMax))
+ if (intr_status & (IntrPCIErr | LinkChange | StatsMax))
netdev_error(dev, intr_status);
if (--boguscnt < 0) {
get_stats(dev);
@@ -1073,49 +1102,41 @@
printk(KERN_WARNING "%s: Too much work at interrupt, "
"status=0x%4.4x / 0x%4.4x.\n",
dev->name, intr_status, readw(ioaddr + IntrClear));
- /* Re-enable us in 3.2msec. */
- writew(0, ioaddr + IntrEnable);
- writew(1000, ioaddr + DownCounter);
- writew(IntrDrvRqst, ioaddr + IntrEnable);
break;
}
} while (1);
-
if (debug > 3)
printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
dev->name, readw(ioaddr + IntrStatus));
+ if (np->cur_tx - np->dirty_tx > 0 && tx_coalesce > 1)
+ writel(100, ioaddr + DownCounter);
- spin_unlock(&np->lock);
}
-/* This routine is logically part of the interrupt handler, but separated
- for clarity and better register allocation. */
-static int netdev_rx(struct net_device *dev)
+static void rx_poll(unsigned long data)
{
+ struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv;
int entry = np->cur_rx % RX_RING_SIZE;
- int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
-
- if (debug > 4) {
- printk(KERN_DEBUG " In netdev_rx(), entry %d status %4.4x.\n",
- entry, np->rx_ring[entry].status);
- }
+ int boguscnt = np->budget;
+ long ioaddr = dev->base_addr;
+ int received = 0;
/* If EOP is set on the next entry, it's a new packet. Send it up. */
while (1) {
struct netdev_desc *desc = &(np->rx_ring[entry]);
- u32 frame_status;
+ u32 frame_status = le32_to_cpu(desc->status);
int pkt_len;
+ if (--boguscnt < 0) {
+ goto not_done;
+ }
if (!(desc->status & DescOwn))
break;
- frame_status = le32_to_cpu(desc->status);
pkt_len = frame_status & 0x1fff; /* Chip omits the CRC. */
if (debug > 4)
printk(KERN_DEBUG " netdev_rx() status was %8.8x.\n",
frame_status);
- if (--boguscnt < 0)
- break;
pci_dma_sync_single(np->pci_dev, desc->frag[0].addr,
np->rx_buf_sz, PCI_DMA_FROMDEVICE);
@@ -1136,7 +1157,6 @@
}
} else {
struct sk_buff *skb;
-
#ifndef final_version
if (debug > 4)
printk(KERN_DEBUG " netdev_rx() normal Rx pkt length %d"
@@ -1164,11 +1184,36 @@
netif_rx(skb);
dev->last_rx = jiffies;
}
- entry = (++np->cur_rx) % RX_RING_SIZE;
+ entry = (entry + 1) % RX_RING_SIZE;
+ received++;
}
+ np->cur_rx = entry;
+ refill_rx (dev);
+ np->budget -= received;
+ writew(DEFAULT_INTR, ioaddr + IntrEnable);
+ return;
+
+not_done:
+ np->cur_rx = entry;
+ refill_rx (dev);
+ if (!received)
+ received = 1;
+ np->budget -= received;
+ if (np->budget <= 0)
+ np->budget = RX_BUDGET;
+ tasklet_schedule(&np->rx_tasklet);
+ return;
+}
+
+static void refill_rx (struct net_device *dev)
+{
+ struct netdev_private *np = dev->priv;
+ int entry;
+ int cnt = 0;
/* Refill the Rx ring buffers. */
- for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) {
+ for (;(np->cur_rx - np->dirty_rx + RX_RING_SIZE) % RX_RING_SIZE > 0;
+ np->dirty_rx = (np->dirty_rx + 1) % RX_RING_SIZE) {
struct sk_buff *skb;
entry = np->dirty_rx % RX_RING_SIZE;
if (np->rx_skbuff[entry] == NULL) {
@@ -1186,30 +1231,17 @@
np->rx_ring[entry].frag[0].length =
cpu_to_le32(np->rx_buf_sz | LastFrag);
np->rx_ring[entry].status = 0;
+ cnt++;
}
-
- /* No need to restart Rx engine, it will poll. */
- return 0;
+ return;
}
-
static void netdev_error(struct net_device *dev, int intr_status)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
u16 mii_ctl, mii_advertise, mii_lpa;
int speed;
-
- if (intr_status & IntrDrvRqst) {
- /* Stop the down counter and turn interrupts back on. */
- if (debug > 1)
- printk("%s: Turning interrupts back on.\n", dev->name);
- writew(0, ioaddr + IntrEnable);
- writew(0, ioaddr + DownCounter);
- writew(IntrRxDone | IntrRxDMADone | IntrPCIErr | IntrDrvRqst |
- IntrTxDone | StatsMax | LinkChange, ioaddr + IntrEnable);
- /* Ack buggy InRequest */
- writew (IntrDrvRqst, ioaddr + IntrStatus);
- }
+
if (intr_status & LinkChange) {
if (np->an_enable) {
mii_advertise = mdio_read (dev, np->phys[0], MII_ADVERTISE);
@@ -1236,6 +1268,9 @@
"full" : "half");
}
check_duplex (dev);
+ if (np->flowctrl == 0)
+ writew(readw(ioaddr + MACCtrl0) & ~EnbFlowCtrl,
+ ioaddr + MACCtrl0);
}
if (intr_status & StatsMax) {
get_stats(dev);
@@ -1482,3 +1517,5 @@
module_init(sundance_init);
module_exit(sundance_exit);
+
+
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-21 5:27 ` Jeff Garzik
@ 2002-06-21 12:17 ` Matthew Hall
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Hall @ 2002-06-21 12:17 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Kernel
[-- Attachment #1: Type: text/plain, Size: 815 bytes --]
On Fri, 2002-06-21 at 06:27, Jeff Garzik wrote:
> Matthew,
>
> This patch just arrived from D-Link. It includes fixes specifically for
> DFX-580TX. Does this fix your problem?
Yes and no,
This version didn't work (once I back-ported it to compile on 2.4.18,
which I suppose I may have not been designed to do), but I had already
got v1.02 to compile and work properly with no problems (on a previous
post).
On a similar note, but not related to the original, has anyone used this
driver on 20 ports? I'll be looking into using the driver with 4/5 of
the dfe-580's and was wondering about scalability...?
Thanks anyway Jeff,
Matthew Hall
--
Matthew Hall -- matt@ecsc.co.uk -- http://people.ecsc.co.uk/~matt/
Sig: Contrary to popular opinion, the plural of 'anecdote' is not
'fact'.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PROBLEM] sundance on d-link dfe-580tx
2002-06-12 3:39 ` Donald Becker
2002-06-13 14:57 ` Matthew Hall
@ 2002-07-12 2:41 ` kwijibo
1 sibling, 0 replies; 12+ messages in thread
From: kwijibo @ 2002-07-12 2:41 UTC (permalink / raw)
To: Donald Becker; +Cc: Matthew Hall, Kernel, jgarzik
Just to give some confirmation of the operation of this new driver.
I had had the same error messages as Matthew did. I followed
the instructions on Donald's site on making the new drivers and
it works great now. It found everything correctly with the following
output:
sundance.c:v1.07 7/3/2002 Written by Donald Becker <becker@scyld.com>
http://www.scyld.com/network/sundance.html
eth0: OEM Sundance Technology ST201 at 0xdc00, 00:05:5d:e6:2b:19, IRQ 11.
eth0: MII PHY found at address 0, status 0x782d advertising 01e1.
eth0: MII PHY found at address 1, status 0x782d advertising 01e1.
eth1: OEM Sundance Technology ST201 at 0xd880, 00:05:5d:e6:2b:1a, IRQ 10.
eth1: MII PHY found at address 0, status 0x7809 advertising 01e1.
eth1: MII PHY found at address 1, status 0x7809 advertising 01e1.
eth2: OEM Sundance Technology ST201 at 0xd800, 00:05:5d:e6:2b:1b, IRQ 9.
eth2: MII PHY found at address 0, status 0x7809 advertising 01e1.
eth2: MII PHY found at address 1, status 0x7809 advertising 01e1.
eth3: OEM Sundance Technology ST201 at 0xd480, 00:05:5d:e6:2b:1c, IRQ 11.
eth3: MII PHY found at address 0, status 0x7809 advertising 01e1.
eth3: MII PHY found at address 1, status 0x7809 advertising 01e1.
I am now sending this message over it.
Any idea when this will be merged into mainstream kernel?
Thanks,
Steven
Donald Becker wrote:
>On 11 Jun 2002, Matthew Hall wrote:
>
>
>
>>To: Kernel <linux-kernel@vger.kernel.org>
>>Cc: becker@scyld.com, jgarzik@mandrakesoft.com
>>
>>
>...
>
>
>>I have been testing the D-Link DFE-580TX Quad channel server card (4
>>port nic), on kernel 2.4.18 with little success.
>>
>>Attached are the appropriate results of dmesg, ifconfig, lspci and
>>modules.conf; aswell as the results of the pci-testing tool found on
>>scyld.com, however the card does not support mii testing, claiming to
>>have no MII transceiver.
>>
>>
>
>Please provide the full detection message.
>
>It appears that you are using a driver that doesn't correctly read the
>EEPROM, and has additional problems. Try a current driver from
> http://www.scyld.com/network/ethercard.html
> ftp://www.scyld.com/pub/network/sundance.c
> http://www.scyld.com/network/updates.html
>
>and run diagnostic program from
> http://www.scyld.com/diag/index.html
>
>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2002-07-12 2:32 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-11 12:43 [PROBLEM] sundance on d-link dfe-580tx Matthew Hall
2002-06-12 3:39 ` Donald Becker
2002-06-13 14:57 ` Matthew Hall
2002-06-13 15:34 ` Ben Greear
2002-06-13 16:12 ` Donald Becker
2002-06-14 16:06 ` Matthew Hall
2002-06-14 21:52 ` Donald Becker
2002-06-21 5:27 ` Jeff Garzik
2002-06-21 12:17 ` Matthew Hall
2002-07-12 2:41 ` kwijibo
2002-06-14 10:15 ` Marcus Sundberg
[not found] ` <1024070521.973.48.camel@smelly.dark.lan>
[not found] ` <vevg8l25uq.fsf@inigo.ingate.se>
2002-06-17 14:58 ` Matthew Hall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox