[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 3/5] Add Unplug v2 (REV_0900000A)
If NICs have not been unplugged, do not start PV network devices and trigger a required reboot. This is to avoid the upgrade case where both emulated and PV devices could be present, due to a 'revert to emulated' policy and emulated NICs not currently getting IP configurations so the HasAlias value is not determined correctly. Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx> --- include/unplug_interface.h | 30 ++++++++++++++++++++++++++++-- src/xenvif.inf | 6 +++--- src/xenvif/pdo.c | 23 ++++++++++++++++++++++- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/include/unplug_interface.h b/include/unplug_interface.h index e465e2e..ca55027 100644 --- a/include/unplug_interface.h +++ b/include/unplug_interface.h @@ -85,6 +85,20 @@ typedef VOID IN BOOLEAN Make ); +/*! \typedef XENBUS_UNPLUG_WASREQUESTED + \brief Has a type of emulated device been unplugged + + \param Interface The interface header + \param Type The type of device + + \return TRUE The type of device has been unplugged this boot. +*/ +typedef BOOLEAN +(*XENBUS_UNPLUG_WASREQUESTED)( + IN PINTERFACE Interface, + IN XENBUS_UNPLUG_DEVICE_TYPE Type + ); + // {73db6517-3d06-4937-989f-199b7501e229} DEFINE_GUID(GUID_XENBUS_UNPLUG_INTERFACE, 0x73db6517, 0x3d06, 0x4937, 0x98, 0x9f, 0x19, 0x9b, 0x75, 0x01, 0xe2, 0x29); @@ -100,7 +114,19 @@ struct _XENBUS_UNPLUG_INTERFACE_V1 { XENBUS_UNPLUG_REQUEST UnplugRequest; }; -typedef struct _XENBUS_UNPLUG_INTERFACE_V1 XENBUS_UNPLUG_INTERFACE, *PXENBUS_UNPLUG_INTERFACE; +/*! \struct _XENBUS_UNPLUG_INTERFACE_V2 + \brief UNPLUG interface version 2 + \ingroup interfaces +*/ +struct _XENBUS_UNPLUG_INTERFACE_V2 { + INTERFACE Interface; + XENBUS_UNPLUG_ACQUIRE UnplugAcquire; + XENBUS_UNPLUG_RELEASE UnplugRelease; + XENBUS_UNPLUG_REQUEST UnplugRequest; + XENBUS_UNPLUG_WASREQUESTED UnplugWasRequested; +}; + +typedef struct _XENBUS_UNPLUG_INTERFACE_V2 XENBUS_UNPLUG_INTERFACE, *PXENBUS_UNPLUG_INTERFACE; /*! \def XENBUS_UNPLUG \brief Macro at assist in method invocation @@ -111,6 +137,6 @@ typedef struct _XENBUS_UNPLUG_INTERFACE_V1 XENBUS_UNPLUG_INTERFACE, *PXENBUS_UNP #endif // _WINDLL #define XENBUS_UNPLUG_INTERFACE_VERSION_MIN 1 -#define XENBUS_UNPLUG_INTERFACE_VERSION_MAX 1 +#define XENBUS_UNPLUG_INTERFACE_VERSION_MAX 2 #endif // _XENBUS_UNPLUG_INTERFACE_H diff --git a/src/xenvif.inf b/src/xenvif.inf index 4b5c9f7..3db059d 100644 --- a/src/xenvif.inf +++ b/src/xenvif.inf @@ -60,9 +60,9 @@ xenvif_coinst_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dll ; DisplayName Section DeviceID ; ----------- ------- -------- -%XenVifName% =XenVif_Inst, XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VIF&REV_09000009 -%XenVifName% =XenVif_Inst, XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VIF&REV_09000009 -%XenVifName% =XenVif_Inst, XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VIF&REV_09000009 +%XenVifName% =XenVif_Inst, XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VIF&REV_0900000A +%XenVifName% =XenVif_Inst, XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VIF&REV_0900000A +%XenVifName% =XenVif_Inst, XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VIF&REV_0900000A [XenVif_Inst] CopyFiles=XenVif_Copyfiles diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c index 2e47be2..3ce6e20 100644 --- a/src/xenvif/pdo.c +++ b/src/xenvif/pdo.c @@ -1247,6 +1247,27 @@ PdoUnplugRequest( XENBUS_UNPLUG(Release, &Pdo->UnplugInterface); } +static BOOLEAN +PdoUnplugRequested( + IN PXENVIF_PDO Pdo + ) +{ + BOOLEAN State; + NTSTATUS status; + + status = XENBUS_UNPLUG(Acquire, &Pdo->UnplugInterface); + if (!NT_SUCCESS(status)) + return FALSE; + + State = XENBUS_UNPLUG(WasRequested, + &Pdo->UnplugInterface, + XENBUS_UNPLUG_DEVICE_TYPE_NICS); + + XENBUS_UNPLUG(Release, &Pdo->UnplugInterface); + + return State; +} + static DECLSPEC_NOINLINE NTSTATUS PdoStartDevice( IN PXENVIF_PDO Pdo, @@ -1343,7 +1364,7 @@ PdoStartDevice( break; } - if (Pdo->HasAlias) { + if (Pdo->HasAlias || !PdoUnplugRequested(Pdo)) { PdoUnplugRequest(Pdo, TRUE); status = STATUS_PNP_REBOOT_REQUIRED; -- 2.41.0.windows.3
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |