Advance Operations
Advance operations decrease the size of the used data space in a NET_BUFFER structure or in all of the NET_BUFFER structures in a NET_BUFFER_LIST structure.
Drivers use the following advance functions:
NdisAdvanceNetBufferListDataStart
Advance operations can sometimes free MDLs that are associated with a NET_BUFFER structure. To provide the mechanism for freeing MDLs, a driver can provide an optional entry point for a NetFreeMdl functions. If the entry point is NULL, NDIS uses a default method to allocate MDLs. MDLs must only be freed within a NetFreeMdl using that reciprocal of the mechanism that was used to allocate the MDL in the NetAllocateMdl function.
To obtain the new DataLength, NDIS subtracts the driver-specified DataOffsetDelta from the current DataLength . If a previous retreat operation allocated new data space, the advance operation can free such previously allocated memory. If an advance operation does not free memory, NDIS simply adds the DataOffsetDelta to the current DataOffset to obtain the new DataOffset . If the advance operation freed memory, NDIS adjusts the DataOffset accordingly.
For the send complete case, advance operations can free memory that was allocated in previous retreat operations. For better performance, drivers should allocate enough total data size before sending to accommodate the retreat operations of all the underlying drivers.
For the receive indication case, advance operations simply adjust the DataOffset and DataLength accordingly. After the advance operation, the headers of lower layers remain in the unused data space.