Skip to content

Commit

Permalink
datapath-windows: Flow Dump handler
Browse files Browse the repository at this point in the history
In this patch we have added basic changes for
handler registeration for FLOW_GET command.

Signed-off-by: Ankur Sharma <[email protected]>
Acked-by: Nithin Raju <[email protected]>
Acked-by: Alin Gabriel Serdean <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
ankursh authored and blp committed Oct 6, 2014
1 parent ffa0808 commit 9043916
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 20 deletions.
2 changes: 1 addition & 1 deletion datapath-windows/include/OvsPub.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
27 changes: 10 additions & 17 deletions datapath-windows/ovsext/Datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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 = {
Expand All @@ -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;
Expand Down Expand Up @@ -985,7 +979,6 @@ OvsPendEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
return status;
}


/*
* --------------------------------------------------------------------------
* Handler for the subscription for the event queue
Expand Down Expand Up @@ -1216,7 +1209,7 @@ HandleDpTransaction(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
}


static NTSTATUS
NTSTATUS
OvsSetupDumpStart(POVS_USER_PARAMS_CONTEXT usrParamsCtx)
{
POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer;
Expand Down
14 changes: 12 additions & 2 deletions datapath-windows/ovsext/Datapath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -151,6 +159,8 @@ FreeUserDumpState(POVS_OPEN_INSTANCE instance)
}
}

NTSTATUS OvsSetupDumpStart(POVS_USER_PARAMS_CONTEXT usrParamsCtx);

#endif /* __DATAPATH_H_ */

#endif /* OVS_USE_NL_INTERFACE */
19 changes: 19 additions & 0 deletions datapath-windows/ovsext/Flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,25 @@ OvsFlowNlCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
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 --
Expand Down
2 changes: 2 additions & 0 deletions datapath-windows/ovsext/Flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9043916

Please sign in to comment.