From 7c5d9f1716fb33f4316a4f81b548430bbed474f8 Mon Sep 17 00:00:00 2001 From: Ankur Sharma Date: Wed, 15 Oct 2014 15:54:54 -0700 Subject: datapath-windows: Action not supported error handling Added changes to support error handling for non supported actions. Added changes in packet execute for sending transactional errors. Signed-off-by: Ankur Sharma Acked-by: Nithin Raju Signed-off-by: Ben Pfaff --- datapath-windows/ovsext/User.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'datapath-windows/ovsext/User.c') diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c index 8400b83bc..f24c4e3f1 100644 --- a/datapath-windows/ovsext/User.c +++ b/datapath-windows/ovsext/User.c @@ -369,6 +369,7 @@ OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx, status = OvsExecuteDpIoctl(&execute); + /* Default reply that we want to send */ if (status == STATUS_SUCCESS) { NlBufInit(&nlBuf, usrParamsCtx->outputBuffer, usrParamsCtx->outputLength); @@ -382,20 +383,23 @@ OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx, if (status == STATUS_SUCCESS) { *replyLen = msgOut->nlMsg.nlmsgLen; } - } - - /* As of now there are no transactional errors in the implementation. - * Once we have them then we need to map status to correct - * nlError value, so that below mentioned code gets hit. */ - if ((nlError != NL_ERROR_SUCCESS) && - (usrParamsCtx->outputBuffer)) { - - POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR) - usrParamsCtx->outputBuffer; - BuildErrorMsg(msgIn, msgError, nlError); - *replyLen = msgError->nlMsg.nlmsgLen; - status = STATUS_SUCCESS; - goto done; + } else { + /* Map NTSTATUS to NL_ERROR */ + nlError = NlMapStatusToNlErr(status); + + /* As of now there are no transactional errors in the implementation. + * Once we have them then we need to map status to correct + * nlError value, so that below mentioned code gets hit. */ + if ((nlError != NL_ERROR_SUCCESS) && + (usrParamsCtx->outputBuffer)) { + + POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR) + usrParamsCtx->outputBuffer; + BuildErrorMsg(msgIn, msgError, nlError); + *replyLen = msgError->nlMsg.nlmsgLen; + status = STATUS_SUCCESS; + goto done; + } } done: @@ -487,7 +491,11 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute) NdisReleaseRWLock(gOvsSwitchContext->dispatchLock, &lockState); } if (ndisStatus != NDIS_STATUS_SUCCESS) { - status = STATUS_UNSUCCESSFUL; + if (ndisStatus == NDIS_STATUS_NOT_SUPPORTED) { + status = STATUS_NOT_SUPPORTED; + } else { + status = STATUS_UNSUCCESSFUL; + } } if (pNbl) { -- cgit v1.2.1