NDIS(4) (i386)

NDIS(4) | NetBSD Kernel Interfaces Manual (i386) | NDIS(4)

# NAME

ndis — NDIS miniport driver wrapper

# SYNOPSIS

ndis* at pci? dev ? function ?

# DESCRIPTION

The ndis wrapper is designed to allow binary Windows® NDIS miniport network drivers to be used with NetBSD. The ndis driver is provided in source code form (sys/dev/if_ndis) and must be combined with the Windows® driver binary supplied with your network adapter. The ndis driver uses the ndisapi kernel subsystem to relocate and link the Windows® binary so that it can be used in conjunction with native code. The ndisapi subsystem provides an interface between the NDIS API and the NetBSD networking infrastructure. The Windows® driver is essentially fooled into thinking it is running on Windows®. Note that this means the ndis driver is only useful on x86 machines.

To build a functional driver, the user must have a copy of the driver distribution media for his or her card. From this distribution, the user must extract two files: the .SYS file containing the driver binary code, and its companion .INF file, which contains the definitions for driver-specific registry keys and other installation data such as device identifiers. These two files are converted into a ndis_driver_data.h file using the ndiscvt(8) utility. The resulting file contains a binary image of the driver plus registry key data. The ndis_driver_data.h is included in several files located in sys/dev/if_ndis so it is needed to compile an NDIS kernel. When the ndis driver is loaded, it will create sysctl(3) nodes for each registry key extracted from the .INF file.

The ndis wrapper is designed to support mainly Ethernet and wireless network devices/drivers with PCI bus attachments. It can support many different media types and speeds.

One limitation however, is that there is no consistent way to learn if an Ethernet device is operating in full or half duplex mode. The NDIS API allows for a generic means for determining link state and speed, but not the duplex setting. There may be driver-specific registry keys to control the media setting which can be configured via the sysctl(8) command.

# EXAMPLES

Assuming you have obtained the appropriate .INF and .SYS files for your device, the ndis_driver_data.h file can be built as follows:

    $ ndiscvt -i your_card.INF -s your_card.SYS -o ndis_driver_data.h

Next uncomment the following lines from sys/arch/i386/conf/GENERIC

    $ cd /usr/src/sys/arch/i386/conf
    $ cp GENERIC NDIS
    $ vi NDIS
     .
     .
     .
    options         COMPAT_NDIS # NDIS network driver
     .
     .
     .
    ndis*   at pci? dev ? function ? # Experimental - NDIS Network Driver

Configure your kernel, then copy the ndis_driver_data.h file into the kernel build directory before compiling the kernel:

    $ cd src/sys/arch/i386/conf
    $ config NDIS
    $ cd ../compile/NDIS
    $ cp /path/to/ndis_driver_data.h .
    $ make depend && make
    $ su
    $ mv /netbsd /onetbsd
    $ cp netbsd /netbsd
    $ reboot

The ndis0 device should be detected at boot:

    Matching vendor: 14e4, product: 4324, name: Dell TrueMobile 1400 Dual Band WLAN Mini-PCI Card
    ndis0 at pci2 dev 3 function 0

The device can then be configured with ifconfig(8):

    ndis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            ssid WWUwireless
            powersave on (100ms sleep)
            chan 6
            address: 00:90:4b:69:94:f0
            media: IEEE802.11 autoselect
            status: no network
            inet 140.160.129.226 netmask 0xfffffc00 broadcast 140.160.131.255
            inet6 fe80::290:4bff:fe69:94f0%ndis0 prefixlen 64 scopeid 0x3

If the ndis driver creates any sysctl nodes, they can be viewed and altered with sysctl(8):

    $ sysctl ndis0
     .
     .
     .
    ndis0.ndis_10280001 = Dell TrueMobile 1300 WLAN Mini-PCI Card
    ndis0.ndis_Environment = 1
    ndis0.ndis_NdisVersion = 0x00050001
    ndis0.ndis_BusType = 5
     .
     .
     .

# DIAGNOSTICS

ndis%d: watchdog timeout
  A packet was queued for transmission and a transmit command was issued, however the device failed to acknowledge the transmission before a timeout expired.

# SEE ALSO

arp(4), netintro(4), ifconfig(8), ndiscvt(8)

NDIS 5.1 specification, http://www.microsoft.com.

# HISTORY

The ndis driver wrapper first appeared in FreeBSD 5.3 and was ported to NetBSD 4.0.

# AUTHORS

The ndis driver was written by Bill Paul <wpaul@windriver.com>. It was ported to NetBSD by Alan Ritter <rittera@NetBSD.org> with help from Phil Nelson <phil@NetBSD.org> as part of Google's Summer of Code 2005.

December 10, 2003 | NetBSD 5.99