[ovs-dev] [PATCH 1/4] datapath-windows: Data structures and functions for dump state

Ankur Sharma ankursharma at vmware.com
Thu Aug 28 23:16:41 UTC 2014


Hi NIthin,

Changes are fine.
One very minor comment would be that we should improve the formatting of InitUserDumpState function. But this can be handled later, we are good for checkin.

Acked-by: Ankur Sharma <ankursharma at vmware.com>


Regards,
Ankur
________________________________________
From: dev <dev-bounces at openvswitch.org> on behalf of Nithin Raju <nithin at vmware.com>
Sent: Thursday, August 28, 2014 10:59 AM
To: dev at openvswitch.org
Subject: [ovs-dev] [PATCH 1/4] datapath-windows: Data structures and    functions for dump state

Signed-off-by: Nithin Raju <nithin at vmware.com>
---
 datapath-windows/ovsext/Datapath.h |   54 ++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/datapath-windows/ovsext/Datapath.h b/datapath-windows/ovsext/Datapath.h
index 6d8a6db..0b303a2 100644
--- a/datapath-windows/ovsext/Datapath.h
+++ b/datapath-windows/ovsext/Datapath.h
@@ -28,6 +28,16 @@
 #ifndef __OVS_DATAPATH_H_
 #define __OVS_DATAPATH_H_ 1

+/*
+ * Structure of any message passed between userspace and kernel.
+ */
+typedef struct _OVS_MESSAGE {
+    NL_MSG_HDR nlMsg;
+    GENL_MSG_HDR genlMsg;
+    OVS_HDR ovsHdr;
+    /* Variable length nl_attrs follow. */
+} OVS_MESSAGE, *POVS_MESSAGE;
+
 typedef struct _OVS_DEVICE_EXTENSION {
     INT numberOpenInstance;
     INT pidCount;
@@ -57,6 +67,12 @@ typedef struct _OVS_OPEN_INSTANCE {
      * restriction might go away as the userspace code gets implemented.
      */
     INT inUse;
+
+    struct {
+        POVS_MESSAGE ovsMsg;    /* OVS message passed during dump start. */
+        UINT32 index[8];        /* markers to continue dump from. One or more
+                                 * of them may be used. */
+    } dumpState;                /* data to support dump commands. */
 } OVS_OPEN_INSTANCE, *POVS_OPEN_INSTANCE;

 NDIS_STATUS OvsCreateDeviceObject(NDIS_HANDLE ovsExtDriverHandle);
@@ -67,15 +83,35 @@ POVS_OPEN_INSTANCE OvsGetOpenInstance(PFILE_OBJECT fileObject,

 NTSTATUS OvsCompleteIrpRequest(PIRP irp, ULONG_PTR infoPtr, NTSTATUS status);

-/*
- * Structure of any message passed between userspace and kernel.
- */
-typedef struct _OVS_MESSAGE {
-    NL_MSG_HDR nlMsg;
-    GENL_MSG_HDR genlMsg;
-    struct ovs_header ovsHdr;
-    /* Variable length nl_attrs follow. */
-} OVS_MESSAGE, *POVS_MESSAGE;
+static __inline NTSTATUS
+InitUserDumpState(POVS_OPEN_INSTANCE instance,
+                  POVS_MESSAGE ovsMsg)
+{
+    /* Clear the dumpState from a previous dump sequence. */
+    ASSERT(instance->dumpState.ovsMsg == NULL);
+    ASSERT(ovsMsg);
+
+    instance->dumpState.ovsMsg = (POVS_MESSAGE) OvsAllocateMemory(
+        sizeof *instance->dumpState.ovsMsg);
+    if (instance->dumpState.ovsMsg == NULL) {
+        return STATUS_NO_MEMORY;
+    }
+    RtlCopyMemory(instance->dumpState.ovsMsg, ovsMsg,
+                  sizeof *instance->dumpState.ovsMsg);
+    RtlZeroMemory(instance->dumpState.index,
+                  sizeof instance->dumpState.index);
+
+    return STATUS_SUCCESS;
+}
+
+static __inline VOID
+FreeUserDumpState(POVS_OPEN_INSTANCE instance)
+{
+    if (instance->dumpState.ovsMsg != NULL) {
+        OvsFreeMemory(instance->dumpState.ovsMsg);
+        RtlZeroMemory(&instance->dumpState, sizeof instance->dumpState);
+    }
+}

 #endif /* __OVS_DATAPATH_H_ */

--
1.7.4.1

_______________________________________________
dev mailing list
dev at openvswitch.org
https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=f6EhnZ0ORGZNt5QbYmRaOxfWfx%2Bqd3KEiPf3%2FYaollU%3D%0A&m=YVxCoK2Q91PVZS3O3myXrjZksyBnazfIgjQDQY4r1fE%3D%0A&s=3bfb18dbb7ba2f2bd701c277bb9ede33b9baa53302ec5be45735f605e1e3a4a8


More information about the dev mailing list