datapath-windows: Implement missed packet kernel-to-user mode notification.
authorEitan Eliahu <eliahue@vmware.com>
Tue, 21 Oct 2014 01:23:00 +0000 (18:23 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 20 Oct 2014 22:49:39 +0000 (15:49 -0700)
An I/O request is queued in Kernel to be completed upon a packet mismatch.
This mechanism is similar to the port state notification.
Access to instance data should be under a lock (TBD)

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
datapath-windows/include/OvsDpInterfaceExt.h
datapath-windows/ovsext/Datapath.c

index 953c8ba..cea9e41 100644 (file)
@@ -77,6 +77,7 @@
 enum ovs_win_control_cmd {
     OVS_CTRL_CMD_WIN_GET_PID,
     OVS_CTRL_CMD_WIN_PEND_REQ,
+    OVS_CTRL_CMD_WIN_PEND_PACKET_REQ,
     OVS_CTRL_CMD_MC_SUBSCRIBE_REQ,
     OVS_CTRL_CMD_PACKET_SUBSCRIBE_REQ,
 
index fae824a..79e7c7d 100644 (file)
@@ -91,6 +91,7 @@ typedef struct _NETLINK_FAMILY {
 /* Handlers for the various netlink commands. */
 static NetlinkCmdHandler OvsGetPidCmdHandler,
                          OvsPendEventCmdHandler,
+                         OvsPendPacketCmdHandler,
                          OvsSubscribeEventCmdHandler,
                          OvsSubscribePacketCmdHandler,
                          OvsReadEventCmdHandler,
@@ -131,6 +132,11 @@ NETLINK_CMD nlControlFamilyCmdOps[] = {
       .supportedDevOp = OVS_WRITE_DEV_OP,
       .validateDpIndex = TRUE,
     },
+    { .cmd = OVS_CTRL_CMD_WIN_PEND_PACKET_REQ,
+      .handler = OvsPendPacketCmdHandler,
+      .supportedDevOp = OVS_WRITE_DEV_OP,
+      .validateDpIndex = TRUE,
+    },
     { .cmd = OVS_CTRL_CMD_MC_SUBSCRIBE_REQ,
       .handler = OvsSubscribeEventCmdHandler,
       .supportedDevOp = OVS_WRITE_DEV_OP,
@@ -2399,4 +2405,28 @@ OvsSubscribePacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
 done:
     return status;
 }
+
+/*
+ * --------------------------------------------------------------------------
+ * Handler for queueing an IRP used for missed packet notification. The IRP is
+ * completed when a packet received and mismatched. STATUS_PENDING is returned
+ * on success. User mode keep a pending IRP at all times.
+ * --------------------------------------------------------------------------
+ */
+static NTSTATUS
+OvsPendPacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
+                       UINT32 *replyLen)
+{
+    UNREFERENCED_PARAMETER(replyLen);
+
+    POVS_OPEN_INSTANCE instance =
+        (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance;
+
+    /*
+     * XXX access to packet queue must be through acquiring a lock as user mode
+     * could unsubscribe and the instnace will be freed.
+     */
+    return OvsWaitDpIoctl(usrParamsCtx->irp, instance->fileObject);
+}
+
 #endif /* OVS_USE_NL_INTERFACE */