[ovs-dev] [PATCH 6/9 v2] datapath-windows: Check for device operation in OvsGetDpCmdHandler

Nithin Raju nithin at vmware.com
Fri Aug 29 08:15:18 UTC 2014


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 <nithin at vmware.com>
Acked-by: Ankur Sharma <ankursharma at vmware.com>
Acked-by: Samuel Ghinet <sghinet at cloudbasesolutions.com>
---
 datapath-windows/ovsext/Datapath.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c
index 9a08556..417f463 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.7.4.1




More information about the dev mailing list