[ovs-dev] [PATCH] datapath-windows: Missed packet, Kernel to User mode notification
Alin Serdean
aserdean at cloudbasesolutions.com
Mon Oct 20 21:47:33 UTC 2014
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
-----Mesaj original-----
De la: dev [mailto:dev-bounces at openvswitch.org] În numele Eitan Eliahu
Trimis: Tuesday, October 21, 2014 4:23 AM
Către: dev at openvswitch.org
Subiect: [ovs-dev] [PATCH] datapath-windows: Missed packet, Kernel to User mode notification
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 at vmware.com>
---
datapath-windows/include/OvsDpInterfaceExt.h | 1 +
datapath-windows/ovsext/Datapath.c | 30 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/datapath-windows/include/OvsDpInterfaceExt.h b/datapath-windows/include/OvsDpInterfaceExt.h
index 953c8ba..cea9e41 100644
--- a/datapath-windows/include/OvsDpInterfaceExt.h
+++ b/datapath-windows/include/OvsDpInterfaceExt.h
@@ -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,
diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c
index fae824a..79e7c7d 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -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 */
--
1.9.4.msysgit.0
_______________________________________________
dev mailing list
dev at openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list