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

[PATCH xennet 1/2] Update to XENVIF_VIF_INTERFACE version 9



From: Paul Durrant <pdurrant@xxxxxxxxxx>

This means we need to re-work the varargs AdapterVifCallback() function into a
new version that deals with the new XENVIF_VIF_CALLBACK_PARAMETERS structure.
Otherwise there is no functional change.

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 include/vif_interface.h | 154 +++++++++++++++++++---------------------
 src/xennet.inf          |   6 +-
 src/xennet/adapter.c    |  78 ++++++--------------
 3 files changed, 97 insertions(+), 141 deletions(-)

diff --git a/include/vif_interface.h b/include/vif_interface.h
index 20de31433297..c157c5ca798e 100644
--- a/include/vif_interface.h
+++ b/include/vif_interface.h
@@ -388,6 +388,49 @@ typedef enum _XENVIF_VIF_CALLBACK_TYPE {
     XENVIF_MAC_STATE_CHANGE
 } XENVIF_VIF_CALLBACK_TYPE, *PXENVIF_VIF_CALLBACK_TYPE;
 
+/*! \typedef XENVIF_VIF_CALLBACK_PARAMETERS_V9
+    \brief VIF interface version 9 parameters for provider to subscriber 
callback function
+
+    \b XENVIF_TRANSMITTER_RETURN_PACKET:
+    \param Cookie Cookie supplied to XENVIF_TRANSMITTER_QUEUE_PACKET
+    \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
+    \param Flags Packet checksum flags
+    \param MaximumSegmentSize The TCP MSS (used only if 
OffloadOptions.OffloadIpVersion[4|6]LargePacket is set)
+    \param TagControlInformation The VLAN TCI (used only if 
OffloadOptions.OffloadTagManipulation is set)
+    \param Info Header information for the packet
+    \param Hash Hash information for the packet
+    \param More A flag to indicate whether more packets will be queued for the 
same CPU
+    \param Cookie Cookie that should be passed to 
XENVIF_RECEIVER_RETURN_PACKET method
+
+    \b XENVIF_MAC_STATE_CHANGE:
+    No additional arguments
+*/
+union _XENVIF_VIF_CALLBACK_PARAMETERS_V9 {
+    struct {
+        PVOID                                       Cookie;
+        PXENVIF_TRANSMITTER_PACKET_COMPLETION_INFO  Completion;
+    } TransmitterReturnPacket;
+    struct {
+        ULONG                           Index;
+        PMDL                            Mdl;
+        ULONG                           Offset;
+        ULONG                           Length;
+        XENVIF_PACKET_CHECKSUM_FLAGS    Flags;
+        USHORT                          MaximumSegmentSize;
+        USHORT                          TagControlInformation;
+        PXENVIF_PACKET_INFO             Info;
+        PXENVIF_PACKET_HASH             Hash;
+        BOOLEAN                         More;
+        PVOID                           Cookie;
+    } ReceiverQueuePacket;
+};
+
 /*! \typedef XENVIF_VIF_ACQUIRE
     \brief Acquire a reference to the VIF interface
 
@@ -408,38 +451,34 @@ typedef VOID
     IN  PINTERFACE  Interface
     );
 
+typedef VOID
+(*XENVIF_VIF_CALLBACK_V8)(
+    IN  PVOID                       Argument OPTIONAL,
+    IN  XENVIF_VIF_CALLBACK_TYPE    Type,
+    ...
+    );
+
+typedef union _XENVIF_VIF_CALLBACK_PARAMETERS_V9 
XENVIF_VIF_CALLBACK_PARAMETERS, *PXENVIF_VIF_CALLBACK_PARAMETERS;
+
 /*! \typedef XENVIF_VIF_CALLBACK
     \brief Provider to subscriber callback function
 
     \param Argument An optional context argument passed to the callback
     \param Type The callback type
-    \param ... Additional paramaters required by \a Type
-
-    \b XENVIF_TRANSMITTER_RETURN_PACKET:
-    \param Cookie Cookie supplied to XENVIF_TRANSMITTER_QUEUE_PACKET
-    \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
-    \param Flags Packet checksum flags
-    \param MaximumSegmentSize The TCP MSS (used only if 
OffloadOptions.OffloadIpVersion[4|6]LargePacket is set)
-    \param TagControlInformation The VLAN TCI (used only if 
OffloadOptions.OffloadTagManipulation is set)
-    \param Info Header information for the packet
-    \param Hash Hash information for the packet
-    \param More A flag to indicate whether more packets will be queued for the 
same CPU
-    \param Cookie Cookie that should be passed to 
XENVIF_RECEIVER_RETURN_PACKET method
-
-    \b XENVIF_MAC_STATE_CHANGE:
-    No additional arguments
+    \param Parameters The callback parameters
 */
 typedef VOID
 (*XENVIF_VIF_CALLBACK)(
-    IN  PVOID                       Argument OPTIONAL,
-    IN  XENVIF_VIF_CALLBACK_TYPE    Type,
-    ...
+    IN  PVOID                           Argument OPTIONAL,
+    IN  XENVIF_VIF_CALLBACK_TYPE        Type,
+    IN  PXENVIF_VIF_CALLBACK_PARAMETERS Parameters
+    );
+
+typedef NTSTATUS
+(*XENVIF_VIF_ENABLE_V8)(
+    IN  PINTERFACE              Interface,
+    IN  XENVIF_VIF_CALLBACK_V8  Callback,
+    IN  PVOID                   Argument OPTIONAL
     );
 
 /*! \typedef XENVIF_VIF_ENABLE
@@ -533,19 +572,6 @@ typedef VOID
     IN  PVOID       Cookie
     );
 
-typedef NTSTATUS
-(*XENVIF_VIF_TRANSMITTER_QUEUE_PACKET_V6)(
-    IN  PINTERFACE                  Interface,
-    IN  PMDL                        Mdl,
-    IN  ULONG                       Offset,
-    IN  ULONG                       Length,
-    IN  XENVIF_VIF_OFFLOAD_OPTIONS  OffloadOptions,
-    IN  USHORT                      MaximumSegmentSize,
-    IN  USHORT                      TagControlInformation,
-    IN  PXENVIF_PACKET_HASH         Hash,
-    IN  PVOID                       Cookie
-    );
-
 /*! \typedef XENVIF_VIF_TRANSMITTER_QUEUE_PACKET
     \brief Queue a packet at the provider's transmit side
 
@@ -826,49 +852,15 @@ typedef NTSTATUS
 DEFINE_GUID(GUID_XENVIF_VIF_INTERFACE, 
 0x76f279cd, 0xca11, 0x418b, 0x92, 0xe8, 0xc5, 0x7f, 0x77, 0xde, 0xe, 0x2e);
 
-/*! \struct _XENVIF_VIF_INTERFACE_V6
-    \brief VIF interface version 6
-    \ingroup interfaces
-*/
-struct _XENVIF_VIF_INTERFACE_V6 {
-    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_V6          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;
-};
-
-/*! \struct _XENVIF_VIF_INTERFACE_V7
-    \brief VIF interface version 7
+/*! \struct _XENVIF_VIF_INTERFACE_V8
+    \brief VIF interface version 8
     \ingroup interfaces
 */
