Bug #224


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

Added by bill.marquette over 17 years ago. Updated about 17 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


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
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 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:

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
ether 00:0c:29:d0:ad:ef
media: Ethernet autoselect



Also available in: Atom PDF