]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath-windows/Flow.c: DEL_FLOWS command handler.
authorAnkur Sharma <ankursharma@vmware.com>
Sat, 27 Sep 2014 00:33:34 +0000 (17:33 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 29 Sep 2014 16:03:42 +0000 (09:03 -0700)
Added changes to handle DEL_FLOWS (FLUSH) scenario.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows/ovsext/Flow.c
datapath-windows/ovsext/Flow.h

index 2eb61748518e311799ed9875692b8a3f901253f0..dc00b041bb4c84bb6ff05a066f11aaf4f71657e0 100644 (file)
@@ -212,7 +212,8 @@ static const NL_POLICY nlFlowActionPolicy[] = {
 /*
  *----------------------------------------------------------------------------
  *  OvsFlowNlNewCmdHandler --
- *    Handler for OVS_FLOW_CMD_NEW command.
+ *    Handler for OVS_FLOW_CMD_NEW/SET/DEL command.
+ *    It also handles FLUSH case (DEL w/o any key in input)
  *----------------------------------------------------------------------------
  */
 NTSTATUS
@@ -249,6 +250,13 @@ OvsFlowNlNewCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
         goto done;
     }
 
+    /* FLOW_DEL command w/o any key input is a flush case. */
+    if ((genlMsgHdr->cmd == OVS_FLOW_CMD_DEL) && 
+        (!(nlAttrs[OVS_FLOW_ATTR_KEY]))) {
+        rc = OvsFlushFlowIoctl(ovsHdr->dp_ifindex);
+        goto done;
+    }
+
     if ((_MapNlToFlowPut(msgIn, nlAttrs[OVS_FLOW_ATTR_KEY],
          nlAttrs[OVS_FLOW_ATTR_ACTIONS], nlAttrs[OVS_FLOW_ATTR_CLEAR],
          &mappedFlow))
@@ -1501,19 +1509,12 @@ unlock:
 }
 
 NTSTATUS
-OvsFlushFlowIoctl(PVOID inputBuffer,
-                  UINT32 inputLength)
+OvsFlushFlowIoctl(UINT32 dpNo)
 {
     NTSTATUS status = STATUS_SUCCESS;
     OVS_DATAPATH *datapath = NULL;
-    UINT32 dpNo;
     LOCK_STATE_EX dpLockState;
 
-    if (inputLength != sizeof(UINT32) || inputBuffer == NULL) {
-        return STATUS_INFO_LENGTH_MISMATCH;
-    }
-
-    dpNo = *(UINT32 *)inputBuffer;
     NdisAcquireSpinLock(gOvsCtrlLock);
     if (gOvsSwitchContext == NULL ||
         gOvsSwitchContext->dpNo != dpNo) {
index e62ba409b9481e4b00db218024d8aa102bf53b07..10ef62be57449cfdb7c449023592cea84cae51b8 100644 (file)
@@ -68,7 +68,7 @@ NTSTATUS OvsPutFlowIoctl(PVOID inputBuffer, UINT32 inputLength,
 NTSTATUS OvsGetFlowIoctl(PVOID inputBuffer, UINT32 inputLength,
                          PVOID outputBuffer, UINT32 outputLength,
                          UINT32 *replyLen);
-NTSTATUS OvsFlushFlowIoctl(PVOID inputBuffer, UINT32 inputLength);
+NTSTATUS OvsFlushFlowIoctl(UINT32 dpNo);
 
 NTSTATUS OvsFlowNlNewCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
                                 UINT32 *replyLen);