[ofw] [patch] use a well known NDIS Keyword for LSO
Smith, Stan
stan.smith at intel.com
Mon Jan 10 10:08:00 PST 2011
Looks reasonable.
stan.
________________________________
From: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Uri Habusha
Sent: Sunday, January 09, 2011 11:28 PM
To: ofw at lists.openfabrics.org
Subject: [ofw] [patch] use a well known NDIS Keywork for LSO
This checking change the code to use the well known NDIS keyword.
In the UI we still expose one keyword to enable/disable LSO (most administrator are not care about the difference between the types).
However in registry there is the LSO keywords, *LSOV1IPv4, *LSOV2IPv4, *LSOV2IPv6. Expert users can change it by script or manually.
The logic is: if the LSO is enabled and all well known keys are disabled, LSO is disabled. If the LSO is disabled all the well known keywords refer as disabled.
Index: ipoib_adapter.h
===================================================================
--- ipoib_adapter.h (revision 3063)
+++ ipoib_adapter.h (working copy)
@@ -107,6 +107,10 @@
boolean_t cm_enabled;
uint32_t cm_payload_mtu;
uint32_t cm_xfer_block_size;
+ boolean_t LsoV1IPv4; // Registry value for large send offload Version 1
+ boolean_t LsoV2IPv4; // Registry value for large send offload Version 2 IPV4
+ boolean_t LsoV2IPv6; // Registry value for large send offload Version2 IPV6
+
} ipoib_params_t;
/*
* FIELDS
Index: ipoib_driver.cpp
===================================================================
--- ipoib_driver.cpp (revision 3063)
+++ ipoib_driver.cpp (working copy)
@@ -56,6 +56,7 @@
#define MAJOR_NDIS_VERSION 6
#define MINOR_NDIS_VERSION 1
+#define LSO_MIN_SEG_COUNT 2
PDRIVER_OBJECT g_p_drv_obj;
@@ -218,7 +219,10 @@
{NDIS_STRING_CONST("MCLeaveRescan"), 1, IPOIB_OFFSET(mc_leave_rescan), IPOIB_SIZE(mc_leave_rescan), 260, 1, 3600},
{NDIS_STRING_CONST("BCJoinRetry"), 1, IPOIB_OFFSET(bc_join_retry), IPOIB_SIZE(bc_join_retry), 50, 0, 1000},
{NDIS_STRING_CONST("CmEnabled"), 0, IPOIB_OFFSET(cm_enabled), IPOIB_SIZE(cm_enabled), FALSE, FALSE, TRUE},
- {NDIS_STRING_CONST("CmPayloadMtu"), 1, IPOIB_OFFSET(cm_payload_mtu), IPOIB_SIZE(cm_payload_mtu), MAX_CM_PAYLOAD_MTU, 512, MAX_CM_PAYLOAD_MTU}
+ {NDIS_STRING_CONST("CmPayloadMtu"), 1, IPOIB_OFFSET(cm_payload_mtu), IPOIB_SIZE(cm_payload_mtu), MAX_CM_PAYLOAD_MTU, 512, MAX_CM_PAYLOAD_MTU},
+ {NDIS_STRING_CONST("*LsoV1IPv4"), 0, IPOIB_OFFSET(LsoV1IPv4), IPOIB_SIZE(LsoV1IPv4), 1, 0, 1},
+ {NDIS_STRING_CONST("*LsoV2IPv4"), 0, IPOIB_OFFSET(LsoV2IPv4), IPOIB_SIZE(LsoV2IPv4), 1, 0, 1},
+ {NDIS_STRING_CONST("*LsoV2IPv6"), 0, IPOIB_OFFSET(LsoV2IPv6), IPOIB_SIZE(LsoV2IPv6), 1, 0, 1},
};
#define IPOIB_NUM_REG_PARAMS (sizeof (HCARegTable) / sizeof(IPOIB_REG_ENTRY))
@@ -727,6 +731,25 @@
"of 0x%x\n", p_adapter->params.sq_depth ));
}
+ if (p_adapter->params.lso) {
+ if (!p_adapter->params.LsoV1IPv4 &&
+ !p_adapter->params.LsoV2IPv4 &&
+ !p_adapter->params.LsoV2IPv6) {
+ //
+ // LSO option is set but all the well known keywords are disabled.
+ // Disable LSO
+ //
+ p_adapter->params.lso = false;
+ }
+ } else {
+ //
+ // The LSO option is disbled. Disabled all well known keywords
+ //
+ p_adapter->params.LsoV1IPv4 = false;
+ p_adapter->params.LsoV2IPv4 = false;
+ p_adapter->params.LsoV2IPv6 = false;
+ }
+
// Adjusting the low watermark parameter
p_adapter->params.rq_low_watermark =
p_adapter->params.rq_depth / p_adapter->params.rq_low_watermark;
@@ -1168,10 +1191,9 @@
NDIS_OFFLOAD *p_offload
)
{
-
ULONG ulEncapsulation = NDIS_ENCAPSULATION_IEEE_802_3 | NDIS_ENCAPSULATION_IEEE_802_3_P_AND_Q;
- memset(p_offload, 0, NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_1);
+ NdisZeroMemory(p_offload, NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_1);
p_offload->Header.Type = NDIS_OBJECT_TYPE_OFFLOAD;
p_offload->Header.Revision = NDIS_OFFLOAD_REVISION_1; // Should be Revision 1, otherwise NDIS will not work at Win2008 R1
@@ -1193,46 +1215,50 @@
p_offload->Checksum.IPv6Transmit.Encapsulation = ulEncapsulation;
- p_offload->Checksum.IPv6Transmit.IpExtensionHeadersSupported =
+ p_offload->Checksum.IPv6Transmit.IpExtensionHeadersSupported = false;
p_offload->Checksum.IPv6Transmit.TcpOptionsSupported =
p_offload->Checksum.IPv6Transmit.TcpChecksum =
- p_offload->Checksum.IPv6Transmit.UdpChecksum = FALSE;
+ p_offload->Checksum.IPv6Transmit.UdpChecksum = !!(p_adapter->params.send_chksum_offload);
p_offload->Checksum.IPv6Receive.Encapsulation = ulEncapsulation;
- p_offload->Checksum.IPv6Receive.IpExtensionHeadersSupported =
+ p_offload->Checksum.IPv6Receive.IpExtensionHeadersSupported = false;
p_offload->Checksum.IPv6Receive.TcpOptionsSupported =
p_offload->Checksum.IPv6Receive.TcpChecksum =
- p_offload->Checksum.IPv6Receive.UdpChecksum = FALSE;
+ p_offload->Checksum.IPv6Receive.UdpChecksum = !!(p_adapter->params.recv_chksum_offload);
- if (p_adapter->params.lso)
+ if (p_adapter->params.lso )
{
- p_offload->LsoV1.IPv4.Encapsulation = ulEncapsulation;
- p_offload->LsoV1.IPv4.MaxOffLoadSize = LARGE_SEND_OFFLOAD_SIZE;
-#define LSO_MIN_SEG_COUNT 2
- p_offload->LsoV1.IPv4.MinSegmentCount = LSO_MIN_SEG_COUNT;
+ ASSERT(p_adapter->params.LsoV1IPv4 ||
+ p_adapter->params.LsoV2IPv4 ||
+ p_adapter->params.LsoV2IPv6);
+
+ if (p_adapter->params.LsoV1IPv4)
+ {
+ p_offload->LsoV1.IPv4.Encapsulation = ulEncapsulation;
+ p_offload->LsoV1.IPv4.MaxOffLoadSize = LARGE_SEND_OFFLOAD_SIZE;
+ p_offload->LsoV1.IPv4.MinSegmentCount = LSO_MIN_SEG_COUNT;
+ p_offload->LsoV1.IPv4.TcpOptions = NDIS_OFFLOAD_SUPPORTED;
+ p_offload->LsoV1.IPv4.IpOptions = NDIS_OFFLOAD_SUPPORTED;
+ }
-
- p_offload->LsoV1.IPv4.TcpOptions = NDIS_OFFLOAD_SUPPORTED;
- p_offload->LsoV1.IPv4.IpOptions = NDIS_OFFLOAD_SUPPORTED;
-
- p_offload->LsoV2.IPv4.Encapsulation = ulEncapsulation;
- p_offload->LsoV2.IPv4.MaxOffLoadSize = LARGE_SEND_OFFLOAD_SIZE;
- p_offload->LsoV2.IPv4.MinSegmentCount = LSO_MIN_SEG_COUNT;
-#if 0
- p_offload->LsoV2.IPv6.Encapsulation = ulEncapsulation;
- p_offload->LsoV2.IPv6.MaxOffLoadSize = LARGE_SEND_OFFLOAD_SIZE;
- p_offload->LsoV2.IPv6.MinSegmentCount = LSO_MIN_SEG_COUNT;
-#endif
-
- } else {
- p_offload->LsoV1.IPv4.TcpOptions = NDIS_OFFLOAD_NOT_SUPPORTED;
- p_offload->LsoV1.IPv4.IpOptions = NDIS_OFFLOAD_NOT_SUPPORTED;
- }
+ if (p_adapter->params.LsoV2IPv4)
+ {
+ p_offload->LsoV2.IPv4.Encapsulation = ulEncapsulation;
+ p_offload->LsoV2.IPv4.MaxOffLoadSize = LARGE_SEND_OFFLOAD_SIZE;
+ p_offload->LsoV2.IPv4.MinSegmentCount = LSO_MIN_SEG_COUNT;
+ }
- p_offload->LsoV2.IPv6.IpExtensionHeadersSupported = NDIS_OFFLOAD_NOT_SUPPORTED;
- p_offload->LsoV2.IPv6.TcpOptionsSupported = NDIS_OFFLOAD_NOT_SUPPORTED;
-
+ if (p_adapter->params.LsoV2IPv6)
+ {
+ p_offload->LsoV2.IPv6.Encapsulation = ulEncapsulation;
+ p_offload->LsoV2.IPv6.MaxOffLoadSize = LARGE_SEND_OFFLOAD_SIZE;
+ p_offload->LsoV2.IPv6.MinSegmentCount = LSO_MIN_SEG_COUNT;
+
+ p_offload->LsoV2.IPv6.IpExtensionHeadersSupported = NDIS_OFFLOAD_NOT_SUPPORTED;
+ p_offload->LsoV2.IPv6.TcpOptionsSupported = NDIS_OFFLOAD_NOT_SUPPORTED;
+ }
+ }
}
@@ -1664,32 +1690,48 @@
//////////////////////////// OFFLOAD OFFLOAD ////////////////////////////
if(pOffloadParam->LsoV1 != NDIS_OFFLOAD_PARAMETERS_NO_CHANGE)
{
- p_adapter->params.lso = (pOffloadParam->LsoV1 == NDIS_OFFLOAD_PARAMETERS_LSOV1_ENABLED);
+ if(pOffloadParam->LsoV1 == NDIS_OFFLOAD_PARAMETERS_LSOV1_ENABLED)
+ {
+ p_adapter->params.LsoV1IPv4 = true;
+ }
+ else
+ {
+ p_adapter->params.LsoV1IPv4 = false;
+ }
StatusIndicationFlag = TRUE;
}
if(pOffloadParam->LsoV2IPv4 != NDIS_OFFLOAD_PARAMETERS_NO_CHANGE)
- {
- p_adapter->params.lso = (pOffloadParam->LsoV1 == NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED);
+ {
+ if(pOffloadParam->LsoV2IPv4 == NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED)
+ {
+ p_adapter->params.LsoV2IPv4 = true;
+ }
+ else
+ {
+ p_adapter->params.LsoV2IPv4 = false;
+ }
StatusIndicationFlag = TRUE;
}
-#if 0
+
if(pOffloadParam->LsoV2IPv6 != NDIS_OFFLOAD_PARAMETERS_NO_CHANGE)
- {
+ {
if(pOffloadParam->LsoV2IPv6 == NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED)
{
- pPort->Config.LsoV2IPv6 = TRUE;
+ p_adapter->params.LsoV2IPv6 = true;
}
else
{
- pPort->Config.LsoV2IPv6 = FALSE;
+ p_adapter->params.LsoV2IPv6 = false;
}
StatusIndicationFlag = TRUE;
}
-#endif
-
+ p_adapter->params.lso = (p_adapter->params.LsoV1IPv4 ||
+ p_adapter->params.LsoV2IPv4 ||
+ p_adapter->params.LsoV2IPv6);
+
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
Index: netipoib.inx
===================================================================
--- netipoib.inx (revision 3063)
+++ netipoib.inx (working copy)
@@ -78,6 +78,10 @@
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
+HKR,"", "*LsoV1IPv4", %REG_DWORD%, 1
+HKR,"", "*LsoV2IPv4", %REG_DWORD%, 1
+HKR,"", "*LsoV2IPv6", %REG_DWORD%, 1
+
HKR, Ndi\Params\RqDepth, ParamDesc, 0, %RQ_DEPTH_STR%
HKR, Ndi\Params\RqDepth, Type, 0, "dword"
HKR, Ndi\Params\RqDepth, Default, 0, "512"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20110110/61799c29/attachment.html>
More information about the ofw
mailing list