-struct _XENVIF_VIF_INTERFACE_V7 {
+struct _XENVIF_VIF_INTERFACE_V8 {
     INTERFACE                                       Interface;
     XENVIF_VIF_ACQUIRE                              Acquire;
     XENVIF_VIF_RELEASE                              Release;
-    XENVIF_VIF_ENABLE                               Enable;
+    XENVIF_VIF_ENABLE_V8                            EnableVersion8;
     XENVIF_VIF_DISABLE                              Disable;
     XENVIF_VIF_QUERY_STATISTIC                      QueryStatistic;
     XENVIF_VIF_QUERY_RING_COUNT                     QueryRingCount;
@@ -894,11 +886,11 @@ struct _XENVIF_VIF_INTERFACE_V7 {
     XENVIF_VIF_MAC_QUERY_FILTER_LEVEL               MacQueryFilterLevel;
 };
 
-/*! \struct _XENVIF_VIF_INTERFACE_V8
-    \brief VIF interface version 8
+/*! \struct _XENVIF_VIF_INTERFACE_V9
+    \brief VIF interface version 9
     \ingroup interfaces
 */
-struct _XENVIF_VIF_INTERFACE_V8 {
+struct _XENVIF_VIF_INTERFACE_V9 {
     INTERFACE                                       Interface;
     XENVIF_VIF_ACQUIRE                              Acquire;
     XENVIF_VIF_RELEASE                              Release;
@@ -928,7 +920,7 @@ struct _XENVIF_VIF_INTERFACE_V8 {
     XENVIF_VIF_MAC_QUERY_FILTER_LEVEL               MacQueryFilterLevel;
 };
 
-typedef struct _XENVIF_VIF_INTERFACE_V8 XENVIF_VIF_INTERFACE, 
*PXENVIF_VIF_INTERFACE;
+typedef struct _XENVIF_VIF_INTERFACE_V9 XENVIF_VIF_INTERFACE, 
*PXENVIF_VIF_INTERFACE;
 
 /*! \def XENVIF_VIF
     \brief Macro at assist in method invocation
@@ -938,7 +930,7 @@ 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_MIN    8
+#define XENVIF_VIF_INTERFACE_VERSION_MAX    9
 
 #endif  // _XENVIF_INTERFACE_H
diff --git a/src/xennet.inf b/src/xennet.inf
index c44f4af18075..58ea5d79fd3e 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 743cf35cd1dc..50cd3e63e382 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -199,75 +199,39 @@ AdapterAllocateComplete (
 
 static VOID
 AdapterVifCallback(
-    IN  PVOID                       Context,
-    IN  XENVIF_VIF_CALLBACK_TYPE    Type,
-    ...
+    IN  PVOID                           Context,
+    IN  XENVIF_VIF_CALLBACK_TYPE        Type,
+    IN  PXENVIF_VIF_CALLBACK_PARAMETERS Parameters
     )
 {
-    PXENNET_ADAPTER     Adapter = Context;
-    va_list             Arguments;
-
-    va_start(Arguments, Type);
+    PXENNET_ADAPTER                     Adapter = Context;
 
     switch (Type) {
-    case XENVIF_TRANSMITTER_RETURN_PACKET: {
-        PVOID                                       Cookie;
-        PXENVIF_TRANSMITTER_PACKET_COMPLETION_INFO  Completion;
-
-        Cookie = va_arg(Arguments, PVOID);
-        Completion = va_arg(Arguments, 
PXENVIF_TRANSMITTER_PACKET_COMPLETION_INFO);
-
+    case XENVIF_TRANSMITTER_RETURN_PACKET:
         TransmitterReturnPacket(Adapter->Transmitter,
-                                Cookie,
-                                Completion);
+                                Parameters->TransmitterReturnPacket.Cookie,
+                                
Parameters->TransmitterReturnPacket.Completion);
         break;
-    }
-    case XENVIF_RECEIVER_QUEUE_PACKET: {
-        ULONG                           Index;
-        PMDL                            Mdl;
-        ULONG                           Offset;
-        ULONG                           Length;
-        XENVIF_PACKET_CHECKSUM_FLAGS    Flags;
-        USHORT                          MaximumSegmentSize;
-        USHORT                          TagControlInformation;
-        PXENVIF_PACKET_INFO             Info;
-        PXENVIF_PACKET_HASH             Hash;
-        BOOLEAN                         More;
-        PVOID                           Cookie;
-
-        Index = va_arg(Arguments, ULONG);
-        Mdl = va_arg(Arguments, PMDL);
-        Offset = va_arg(Arguments, ULONG);
-        Length = va_arg(Arguments, ULONG);
-        Flags = va_arg(Arguments, XENVIF_PACKET_CHECKSUM_FLAGS);
-        MaximumSegmentSize = va_arg(Arguments, USHORT);
-        TagControlInformation = va_arg(Arguments, USHORT);
-        Info = va_arg(Arguments, PXENVIF_PACKET_INFO);
-        Hash = va_arg(Arguments, PXENVIF_PACKET_HASH);
-        More = va_arg(Arguments, BOOLEAN);
-        Cookie = va_arg(Arguments, PVOID);
 
+    case XENVIF_RECEIVER_QUEUE_PACKET:
         ReceiverQueuePacket(Adapter->Receiver,
-                            Index,
-                            Mdl,
-                            Offset,
-                            Length,
-                            Flags,
-                            MaximumSegmentSize,
-                            TagControlInformation,
-                            Info,
-                            Hash,
-                            More,
-                            Cookie);
+                            Parameters->ReceiverQueuePacket.Index,
+                            Parameters->ReceiverQueuePacket.Mdl,
+                            Parameters->ReceiverQueuePacket.Offset,
+                            Parameters->ReceiverQueuePacket.Length,
+                            Parameters->ReceiverQueuePacket.Flags,
+                            Parameters->ReceiverQueuePacket.MaximumSegmentSize,
+                            
Parameters->ReceiverQueuePacket.TagControlInformation,
+                            Parameters->ReceiverQueuePacket.Info,
+                            Parameters->ReceiverQueuePacket.Hash,
+                            Parameters->ReceiverQueuePacket.More,
+                            Parameters->ReceiverQueuePacket.Cookie);
         break;
-    }
-    case XENVIF_MAC_STATE_CHANGE: {
+
+    case XENVIF_MAC_STATE_CHANGE:
         AdapterMediaStateChange(Adapter);
         break;
     }
-    }
-
-    va_end(Arguments);
 }
 
 static VOID
-- 
2.17.1




 


Rackspace

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