[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Pass the receive queue index to XENNET
Update the XENVIF_VIF interface to version 8 to include an extra 'Index' parameter to the XENVIF_RECEIVER_QUEUE_PACKET callback. This means XENNET no longer has to use current CPU to decide which queue is which. This patch also fixes a couple of ASSERTion failures seen in debugging. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- include/revision.h | 3 +- include/vif_interface.h | 39 ++++++++++++++++- src/xenvif/pdo.c | 2 +- src/xenvif/receiver.c | 13 ++++-- src/xenvif/vif.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ src/xenvif/vif.h | 1 + 6 files changed, 159 insertions(+), 7 deletions(-) diff --git a/include/revision.h b/include/revision.h index 4adf4e9..6146bb7 100644 --- a/include/revision.h +++ b/include/revision.h @@ -46,7 +46,8 @@ DEFINE_REVISION(0x08000006, 1, 4, 2, 1), \ DEFINE_REVISION(0x08000009, 1, 5, 2, 1), \ DEFINE_REVISION(0x0800000B, 1, 6, 2, 1), \ - DEFINE_REVISION(0x0800000C, 1, 7, 2, 1) + DEFINE_REVISION(0x0800000C, 1, 7, 2, 1), \ + DEFINE_REVISION(0x0800000D, 1, 8, 2, 1) // Revision 0x08000005, 0x08000007, 0x08000008 and 0x0800000A are already // in use in the staging-8.1 branch. diff --git a/include/vif_interface.h b/include/vif_interface.h index 4a95989..38872bc 100644 --- a/include/vif_interface.h +++ b/include/vif_interface.h @@ -383,6 +383,7 @@ typedef VOID \param Completion Packet completion information \b XENVIF_RECEIVER_QUEUE_PACKET: + \param Index The index of the queue on which the packet was received \param Mdl The initial MDL of the packet \param Offset The offset of the packet data in the initial MDL \param Length The total length of the packet @@ -1006,7 +1007,41 @@ struct _XENVIF_VIF_INTERFACE_V7 { XENVIF_VIF_MAC_QUERY_FILTER_LEVEL MacQueryFilterLevel; }; -typedef struct _XENVIF_VIF_INTERFACE_V7 XENVIF_VIF_INTERFACE, *PXENVIF_VIF_INTERFACE; +/*! \struct _XENVIF_VIF_INTERFACE_V8 + \brief VIF interface version 8 + \ingroup interfaces +*/ +struct _XENVIF_VIF_INTERFACE_V8 { + INTERFACE Interface; + XENVIF_VIF_ACQUIRE Acquire; + XENVIF_VIF_RELEASE Release; + XENVIF_VIF_ENABLE Enable; + XENVIF_VIF_DISABLE Disable; + XENVIF_VIF_QUERY_STATISTIC QueryStatistic; + XENVIF_VIF_QUERY_RING_COUNT QueryRingCount; + XENVIF_VIF_UPDATE_HASH_MAPPING UpdateHashMapping; + XENVIF_VIF_RECEIVER_RETURN_PACKET ReceiverReturnPacket; + XENVIF_VIF_RECEIVER_SET_OFFLOAD_OPTIONS ReceiverSetOffloadOptions; + XENVIF_VIF_RECEIVER_SET_BACKFILL_SIZE ReceiverSetBackfillSize; + XENVIF_VIF_RECEIVER_QUERY_RING_SIZE ReceiverQueryRingSize; + XENVIF_VIF_RECEIVER_SET_HASH_ALGORITHM ReceiverSetHashAlgorithm; + XENVIF_VIF_RECEIVER_QUERY_HASH_CAPABILITIES ReceiverQueryHashCapabilities; + XENVIF_VIF_RECEIVER_UPDATE_HASH_PARAMETERS ReceiverUpdateHashParameters; + XENVIF_VIF_TRANSMITTER_QUEUE_PACKET TransmitterQueuePacket; + XENVIF_VIF_TRANSMITTER_QUERY_OFFLOAD_OPTIONS TransmitterQueryOffloadOptions; + XENVIF_VIF_TRANSMITTER_QUERY_LARGE_PACKET_SIZE TransmitterQueryLargePacketSize; + XENVIF_VIF_TRANSMITTER_QUERY_RING_SIZE TransmitterQueryRingSize; + XENVIF_VIF_MAC_QUERY_STATE MacQueryState; + XENVIF_VIF_MAC_QUERY_MAXIMUM_FRAME_SIZE MacQueryMaximumFrameSize; + XENVIF_VIF_MAC_QUERY_PERMANENT_ADDRESS MacQueryPermanentAddress; + XENVIF_VIF_MAC_QUERY_CURRENT_ADDRESS MacQueryCurrentAddress; + XENVIF_VIF_MAC_QUERY_MULTICAST_ADDRESSES MacQueryMulticastAddresses; + XENVIF_VIF_MAC_SET_MULTICAST_ADDRESSES MacSetMulticastAddresses; + XENVIF_VIF_MAC_SET_FILTER_LEVEL MacSetFilterLevel; + XENVIF_VIF_MAC_QUERY_FILTER_LEVEL MacQueryFilterLevel; +}; + +typedef struct _XENVIF_VIF_INTERFACE_V8 XENVIF_VIF_INTERFACE, *PXENVIF_VIF_INTERFACE; /*! \def XENVIF_VIF \brief Macro at assist in method invocation @@ -1017,6 +1052,6 @@ typedef struct _XENVIF_VIF_INTERFACE_V7 XENVIF_VIF_INTERFACE, *PXENVIF_VIF_INTER #endif // _WINDLL #define XENVIF_VIF_INTERFACE_VERSION_MIN 2 -#define XENVIF_VIF_INTERFACE_VERSION_MAX 7 +#define XENVIF_VIF_INTERFACE_VERSION_MAX 8 #endif // _XENVIF_INTERFACE_H diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c index 8e46566..496a91a 100644 --- a/src/xenvif/pdo.c +++ b/src/xenvif/pdo.c @@ -2836,7 +2836,7 @@ PdoDestroy( PDEVICE_OBJECT PhysicalDeviceObject = Dx->DeviceObject; PXENVIF_FDO Fdo = __PdoGetFdo(Pdo); - ASSERT(!Pdo->UnplugRequested); + PdoUnplugRequest(Pdo, FALSE); Pdo->HasAlias = FALSE; diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index 844e243..042d550 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -1400,6 +1400,7 @@ __ReceiverRingReleaseLock( PXENVIF_VIF_CONTEXT Context; LIST_ENTRY List; ULONG Count; + BOOLEAN More; ASSERT3U(KeGetCurrentIrql(), ==, DISPATCH_LEVEL); @@ -1422,7 +1423,9 @@ __ReceiverRingReleaseLock( #pragma prefast(disable:26110) KeReleaseSpinLockFromDpcLevel(&Ring->Lock); - while (!IsListEmpty(&List)) { + More = !IsListEmpty(&List) ? TRUE : FALSE; + + while (More) { PLIST_ENTRY ListEntry; PXENVIF_RECEIVER_PACKET Packet; @@ -1431,11 +1434,15 @@ __ReceiverRingReleaseLock( RtlZeroMemory(ListEntry, sizeof (LIST_ENTRY)); + ASSERT(More); + More = !IsListEmpty(&List) ? TRUE : FALSE; + Packet = CONTAINING_RECORD(ListEntry, XENVIF_RECEIVER_PACKET, ListEntry); VifReceiverQueuePacket(Context, + Ring->Index, &Packet->Mdl, Packet->Offset, Packet->Length, @@ -1444,11 +1451,11 @@ __ReceiverRingReleaseLock( Packet->TagControlInformation, &Packet->Info, &Packet->Hash, - !IsListEmpty(&List), + More, Packet); } - ASSERT(IsListEmpty(&List)); + ASSERT(!More); } static DECLSPEC_NOINLINE VOID diff --git a/src/xenvif/vif.c b/src/xenvif/vif.c index cb28aa5..28c77e1 100644 --- a/src/xenvif/vif.c +++ b/src/xenvif/vif.c @@ -1224,6 +1224,36 @@ static struct _XENVIF_VIF_INTERFACE_V7 VifInterfaceVersion7 = { VifMacQueryFilterLevel }; +static struct _XENVIF_VIF_INTERFACE_V8 VifInterfaceVersion8 = { + { sizeof (struct _XENVIF_VIF_INTERFACE_V8), 8, NULL, NULL, NULL }, + VifAcquire, + VifRelease, + VifEnable, + VifDisable, + VifQueryStatistic, + VifQueryRingCount, + VifUpdateHashMapping, + VifReceiverReturnPacket, + VifReceiverSetOffloadOptions, + VifReceiverSetBackfillSize, + VifReceiverQueryRingSize, + VifReceiverSetHashAlgorithm, + VifReceiverQueryHashCapabilities, + VifReceiverUpdateHashParameters, + VifTransmitterQueuePacket, + VifTransmitterQueryOffloadOptions, + VifTransmitterQueryLargePacketSize, + VifTransmitterQueryRingSize, + VifMacQueryState, + VifMacQueryMaximumFrameSize, + VifMacQueryPermanentAddress, + VifMacQueryCurrentAddress, + VifMacQueryMulticastAddresses, + VifMacSetMulticastAddresses, + VifMacSetFilterLevel, + VifMacQueryFilterLevel +}; + NTSTATUS VifInitialize( IN PXENVIF_PDO Pdo, @@ -1390,6 +1420,23 @@ VifGetInterface( status = STATUS_SUCCESS; break; } + case 8: { + struct _XENVIF_VIF_INTERFACE_V8 *VifInterface; + + VifInterface = (struct _XENVIF_VIF_INTERFACE_V8 *)Interface; + + status = STATUS_BUFFER_OVERFLOW; + if (Size < sizeof (struct _XENVIF_VIF_INTERFACE_V8)) + break; + + *VifInterface = VifInterfaceVersion8; + + ASSERT3U(Interface->Version, ==, Version); + Interface->Context = Context; + + status = STATUS_SUCCESS; + break; + } default: status = STATUS_NOT_SUPPORTED; break; @@ -1428,6 +1475,7 @@ VifTeardown( static FORCEINLINE VOID __VifReceiverQueuePacketVersion1( IN PXENVIF_VIF_CONTEXT Context, + IN ULONG Index, IN PMDL Mdl, IN ULONG Offset, IN ULONG Length, @@ -1445,6 +1493,7 @@ __VifReceiverQueuePacketVersion1( LIST_ENTRY List; NTSTATUS status; + UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(Hash); UNREFERENCED_PARAMETER(More); @@ -1504,6 +1553,7 @@ fail1: static FORCEINLINE VOID __VifReceiverQueuePacketVersion4( IN PXENVIF_VIF_CONTEXT Context, + IN ULONG Index, IN PMDL Mdl, IN ULONG Offset, IN ULONG Length, @@ -1516,6 +1566,7 @@ __VifReceiverQueuePacketVersion4( IN PVOID Cookie ) { + UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(Hash); UNREFERENCED_PARAMETER(More); @@ -1534,6 +1585,7 @@ __VifReceiverQueuePacketVersion4( static FORCEINLINE VOID __VifReceiverQueuePacketVersion6( IN PXENVIF_VIF_CONTEXT Context, + IN ULONG Index, IN PMDL Mdl, IN ULONG Offset, IN ULONG Length, @@ -1546,6 +1598,7 @@ __VifReceiverQueuePacketVersion6( IN PVOID Cookie ) { + UNREFERENCED_PARAMETER(Index); UNREFERENCED_PARAMETER(More); Context->Callback(Context->Argument, @@ -1562,8 +1615,41 @@ __VifReceiverQueuePacketVersion6( } static FORCEINLINE VOID +__VifReceiverQueuePacketVersion7( + IN PXENVIF_VIF_CONTEXT Context, + IN ULONG Index, + IN PMDL Mdl, + IN ULONG Offset, + IN ULONG Length, + IN XENVIF_PACKET_CHECKSUM_FLAGS Flags, + IN USHORT MaximumSegmentSize, + IN USHORT TagControlInformation, + IN PXENVIF_PACKET_INFO Info, + IN PXENVIF_PACKET_HASH Hash, + IN BOOLEAN More, + IN PVOID Cookie + ) +{ + UNREFERENCED_PARAMETER(Index); + + Context->Callback(Context->Argument, + XENVIF_RECEIVER_QUEUE_PACKET, + Mdl, + Offset, + Length, + Flags, + MaximumSegmentSize, + TagControlInformation, + Info, + Hash, + More, + Cookie); +} + +static FORCEINLINE VOID __VifReceiverQueuePacket( IN PXENVIF_VIF_CONTEXT Context, + IN ULONG Index, IN PMDL Mdl, IN ULONG Offset, IN ULONG Length, @@ -1578,6 +1664,7 @@ __VifReceiverQueuePacket( { Context->Callback(Context->Argument, XENVIF_RECEIVER_QUEUE_PACKET, + Index, Mdl, Offset, Length, @@ -1593,6 +1680,7 @@ __VifReceiverQueuePacket( VOID VifReceiverQueuePacket( IN PXENVIF_VIF_CONTEXT Context, + IN ULONG Index, IN PMDL Mdl, IN ULONG Offset, IN ULONG Length, @@ -1609,6 +1697,7 @@ VifReceiverQueuePacket( case 2: case 3: __VifReceiverQueuePacketVersion1(Context, + Index, Mdl, Offset, Length, @@ -1624,6 +1713,7 @@ VifReceiverQueuePacket( case 4: case 5: __VifReceiverQueuePacketVersion4(Context, + Index, Mdl, Offset, Length, @@ -1638,6 +1728,7 @@ VifReceiverQueuePacket( case 6: __VifReceiverQueuePacketVersion6(Context, + Index, Mdl, Offset, Length, @@ -1651,7 +1742,23 @@ VifReceiverQueuePacket( break; case 7: + __VifReceiverQueuePacketVersion7(Context, + Index, + Mdl, + Offset, + Length, + Flags, + MaximumSegmentSize, + TagControlInformation, + Info, + Hash, + More, + Cookie); + break; + + case 8: __VifReceiverQueuePacket(Context, + Index, Mdl, Offset, Length, @@ -1712,6 +1819,7 @@ VifTransmitterReturnPacket( case 5: case 6: case 7: + case 8: Context->Callback(Context->Argument, XENVIF_TRANSMITTER_RETURN_PACKET, Cookie, diff --git a/src/xenvif/vif.h b/src/xenvif/vif.h index 025871d..a2fd613 100644 --- a/src/xenvif/vif.h +++ b/src/xenvif/vif.h @@ -71,6 +71,7 @@ VifReceiverQueuePacketsVersion1( extern VOID VifReceiverQueuePacket( IN PXENVIF_VIF_CONTEXT Context, + IN ULONG Index, IN PMDL Mdl, IN ULONG Offset, IN ULONG Length, -- 2.5.3 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |