[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 2/3] Shim NdisMIndicateReceiveNetBufferLists() to avoid multiple indications



It seems that, on some versions of Windows, something in the network
stack does not work properly with receive indications of more than
one NET_BUFFER_LIST at once.

This patch shims NdisMIndicateReceiveNetBufferLists() to iterate over
a chain of NET_BUFFER_LISTS and indicate them separately. Hopefully
this workaround can be removed in future.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xennet/receiver.c | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c
index 86d2ffb..36a153b 100644
--- a/src/xennet/receiver.c
+++ b/src/xennet/receiver.c
@@ -323,6 +323,35 @@ fail1:
     return NULL;
 }
 
+static FORCEINLINE VOID __IndicateReceiveNetBufferLists(
+    IN  NDIS_HANDLE         MiniportAdapterHandle,
+    IN  PNET_BUFFER_LIST    NetBufferLists,
+    IN  NDIS_PORT_NUMBER    PortNumber,
+    IN  ULONG               NumberOfNetBufferLists,
+    IN  ULONG               ReceiveFlags
+    )
+{
+    ULONG                   Count;
+
+    Count = 0;
+    while (NetBufferLists != NULL) {
+        PNET_BUFFER_LIST        Next;
+
+        Next = NET_BUFFER_LIST_NEXT_NBL(NetBufferLists);
+        NET_BUFFER_LIST_NEXT_NBL(NetBufferLists) = NULL;
+
+        NdisMIndicateReceiveNetBufferLists(MiniportAdapterHandle,
+                                           NetBufferLists,
+                                           PortNumber,
+                                           1,
+                                           ReceiveFlags);
+
+        Count++;
+        NetBufferLists = Next;
+    }
+    ASSERT3U(Count, ==, NumberOfNetBufferLists);
+}
+
 static VOID
 __ReceiverPushPackets(
     IN  PXENNET_RECEIVER    Receiver,
@@ -357,11 +386,11 @@ __ReceiverPushPackets(
     if (Indicated - Returned > IN_NDIS_MAX)
         Flags |= NDIS_RECEIVE_FLAGS_RESOURCES;
 
-    NdisMIndicateReceiveNetBufferLists(AdapterGetHandle(Receiver->Adapter),
-                                       NetBufferList,
-                                       NDIS_DEFAULT_PORT_NUMBER,
-                                       Count,
-                                       Flags);
+    __IndicateReceiveNetBufferLists(AdapterGetHandle(Receiver->Adapter),
+                                    NetBufferList,
+                                    NDIS_DEFAULT_PORT_NUMBER,
+                                    Count,
+                                    Flags);
 
     if (Flags & NDIS_RECEIVE_FLAGS_RESOURCES)
         (VOID) __ReceiverReturnNetBufferLists(Receiver, NetBufferList, FALSE);
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.