1.1 Network Driver Interface Specification (NDIS)

NDIS describes the interface by which one or more NIC drivers communicate with one or more underlying network interface cards, with one or more overlying protocol drivers, and with the operating system. NDIS supports the following:

NDIS defines a fully abstracted environment for NIC driver development. For every external function that a NIC driver needs to perform, it can rely on NDIS routines to perform the operation. This includes the entire range of tasks performed by a NIC driver, from communicating with protocol drivers, to registering and intercepting NIC hardware interrupts, and communicating with underlying NICs through manipulating registers, port I/O, and so forth. Therefore, NIC drivers can be written entirely in platform-independent high-level languages such as C. These drivers can then be recompiled with a system-compatible compiler to run in any NDIS environment.

To provide this level of abstraction and portability, Windows NT provides an NDIS export library referred to here as the NDIS library or NDIS. All interactions between a NIC driver and protocol drivers, a NIC driver and the operating system, and a NIC driver and the network adapters that it controls are through calls to NDIS functions. NDIS is packaged in an export library (ndis.sys) as a set of functions, with emphasis on in-line macros for maximum performance. All NDIS drivers, including highest-level NDIS protocol drivers, intermediate NDIS drivers, and NIC drivers link against this library. When called, an NDIS function calls an associated function in a higher-level driver, in an intermediate NDIS driver, in a NIC driver, in the operating system, or else performs an internal-to-NDIS local action.

Figure 1.1 shows an overview of this architecture.

Figure 1.1 NDIS Driver Architecture

NDIS forms a wrapper around a NIC driver. At the upper edge, NDIS interfaces between the NIC driver and various intermediate NDIS drivers, legacy transport drivers written to the LAN protocol and native-media-aware protocol drivers. For instance, a packet sent by an intermediate NDIS driver or native-media-aware protocol driver is sent down to the NIC driver by calling NDIS. NDIS then calls the NIC driver to send the packet over the network. NDIS provides such services to the NIC driver as serializing sends and requests, ensuring that the driver completes one send before it receives another send request. This frees the NIC driver from creating and maintaining queues and simplifies the task of the NIC driver writer. NDIS provides support for full-duplex operations so that a miniport can be executing packet sends and receives simultaneously on an SMP machine. NDIS also provides support for multipacket sends and multipacket receive indications.

While all these NDIS features are available to most miniports, they are not available to legacy full NIC drivers. Consequently, legacy full NIC drivers do not benefit from some features, such as multipacket sends and receives, as well as features planned for future versions of NDIS. For these reasons, driver writers should write a miniport NIC driver rather than a full NIC driver, and existing full NIC drivers should be converted into miniports.

NDIS provides common functions to the interface between the NIC driver and network interface cards. This lower edge set of functions allows the NIC driver to manage the NIC hardware through NDIS functions that call a set of OS-specific components. NDIS allows the NIC driver to be abstracted from the operating system and hardware architecture on which it runs so that a single driver is portable across platforms on which NDIS is implemented.

The NDIS library also includes a set of Filter Library routines for the most common types of network media. The filter libraries provide an environment where a protocol driver can specify destination addresses or address types for packets that it is interested in receiving. Thereafter, each incoming packet will be routed to one, several, or all bound upper layer drivers based on the packet’s destination address. The NIC driver simply passes an incoming packet up by calling an NDIS function. NDIS does the work of routing the packet to interested upper network layers. If the NIC driver prefers, it can use a null filter and indicate received packets to all bound protocols.