Skip to content

Commit

Permalink
datapath-windows: Reply for Flow Flush.
Browse files Browse the repository at this point in the history
Added changes to send a reply for FLOW_FUSH case. This is needed
as with nithin's transaction reply changes we'll need reply for each
command.

This patch also contains minor fixes for sending replies in
success case as well.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
ankursh authored and blp committed Oct 13, 2014
1 parent 34d4fea commit c26acd5
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion datapath-windows/ovsext/Flow.c
Expand Up @@ -290,8 +290,27 @@ OvsFlowNlCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
/* 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 (rc == STATUS_SUCCESS) {
/* XXX: refactor this code. */
/* So far so good. Prepare the reply for userspace */
NlBufInit(&nlBuf, usrParamsCtx->outputBuffer,
usrParamsCtx->outputLength);

/* Prepare nl Msg headers */
rc = NlFillOvsMsg(&nlBuf, nlMsgHdr->nlmsgType, 0,
nlMsgHdr->nlmsgSeq, nlMsgHdr->nlmsgPid,
genlMsgHdr->cmd, OVS_FLOW_VERSION,
ovsHdr->dp_ifindex);

if (rc == STATUS_SUCCESS) {
*replyLen = msgOut->nlMsg.nlmsgLen;
}
}

goto done;
}

if ((rc = _MapNlToFlowPut(msgIn, nlAttrs[OVS_FLOW_ATTR_KEY],
Expand Down Expand Up @@ -342,6 +361,7 @@ OvsFlowNlCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
usrParamsCtx->outputBuffer;
BuildErrorMsg(msgIn, msgError, nlError);
*replyLen = msgError->nlMsg.nlmsgLen;
rc = STATUS_SUCCESS;
}

return rc;
Expand All @@ -360,6 +380,12 @@ OvsFlowNlGetCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
NTSTATUS rc = STATUS_SUCCESS;
NL_ERROR nlError = NL_ERROR_SUCCESS;
POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer;
POVS_MESSAGE msgOut = (POVS_MESSAGE)usrParamsCtx->outputBuffer;
PNL_MSG_HDR nlMsgHdr = &(msgIn->nlMsg);
PGENL_MSG_HDR genlMsgHdr = &(msgIn->genlMsg);
POVS_HDR ovsHdr = &(msgIn->ovsHdr);

NL_BUFFER nlBuf;

*replyLen = 0;

Expand All @@ -381,6 +407,23 @@ OvsFlowNlGetCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
usrParamsCtx->outputBuffer;
BuildErrorMsg(msgIn, msgError, nlError);
*replyLen = msgError->nlMsg.nlmsgLen;
rc = STATUS_SUCCESS;
goto done;
}

if (rc == STATUS_SUCCESS) {
NlBufInit(&nlBuf, usrParamsCtx->outputBuffer,
usrParamsCtx->outputLength);

/* Prepare nl Msg headers */
rc = NlFillOvsMsg(&nlBuf, nlMsgHdr->nlmsgType, 0,
nlMsgHdr->nlmsgSeq, nlMsgHdr->nlmsgPid,
genlMsgHdr->cmd, OVS_FLOW_VERSION,
ovsHdr->dp_ifindex);

if (rc == STATUS_SUCCESS) {
*replyLen = msgOut->nlMsg.nlmsgLen;
}
}

done:
Expand Down

0 comments on commit c26acd5

Please sign in to comment.