Subject: half-working Conexant LANfinity driver
To: None <port-i386@NetBSD.org>
From: Frank Wille <frank@phoenix.owl.de>
List: port-i386
Date: 03/25/2006 15:23:54
Hi!

While trying to install NetBSD on a friend's Compaq Presario 1700 laptop I
realized that the onboard Conexant LANfinity NIC (based on the RS7112 chip)
is not supported.

So I gathered information about the chip and found out, by inspecting the
FreeBSD and Linux drivers, that it should be compatible to the DEC/Intel
"Tulip" driver.

Although I have no experience with NetBSD driver programming and no
knowledge about network chips I started to adapt the FreeBSD and Linux
drivers to the NetBSD 3.0 source.

The status:

The chip is recognized and initialized, the MAC address is read from the
ROM and the supported media types are displayed (the second Conexant
product is an integrated 56k modem, which I don't care about):

---8<---
tlp0 at pci0 dev 9 function 0: Conexant RS7112 Ethernet, pass 0.8
tlp0: interrupting at irq 9
tlp0: Ethernet address 00:50:8b:fa:30:03
ukphy0 at tlp0 phy 1: Generic IEEE 802.3u media interface
ukphy0: OUI 0x0010a1, model 0x0032, rev. 0
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
Conexant Systems product 0x1815 (miscellaneous communications, revision 0x05) at pci0 dev 9 function 1 not configured
---8<---

The driver also detects the currently connected media type and that a
carrier is present (ifconfig tlp0):
---8<---
tlp0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
    address: 00:50:8b:fa:30:03
    media: Ethernet autoselect (10baseT)
    status: active
---8<---

But when assigning an IPv4 address and bringing the interface up, the trouble
starts. I get lots of those messages:
tlp0: receive process failed to idle: state RUNNING - WAIT
tlp0: receive process failed to idle: state RUNNING - WAIT
tlp0: transmit timeout

So I enabled the TLP_DEBUG mode in sys/devs/ic/tulip.c and inserted a
printf, starting with "-- status=", in the main-loop of the interrupt service
routine tlp_intr(), which prints the chip's status register and the masked
rxstatus and txstatus.
The following happens after an "ifconfig tlp0 inet 192.168.0.17 up debug":

---8<---
tlp0: receive process failed to idle: state RUNNING - WAIT
-- status=f0670005 rxtatus=00000000 txstatus=00000001
tlp0: receive process failed to idle: state RUNNING - WAIT
-- status=f0370001 rxtatus=00000000 txstatus=00000001
tlp0: tlp_filter_setup: sc_flags 0x00001805
tlp0: tlp_filter_setup: deferring
tlp0: tlp_start: sc_flags 0x00001805, if_flags 0xffff8c47
tlp0: tlp_start: sc_flags 0x00001805, if_flags 0xffff8c47
tlp0: tlp_filter_setup: sc_flags 0x00001805
tlp0: tlp_filter_setup: deferring
tlp0: tlp_start: sc_flags 0x00001805, if_flags 0xffff8c47
tlp0: tlp_intr
-- status=f0270004 rxtatus=00000000 txstatus=00000000
tlp0: tlp_start: sc_flags 0x00001805, if_flags 0xffff8c47
tlp0: tlp_intr
-- status=f0670004 rxtatus=00000000 txstatus=00000000
tlp0: tlp_start: sc_flags 0x00001805, if_flags 0xffff8c47
tlp0: transmit timeout
tlp0: tlp_filter_setup: sc_flags 0x00001804
filter_setup 0xc0b3a380 transmit chain:
descriptor 0:
td_status:   0x00000000
td_ctl:      0x880000c0
td_bufaddr1: 0x01436400
td_bufaddr2: 0x01432010
tlp0: tlp_filter_setup: returning
tlp0: receive process failed to idle: state RUNNING - WAIT
tlp0: tlp_start: sc_flags 0x00001806, if_flags 0xffff8847
tlp0: tlp_start: txfree 1023, txnext 1
txsoft 0xc0b3a398 transmit chain:
descriptor 1:
td_status:   0x00000000
td_ctl:      0x6000002a
td_bufaddr1: 0x0ed2e6d6
td_bufaddr2: 0x01432020
txsoft 0xc0b3a3b0 transmit chain:
descriptor 2:
td_status:   0x80000000
td_ctl:      0x6000004e
td_bufaddr1: 0x0ed2e73a
td_bufaddr2: 0x01432030
txsoft 0xc0b3a3c8 transmit chain:
descriptor 3:
td_status:   0x80000000
td_ctl:      0x20000036
td_bufaddr1: 0x0ed2e8ca
td_bufaddr2: 0x01432040
descriptor 4:
td_status:   0x80000000
td_ctl:      0x00000008
td_bufaddr1: 0x0ed2ea20
td_bufaddr2: 0x01432050
descriptor 5:
td_status:   0x80000000
td_ctl:      0x40000018
td_bufaddr1: 0x0ed2e920
td_bufaddr2: 0x01432060
tlp0: packets enqueued, IC on 5, OWN on 1
tlp0: tlp_intr
-- status=f0270005 rxtatus=00000000 txstatus=00000001
tlp0: tlp_txintr: sc_flags 0x00001806
txsoft 0xc0b3a380 transmit chain:
descriptor 0:
td_status:   0x7fffffff
td_ctl:      0x880000c0
td_bufaddr1: 0x01436400
td_bufaddr2: 0x01432010
txsoft 0xc0b3a398 transmit chain:
descriptor 1:
td_status:   0x80000000
td_ctl:      0x6000002a
td_bufaddr1: 0x0ed2e6d6
td_bufaddr2: 0x01432020
tlp0: tlp_start: sc_flags 0x00001804, if_flags 0xffff8847
tlp0: tlp_start: txfree 1019, txnext 6
tlp0: tlp_intr
-- status=f0270004 rxtatus=00000000 txstatus=00000000
tlp0: tlp_start: sc_flags 0x00001804, if_flags 0xffff8847
tlp0: tlp_start: txfree 1019, txnext 6
tlp0: tlp_intr
-- status=f0670004 rxtatus=00000000 txstatus=00000000
tlp0: tlp_start: sc_flags 0x00001804, if_flags 0xffff8847
tlp0: tlp_start: txfree 1019, txnext 6
tlp0: tlp_start: sc_flags 0x00001804, if_flags 0xffff8847
tlp0: tlp_start: txfree 1019, txnext 6
txsoft 0xc0b3a3e0 transmit chain:
descriptor 6:
td_status:   0x00000000
td_ctl:      0x20000036
td_bufaddr1: 0x0ed2e4ca
td_bufaddr2: 0x01432070
descriptor 7:
td_status:   0x80000000
td_ctl:      0x00000008
td_bufaddr1: 0x0ed2e320
td_bufaddr2: 0x01432080
descriptor 8:
td_status:   0x80000000
td_ctl:      0x40000018
td_bufaddr1: 0x0ed2e520
td_bufaddr2: 0x01432090
tlp0: packets enqueued, IC on 8, OWN on 6
tlp0: tlp_intr
-- status=f0270004 rxtatus=00000000 txstatus=00000000
tlp0: tlp_start: sc_flags 0x00001804, if_flags 0xffff8847
tlp0: tlp_start: txfree 1016, txnext 9
tlp0: transmit timeout
tlp0: tlp_filter_setup: sc_flags 0x00001804
filter_setup 0xc0b3a380 transmit chain:
descriptor 0:
td_status:   0x00000000
td_ctl:      0x880000c0
td_bufaddr1: 0x01436400
td_bufaddr2: 0x01432010
tlp0: tlp_filter_setup: returning
tlp0: receive process failed to idle: state RUNNING - WAIT
tlp0: tlp_start: sc_flags 0x00001806, if_flags 0xffff8847
tlp0: tlp_start: txfree 1023, txnext 1
tlp0: tlp_intr
-- status=f0670005 rxtatus=00000000 txstatus=00000001
tlp0: tlp_txintr: sc_flags 0x00001806
txsoft 0xc0b3a380 transmit chain:
descriptor 0:
td_status:   0x7fffffff
td_ctl:      0x880000c0
td_bufaddr1: 0x01436400
td_bufaddr2: 0x01432010
tlp0: tlp_start: sc_flags 0x00001804, if_flags 0xffff8847
tlp0: tlp_start: txfree 1024, txnext 1
---8<---

I have never any rx-interrupts, but there seem to be tx-interrupts at the
beginning. But only at the beginning. When doing a "ping -c1 192.168.0.1"
later (without debug), there is only
---8<---
-- status=f0270004 rxstatus=00000000 txstatus=00000000
-- status=f0670004 rxstatus=00000000 txstatus=00000000
tlp0: transmit timeout
---8<---

No tx-interrupt, followed by a transmit timeout after a few seconds.

To make sure that the hardware is not defect, I installed FreeBSD and saw
the RS7112 correctly working.

What am I doing wrong? Where should I have a closer look? Any advice from
the experts is highly appreciated.

Thanks in advance!

-- 
    _  Frank Wille (frank@phoenix.owl.de)
 _ //  http://sun.hasenbraten.de/~frank/
 \X/   Phx @ #AmigaGer