A review comment was that we should check for device operation
rather than whether the dump context while deciding if the operation
is a dump start or a dump continue.

Signed-off-by: Nithin Raju <nit...@vmware.com>
Signed-off-by: Ankur Sharma <ankursha...@vmware.com>
Acked-by: Ankur Sharma <ankursha...@vmware.com>
---
Please attribute this to Nithin Raju <nit...@vmware.com>
---
 datapath-windows/ovsext/Datapath.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/datapath-windows/ovsext/Datapath.c 
b/datapath-windows/ovsext/Datapath.c
index 60849c8..7103764 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -827,14 +827,9 @@ OvsGetDpCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
     POVS_OPEN_INSTANCE instance =
         (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance;
 
-    if (instance->dumpState.ovsMsg == NULL) {
+    if (usrParamsCtx->devOp == OVS_WRITE_DEV_OP) {
         NTSTATUS status;
 
-        if (usrParamsCtx->devOp != OVS_WRITE_DEV_OP) {
-            ASSERT(FALSE);
-            return STATUS_INVALID_DEVICE_STATE;
-        }
-
         /* input buffer has been validated while validating write dev op. */
         ASSERT(msgIn != NULL && usrParamsCtx->inputLength >= sizeof *msgIn);
 
@@ -844,12 +839,21 @@ OvsGetDpCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
         }
         /* XXX: Handle other NLM_F_* flags in the future. */
 
+        /*
+         * This operation should be setting up the dump state. If there's any
+         * previous state, clear it up so as to set it up afresh.
+         */
+        if (instance->dumpState.ovsMsg != NULL) {
+            FreeUserDumpState(instance);
+        }
         status = InitUserDumpState(instance, msgIn);
         if (status != STATUS_SUCCESS) {
             return STATUS_NO_MEMORY;
         }
     } else {
-        if (usrParamsCtx->devOp != OVS_READ_DEV_OP) {
+        ASSERT(usrParamsCtx->devOp == OVS_READ_DEV_OP);
+
+        if (instance->dumpState.ovsMsg == NULL) {
             ASSERT(FALSE);
             return STATUS_INVALID_DEVICE_STATE;
         }
-- 
1.8.3.2

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to