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

[PATCH 1/2] Introduce per-dpc rate limits for XenVif / XeNet Rx path.


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
  • Date: Fri, 13 May 2022 11:24:12 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Martin Harvey <Martin.Harvey@xxxxxxxxxx>, Martin Harvey <martin.harvey@xxxxxxxxxx>
  • Delivery-date: Fri, 13 May 2022 10:24:41 +0000
  • Ironport-data: A9a23:Xe/VJ6iJwIfVlVejA4jc0k7vX161NBAKZh0ujC45NGQN5FlHY01je htvXDuCOa7bY2GmL4oga9jkoEsG6JbUzN9hQFE/pS1kRisb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M68wIFqtQw24LhXlrW4 YqaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YSgzDIbnn/wzaDxBCBsgMvZt4q3jK0Hq5KR/z2WeG5ft6/BnDUVwNowE4OdnR2pJ8 JT0KhhUMErF3bjvhuvmFK883azPL+GyVG8bknRp1y3YC7AmSIrdTrTi7t5ExjYgwMtJGJ4yY uJGMGM3PUWZO3WjPH86UrABvtWpgELbLR0JuFWTl5IZ0mL6mVkZPL/Fb4OOJ43iqd9utlmZo Cfe4SH1Dw8XMPSbyCGZ6TS8i+nXhyT5VYkOUrqi+ZZXbEa7nzJJTkdMDB3i/Kf/2hXWt89jx 1I81TAchoM17GKQa8DmZUO3+1WerDoWYo8FewEl0z2lxq3R6gefI2ELSD9dddAr3PMLqSwWO kyhxI2wW2E22FGBYTfEr+rP82vuUcQABTVaDRLoWzfp9DUKTGsbqhvUBuhuH6eu5jEeMWGhm mvaxMTSalh6sCLq60lZ1Q2f695PjsKQJuLQ2ukwdjj9hj6VnKb/O+SVBaHztJ6s1rqxQFibp 2QjkMOD9u0IBpzlvHXTHb9WTOn1uK7damW0bbtT834JrW7FxpJeVdoIvGEWyLlBbK7ohgMFk GeM4FgMtfe/zVOhbLNtYpLZNijZ5fOIKDgRbdiNNoAmSsEoLGevpXg+DWbNjjuFuBV9zskC1 WKzLJ/E4YAyUvw3klJbho41jNcW+8zJ7TmNGsqnn0/3gdJzphe9EN84DbdHVchhhIvsnekf2 4w32xeio/mHbNDDXw==
  • Ironport-hdrordr: A9a23:Ur53q6zo72aqTX+Pm56mKrPwJr1zdoMgy1knxilNoRw8SKOlfq eV7ZEmPH7P+VEssR4b+OxoVJPsfZq+z+8W3WByB9eftWDd0QPCRr2KhbGSpwEIcBeRygcy78 tdmtBFeb7NMWQ=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

This patch allows XenNet to keep track of how many packets have
been processed in a "batch" (per DPC), and to ask XenVif to stop
the current batch once some predefined limit has been met.

Signed-off-by: Martin Harvey <martin.harvey@xxxxxxxxxx>
---
 include/vif_interface.h |  7 +++++--
 src/xennet.inf          |  6 +++---
 src/xennet/adapter.c    |  5 ++++-
 src/xennet/receiver.c   | 12 ++++++++++--
 src/xennet/receiver.h   |  3 ++-
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/include/vif_interface.h b/include/vif_interface.h
index 20de314..c034657 100644
--- a/include/vif_interface.h
+++ b/include/vif_interface.h
@@ -928,7 +928,10 @@ struct _XENVIF_VIF_INTERFACE_V8 {
     XENVIF_VIF_MAC_QUERY_FILTER_LEVEL               MacQueryFilterLevel;
 };
 
