EVT_NET_ADAPTER_RETURN_RX_BUFFER callback function (netadapter.h)

Implement this optional callback function to perform cleanup on a NET_FRAGMENT receive buffer for which you previously specified manual fragment allocation and attachment.

Syntax

EVT_NET_ADAPTER_RETURN_RX_BUFFER EvtNetAdapterReturnRxBuffer;

void EvtNetAdapterReturnRxBuffer(
  [_In_] NETADAPTER Adapter,
  [_In_] NET_FRAGMENT_RETURN_CONTEXT_HANDLE RxReturnContext
)
{...}

Parameters

[_In_] Adapter

The network adapter object that the client created in a prior call to NetAdapterCreate.

[_In_] RxReturnContext

A pointer to a driver-allocated context space structure.

Return value

None

Remarks

Register your implementation of this callback function by setting the appropriate member of NET_ADAPTER_RX_CAPABILITIES structure and then calling NetAdapterSetDatapathCapabilities. Client drivers typically call NetAdapterSetDatapathCapabilities when starting a net adapter, before calling NetAdapterStart.

This callback function is optional unless the net adapter client driver initializes its NET_ADAPTER_RX_CAPABILITIES structure using the NET_ADAPTER_RX_CAPABILITIES_INIT_DRIVER_MANAGED function. By using this initialization function, the driver tells the operating system that it is managing allocation and attachment of NET_FRAGMENT receive buffers manually, so it must provide this callback function in this case for the operating system to invoke once the system is finished with the buffer.

Example

In this callback function, the client driver can perform whatever cleanup or follow-up actions it needs now that the operating system has finished with this receive buffer. In the following example, the return context contains a member to track the number of indicated packets, as well as a memory object used for a lookaside buffer during receive processing. Error handling has been left out for clarity.

VOID
MyReturnRxBuffer(
	_In_	NETADAPTER							Adapter,
	_In_	NET_FRAGMENT_RETURN_CONTEXT_HANDLE	RxReturnContext
)
{
	UNREFERENCED_PARAMETER(Adapter);

	RxReturnContext->IndicatedPackets--;

	// Clean up the lookaside buffer if this is the last packet
	if(RxReturnContext->IndicatedPackets == 0)
	{
		WdfObjectDelete(RxReturnContext->LookasideBufferMemory);
	}
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.25
Header netadapter.h (include netadaptercx.h)
IRQL <= DISPATCH_LEVEL

See also

NET_ADAPTER_RX_CAPABILITIES