Restoring Hyper-V Extensible Switch Run-Time Data

When a Hyper-V child partition that has a network adapter connection to an extensible switch port is resumed from a pause, the Hyper-V extensible switch interface is notified. This causes the protocol edge of the extensible switch to issue an object identifier (OID) set request of OID_SWITCH_NIC_RESTORE down the extensible switch driver stack. When an extension receives this OID request, it can restore its run-time data for the extensible switch port that is used by the child partition.

The InformationBuffer member of the NDIS_OID_REQUEST structure for the OID_SWITCH_NIC_RESTORE request contains a pointer to an NDIS_SWITCH_NIC_SAVE_STATE structure. This structure is allocated by the protocol edge of the extensible switch.

When it receives the OID set request of OID_SWITCH_NIC_RESTORE, the extensible switch extension must first determine whether it owns the run-time data. The extension does this by comparing the value of the ExtensionId member of the NDIS_SWITCH_NIC_SAVE_STATE structure to the GUID value that the extension uses to identify itself.

If the extension owns the run-time data for an extensible switch NIC, it restores this data in the following way:

  1. The extension copies the run-time data in the SaveData member to driver-allocated storage.

    Note The value of the PortId member of the NDIS_SWITCH_NIC_SAVE_STATE structure may be different from the PortId value at the time that the run-time data was saved. This can occur if run-time data was saved during a Live Migration from one host to another. However, the configuration of the extensible switch NIC is retained during the Live Migration. This enables the extension to restore the run-time data to the extensible switch NIC by using the new PortId value.

  2. The extension completes the OID set request with NDIS_STATUS_SUCCESS.

If the extension does not own the specified run-time data to save, the extension calls NdisFOidRequest. This forwards the OID set request to underlying drivers in the extensible switch driver stack. In this case, the extension must not modify the NDIS_SWITCH_NIC_SAVE_STATE structure that is associated with the OID request. For more information on how to forward OID requests, see Filtering OID Requests in an NDIS Filter Driver.

If the OID set request of OID_SWITCH_NIC_RESTORE is completed with NDIS_STATUS_SUCCESS, the protocol edge of the extensible switch issues another OID set request. When it receives this new OID set request, the extension can do one of the following:

  • If it owns the run-time data in the new OID request, the extension restores the additional run-time data within the NDIS_SWITCH_NIC_SAVE_STATE structure. The extension then completes the OID request with NDIS_STATUS_SUCCESS.

  • If it does not own the run-time data in the new OID request, the extension calls NdisFOidRequest to forward this OID set request to underlying drivers.

OID_SWITCH_NIC_RESTORE_COMPLETE
The extensible switch interface signals the protocol edge of the extensible switch to issue this OID at the completion of the restore operation of run-time data for an extensible switchnetwork adapter.

This OID request notifies the extension that the restore operation has completed only for a specified extensible switch NIC.

For more information about this OID request, see OID_SWITCH_NIC_RESTORE_COMPLETE.

Note If the OID_SWITCH_NIC_RESTORE set request is received by the miniport edge of the extensible switch, it completes the OID request with NDIS_STATUS_SUCCESS. This notifies the protocol edge of the extensible switch that no extension owns the run-time data. If this happens, the extensible switch interface logs an event that documents the ExtensionId and PortId member values for the extension that originally saved the run-time port data.