-typedef struct _XENVIF_VIF_INTERFACE_V8 XENVIF_VIF_INTERFACE, 
*PXENVIF_VIF_INTERFACE;
+/* V9 is exactly the same as V8 */
+typedef struct _XENVIF_VIF_INTERFACE_V8 XENVIF_VIF_INTERFACE_V9;
+
+typedef XENVIF_VIF_INTERFACE_V9 XENVIF_VIF_INTERFACE, *PXENVIF_VIF_INTERFACE;
 
 /*! \def XENVIF_VIF
     \brief Macro at assist in method invocation
@@ -939,6 +942,6 @@ typedef struct _XENVIF_VIF_INTERFACE_V8 
XENVIF_VIF_INTERFACE, *PXENVIF_VIF_INTER
 #endif  // _WINDLL
 
 #define XENVIF_VIF_INTERFACE_VERSION_MIN    6
-#define XENVIF_VIF_INTERFACE_VERSION_MAX    8
+#define XENVIF_VIF_INTERFACE_VERSION_MAX    9
 
 #endif  // _XENVIF_INTERFACE_H
diff --git a/src/xennet.inf b/src/xennet.inf
index c44f4af..58ea5d7 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -61,9 +61,9 @@ 
xennet_coinst_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dll
 ; DisplayName          Section         DeviceID
 ; -----------          -------         --------
 
-%XenNetName%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_NET&REV_09000001
-%XenNetName%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0001&DEV_NET&REV_09000001
-%XenNetName%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0002&DEV_NET&REV_09000001
+%XenNetName%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_NET&REV_09000002
+%XenNetName%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0001&DEV_NET&REV_09000002
+%XenNetName%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0002&DEV_NET&REV_09000002
 
 [XenNet_Inst] 
 Characteristics=0x84
diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
index 743cf35..a1bf9e8 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -234,6 +234,7 @@ AdapterVifCallback(
         PXENVIF_PACKET_HASH             Hash;
         BOOLEAN                         More;
         PVOID                           Cookie;
+        PBOOLEAN                        NdisFinished;
 
         Index = va_arg(Arguments, ULONG);
         Mdl = va_arg(Arguments, PMDL);
@@ -246,6 +247,7 @@ AdapterVifCallback(
         Hash = va_arg(Arguments, PXENVIF_PACKET_HASH);
         More = va_arg(Arguments, BOOLEAN);
         Cookie = va_arg(Arguments, PVOID);
+        NdisFinished = va_arg(Arguments, PBOOLEAN);
 
         ReceiverQueuePacket(Adapter->Receiver,
                             Index,
@@ -258,7 +260,8 @@ AdapterVifCallback(
                             Info,
                             Hash,
                             More,
-                            Cookie);
+                            Cookie,
+                            NdisFinished);
         break;
     }
     case XENVIF_MAC_STATE_CHANGE: {
diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c
index 65527c5..d7a1e41 100644
--- a/src/xennet/receiver.c
+++ b/src/xennet/receiver.c
@@ -45,6 +45,7 @@ typedef struct _XENNET_RECEIVER_QUEUE {
     PNET_BUFFER_LIST    Head;
     PNET_BUFFER_LIST    Tail;
     ULONG               Count;
+    ULONG               SinceLastPush;
 } XENNET_RECEIVER_QUEUE, *PXENNET_RECEIVER_QUEUE;
 
 struct _XENNET_RECEIVER {
@@ -544,7 +545,8 @@ ReceiverQueuePacket(
     IN  PXENVIF_PACKET_INFO             Info,
     IN  PXENVIF_PACKET_HASH             Hash,
     IN  BOOLEAN                         More,
-    IN  PVOID                           Cookie
+    IN  PVOID                           Cookie,
+    OUT PBOOLEAN                        NdisFinished
     )
 {
     PXENVIF_VIF_INTERFACE               VifInterface;
@@ -582,11 +584,17 @@ ReceiverQueuePacket(
         Queue->Tail = NetBufferList;
     }
     Queue->Count++;
+    Queue->SinceLastPush++;
+
+    *NdisFinished = More && (Queue->SinceLastPush > IN_NDIS_MAX);
+
+    if (!More || (*NdisFinished))
+        Queue->SinceLastPush = 0;
 
     KeReleaseSpinLockFromDpcLevel(&Queue->Lock);
 
 done:
-    if (!More)
+    if (!More || (*NdisFinished))
         __ReceiverPushPackets(Receiver, Index);
 }
 
diff --git a/src/xennet/receiver.h b/src/xennet/receiver.h
index 5fc9e66..6089fd4 100644
--- a/src/xennet/receiver.h
+++ b/src/xennet/receiver.h
@@ -68,7 +68,8 @@ ReceiverQueuePacket(
     IN  PXENVIF_PACKET_INFO             Info,
     IN  PXENVIF_PACKET_HASH             Hash,
     IN  BOOLEAN                         More,
-    IN  PVOID                           Cookie
+    IN  PVOID                           Cookie,
+    OUT PBOOLEAN                        NdisFinished
     );
 
 extern PXENVIF_VIF_OFFLOAD_OPTIONS
-- 
2.25.0.windows.1




 


Rackspace

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