Summer of Code: NDIS on NetBSD
[NetBSD logo]    &    [Google logo]

NetBSD-SoC: Porting FreeBSD's NDIS Network Driver to NetBSD

Update:

This project was imported into the NetBSD source tree on March 30, 2006. Further work on the code will continue there. To use NDIS you will need to update to NetBSD-current. See ndis(4) for installation instructions.

What is it?

Writing a device driver requires access to detailed documentation describing the register-level interface to the device. However many manufacturers don't provide this information instead producing their own drivers, typically for Windows. This presents a problem for Open-Source operating systems wanting to support these devices.

Windows network drivers use the Network Device Interface Specification (NDIS) which is a standard API allowing a single Network Interface Card (NIC) to support multiple network protocols. After implementing NDIS on an OS other than Windows, it is possible (with a few tricks) to run a binary version of a Windows driver that thinks it's still talking to Windows. This has already been done for Linux (NdisWrapper) and for FreeBSD. As FreeBSD and NetBSD are derived from the same code base (4.4 BSD) it seems logical to port FreeBSD's NDIS implementation to NetBSD.

Project Goals

Mandatory Requirements

In order for this project to be considered completed it should produce a driver working well enough to use at least a standard wired Ethernet card on PCI bus. In other words it should produce a working driver for at least one card.

Would Be Nice/Long Term Goals

I would like to get a driver working for a wireless card by the end of the summer. In addition, the more cards that NetBSD doesn't have support for and I can get a working driver the better. Here is a list of some more goals:

Status

As far as I know the dirver isn't working right now under NetBSD 2.0.2. I'm currently using 3.99.7, but I think it will work with any kernel that includes the sys/lkm/dev/pci/dummy_pci driver as this is the model I use for attaching (in the Loadable Kernel Module which isn't working right now anyway). Also sys/dev/if_ndis and sys/compat/ndis can now be compiled directly into the kernel for use with the kernel debugger (see the instructions in README.NetBSD.)

The Loadable Kernel Module version of the driver isn't working right now, as I'm focusing entirely on the in-kernel version. Since I can't run the kernel debugger in the LKM version, and I didn't want to spend a lot of time keeping both up to date. I've also switched from testing on a Broadcom wireless PCI card to a wired Intel Pro/100 card as the Windows DDK comes with the source code for it's driver. This has made my life much easier.

Check out my blog for this project. I haven't used one of these before, but it seemed like a useful way to keep everyone up to date on my progress. Feel free to leave feedback.

Documentation

See the README.NetBSD file with instructions on how to build, and more information.

Cards That Have Been Tested

Technical Details

There are three "modules" to this project which must be ported from FreeBSD. The files in sys/compat/ndis compile into a Loadable Kernel Module (ndis.o) or directly into the kernel, and implement the NDIS API, as well as some other Windows functions. usr.sbin/ndiscvt contains files which compile to make the ndiscvt userland program, which generates an ndis_driver_data.h file from a pair of Windows .inf and .sys files. This generated header file is then compiled with the files in sys/dev/if_ndis to make a functional driver for the card whose .inf and .sys files were used.

Links to Information Relating to this Project

To Checkout the Current Sources:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/netbsd-soc login (Password: just press ENTER)
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/netbsd-soc co -P ndis
See the README.NetBSD file for building instructions

The sources can also be viewed using a web interface

I've tried to label areas where I don't know what to do, or think that more work needs to be done with comments beginning with TODO:. So if you check out the sources, change to the base ndis/ directory, then enter the command:

find ./ -exec grep -H TODO {} ";"

this should print out a list of all the TODO's.


SourceForge.net Logo
Alan Ritter <rittera@users.sourceforge.net>
$Id: index.html,v 1.31 2006/05/02 02:50:03 rittera Exp $