[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kernel internals network driver question..



Greetings,

I took a swing at bringing the NetBSD driver for the RTL8150 controller
chip over to an OpenBSD notebook (following -current).

I used if_aue.c and some of the existing mii/phy drivers as a reference
for some of the differences between OpenBSD and NetBSD and it went quite
smoothly(minor differences).


At this point, the driver works from my limited tests, except for a slight
err with ifconfig(8) output (which is obviously an indication of something
else being broken).


USB-wise (from usbdevs -vd):

Controller /dev/usb0:
addr 1: self powered, config 1, UHCI root hub(0x0000), vendor
0x0000(0x0000), rev 1.00
 uhub0
 port 1 addr 2: self powered, config 1, Generic USB Hub(0x9254),
ALCOR(0x058f), rev 3.10
  uhub1
  port 1 powered
  port 2 addr 3: power 120 mA, config 1, Linksys USB LAN Adapter(0x8150),
Linksys(0x0bda), rev 1.00
   url0
  port 3 addr 4: power 160 mA, config 1, SOHOware[TM] 10/100 USB(0x9100),
NDC(0x15e8), rev 1.01
   aue0
  port 4 powered
 port 2 powered



The device shows up in dmesg and is able to read the MAC addr etc:

url0 at uhub1 port 2
url0: Linksys Linksys USB LAN Adapter, rev 1.10/1.00, addr 3
url0: Ethernet address 00:10:60:c2:9b:71
urlphy0 at url0 phy 0: Realtek RTL8150L internal media interface
urlphy0:

Note the last line is empty when it should be printing out something
like:

ukphy0: OUI 0x000895, model 0x0021, rev. 11

Could this be the problem? Not setting the correct PHY/MII flags?


The interface appears in my interface list, and the kernel knows about
the media options it supports. This is where the fun starts with
ifconfig(8):

root@soldatus:~# ifconfig -m url0
url0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        nwid
0x820300a8d8bfdfa54a0000f84900000000000000000000000000000000000000000200f8d8bfd
f104b0000b051030068820300d05103001c00000000001500bc820300f8d8bfdf20260000030000
007e6920c0b0510300880a0000b0510300d05103006882030043
        powersave off
        media: Ethernet 100baseTX full-duplex
        status: active
        supported media:
                media 10baseT
                media 10baseT mediaopt full-duplex
                media 100baseTX
                media 100baseTX mediaopt full-duplex
                media autoselect
        physical address inet  -->
        inet 10.78.2.20 netmask 0xffffff00 broadcast 10.78.2.255
        inet6 fe80::210:60ff:fec2:9b71%url0 prefixlen 64 scopeid 0x14
root@soldatus:~#

Problems:

1) This is not a 802.11 device but the kernel shows powersave and nwid
output. The nwid information changes slightly each time (incrementing
counters in the data it is snarfing?)

2) The 'physical address inet ->' line. Another indication that
the kernel may be confused on what type of PHY this is.


It looks like the kernel is missing some flags that tell it
what type of PHY this is. Am I close??


After I assign the address to the interface, the machine is
able to learn/send ARPs on the interface and work at an IP level:

root@soldatus:~# ping -c  10 -q 10.78.2.1
PING 10.78.2.1 (10.78.2.1): 56 data bytes
--- 10.78.2.1 ping statistics ---
10 packets transmitted, 10 packets received, 0% packet loss
round-trip min/avg/max/std-dev = 1.193/3.027/6.945/2.204 ms

root@soldatus:~# /usr/local/netperf/netperf -H 10.78.2.2
TCP STREAM TEST to 10.78.2.2
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 16384  16384  16384    10.03       5.79
root@soldatus:~#

I get 5.79Mb/sec with an aue interface as well, so I am not
worried about the speed, this adapter is very tiny and travels
well.

I also tested IPv6 connectivity and it worked OK. Tested with
ping6 and TCP (ssh over IPv6).


This was tested with Linksys USB100M adapter,
http://www.linksys.com/Products/product.asp?grid=31&prid=402


Anyone have a clue as to where I went wrong from looking at the
above errors?


The patch (68Kbytes) at http://www.ackley.net/~jason/obsd-rtl8150.patch
includes the changes to sys to make this work. This does not include man
pages for url(4) or urlphy(4) just yet..

With the above patch there are some changes that take place elsewhere,
such as net/if_ethersubr.c and netinet/if_ether.h .

These changes are to bring in the ether_crc32_le() and ether_crc32_be()
functions from NetBSD into if_ethersubr.c .

Due these functions being moved here, the private copies of
ether_crc32_le() in arch/macppc/dev/if_gm.c and dev/ic/lemac.c are #if 0'd
out to avoid conflicts. (The private copies even mention relocating them
to if_ethersubr.c).

(Even tho it is a Linksys, it matches on a GREENHOUSE2 USBKR100, so it
does not need to be added to if_url.c)


Thanks for any pointers or input !


cheers,
--
jason