Share via


Accessing Per-Packet Information (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.

The TCP/IP transport and a miniport driver use a packet's per-packet information to pass information about task offload operations to each other. Per-packet information is out-of-band data specified by an NDIS_PACKET_EXTENSIONstructure. This structure is defined as:

typedef struct _NDIS_PACKET_EXTENSION
{
    PVOID  NdisPacketInfo[MaxPerPacketInfo];
} NDIS_PACKET_EXTENSION, *PNDIS_PACKET_EXTENSION;

Every packet descriptor allocated with NdisAllocatePacket has an associated NDIS_PACKET_EXTENSION structure. This structure contains an array of pointers (PVOIDs), each of which points to or contains a particular type of per-packet information that is associated with the packet descriptor.

To access per-packet information, drivers should use the NDIS_PER_PACKET_INFO_FROM_PACKET macro. The NDIS_PER_PACKET_INFO_FROM_PACKET macro is defined as:

PVOID
    NDIS_PER_PACKET_INFO_FROM_PACKET(
        IN PNDIS_PACKET  Packet,
        IN NDIS_PER_PACKET_INFO InfoType
        );

This macro returns a pointer that points to or contains the specified type of per-packet information for a specified packet. The InfoType values that pertain to offload tasks are TcpIpCheckSumPacketInfo, IpSecPacketInfo, and TcpLargeSendPacketInfo. These values are the same as the index values (described earlier) that return pointers or values from the NdisPacketInfo array in the NDIS_PACKET_EXTENSION structure. For example, if the specified InfoTypeis TcpIpCheckSumPacketInfo, the macro returns an NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure that is associated with the specified packet descriptor. A driver can call this macro once for each type of per-packet information that it must access.

Alternatively, drivers can use the NDIS_PACKET_EXTENSION_FROM_PACKETmacro to access per-packet information. The NDIS_PACKET_EXTENSION_FROM_PACKET macro is defined as:

PNDIS_PACKET_EXTENSION
    NDIS_PACKET_EXTENSION_FROM_PACKET(
        IN PNDIS_PACKET  Packet
        );

This macro returns a pointer to the NDIS_PACKET_EXTENSION structure that is associated with the specified packet descriptor. After obtaining the pointer to the NDIS_PACKET_EXTENSION structure, the driver can use the appropriate array index to access a particular type of per-packet information. The following index values pertain to offload tasks:

  • TcpIpCheckSumPacketInfo
    Indexes an NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure (not a pointer to the structure). This structure specifies per-packet information for checksum operations that are offloaded to a miniport driver.

  • IpSecPacketInfo
    Indexes a pointer that points to an NDIS_IPSEC_PACKET_INFO structure. This structure specifies per-packet information for IP security operations that are offloaded to a miniport driver.

  • TcpLargeSendPacketInfo
    Indexes a ULONG value (not a pointer to the ULONG value) that is used to offload the segmentation of large TCP packets.

 

 

Send comments about this topic to Microsoft