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

[win-pv-devel] [PATCH 2/3] Remove header/data split support



During logo testing it became apparent that:

a) This is predicated on support VLAN ID, which is not something we really
   want in a PV driver (since the backend network may actually be a VLAN).
b) Turning on Viridian flags causes NDIS to stop enabling header/data split.
   (There's a call to NdisGetHypervisorInfo() in NdisMSetHDSplitAttributes()).

Issue a) makes it undesirable to implement and b) makes it pretty much
pointless having the code around. Hence this patch removes it.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xennet.inf        |  7 ----
 src/xennet/adapter.c  | 88 +--------------------------------------------------
 src/xennet/receiver.c | 56 +-------------------------------
 src/xennet/receiver.h |  6 ----
 4 files changed, 2 insertions(+), 155 deletions(-)

diff --git a/src/xennet.inf b/src/xennet.inf
index 31b2f64..ae194b7 100644
--- a/src/xennet.inf
+++ b/src/xennet.inf
@@ -159,13 +159,6 @@ HKR, Ndi\params\LROIPv6,                          
Optional,   0, "0"
 HKR, Ndi\params\LROIPv6\enum,                     "0",        0, %Disabled%
 HKR, Ndi\params\LROIPv6\enum,                     "1",        0, %Enabled%
 
-HKR, Ndi\params\*HeaderDataSplit,                 ParamDesc,  0, 
%HeaderDataSplit%
-HKR, Ndi\params\*HeaderDataSplit,                 Type,       0, "enum"
-HKR, Ndi\params\*HeaderDataSplit,                 Default,    0, "0"
-HKR, Ndi\params\*HeaderDataSplit,                 Optional,   0, "0"
-HKR, Ndi\params\*HeaderDataSplit\enum,            "0",        0, %Disabled%
-HKR, Ndi\params\*HeaderDataSplit\enum,            "1",        0, %Enabled%
-
 [XenNet_Inst.Services] 
 AddService=xennet,0x02,XenNet_Service,XenNet_EventLog
 
diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c
index 806b1e3..dca9b7b 100644
--- a/src/xennet/adapter.c
+++ b/src/xennet/adapter.c
@@ -60,7 +60,6 @@ typedef struct _PROPERTIES {
     int lsov6;
     int lrov4;
     int lrov6;
-    ULONG HeaderDataSplit;
 } PROPERTIES, *PPROPERTIES;
 
 struct _XENNET_ADAPTER {
@@ -139,7 +138,6 @@ static NDIS_OID XennetSupportedOids[] =
     OID_PNP_CAPABILITIES,
     OID_PNP_QUERY_POWER,
     OID_PNP_SET_POWER,
-    OID_GEN_HD_SPLIT_PARAMETERS,
 };
 
 #define ADAPTER_POOL_TAG    'AteN'
