Packet Structure (NDIS 5.1)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NDIS packets are allocated by a protocol driver, filled with data, and passed 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 up 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 make up a packet. The following figure illustrates a structure of a packet.

A packet is composed of the following:

  • A packet descriptor that contains private areas for the miniport driver and a protocol driver, a set of flags associated with the packet and whose meaning is defined by a cooperating miniport driver(s) and protocol driver(s), the number of physical pages that contain the packet, the total length of the packet, and a pointer to the first buffer descriptor that maps the first buffer in the packet.

  • A set of buffer descriptors. A buffer descriptor describes the starting virtual address of each buffer, the buffer's byte offset into the page pointed to by the virtual address, the total number of bytes in the buffer and a pointer to the next buffer descriptor, if any.

  • The 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 bus-master NIC driver that allocates shared memory 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 driver 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.

 

 

Send comments about this topic to Microsoft