[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH] Update to EVTCHN version 3



Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 include/evtchn_interface.h | 33 ++++++++++++++++++++++++-----
 src/xenvif/receiver.c      | 53 ++++++++++++++++++----------------------------
 src/xenvif/transmitter.c   | 45 +++++++++++++++------------------------
 3 files changed, 66 insertions(+), 65 deletions(-)

diff --git a/include/evtchn_interface.h b/include/evtchn_interface.h
index 4ab2b28..1bc456a 100644
--- a/include/evtchn_interface.h
+++ b/include/evtchn_interface.h
@@ -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;
@@ -220,6 +226,23 @@ struct _XENBUS_EVTCHN_INTERFACE_V2 {
     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;
+    XENBUS_EVTCHN_OPEN      EvtchnOpen;
+    XENBUS_EVTCHN_BIND      EvtchnBind;
     XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
     XENBUS_EVTCHN_SEND      EvtchnSend;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
@@ -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
 
diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index e64c942..da869d9 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -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;
 
diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index bdf1b44..28b2613 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -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,
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.