@@ -561,6 +559,7 @@ AdapterGetOffloadEncapsulation(
         TxOptions->OffloadIpVersion6UdpChecksum = 1;
 
     RxOptions = ReceiverOffloadOptions(Adapter->Receiver);
+
     RxOptions->Value = 0;
     RxOptions->OffloadTagManipulation = 1;
 
@@ -672,18 +671,6 @@ invalid_parameter:
 #undef CHANGE
 
 static NDIS_STATUS
-AdapterGetHeaderDataSplitParameters(
-    IN  PXENNET_ADAPTER             Adapter,
-    IN  PNDIS_HD_SPLIT_PARAMETERS   Split
-    )
-{
-    if (Split->HDSplitCombineFlags == NDIS_HD_SPLIT_COMBINE_ALL_HEADERS)
-        ReceiverSplitHeaderData(Adapter->Receiver, 0);
-
-    return NDIS_STATUS_SUCCESS;
-}
-
-static NDIS_STATUS
 AdapterQueryGeneralStatistics(
     IN  PXENNET_ADAPTER     Adapter,
     IN  PNDIS_STATISTICS_INFO   Info,
@@ -1693,16 +1680,6 @@ AdapterSetInformation(
         }
         break;
 
-    case OID_GEN_HD_SPLIT_PARAMETERS:
-        BytesNeeded = sizeof(NDIS_HD_SPLIT_PARAMETERS);
-        if (BufferLength >= BytesNeeded) {
-            ndisStatus = AdapterGetHeaderDataSplitParameters(Adapter,
-                                                             
(PNDIS_HD_SPLIT_PARAMETERS)Buffer);
-            if (ndisStatus == NDIS_STATUS_SUCCESS)
-                BytesRead = sizeof(NDIS_HD_SPLIT_PARAMETERS);
-        }
-        break;
-
     case OID_GEN_INTERRUPT_MODERATION:
     case OID_GEN_MACHINE_NAME:
         Warn = FALSE;
@@ -2393,7 +2370,6 @@ AdapterGetAdvancedSettings(
     READ_PROPERTY(Adapter->Properties.lrov4, L"LROIPv4", 1, Handle);
     READ_PROPERTY(Adapter->Properties.lrov6, L"LROIPv6", 1, Handle);
     READ_PROPERTY(Adapter->Properties.need_csum_value, L"NeedChecksumValue", 
1, Handle);
-    READ_PROPERTY(Adapter->Properties.HeaderDataSplit, L"*HeaderDataSplit", 1, 
Handle);
 
     NdisCloseConfiguration(Handle);
 
@@ -2678,63 +2654,6 @@ AdapterSetOffloadAttributes(
     return ndisStatus;
 }
 
-static NDIS_STATUS
-AdapterSetHeaderDataSplitAttributes(
-    IN  PXENNET_ADAPTER                                 Adapter
-    )
-{
-    NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES    Attribs;
-    NDIS_HD_SPLIT_ATTRIBUTES                            Split;
-    NDIS_STATUS                                         NdisStatus;
-
-    RtlZeroMemory(&Attribs, sizeof(Attribs));
-
-    Attribs.Header.Type = 
NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES;
-    Attribs.Header.Revision = 
NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES_REVISION_1;
-    Attribs.Header.Size = 
NDIS_SIZEOF_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES_REVISION_1;
-
-    RtlZeroMemory(&Split, sizeof(Split));
-
-    Split.Header.Type = NDIS_OBJECT_TYPE_HD_SPLIT_ATTRIBUTES;
-    Split.Header.Revision = NDIS_HD_SPLIT_ATTRIBUTES_REVISION_1;
-    Split.Header.Size = NDIS_SIZEOF_HD_SPLIT_ATTRIBUTES_REVISION_1;
-    Split.HardwareCapabilities =
-        NDIS_HD_SPLIT_CAPS_SUPPORTS_HEADER_DATA_SPLIT |
-        NDIS_HD_SPLIT_CAPS_SUPPORTS_IPV4_OPTIONS |
-        NDIS_HD_SPLIT_CAPS_SUPPORTS_IPV6_EXTENSION_HEADERS |
-        NDIS_HD_SPLIT_CAPS_SUPPORTS_TCP_OPTIONS;
-
-    if (Adapter->Properties.HeaderDataSplit != 0)
-        Split.CurrentCapabilities = Split.HardwareCapabilities;
-
-    Attribs.HDSplitAttributes = &Split;
-
-    NdisStatus = NdisMSetMiniportAttributes(Adapter->NdisAdapterHandle,
-                                            
(PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&Attribs);
-    if (NdisStatus != NDIS_STATUS_SUCCESS)
-        goto fail1;
-
-    if (Split.HDSplitFlags == NDIS_HD_SPLIT_ENABLE_HEADER_DATA_SPLIT) {
-        ASSERT(Split.CurrentCapabilities & 
NDIS_HD_SPLIT_CAPS_SUPPORTS_HEADER_DATA_SPLIT);
-
-        Info("BackfillSize = %u\n", Split.BackfillSize);
-        Info("MaxHeaderSize = %u\n", Split.MaxHeaderSize);
-
-        XENVIF_VIF(ReceiverSetBackfillSize,
-                   &Adapter->VifInterface,
-                   Split.BackfillSize);
-
-        ReceiverSplitHeaderData(Adapter->Receiver, Split.MaxHeaderSize);
-    }
-
-    return NDIS_STATUS_SUCCESS;
-
-fail1:
-    Error("fail1 (%08x)\n", NdisStatus);
-
-    return NdisStatus;
-}
-
 NDIS_STATUS
 AdapterInitialize(
     IN  NDIS_HANDLE         Handle,
@@ -2821,10 +2740,6 @@ AdapterInitialize(
     if (ndisStatus != NDIS_STATUS_SUCCESS)
         goto fail11;
 
-    ndisStatus = AdapterSetHeaderDataSplitAttributes(*Adapter);
-    if (ndisStatus != NDIS_STATUS_SUCCESS)
-        goto fail12;
-
     RtlZeroMemory(&Dma, sizeof(NDIS_SG_DMA_DESCRIPTION));
     Dma.Header.Type = NDIS_OBJECT_TYPE_SG_DMA_DESCRIPTION;
     Dma.Header.Revision = NDIS_SG_DMA_DESCRIPTION_REVISION_1;
@@ -2842,7 +2757,6 @@ AdapterInitialize(
 
     return NDIS_STATUS_SUCCESS;
 
-fail12:
 fail11:
 fail10:
 fail9:
diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c
index 9f5ac60..08c6413 100644
--- a/src/xennet/receiver.c
+++ b/src/xennet/receiver.c
@@ -47,7 +47,6 @@ struct _XENNET_RECEIVER {
     LONG                        InNDIS;
     LONG                        InNDISMax;
     XENVIF_VIF_OFFLOAD_OPTIONS  OffloadOptions;
-    ULONG                       MaxHeaderSize;
 };
 
 #define RECEIVER_POOL_TAG       'RteN'
@@ -177,10 +176,10 @@ __ReceiverReceivePacket(
     )
 {
     PNET_BUFFER_LIST                            NetBufferList;
-    PNET_BUFFER                                 NetBuffer;
     NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO   csumInfo;
 
     UNREFERENCED_PARAMETER(MaximumSegmentSize);
+    UNREFERENCED_PARAMETER(Info);
 
     NetBufferList = __ReceiverAllocateNetBufferList(Receiver,
                                                     Mdl,
@@ -190,8 +189,6 @@ __ReceiverReceivePacket(
     if (NetBufferList == NULL)
         goto fail1;
 
-    NetBuffer = NET_BUFFER_LIST_FIRST_NB(NetBufferList);
-
     NetBufferList->SourceHandle = AdapterGetHandle(Receiver->Adapter);
 
     csumInfo.Value = 0;
@@ -221,48 +218,6 @@ __ReceiverReceivePacket(
         NET_BUFFER_LIST_INFO(NetBufferList, Ieee8021QNetBufferListInfo) = 
Ieee8021QInfo.Value;
     }
 
-    if (Info->IpHeader.Offset != 0) {
-        ULONG                   NblFlags;
-        PUCHAR                  InfoVa;
-        PIP_HEADER              IpHeader;
-        NDIS_PHYSICAL_ADDRESS   DataPhysicalAddress;
-
-        NblFlags = NET_BUFFER_LIST_NBL_FLAGS(NetBufferList);
-
-        InfoVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-        ASSERT(InfoVa != NULL);
-        InfoVa += Offset;
-
-        IpHeader = (PIP_HEADER)(InfoVa + Info->IpHeader.Offset);
-
-        if (IpHeader->Version == 4) {
-            NblFlags |= NDIS_NBL_FLAGS_IS_IPV4;
-        } else {
-            ASSERT3U(IpHeader->Version, ==, 6);
-            NblFlags |= NDIS_NBL_FLAGS_IS_IPV6;
-        }
-
-        if (Info->TcpHeader.Offset != 0)
-            NblFlags |= NDIS_NBL_FLAGS_IS_TCP;
-        else if (Info->UdpHeader.Offset != 0)
-            NblFlags |= NDIS_NBL_FLAGS_IS_UDP;
-
-        if (Mdl->Next != NULL && Info->Length < Receiver->MaxHeaderSize) {
-            NblFlags |= NDIS_NBL_FLAGS_HD_SPLIT;
-            if (NblFlags & (NDIS_NBL_FLAGS_IS_TCP | NDIS_NBL_FLAGS_IS_UDP))
-                NblFlags |= 
NDIS_NBL_FLAGS_SPLIT_AT_UPPER_LAYER_PROTOCOL_PAYLOAD;
-            else
-                NblFlags |= 
NDIS_NBL_FLAGS_SPLIT_AT_UPPER_LAYER_PROTOCOL_HEADER;
-
-            DataPhysicalAddress.QuadPart = 
(ULONGLONG)MmGetMdlPfnArray(Mdl->Next)[0] << PAGE_SHIFT;
-            DataPhysicalAddress.QuadPart += Mdl->Next->ByteOffset;
-
-            NET_BUFFER_DATA_PHYSICAL_ADDRESS(NetBuffer) = DataPhysicalAddress;
-        }
-
-        NET_BUFFER_LIST_NBL_FLAGS(NetBufferList) = NblFlags;
-    }
-
     return NetBufferList;
 
 fail2:
@@ -461,12 +416,3 @@ ReceiverOffloadOptions(
 {
     return &Receiver->OffloadOptions;
 }
-
-VOID
-ReceiverSplitHeaderData(
-    IN  PXENNET_RECEIVER    Receiver,
-    IN  ULONG               MaxHeaderSize
-    )
-{
-    Receiver->MaxHeaderSize = MaxHeaderSize;
-}
diff --git a/src/xennet/receiver.h b/src/xennet/receiver.h
index fbc0151..e6b2af1 100644
--- a/src/xennet/receiver.h
+++ b/src/xennet/receiver.h
@@ -73,10 +73,4 @@ ReceiverOffloadOptions(
     IN  PXENNET_RECEIVER    Receiver
     );
 
-extern VOID
-ReceiverSplitHeaderData(
-    IN  PXENNET_RECEIVER    Receiver,
-    IN  ULONG               MaxHeaderSize
-    );
-
 #endif // _XENNET_RECEIVER_H_
-- 
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®.