lnc(4) driver ported from freebsd (le(4))

Scott Ullrich geekgod at geekgod.com
Sun Jul 2 01:10:59 PDT 2006


Bill Marquette wrote:
I was interested in learning something about the kernel, so figured
I'd take a crack at porting the le(4) driver that FreeBSD brought in
from NetBSD - the ultimate goal is to bring pcn(4) from NetBSD over -
the combination of the two drivers appears to be better than the
existing lnc(4)/pcn(4) that Dragonfly has today (at least for VMWare)
and supports VLANs which the existing lnc(4) doesn't appear to (maybe
I missed something).  As Dragonfly already has a le(4) driver and this
was really a replacement for the existing lnc(4), I changed the driver
name to lnc (functions and some defines are a little goofy right now
because of it - looking for a little direction there).
If there's interest, I'm looking for a little feedback on the port.  I
know there's still some cleanup to do (and a man page update!), but
more importantly:
I borrowed the lock code from aac(4) - I'm not sure it's the "right
way" to do things as it's the only driver that seems to use lock(9)
functions - but it was the easiest one to use to see Dragonfly vs
FreeBSD differences.
I ifdef'd out FreeBSD-isms (I still have some cleaning to do there) -
I'm not sure how that's treat in the Dragonfly tree, I only see a few
instances of that in the network drivers, maybe that code should just
go?
FreeBSD has BUS_PROBE_LOW_PRIORITY to set bus priorities so drivers
can pre-empt other drivers, I didn't see anything akin to that in
Dragonfly (and sadly hardcoded the value - this needs to be cleaned up
still).  The old driver defined LNC_PROBE_PRIORITY to -1, is that the
"correct way" ? :)
With all that said...it does work :)  I've been running it for a
couple days now in vmware without any issues (file transfers, multiple
simultaneous ifconfig up/down).
The patch can be found at: http://www.pfsense.org/~billm/dfly/lnc.patch

The patch removes if_lnc.c and if_lnc.h
and adds lance.c am7990.c am79900.c
I just noticed that I'm not rm'ing if_lncvar.h and if_lncreg.h - doh!

Original dmesg snippet in vmware
lnc0: <PCNet/PCI Ethernet adapter> port 0x1400-0x147f irq 11 at device
17.0 on pci0
lnc0: MAC address: 00:0c:29:d0:ad:ef
lnc0: PCnet-PCI
#ifconfig lnc0
lnc0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
       ether 00:0c:29:d0:ad:ef
new dmesg snippet in vmware
lnc0: <AMD PCnet-PCI> port 0x1400-0x147f irq 11 at device 17.0 on pci0
lnc0: 16 receive buffers, 4 transmit buffers
lnc0: MAC address: 00:0c:29:d0:ad:ef
#ifconfig lnc0
lnc0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
       options=8<VLAN_MTU>
       ether 00:0c:29:d0:ad:ef
       media: Ethernet autoselect
--Bill
I have also ran this patch for a few days with no issues.

If there is no objections I would like to commit this by Thursday 7/1/2006.

Scott





More information about the Submit mailing list