]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/commitdiff
Update to EVTCHN version 3
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 3 Feb 2015 14:02:02 +0000 (14:02 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 3 Feb 2015 14:02:02 +0000 (14:02 +0000)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
include/evtchn_interface.h
src/xenvif/receiver.c
src/xenvif/transmitter.c

index 4ab2b2851bbf43b891db699d2bc2dee6d11c1832..1bc456a7d82bf5655c985ee261b66ca8832b1843 100644 (file)
@@ -126,15 +126,21 @@ typedef NTSTATUS
     IN  ULONG                   Cpu
     );
 
+typedef BOOLEAN
+(*XENBUS_EVTCHN_UNMASK_V1)(
+    IN  PINTERFACE              Interface,
+    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
+    IN  BOOLEAN                 InCallback
+    );
+
 /*! \typedef XENBUS_EVTCHN_UNMASK
     \brief Unmask an event channel
 
     \param Interface The interface header
     \param Channel The channel handle
     \param InCallback Set to TRUE if this method is invoked in context of the channel callback
-    \return TRUE if there was an event pending at the point of unmask, FALSE otherwise
 */
-typedef BOOLEAN
+typedef VOID
 (*XENBUS_EVTCHN_UNMASK)(
     IN  PINTERFACE              Interface,
     IN  PXENBUS_EVTCHN_CHANNEL  Channel,
@@ -203,7 +209,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V1 {
     XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
     XENBUS_EVTCHN_OPEN      EvtchnOpen;
-    XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
+    XENBUS_EVTCHN_UNMASK_V1 EvtchnUnmaskVersion1;
     XENBUS_EVTCHN_SEND      EvtchnSend;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
     XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
@@ -215,6 +221,23 @@ struct _XENBUS_EVTCHN_INTERFACE_V1 {
     \ingroup interfaces
 */
 struct _XENBUS_EVTCHN_INTERFACE_V2 {
+    INTERFACE               Interface;
+    XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
+    XENBUS_EVTCHN_RELEASE   EvtchnRelease;
+    XENBUS_EVTCHN_OPEN      EvtchnOpen;
+    XENBUS_EVTCHN_BIND      EvtchnBind;
+    XENBUS_EVTCHN_UNMASK_V1 EvtchnUnmaskVersion1;
+    XENBUS_EVTCHN_SEND      EvtchnSend;
+    XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
+    XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
+    XENBUS_EVTCHN_CLOSE     EvtchnClose;
+};
+
+/*! \struct _XENBUS_EVTCHN_INTERFACE_V3
+    \brief EVTCHN interface version 3
+    \ingroup interfaces
+*/
+struct _XENBUS_EVTCHN_INTERFACE_V3 {
     INTERFACE               Interface;
     XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
@@ -227,7 +250,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V2 {
     XENBUS_EVTCHN_CLOSE     EvtchnClose;
 };
 
-typedef struct _XENBUS_EVTCHN_INTERFACE_V2 XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVTCHN_INTERFACE;
+typedef struct _XENBUS_EVTCHN_INTERFACE_V3 XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVTCHN_INTERFACE;
 
 /*! \def XENBUS_EVTCHN
     \brief Macro at assist in method invocation
@@ -238,7 +261,7 @@ typedef struct _XENBUS_EVTCHN_INTERFACE_V2 XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVT
 #endif  // _WINDLL
 
 #define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 1
-#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 2
+#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 3
 
 #endif  // _XENBUS_EVTCHN_INTERFACE_H
 
index e64c94299bf55f02b27dba0f380fd25973b8a865..da869d97ae9871d34e37d2167b75f0ddbe9b8864 100644 (file)
@@ -1852,24 +1852,22 @@ __ReceiverRingNotify(
     __ReceiverRingReleaseLock(Ring);
 }
 
-static FORCEINLINE BOOLEAN
+static FORCEINLINE VOID
 __ReceiverRingUnmask(
     IN  PXENVIF_RECEIVER_RING   Ring
     )
 {
     PXENVIF_RECEIVER            Receiver;
-    BOOLEAN                     Pending;
 
-    Receiver = Ring->Receiver;
+    if (!Ring->Connected)
+        return;
 
-    Pending = (Ring->Connected) ?
-              XENBUS_EVTCHN(Unmask,
-                            &Receiver->EvtchnInterface,
-                            Ring->Channel,
-                            FALSE) :
-              FALSE;
+    Receiver = Ring->Receiver;
 
-    return Pending;
+    XENBUS_EVTCHN(Unmask,
+                  &Receiver->EvtchnInterface,
+                  Ring->Channel,
+                  FALSE);
 }
 
 __drv_functionClass(KDEFERRED_ROUTINE)
@@ -1888,7 +1886,6 @@ ReceiverRingDpc(
     PXENVIF_RECEIVER_RING   Ring = Context;
     PXENVIF_RECEIVER        Receiver;
     PXENVIF_FRONTEND        Frontend;
-    BOOLEAN                 Pending;
 
     UNREFERENCED_PARAMETER(Dpc);
     UNREFERENCED_PARAMETER(Argument1);
@@ -1899,19 +1896,17 @@ ReceiverRingDpc(
     Receiver = Ring->Receiver;
     Frontend = Receiver->Frontend;
 
-    do {
-        if (Ring->Enabled) {
-            if (Receiver->Split) {
-                __ReceiverRingNotify(Ring);
-            } else {
-                TransmitterRingNotify(FrontendGetTransmitter(Frontend),
-                                      Ring->Index);
-                __ReceiverRingNotify(Ring);
-            }
+    if (Ring->Enabled) {
+        if (Receiver->Split) {
+            __ReceiverRingNotify(Ring);
+        } else {
+            TransmitterRingNotify(FrontendGetTransmitter(Frontend),
+                                  Ring->Index);
+            __ReceiverRingNotify(Ring);
         }
+    }
 
-        Pending = __ReceiverRingUnmask(Ring);
-    } while (Pending);
+    __ReceiverRingUnmask(Ring);
 }
 
 KSERVICE_ROUTINE    ReceiverRingEvtchnCallback;
@@ -2161,7 +2156,6 @@ __ReceiverRingConnect(
     PXENVIF_RECEIVER            Receiver;
     PXENVIF_FRONTEND            Frontend;
     PFN_NUMBER                  Pfn;
-    BOOLEAN                     Pending;
     CHAR                        Name[MAXNAMELEN];
     NTSTATUS                    status;
 
@@ -2221,15 +2215,10 @@ __ReceiverRingConnect(
                                 (CCHAR)Ring->Index);
     }
 
-    Pending = XENBUS_EVTCHN(Unmask,
-                            &Receiver->EvtchnInterface,
-                            Ring->Channel,
-                            FALSE);
-
-    if (Pending)
-        XENBUS_EVTCHN(Trigger,
-                      &Receiver->EvtchnInterface,
-                      Ring->Channel);
+    XENBUS_EVTCHN(Unmask,
+                  &Receiver->EvtchnInterface,
+                  Ring->Channel,
+                  FALSE);
 
     Ring->Connected = TRUE;
 
index bdf1b442363ead5c123549ba20c4d28e668d3cd5..28b26130a8d25d1f31bbbf23da4b78ceede0b068 100644 (file)
@@ -2601,24 +2601,22 @@ __TransmitterRingNotify(
     __TransmitterRingReleaseLock(Ring);
 }
 
-static FORCEINLINE BOOLEAN
+static FORCEINLINE VOID
 __TransmitterRingUnmask(
     IN  PXENVIF_TRANSMITTER_RING    Ring
     )
 {
     PXENVIF_TRANSMITTER             Transmitter;
-    BOOLEAN                         Pending;
 
-    Transmitter = Ring->Transmitter;
+    if (!Ring->Connected)
+        return;
 
-    Pending = (Ring->Connected) ?
-              XENBUS_EVTCHN(Unmask,
-                            &Transmitter->EvtchnInterface,
-                            Ring->Channel,
-                            FALSE) :
-              FALSE;
+    Transmitter = Ring->Transmitter;
 
-    return Pending;
+    XENBUS_EVTCHN(Unmask,
+                  &Transmitter->EvtchnInterface,
+                  Ring->Channel,
+                  FALSE);
 }
 
 __drv_functionClass(KDEFERRED_ROUTINE)
@@ -2636,7 +2634,6 @@ TransmitterRingDpc(
 {
     PXENVIF_TRANSMITTER_RING    Ring = Context;
     PXENVIF_TRANSMITTER         Transmitter;
-    BOOLEAN                     Pending;
 
     UNREFERENCED_PARAMETER(Dpc);
     UNREFERENCED_PARAMETER(Argument1);
@@ -2646,14 +2643,12 @@ TransmitterRingDpc(
 
     Transmitter = Ring->Transmitter;
 
-    do {
-        if (Ring->Enabled) {
-            ASSERT(Transmitter->Split);
-            __TransmitterRingNotify(Ring);
-        }
+    if (Ring->Enabled) {
+        ASSERT(Transmitter->Split);
+        __TransmitterRingNotify(Ring);
+    }
 
-        Pending = __TransmitterRingUnmask(Ring);
-    } while (Pending);
+    __TransmitterRingUnmask(Ring);
 }
 
 KSERVICE_ROUTINE    TransmitterRingEvtchnCallback;
@@ -2995,7 +2990,6 @@ __TransmitterRingConnect(
     PXENVIF_TRANSMITTER             Transmitter;
     PXENVIF_FRONTEND                Frontend;
     PFN_NUMBER                      Pfn;
-    BOOLEAN                         Pending;
     CHAR                            Name[MAXNAMELEN];
     NTSTATUS                        status;
 
@@ -3058,15 +3052,10 @@ __TransmitterRingConnect(
                                     (CCHAR)Ring->Index);
         }
 
-        Pending = XENBUS_EVTCHN(Unmask,
-                                &Transmitter->EvtchnInterface,
-                                Ring->Channel,
-                                FALSE);
-
-        if (Pending)
-            XENBUS_EVTCHN(Trigger,
-                          &Transmitter->EvtchnInterface,
-                          Ring->Channel);
+        XENBUS_EVTCHN(Unmask,
+                      &Transmitter->EvtchnInterface,
+                      Ring->Channel,
+                      FALSE);
     }
 
     status = XENBUS_DEBUG(Register,