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

[win-pv-devel] [PATCH] Update to VIF interface version 5



Use version 5 of the interface to avoid the shutdown race present in
version 4.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 include/vif_interface.h  | 48 +++++++++++++++++++++++++++++++++++++++++++++---
 src/xennet.inf           |  6 +++---
 src/xennet/transmitter.c | 26 ++++++++++++++++----------
 3 files changed, 64 insertions(+), 16 deletions(-)

diff --git a/include/vif_interface.h b/include/vif_interface.h
index 27c5d2d..5a064fd 100644
--- a/include/vif_interface.h
+++ b/include/vif_interface.h
@@ -460,6 +460,19 @@ typedef NTSTATUS
     IN  PLIST_ENTRY List
     );
 
+typedef VOID
+(*XENVIF_VIF_TRANSMITTER_QUEUE_PACKET_V4)(
+    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
 
@@ -473,7 +486,7 @@ typedef NTSTATUS
     \param Hash Hash information for the packet
     \param Cookie A cookie specified by the caller that will be passed to the 
XENVIF_TRANSMITTER_RETURN_PACKET callback
 */
-typedef VOID
+typedef NTSTATUS
 (*XENVIF_VIF_TRANSMITTER_QUEUE_PACKET)(
     IN  PINTERFACE                  Interface,
     IN  PMDL                        Mdl,
@@ -766,6 +779,35 @@ struct _XENVIF_VIF_INTERFACE_V4 {
     XENVIF_VIF_RECEIVER_SET_OFFLOAD_OPTIONS         ReceiverSetOffloadOptions;
     XENVIF_VIF_RECEIVER_SET_BACKFILL_SIZE           ReceiverSetBackfillSize;
     XENVIF_VIF_RECEIVER_QUERY_RING_SIZE             ReceiverQueryRingSize;
+    XENVIF_VIF_TRANSMITTER_QUEUE_PACKET_V4          
TransmitterQueuePacketVersion4;
+    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_V5
+    \brief VIF interface version 5
+    \ingroup interfaces
+*/
+struct _XENVIF_VIF_INTERFACE_V5 {
+    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_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_TRANSMITTER_QUEUE_PACKET             TransmitterQueuePacket;
     XENVIF_VIF_TRANSMITTER_QUERY_OFFLOAD_OPTIONS    
TransmitterQueryOffloadOptions;
     XENVIF_VIF_TRANSMITTER_QUERY_LARGE_PACKET_SIZE  
TransmitterQueryLargePacketSize;
@@ -780,7 +822,7 @@ struct _XENVIF_VIF_INTERFACE_V4 {
     XENVIF_VIF_MAC_QUERY_FILTER_LEVEL               MacQueryFilterLevel;
 };
 
-typedef struct _XENVIF_VIF_INTERFACE_V4 XENVIF_VIF_INTERFACE, 
*PXENVIF_VIF_INTERFACE;
+typedef struct _XENVIF_VIF_INTERFACE_V5 XENVIF_VIF_INTERFACE, 
*PXENVIF_VIF_INTERFACE;
 
 /*! \def XENVIF_VIF
     \brief Macro at assist in method invocation
@@ -791,6 +833,6 @@ typedef struct _XENVIF_VIF_INTERFACE_V4 
XENVIF_VIF_INTERFACE, *PXENVIF_VIF_INTER
 #endif  // _WINDLL
 
 #define XENVIF_VIF_INTERFACE_VERSION_MIN    2
-#define XENVIF_VIF_INTERFACE_VERSION_MAX    4
+#define XENVIF_VIF_INTERFACE_VERSION_MAX    5
 
 #endif  // _XENVIF_INTERFACE_H
diff --git a/src/xennet.inf b/src/xennet.inf
index 88aaac4..058b5ac 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
 ; -----------          -------         --------
 
-%XenNetDesc%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_NET&REV_08000006
-%XenNetDesc%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0001&DEV_NET&REV_08000006
-%XenNetDesc%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0002&DEV_NET&REV_08000006
+%XenNetDesc%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_NET&REV_08000007
+%XenNetDesc%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0001&DEV_NET&REV_08000007
+%XenNetDesc%           =XenNet_Inst,   
XENVIF\VEN_@VENDOR_PREFIX@0002&DEV_NET&REV_08000007
 
 [XenNet_Inst] 
 Characteristics=0x84
diff --git a/src/xennet/transmitter.c b/src/xennet/transmitter.c
index 5574b9c..b5e110a 100644
--- a/src/xennet/transmitter.c
+++ b/src/xennet/transmitter.c
@@ -252,21 +252,27 @@ TransmitterSendNetBufferLists(
         while (NetBuffer != NULL) {
             PVOID               Cookie = NetBufferList;
             XENVIF_PACKET_HASH  Hash;
+            NTSTATUS            status;
 
             ListReserved->Reference++;
 
             Hash.Algorithm = XENVIF_PACKET_HASH_ALGORITHM_NONE;
 
-            XENVIF_VIF(TransmitterQueuePacket,
-                       AdapterGetVifInterface(Transmitter->Adapter),
-                       NET_BUFFER_CURRENT_MDL(NetBuffer),
-                       NET_BUFFER_CURRENT_MDL_OFFSET(NetBuffer),
-                       NET_BUFFER_DATA_LENGTH(NetBuffer),
-                       OffloadOptions,
-                       MaximumSegmentSize,
-                       TagControlInformation,
-                       &Hash,
-                       Cookie);
+            status = XENVIF_VIF(TransmitterQueuePacket,
+                                AdapterGetVifInterface(Transmitter->Adapter),
+                                NET_BUFFER_CURRENT_MDL(NetBuffer),
+                                NET_BUFFER_CURRENT_MDL_OFFSET(NetBuffer),
+                                NET_BUFFER_DATA_LENGTH(NetBuffer),
+                                OffloadOptions,
+                                MaximumSegmentSize,
+                                TagControlInformation,
+                                &Hash,
+                                Cookie);
+            if (!NT_SUCCESS(status)) {
+                __TransmitterReturnPacket(Transmitter, Cookie,
+                                          NDIS_STATUS_NOT_ACCEPTED);
+                break;
+            }
 
             NetBuffer = NET_BUFFER_NEXT_NB(NetBuffer);
         }
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

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