[ovs-dev] [PATCH 6/9 v3] datapath-windows: Check for device operation in OvsGetDpCmdHandler
Ankur Sharma
ankursharma at vmware.com
Fri Aug 29 19:04:38 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>
Signed-off-by: Ankur Sharma <ankursharma at vmware.com>
Acked-by: Ankur Sharma <ankursharma at vmware.com>
---
Please attribute this to Nithin Raju <nithin at 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
More information about the dev
mailing list