In this patch we have made following changes:

OvsPacketExecute =>
Changed the data structure to have packet and
actions as pointer (instead of zero length array). It is done because
we will not do memcpy of packet now, pointer will just point
to corresponding offset in input buffer.

OvsExecuteDpIoctl =>
We only need input buffer now. Hence Changed the function signature.

Signed-off-by: Ankur Sharma <ankursha...@vmware.com>
---
 datapath-windows/include/OvsPub.h |  8 ++------
 datapath-windows/ovsext/User.c    | 17 +++--------------
 datapath-windows/ovsext/User.h    |  4 +---
 3 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/datapath-windows/include/OvsPub.h 
b/datapath-windows/include/OvsPub.h
index e94dacf..f34e2bf 100644
--- a/datapath-windows/include/OvsPub.h
+++ b/datapath-windows/include/OvsPub.h
@@ -428,12 +428,8 @@ typedef struct OvsPacketExecute {
 
    uint32_t packetLen;
    uint32_t actionsLen;
-   union {
-       /* Variable size blob with packet data first, followed by action
-        * attrs. */
-       char packetBuf[0];
-       NL_ATTR  actions[0];
-   };
+   PCHAR packetBuf;
+   PNL_ATTR actions;
 } OvsPacketExecute;
 
 
diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c
index 1accb87..184608a 100644
--- a/datapath-windows/ovsext/User.c
+++ b/datapath-windows/ovsext/User.c
@@ -319,9 +319,7 @@ OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT 
usrParamsCtx,
 }
 
 NTSTATUS
-OvsExecuteDpIoctl(PVOID inputBuffer,
-                  UINT32 inputLength,
-                  UINT32 outputLength)
+OvsExecuteDpIoctl(PVOID inputBuffer)
 {
     NTSTATUS                    status = STATUS_SUCCESS;
     NTSTATUS                    ndisStatus;
@@ -334,10 +332,6 @@ OvsExecuteDpIoctl(PVOID inputBuffer,
     OVS_PACKET_HDR_INFO layers;
     POVS_VPORT_ENTRY vport;
 
-    if (inputLength < sizeof(*execute) || outputLength != 0) {
-        return STATUS_INFO_LENGTH_MISMATCH;
-    }
-
     NdisAcquireSpinLock(gOvsCtrlLock);
     if (gOvsSwitchContext == NULL) {
         status = STATUS_INVALID_PARAMETER;
@@ -351,18 +345,13 @@ OvsExecuteDpIoctl(PVOID inputBuffer,
         goto unlock;
     }
 
-    if (inputLength != sizeof (*execute) +
-                       execute->actionsLen + execute->packetLen) {
-        status = STATUS_INFO_LENGTH_MISMATCH;
-        goto unlock;
-    }
-    actions = (PNL_ATTR)((PCHAR)&execute->actions + execute->packetLen);
+    actions = execute->actions;
 
     /*
      * Allocate the NBL, copy the data from the userspace buffer. Allocate
      * also, the forwarding context for the packet.
      */
-    pNbl = OvsAllocateNBLForUserBuffer(gOvsSwitchContext, &execute->packetBuf,
+    pNbl = OvsAllocateNBLForUserBuffer(gOvsSwitchContext, execute->packetBuf,
                                        execute->packetLen);
     if (pNbl == NULL) {
         status = STATUS_NO_MEMORY;
diff --git a/datapath-windows/ovsext/User.h b/datapath-windows/ovsext/User.h
index cbe0e4e..a0b3a9f 100644
--- a/datapath-windows/ovsext/User.h
+++ b/datapath-windows/ovsext/User.h
@@ -106,9 +106,7 @@ NTSTATUS OvsReadDpIoctl(PFILE_OBJECT fileObject,
                               PVOID outputBuffer,
                               UINT32 outputLength,
                               UINT32 *replyLen);
-NTSTATUS OvsExecuteDpIoctl(PVOID inputBuffer,
-                           UINT32 inputLength,
-                           UINT32 outputLength);
+NTSTATUS OvsExecuteDpIoctl(PVOID inputBuffer);
 NTSTATUS OvsPurgeDpIoctl(PFILE_OBJECT fileObject);
 
 NTSTATUS OvsWaitDpIoctl(PIRP irp, PFILE_OBJECT fileObject);
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to