Hyper-V Extensible Switch Forwarding Context Data Types

The NET_BUFFER_LIST structure for each packet that traverses the Hyper-V extensible switch data path contains out-of-band (OOB) data. This data specifies the source port from where the packet originated, as well as one or more destination ports for packet delivery. This OOB data is known as the extensible switch forwarding context.

The following data types have been declared to access the extensible switch forwarding context within a packet's NET_BUFFER_LIST structure:

NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO
This is a 64-bit union that contains the forwarding characteristics of a packet. This data includes the identifiers for the source port and network adapter connection from which the packet originated. This data also includes the number of unused elements that are available in the destination port array.

The extensible switch extension can access this data by using the NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL macro.

NDIS_SWITCH_FORWARDING_DESTINATION_ARRAY
This structure defines the destination port array for the packet. Each element in this array is formatted as an NDIS_SWITCH_PORT_DESTINATION structure.

The NDIS_SWITCH_FORWARDING_DESTINATION_ARRAY structure contains members that specify the current number of the total number of elements as well as the number of used elements in the array.

The extensible switch extension can obtain this array by calling the GetNetBufferListDestinations function. If the driver adds or modifies elements in the array for a packet with multiple destination ports, it must call the UpdateNetBufferListDestinations function. This function commits those changes to the destination port array in the packet's forwarding context.

Note  To commit changes to a packet with only one destination port, it is more efficient for the driver to call the AddNetBufferListDestination function.

NDIS_SWITCH_PORT_DESTINATION
This structure defines a destination port for the packet. For packets with a single destination port, there is only one NDIS_SWITCH_PORT_DESTINATION element in the destination port array. For packets with multiple destination ports, there are one or more of these elements in the array.

After the extensible switch extension has called GetNetBufferListDestinations to obtain the packet's destination port array, it can access individual elements in the array by using the NDIS_SWITCH_PORT_DESTINATION_AT_ARRAY_INDEX macro.