[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 2/2] Remove version 1 of the XENVIF_VIF interface
The revision has been gone from the PDO for a long time so version 1 of the interface has been technically dead for a while. This patch cleans up the code. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- include/vif_interface.h | 95 +------------------------ src/xenvif/transmitter.c | 177 ++--------------------------------------------- src/xenvif/transmitter.h | 13 ---- src/xenvif/vif.c | 106 ---------------------------- src/xenvif/vif.h | 6 -- 5 files changed, 7 insertions(+), 390 deletions(-) diff --git a/include/vif_interface.h b/include/vif_interface.h index 2e749a4..f6b6298 100644 --- a/include/vif_interface.h +++ b/include/vif_interface.h @@ -242,29 +242,8 @@ struct _XENVIF_TRANSMITTER_PACKET_COMPLETION_INFO_V1 { typedef struct _XENVIF_TRANSMITTER_PACKET_COMPLETION_INFO_V1 XENVIF_TRANSMITTER_PACKET_COMPLETION_INFO, *PXENVIF_TRANSMITTER_PACKET_COMPLETION_INFO; -#pragma warning(push) -#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union - -/*! \struct _XENVIF_TRANSMITTER_PACKET_V1 - \brief Transmit-side packet structure -*/ -struct _XENVIF_TRANSMITTER_PACKET_V1 { - /*! Pointer used for chaining packets together */ - struct _XENVIF_TRANSMITTER_PACKET_V1 *Next; - union { - struct _XENVIF_TRANSMITTER_PACKET_SEND_INFO_V1 Send; - struct _XENVIF_TRANSMITTER_PACKET_COMPLETION_INFO_V1 Completion; - }; -}; - -typedef struct _XENVIF_TRANSMITTER_PACKET_V1 XENVIF_TRANSMITTER_PACKET_V1, *PXENVIF_TRANSMITTER_PACKET_V1; - -#pragma warning(pop) - #pragma pack(pop) -C_ASSERT(sizeof (struct _XENVIF_TRANSMITTER_PACKET_V1) <= (3 * sizeof (PVOID))); - /*! \struct _XENVIF_TRANSMITTER_PACKET_V2 \brief Transmit-side packet structure (v2) */ @@ -289,26 +268,6 @@ struct _XENVIF_TRANSMITTER_PACKET_V2 { typedef struct _XENVIF_TRANSMITTER_PACKET_V2 XENVIF_TRANSMITTER_PACKET, *PXENVIF_TRANSMITTER_PACKET; -/*! \enum _XENVIF_TRANSMITTER_PACKET_OFFSET - \brief Offsets of packet metadata relative to - XENVIF_TRANSMITTER_PACKET pointer - - Because the transmit side packet structure is limited to 3 pointer - types in size, not all information about the packet can be passed in - the structure. Other information can, however, be found by applying - these byte offsets to the structure pointer and then dereferencing the - specified type. -*/ -typedef enum _XENVIF_TRANSMITTER_PACKET_OFFSET { - /*! The offset of the start of the packet within the MDL (type ULONG) */ - XENVIF_TRANSMITTER_PACKET_OFFSET_OFFSET = 0, - /*! The total length of the packet (type ULONG) */ - XENVIF_TRANSMITTER_PACKET_LENGTH_OFFSET, - /*! MDL referencing the initial buffer of the packet (type PMDL) */ - XENVIF_TRANSMITTER_PACKET_MDL_OFFSET, - XENVIF_TRANSMITTER_PACKET_OFFSET_COUNT -} XENVIF_TRANSMITTER_PACKET_OFFSET, *PXENVIF_TRANSMITTER_PACKET_OFFSET; - /*! \enum _XENVIF_VIF_STATISTIC \brief Interface statistics */ @@ -481,23 +440,6 @@ typedef VOID IN PLIST_ENTRY List ); -/*! \typedef XENVIF_VIF_TRANSMITTER_SET_PACKET_OFFSET - \brief Set byte offset of packet information relative to - XENVIF_TRANSMITTER_PACKET pointer. - - See \ref _XENVIF_TRANSMITTER_PACKET_OFFSET. - - \param Interface The interface header - \param Type The offset type - \param Value The offset value -*/ -typedef NTSTATUS -(*XENVIF_VIF_TRANSMITTER_SET_PACKET_OFFSET)( - IN PINTERFACE Interface, - IN XENVIF_TRANSMITTER_PACKET_OFFSET Type, - IN LONG_PTR Value - ); - /*! \typedef XENVIF_VIF_TRANSMITTER_GET_PACKET_HEADERS \brief Get the packet headers into supplied buffer @@ -514,12 +456,6 @@ typedef NTSTATUS OUT PXENVIF_PACKET_INFO Info ); -typedef NTSTATUS -(*XENVIF_VIF_TRANSMITTER_QUEUE_PACKETS_V1)( - IN PINTERFACE Interface, - IN PXENVIF_TRANSMITTER_PACKET_V1 Head - ); - /*! \typedef XENVIF_VIF_TRANSMITTER_QUEUE_PACKETS \brief Queue transmit side packets at the provider @@ -738,35 +674,6 @@ typedef NTSTATUS DEFINE_GUID(GUID_XENVIF_VIF_INTERFACE, 0x76f279cd, 0xca11, 0x418b, 0x92, 0xe8, 0xc5, 0x7f, 0x77, 0xde, 0xe, 0x2e); -/*! \struct _XENVIF_VIF_INTERFACE_V1 - \brief VIF interface version 1 - \ingroup interfaces -*/ -struct _XENVIF_VIF_INTERFACE_V1 { - 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_RECEIVER_RETURN_PACKETS ReceiverReturnPackets; - XENVIF_VIF_RECEIVER_SET_OFFLOAD_OPTIONS ReceiverSetOffloadOptions; - XENVIF_VIF_RECEIVER_QUERY_RING_SIZE ReceiverQueryRingSize; - XENVIF_VIF_TRANSMITTER_SET_PACKET_OFFSET TransmitterSetPacketOffset; - XENVIF_VIF_TRANSMITTER_QUEUE_PACKETS_V1 TransmitterQueuePacketsVersion1; - 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; -}; - /*! \struct _XENVIF_VIF_INTERFACE_V2 \brief VIF interface version 2 \ingroup interfaces @@ -836,7 +743,7 @@ typedef struct _XENVIF_VIF_INTERFACE_V3 XENVIF_VIF_INTERFACE, *PXENVIF_VIF_INTER #endif // _WINDLL -#define XENVIF_VIF_INTERFACE_VERSION_MIN 1 +#define XENVIF_VIF_INTERFACE_VERSION_MIN 2 #define XENVIF_VIF_INTERFACE_VERSION_MAX 3 #endif // _XENVIF_INTERFACE_H diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c index 8bf0c2c..088bdb6 100644 --- a/src/xenvif/transmitter.c +++ b/src/xenvif/transmitter.c @@ -201,7 +201,6 @@ struct _XENVIF_TRANSMITTER { PXENVIF_TRANSMITTER_RING *Ring; LONG MaxQueues; LONG NumQueues; - LONG_PTR Offset[XENVIF_TRANSMITTER_PACKET_OFFSET_COUNT]; BOOLEAN Split; BOOLEAN MulticastControl; ULONG DisableIpVersion4Gso; @@ -2541,36 +2540,6 @@ __TransmitterRingPushRequests( #define XENVIF_TRANSMITTER_LOCK_BIT ((ULONG_PTR)1) -static FORCEINLINE ULONG -__TransmitterReversePacketList( - IN PXENVIF_TRANSMITTER_PACKET_V1 *Packet - ) -{ - PXENVIF_TRANSMITTER_PACKET_V1 HeadPacket; - ULONG Count; - - HeadPacket = NULL; - Count = 0; - - while (*Packet != NULL) { - PXENVIF_TRANSMITTER_PACKET_V1 Next; - - ASSERT(((ULONG_PTR)*Packet & XENVIF_TRANSMITTER_LOCK_BIT) == 0); - - Next = (*Packet)->Next; - - (*Packet)->Next = HeadPacket; - HeadPacket = *Packet; - - *Packet = Next; - Count++; - } - - *Packet = HeadPacket; - - return Count; -} - static DECLSPEC_NOINLINE VOID TransmitterRingSwizzle( IN PXENVIF_TRANSMITTER_RING Ring @@ -2739,48 +2708,14 @@ __TransmitterReturnPackets( ) { PXENVIF_FRONTEND Frontend; - PXENVIF_VIF_CONTEXT VifContext; - - Frontend = Transmitter->Frontend; - VifContext = PdoGetVifContext(FrontendGetPdo(Frontend)); - - switch (VifGetVersion(VifContext)) { - case 1: { - PXENVIF_TRANSMITTER_PACKET_V1 HeadPacket; - PXENVIF_TRANSMITTER_PACKET_V1 NextPacket; - - HeadPacket = NextPacket = NULL; - - while (!IsListEmpty(List)) { - PLIST_ENTRY ListEntry; - PXENVIF_TRANSMITTER_PACKET Packet; - - ListEntry = RemoveTailList(List); - ASSERT3P(ListEntry, !=, List); - - Packet = CONTAINING_RECORD(ListEntry, XENVIF_TRANSMITTER_PACKET, ListEntry); - Packet->ListEntry.Flink = Packet->ListEntry.Blink = NULL; - - HeadPacket = Packet->Cookie; - HeadPacket->Next = NextPacket; - NextPacket = HeadPacket; - - HeadPacket->Completion = Packet->Completion; - __TransmitterPutPacket(Transmitter, Packet); - } - - if (HeadPacket != NULL) - VifTransmitterReturnPacketsVersion1(VifContext, HeadPacket); + if (IsListEmpty(List)) + return; - break; - } - default: - if (!IsListEmpty(List)) - VifTransmitterReturnPackets(VifContext, List); + Frontend = Transmitter->Frontend; - break; - } + VifTransmitterReturnPackets(PdoGetVifContext(FrontendGetPdo(Frontend)), + List); } static FORCEINLINE BOOLEAN @@ -4043,16 +3978,8 @@ TransmitterDebugCallback( IN BOOLEAN Crashing ) { - PXENVIF_TRANSMITTER Transmitter = Argument; - + UNREFERENCED_PARAMETER(Argument); UNREFERENCED_PARAMETER(Crashing); - - XENBUS_DEBUG(Printf, - &Transmitter->DebugInterface, - "OFFSETS: Offset @ %ld Length @ %ld Mdl @ %ld\n", - Transmitter->Offset[XENVIF_TRANSMITTER_PACKET_OFFSET_OFFSET], - Transmitter->Offset[XENVIF_TRANSMITTER_PACKET_LENGTH_OFFSET], - Transmitter->Offset[XENVIF_TRANSMITTER_PACKET_MDL_OFFSET]); } NTSTATUS @@ -4518,9 +4445,6 @@ TransmitterTeardown( ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL); KeFlushQueuedDpcs(); - RtlZeroMemory(Transmitter->Offset, - sizeof (LONG_PTR) * XENVIF_TRANSMITTER_PACKET_OFFSET_COUNT); - Index = Transmitter->MaxQueues; while (--Index >= 0) { PXENVIF_TRANSMITTER_RING Ring = Transmitter->Ring[Index]; @@ -4568,29 +4492,6 @@ TransmitterTeardown( __TransmitterFree(Transmitter); } -NTSTATUS -TransmitterSetPacketOffset( - IN PXENVIF_TRANSMITTER Transmitter, - IN XENVIF_TRANSMITTER_PACKET_OFFSET Type, - IN LONG_PTR Value - ) -{ - NTSTATUS status; - - status = STATUS_INVALID_PARAMETER; - if (Type >= XENVIF_TRANSMITTER_PACKET_OFFSET_COUNT) - goto fail1; - - Transmitter->Offset[Type] = Value; - - return STATUS_SUCCESS; - -fail1: - Error("fail1 (%08x)\n", status); - - return status; -} - static BOOLEAN __TransmitterGetPacketHeadersPullup( IN PVOID Argument, @@ -4682,72 +4583,6 @@ fail1: } VOID -TransmitterQueuePacketsVersion1( - IN PXENVIF_TRANSMITTER Transmitter, - IN PXENVIF_TRANSMITTER_PACKET_V1 HeadPacket - ) -{ -#define OFFSET_EXISTS(_Transmitter, _Packet, _Type) \ - ((_Transmitter)->Offset[XENVIF_TRANSMITTER_PACKET_ ## _Type ## _OFFSET] != 0) - -#define OFFSET(_Transmitter, _Packet, _Type) \ - ((OFFSET_EXISTS(_Transmitter, _Packet, _Type)) ? \ - (PVOID)((PUCHAR)(_Packet) + \ - (_Transmitter)->Offset[XENVIF_TRANSMITTER_PACKET_ ## _Type ## _OFFSET]) : \ - NULL) - - LIST_ENTRY List; - PXENVIF_FRONTEND Frontend; - PXENVIF_VIF_CONTEXT VifContext; - - Frontend = Transmitter->Frontend; - VifContext = PdoGetVifContext(FrontendGetPdo(Frontend)); - - ASSERT3U(VifGetVersion(VifContext), ==, 1); - - InitializeListHead(&List); - - while (HeadPacket != NULL) { - PXENVIF_TRANSMITTER_PACKET Packet; - - Packet = __TransmitterGetPacket(Transmitter); - if (Packet == NULL) - break; - - Packet->Cookie = HeadPacket; - Packet->Send = HeadPacket->Send; - - ASSERT(OFFSET_EXISTS(Transmitter, HeadPacket, MDL)); - Packet->Mdl = *(PMDL *)OFFSET(Transmitter, HeadPacket, MDL); - - if (OFFSET_EXISTS(Transmitter, HeadPacket, OFFSET)) - Packet->Offset = *(PULONG)OFFSET(Transmitter, HeadPacket, OFFSET); - else - Packet->Offset = 0; - - ASSERT(OFFSET_EXISTS(Transmitter, HeadPacket, LENGTH)); - Packet->Length = *(PULONG)OFFSET(Transmitter, HeadPacket, LENGTH); - - // Packets from legacy clients go to queue 0. - Packet->Value = 0; - - InsertTailList(&List, &Packet->ListEntry); - - HeadPacket = HeadPacket->Next; - } - - if (!IsListEmpty(&List)) - TransmitterQueuePackets(Transmitter, &List); - - if (HeadPacket != NULL) - VifTransmitterReturnPacketsVersion1(VifContext, - HeadPacket); - -#undef OFFSET -#undef OFFSET_EXISTS -} - -VOID TransmitterQueuePackets( IN PXENVIF_TRANSMITTER Transmitter, IN PLIST_ENTRY List diff --git a/src/xenvif/transmitter.h b/src/xenvif/transmitter.h index eddc51b..04f1f6e 100644 --- a/src/xenvif/transmitter.h +++ b/src/xenvif/transmitter.h @@ -116,12 +116,6 @@ TransmitterQueryRingSize( ); extern VOID -TransmitterQueuePacketsVersion1( - IN PXENVIF_TRANSMITTER Transmitter, - IN PXENVIF_TRANSMITTER_PACKET_V1 HeadPacket - ); - -extern VOID TransmitterQueuePackets( IN PXENVIF_TRANSMITTER Transmitter, IN PLIST_ENTRY List @@ -141,13 +135,6 @@ TransmitterQueryLargePacketSize( ); extern NTSTATUS -TransmitterSetPacketOffset( - IN PXENVIF_TRANSMITTER Transmitter, - IN XENVIF_TRANSMITTER_PACKET_OFFSET Type, - IN LONG_PTR Value - ); - -extern NTSTATUS TransmitterGetPacketHeaders( IN PXENVIF_TRANSMITTER Transmitter, IN PXENVIF_TRANSMITTER_PACKET Packet, diff --git a/src/xenvif/vif.c b/src/xenvif/vif.c index 02d1d11..556280b 100644 --- a/src/xenvif/vif.c +++ b/src/xenvif/vif.c @@ -237,28 +237,6 @@ done: return status; } -static NTSTATUS -VifTransmitterSetPacketOffset( - IN PINTERFACE Interface, - IN XENVIF_TRANSMITTER_PACKET_OFFSET Type, - IN LONG_PTR Value - ) -{ - PXENVIF_VIF_CONTEXT Context = Interface->Context; - NTSTATUS status; - - AcquireMrswLockShared(&Context->Lock); - - ASSERT3U(VifGetVersion(Context), ==, 1); - status = TransmitterSetPacketOffset(FrontendGetTransmitter(Context->Frontend), - Type, - Value); - - ReleaseMrswLockShared(&Context->Lock); - - return status; -} - static VOID VifReceiverReturnPackets( IN PINTERFACE Interface, @@ -300,35 +278,6 @@ VifTransmitterGetPacketHeaders( } static NTSTATUS -VifTransmitterQueuePacketsVersion1( - IN PINTERFACE Interface, - IN PXENVIF_TRANSMITTER_PACKET_V1 Head - ) -{ - PXENVIF_VIF_CONTEXT Context = Interface->Context; - NTSTATUS status; - - AcquireMrswLockShared(&Context->Lock); - - status = STATUS_UNSUCCESSFUL; - if (Context->Enabled == FALSE) - goto fail1; - - ASSERT3U(VifGetVersion(Context), ==, 1); - TransmitterQueuePacketsVersion1(FrontendGetTransmitter(Context->Frontend), - Head); - - ReleaseMrswLockShared(&Context->Lock); - - return STATUS_SUCCESS; - -fail1: - ReleaseMrswLockShared(&Context->Lock); - - return status; -} - -static NTSTATUS VifTransmitterQueuePackets( IN PINTERFACE Interface, IN PLIST_ENTRY List @@ -713,31 +662,6 @@ done: ReleaseMrswLockExclusive(&Context->Lock, Irql, FALSE); } -static struct _XENVIF_VIF_INTERFACE_V1 VifInterfaceVersion1 = { - { sizeof (struct _XENVIF_VIF_INTERFACE_V1), 1, NULL, NULL, NULL }, - VifAcquire, - VifRelease, - VifEnable, - VifDisable, - VifQueryStatistic, - VifReceiverReturnPackets, - VifReceiverSetOffloadOptions, - VifReceiverQueryRingSize, - VifTransmitterSetPacketOffset, - VifTransmitterQueuePacketsVersion1, - VifTransmitterQueryOffloadOptions, - VifTransmitterQueryLargePacketSize, - VifTransmitterQueryRingSize, - VifMacQueryState, - VifMacQueryMaximumFrameSize, - VifMacQueryPermanentAddress, - VifMacQueryCurrentAddress, - VifMacQueryMulticastAddresses, - VifMacSetMulticastAddresses, - VifMacSetFilterLevel, - VifMacQueryFilterLevel -}; - static struct _XENVIF_VIF_INTERFACE_V2 VifInterfaceVersion2 = { { sizeof (struct _XENVIF_VIF_INTERFACE_V2), 2, NULL, NULL, NULL }, VifAcquire, @@ -853,23 +777,6 @@ VifGetInterface( NTSTATUS status; switch (Version) { - case 1: { - struct _XENVIF_VIF_INTERFACE_V1 *VifInterface; - - VifInterface = (struct _XENVIF_VIF_INTERFACE_V1 *)Interface; - - status = STATUS_BUFFER_OVERFLOW; - if (Size < sizeof (struct _XENVIF_VIF_INTERFACE_V1)) - break; - - *VifInterface = VifInterfaceVersion1; - - ASSERT3U(Interface->Version, ==, Version); - Interface->Context = Context; - - status = STATUS_SUCCESS; - break; - } case 2: { struct _XENVIF_VIF_INTERFACE_V2 *VifInterface; @@ -953,19 +860,6 @@ VifReceiverQueuePackets( } VOID -VifTransmitterReturnPacketsVersion1( - IN PXENVIF_VIF_CONTEXT Context, - IN PXENVIF_TRANSMITTER_PACKET_V1 Head - ) -{ - ASSERT3U(VifGetVersion(Context), ==, 1); - - Context->Callback(Context->Argument, - XENVIF_TRANSMITTER_RETURN_PACKETS, - Head); -} - -VOID VifTransmitterReturnPackets( IN PXENVIF_VIF_CONTEXT Context, IN PLIST_ENTRY List diff --git a/src/xenvif/vif.h b/src/xenvif/vif.h index 967b7aa..a842b79 100644 --- a/src/xenvif/vif.h +++ b/src/xenvif/vif.h @@ -69,12 +69,6 @@ VifReceiverQueuePackets( ); extern VOID -VifTransmitterReturnPacketsVersion1( - IN PXENVIF_VIF_CONTEXT Context, - IN PXENVIF_TRANSMITTER_PACKET_V1 Head - ); - -extern VOID VifTransmitterReturnPackets( IN PXENVIF_VIF_CONTEXT Context, IN PLIST_ENTRY List -- 2.1.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |