[ovs-dev] [PATCH] datapath-windows: Missed packets are not queued.

Sorin Vinturis svinturis at cloudbasesolutions.com
Wed Sep 24 09:43:16 UTC 2014


    Currently, whenever there's a missed packet, the ovs driver allocates
    memory and copies the packet even if there's no packet queue setup from
    userspace. Then if there's no queue created, the packet is released and
    dropped.

    The solution was to check for the existence of the userspace queue before
    trying to allocate and add a new missed packet to the queue. If there is
    no userspace queue created, the original packet is dropped without creating
    a new missed packet.

    Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
    Reported-by: Nithin Raju <nithin at vmware.com>
    Reported-at: https://github.com/openvswitch/ovs-issues/issues/32
---
 datapath-windows/ovsext/Datapath.c | 2 ++
 datapath-windows/ovsext/Ioctl.c    | 4 +++-
 datapath-windows/ovsext/User.c     | 8 ++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c
index 0dfdd57..95af4b6 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -419,6 +419,7 @@ OvsAddOpenInstance(POVS_DEVICE_EXTENSION ovsExt,
     for (i = 0; i < OVS_MAX_OPEN_INSTANCES; i++) {
         if (ovsOpenInstanceArray[i] == NULL) {
             ovsOpenInstanceArray[i] = instance;
+            ovsNumberOfOpenInstances++;
             instance->cookie = i;
             break;
         }
@@ -457,6 +458,7 @@ OvsRemoveOpenInstance(PFILE_OBJECT fileObject)
     fileObject->FsContext = NULL;
     ASSERT(ovsOpenInstanceArray[instance->cookie] == instance);
     ovsOpenInstanceArray[instance->cookie] = NULL;
+    ovsNumberOfOpenInstances--;
     OvsReleaseCtrlLock();
     ASSERT(instance->eventQueue == NULL);
     ASSERT (instance->packetQueue == NULL);
diff --git a/datapath-windows/ovsext/Ioctl.c b/datapath-windows/ovsext/Ioctl.c
index 71e3933..9b93200 100644
--- a/datapath-windows/ovsext/Ioctl.c
+++ b/datapath-windows/ovsext/Ioctl.c
@@ -99,7 +99,7 @@ OvsCleanupIoctl()
     if (ovsFlowLock) {
         NdisFreeSpinLock(ovsFlowLock);
         NdisFreeSpinLock(gOvsCtrlLock);
-        gOvsCtrlLock = NULL;
+        ovsFlowLock = NULL;
         gOvsCtrlLock = NULL;
     }
 }
@@ -266,6 +266,7 @@ OvsAddOpenInstance(PFILE_OBJECT fileObject)
     for (i = 0; i < OVS_MAX_OPEN_INSTANCES; i++) {
         if (ovsOpenInstanceArray[i] == NULL) {
             ovsOpenInstanceArray[i] = instance;
+            ovsNumberOfOpenInstances++;
             instance->cookie = i;
             break;
         }
@@ -300,6 +301,7 @@ OvsRemoveOpenInstance(PFILE_OBJECT fileObject)
     fileObject->FsContext = NULL;
     ASSERT(ovsOpenInstanceArray[instance->cookie] == instance);
     ovsOpenInstanceArray[instance->cookie] = NULL;
+    ovsNumberOfOpenInstances--;
     OvsReleaseCtrlLock();
     ASSERT(instance->eventQueue == NULL);
     ASSERT (instance->packetQueue == NULL);
diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c
index 612a4bd..26cd431 100644
--- a/datapath-windows/ovsext/User.c
+++ b/datapath-windows/ovsext/User.c
@@ -563,6 +563,14 @@ OvsCreateQueuePacket(UINT32 queueId,
     NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO csumInfo;
     NDIS_NET_BUFFER_LIST_8021Q_INFO vlanInfo;
 
+    if (!OvsGetQueue(queueId)) {
+        /*
+         * There is no userspace queue created yet, so there is no point for
+         * creating a new packet to be queued.
+         */
+        return NULL;
+    }
+
     csumInfo.Value = NET_BUFFER_LIST_INFO(nbl, TcpIpChecksumNetBufferListInfo);
 
     if (isRecv && (csumInfo.Receive.TcpChecksumFailed ||
-- 
1.9.1



More information about the dev mailing list