Share via


Referencing Offloaded State Through an Intermediate Driver

[The TCP chimney offload feature is deprecated and should not be used.]

For each state object that is offloaded by the host stack to an intermediate driver's MiniportInitiateOffload function, the intermediate driver must do the following:

  • Store the value of NdisOffloadHandle in the NDIS_MINIPORT_OFFLOAD_BLOCK_LIST structure that is passed to the intermediate driver's MiniportInitiateOffload function.

  • Initialize and store an NDIS_OFFLOAD_HANDLE structure that references the intermediate driver's context for the offloaded state object.

The intermediate driver stores both the value of NdisOffloadHandle and the NDIS_OFFLOAD_HANDLE structure in its context for the offloaded state object. This context, called an IM offload entry, is valid for the duration of the offload of the state object.

The following figure shows how an offloaded state object is referenced through an intermediate driver.

diagram illustrating how an offloaded state object is referenced through an intermediate driver

When offloading a state object, the host stack supplies a pointer to an NDIS_OFFLOAD_HANDLE structure. This pointer references the host stack's Transmission Control Block (TCB). The NDIS_OFFLOAD_HANDLE structure contains a pointer in the MiniportOffloadContext member that references a memory location into which the intermediate driver writes a PVOID value before completing the initiate offload operation. This PVOID value references the intermediate driver's IM offload entry for the offloaded state object.

The intermediate driver stores the pointer to the host stack's NDIS_OFFLOAD_HANDLE structure, which was passed in as the value of NdisOffloadHandle, in its IM offload entry for the offloaded state object. Before offloading the state object to the underlying offload target, the intermediate driver initializes an NDIS_OFFLOAD_HANDLE structure of its own and stores this structure in its IM offload entry.

When offloading the state object to the underlying offload target, the intermediate driver supplies a pointer to its own NDIS_OFFLOAD_HANDLE structure. This pointer references the intermediate driver's IM offload entry for the offloaded state object. The NDIS_OFFLOAD_HANDLE structure contains a pointer in the MiniportOffloadContext member that references a memory location into which the offload target writes a PVOID value before completing the initiate offload operation. This PVOID value references the intermediate driver's miniport offload context for the offloaded state object.

The offload target stores the pointer to the intermediate driver's NDIS_OFFLOAD_HANDLE structure, which was passed in as the value of NdisOffloadHandle, in its miniport offload context for the offloaded state object.

When calling a state-manipulation function (NdisInitiateOffload, NdisInvalidateOffload, NdisQueryOffload, NdisTerminateOffload, or NdisUpdateOffload), the host stack or intermediate driver supplies a pointer to its NDIS_OFFLOAD_HANDLE structure for the state object. The host stack or intermediate driver supplies this pointer in the OffloadHandle member of the NDIS_PROTOCOL_OFFLOAD_BLOCK_LIST structure that it passes to the state-manipulation function. The underlying driver or offload target receives this pointer in the NdisOffloadHandle member in the NDIS_MINIPORT_OFFLOAD_BLOCK_LIST structure that is passed to its corresponding state-manipulation function ( MiniportInitiateOffload, MiniportInvalidateOffload, MiniportQueryOffload, MiniportTerminateOffload, or MiniportUpdateOffload).

When making an indication on an offloaded state object (that is, when referencing the offloaded state object in a call to the NdisTcpOffloadEventHandler function or the NdisTcpOffloadReceiveHandler function), the offload target or intermediate driver supplies its stored handle for the offloaded state object. The overlying driver receives this pointer in the OffloadHandle member of the NDIS_PROTOCOL_OFFLOAD_BLOCK_LIST structure that is passed to its corresponding indication function ( ProtocolTcpOffloadEvent or ProtocolTcpOffloadReceiveIndicate).