NDIS Packet Structure
A protocol driver allocates an NDIS packet, fills it with data, and passes it to the next lower NDIS driver so that the data can be sent on the network. Some lowest level NIC drivers allocate packets to hold received data and pass the packet to interested higher-layer drivers. Sometimes, a protocol driver allocates a packet and passes it to a NIC driver with a request that the NIC driver copy received data into the provided packet. NDIS provides functions for allocating and manipulating the substructures that constitute a packet. A packet contains packet descriptors and buffer descriptors, each of which contains other elements.
The following list shows the contents of a typical packet descriptor:
- Private areas for the miniport NIC driver and a protocol driver
- Flags associated with the packet, defined by a cooperating miniport(s) and protocol driver(s)
- Number of physical pages that contain the packet
- Total length of the packet
- Pointer to the first buffer descriptor that maps the first buffer in the packet
The following list shows the contents of a typical buffer descriptor:
- Starting virtual address of each buffer
- Buffer's byte offset into the page pointed to by the virtual address
- Total number of bytes in the buffer
- Pointer to the next buffer descriptor, if any
- Virtual range, possibly spanning more than one page that makes up the buffer described by the buffer descriptor. These virtual pages map to physical memory.
A driver that allocates shared memory, such as a bus master NIC driver for receiving incoming packets or a protocol driver that allocates memory for sending a packet, must ensure that any buffer used to contain incoming or outgoing data is cache-aligned. This is necessary so that the miniport can flush the buffer to assure coherency before sending a packet and to flush a received buffer before indicating the data to an upper layer.
See Also
Network Driver Programming Considerations | NDIS Driver Upper-Edge Functions | WAN Miniport Drivers
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.