[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.
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |