datapath-windows: Flow Dump handler
authorAnkur Sharma <ankursharma@vmware.com>
Fri, 3 Oct 2014 22:53:43 +0000 (15:53 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 6 Oct 2014 22:26:39 +0000 (15:26 -0700)
In this patch we have added basic changes for
handler registeration for FLOW_GET command.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows/include/OvsPub.h
datapath-windows/ovsext/Datapath.c
datapath-windows/ovsext/Datapath.h
datapath-windows/ovsext/Flow.c
datapath-windows/ovsext/Flow.h

index a8516b6..e94dacf 100644 (file)
@@ -349,7 +349,7 @@ typedef struct OvsFlowInfo {
     OvsFlowKey key;
     struct OvsFlowStats stats;
     uint32_t actionsLen;
-    NL_ATTR actions[0];
+    PNL_ATTR actions;
 } OvsFlowInfo;
 
 enum GetFlags {
index 2d2468e..e2d89a6 100644 (file)
@@ -85,16 +85,6 @@ typedef struct _NETLINK_FAMILY {
     UINT16 opsCount;
 } NETLINK_FAMILY, *PNETLINK_FAMILY;
 
-/*
- * Device operations to tag netlink commands with. This is a bitmask since it is
- * possible that a particular command can be invoked via different device
- * operations.
- */
-#define OVS_READ_DEV_OP          (1 << 0)
-#define OVS_WRITE_DEV_OP         (1 << 1)
-#define OVS_TRANSACTION_DEV_OP   (1 << 2)
-#define OVS_READ_EVENT_DEV_OP    (1 << 3)
-
 /* Handlers for the various netlink commands. */
 static NetlinkCmdHandler OvsGetPidCmdHandler,
                          OvsGetDpCmdHandler,
@@ -157,7 +147,7 @@ NETLINK_CMD nlDatapathFamilyCmdOps[] = {
       .handler         = OvsGetDpCmdHandler,
       .supportedDevOp  = OVS_WRITE_DEV_OP | OVS_READ_DEV_OP |
                          OVS_TRANSACTION_DEV_OP,
-       .validateDpIndex = FALSE
+      .validateDpIndex = FALSE
     },
     { .cmd             = OVS_DP_CMD_SET,
       .handler         = OvsSetDpCmdHandler,
@@ -214,7 +204,7 @@ NETLINK_CMD nlFlowFamilyCmdOps[] = {
       .supportedDevOp   = OVS_TRANSACTION_DEV_OP,
       .validateDpIndex  = TRUE
     },
-    { .cmd              = OVS_FLOW_CMD_SET, 
+    { .cmd              = OVS_FLOW_CMD_SET,
       .handler          = OvsFlowNlCmdHandler,
       .supportedDevOp   = OVS_TRANSACTION_DEV_OP,
       .validateDpIndex  = TRUE
@@ -223,7 +213,13 @@ NETLINK_CMD nlFlowFamilyCmdOps[] = {
       .handler          = OvsFlowNlCmdHandler,
       .supportedDevOp   = OVS_TRANSACTION_DEV_OP,
       .validateDpIndex  = TRUE
-    }
+    },
+    { .cmd              = OVS_FLOW_CMD_GET,
+      .handler          = OvsFlowNlGetCmdHandler,
+      .supportedDevOp   = OVS_TRANSACTION_DEV_OP |
+                          OVS_WRITE_DEV_OP | OVS_READ_DEV_OP,
+      .validateDpIndex  = TRUE
+    },
 };
 
 NETLINK_FAMILY nlFLowFamilyOps = {
@@ -246,8 +242,6 @@ static NTSTATUS ValidateNetlinkCmd(UINT32 devOp,
 static NTSTATUS InvokeNetlinkCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
                                         NETLINK_FAMILY *nlFamilyOps,
                                         UINT32 *replyLen);
-static NTSTATUS OvsSetupDumpStart(POVS_USER_PARAMS_CONTEXT usrParamsCtx);
-
 
 /* Handles to the device object for communication with userspace. */
 NDIS_HANDLE gOvsDeviceHandle;
@@ -985,7 +979,6 @@ OvsPendEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
     return status;
 }
 
-
 /*
  * --------------------------------------------------------------------------
  *  Handler for the subscription for the event queue
@@ -1216,7 +1209,7 @@ cleanup:
 }
 
 
-static NTSTATUS
+NTSTATUS
 OvsSetupDumpStart(POVS_USER_PARAMS_CONTEXT usrParamsCtx)
 {
     POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer;
index 689e0ae..e3bb638 100644 (file)
@@ -36,12 +36,21 @@ typedef struct _OVS_MESSAGE_ERROR {
     NL_MSG_ERR errorMsg;
 } OVS_MESSAGE_ERROR, *POVS_MESSAGE_ERROR;
 
+/*
+ * Device operations to tag netlink commands with. This is a bitmask since it
+ * is possible that a particular command can be invoked via different device
+ * operations.
+ */
+#define OVS_READ_DEV_OP          (1 << 0)
+#define OVS_WRITE_DEV_OP         (1 << 1)
+#define OVS_TRANSACTION_DEV_OP   (1 << 2)
+#define OVS_READ_EVENT_DEV_OP    (1 << 3)
+
 typedef struct _OVS_DEVICE_EXTENSION {
     INT numberOpenInstance;
     INT pidCount;
 } OVS_DEVICE_EXTENSION, *POVS_DEVICE_EXTENSION;
 
-
 /*
  * Private context for each handle on the device.
  */
@@ -83,7 +92,6 @@ POVS_OPEN_INSTANCE OvsGetOpenInstance(PFILE_OBJECT fileObject,
 
 NTSTATUS OvsCompleteIrpRequest(PIRP irp, ULONG_PTR infoPtr, NTSTATUS status);
 
-
 /*
  * Utility structure and functions to collect in one place all the parameters
  * passed during a call from userspace.
@@ -151,6 +159,8 @@ FreeUserDumpState(POVS_OPEN_INSTANCE instance)
     }
 }
 
+NTSTATUS OvsSetupDumpStart(POVS_USER_PARAMS_CONTEXT usrParamsCtx);
+
 #endif /* __DATAPATH_H_ */
 
 #endif /* OVS_USE_NL_INTERFACE */
index 5cab6e1..d1c318c 100644 (file)
@@ -305,6 +305,25 @@ done:
     return rc;
 }
 
+/*
+ *----------------------------------------------------------------------------
+ *  OvsFlowNlGetCmdHandler --
+ *    Handler for OVS_FLOW_CMD_GET/DUMP commands.
+ *----------------------------------------------------------------------------
+ */
+NTSTATUS
+OvsFlowNlGetCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
+                       UINT32 *replyLen)
+{
+    NTSTATUS rc = STATUS_SUCCESS;
+    *replyLen = 0;
+
+    UNREFERENCED_PARAMETER(usrParamsCtx);
+    UNREFERENCED_PARAMETER(replyLen);
+
+    return rc;
+}
+
 /*
  *----------------------------------------------------------------------------
  *  _MapNlToFlowPut --
index 79cb791..7835b8c 100644 (file)
@@ -72,6 +72,8 @@ NTSTATUS OvsFlushFlowIoctl(UINT32 dpNo);
 
 NTSTATUS OvsFlowNlCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
                              UINT32 *replyLen);
+NTSTATUS OvsFlowNlGetCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
+                                UINT32 *replyLen);
 
 /* Flags for tunneling */
 #define OVS_TNL_F_DONT_FRAGMENT         (1 << 0)