NET_BUFFER_LIST_CONTEXT (Compact 2013)

3/26/2014

This structure stores context information for a NET_BUFFER_LIST structure.

Syntax

typedef struct {
  PNET_BUFFER_LIST_CONTEXT  Next;
  USHORT  Size;
  USHORT  Offset;
  DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)UCHAR  ContextData[];
} NET_BUFFER_LIST_CONTEXT, *PNET_BUFFER_LIST_CONTEXT;

Members

  • Next
    A pointer to the next NET_BUFFER_LIST_CONTEXT structure in a linked list of NET_BUFFER_LIST_CONTEXT structures.
  • Size
    The size, in bytes, of the context space in the NET_BUFFER_LIST_CONTEXT structure, including the used and unused context space.
  • Offset
    The offset, in bytes, from the beginning of the context data bufferto the start of the context data in the NET_BUFFER_LIST_CONTEXT structure. The Offset member also specifies the size in bytes of the unused context space in the NET_BUFFER_LIST_CONTEXT structure.
  • ContextData
    The context data buffer. The context data can include any information that a driver requires.

Remarks

Every NET_BUFFER_LIST structure can include a preallocated NET_BUFFER_LIST_CONTEXT structure. As a NET_BUFFER_LIST structure travels through the driver stack, the linked list of NET_BUFFER_LIST_CONTEXT structures can expand to accommodate additional dataspace for each driver.

Drivers should use the following NDIS macros and functions to access and manipulate members in a NET_BUFFER_LIST_CONTEXT structure:

The ContextData member of the NET_BUFFER_LIST_CONTEXT structure specifies the data part of the NET_BUFFER_LIST_CONTEXT structure. To improve system performance, a driver should preallocate any required context dataspace when the driver allocates a NET_BUFFER_LIST structure pool. To preallocate this dataspace, a driver calls the NdisAllocateNetBufferListPool function and then specifies the dataspace required in the ContextSize parameter. Preallocation of this dataspace saves NDIS from allocating memory in the receive and send paths.

Note   NDIS estimates the required context dataspace and, if it is necessary, adjusts the allocated dataspace to meet the requirements for the driver stack.

The Offset member specifies the unused context space in the NET_BUFFER_LIST_CONTEXT structure. The Offset member also indicates the offset from the beginning of the ContextData member to the start of the used context dataspace.

NDIS drivers call the NdisAllocateNetBufferListContext function to allocate contiguous buffer space in the NET_BUFFER_LIST_CONTEXT structure. If it is necessary, NDIS allocates a new NET_BUFFER_LIST_CONTEXT structure with additional space to honor the request. NDIS drivers call the NdisFreeNetBufferListContext function to free the buffer space.

Use the NET_BUFFER_LIST_CONTEXT_DATA_SIZE macro to obtain the size of the used context space. Use the NET_BUFFER_LIST_CONTEXT_DATA_START macro for the starting address of the used context space.

Requirements

Header

ndis.h

See Also

Reference

NDIS NET_BUFFER Structures
NdisAllocateNetBufferListContext
NdisAllocateNetBufferListPool
NdisFreeNetBufferListContext
NET_BUFFER
NET_BUFFER_LIST
NET_BUFFER_LIST_CONTEXT_DATA_START
NET_BUFFER_LIST_CONTEXT_DATA_SIZE