Added support for handling multiple NBLs when creating and forwarding
packets to userspace.

Signed-off-by: Sorin Vinturis <svintu...@cloudbasesolutions.com>
Reported-by: Alessandro Pilotti <apilo...@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/2

---
 datapath-windows/ovsext/User.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c
index 03f0377..9cb0522 100644
--- a/datapath-windows/ovsext/User.c
+++ b/datapath-windows/ovsext/User.c
@@ -795,6 +795,7 @@ OvsCreateAndAddPackets(PVOID userData,
 {
     POVS_PACKET_QUEUE_ELEM elem;
     PNET_BUFFER_LIST newNbl = NULL;
+    PNET_BUFFER_LIST nextNbl = NULL;
     PNET_BUFFER nb;
 
     if (hdrInfo->isTcp) {
@@ -818,8 +819,8 @@ OvsCreateAndAddPackets(PVOID userData,
         }
     }
 
-    nb = NET_BUFFER_LIST_FIRST_NB(nbl);
-    while (nb) {
+    while (nbl) {
+        nb = NET_BUFFER_LIST_FIRST_NB(nbl);
         elem = OvsCreateQueueNlPacket(userData, userDataLen,
                                     cmd, inPort, key, nbl, nb,
                                     isRecv, hdrInfo);
@@ -827,11 +828,13 @@ OvsCreateAndAddPackets(PVOID userData,
             InsertTailList(list, &elem->link);
             (*num)++;
         }
-        nb = NET_BUFFER_NEXT_NB(nb);
-    }
-    if (newNbl) {
-        OvsCompleteNBL(switchContext, newNbl, TRUE);
+        nextNbl = NET_BUFFER_LIST_NEXT_NBL(nbl);
+        NET_BUFFER_LIST_NEXT_NBL(nbl) = NULL;
+
+        OvsCompleteNBL(switchContext, nbl, TRUE);
+        nbl = nextNbl;
     }
+
     return NDIS_STATUS_SUCCESS;
 }
 
-- 
1.9.0.msysgit.0
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to