[Openib-windows] [PATCH] recv checksum offload

Yossi Leybovich sleybo at mellanox.co.il
Tue May 30 03:18:45 PDT 2006


Fab 
 
Attached patch that  add registry value to the IPoIB with control
whether offload/not offload  recv checksum.
I tested it with the NDIS checksum test and all tests passed (actually
they skipped)
 
pls apply
 
10x
Yoss
 
Signed-off-by: Yossi Leybovich (sleybo at mallanox.co.il)
Index: ulp/ipoib/kernel/ipoib_adapter.h
===================================================================
--- ulp/ipoib/kernel/ipoib_adapter.h (revision 1369)
+++ ulp/ipoib/kernel/ipoib_adapter.h (working copy)
@@ -65,6 +65,7 @@
  int32_t  rq_depth;
  int32_t  sq_depth;
  boolean_t send_chksum_offload;
+ boolean_t recv_chksum_offload;
  boolean_t wsdp_enabled;
  uint16_t static_lid;
  uint32_t sa_timeout;
@@ -87,6 +88,10 @@
 *  so that IPoIB packets should never be forwarded out of the IB subnet
 *  without recalculating the checksum.
 *
+*
+* recv_chksum_offload
+*  Flag to indicate whether to offload recv checksums.
+*
 * wsdp_enabled
 *  Flag to indicate whether WSDP is enabled for an adapter adapter.
 *
Index: ulp/ipoib/kernel/ipoib_driver.c
===================================================================
--- ulp/ipoib/kernel/ipoib_driver.c (revision 1369)
+++ ulp/ipoib/kernel/ipoib_driver.c (working copy)
@@ -461,6 +461,19 @@
  }
  p_adapter->params.send_chksum_offload =
(p_param->ParameterData.IntegerData != 0);
 
+ 
+ /* Required: Send Checksum Offload. */
+ RtlInitUnicodeString( &keyword, L"RecvChksum" );
+ NdisReadConfiguration(
+  &status, &p_param, h_config, &keyword, NdisParameterInteger );
+ if( status != NDIS_STATUS_SUCCESS )
+ {
+  IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+   ("Recv Checksum Offload parameter missing.\n") );
+  return status;
+ }
+ p_adapter->params.recv_chksum_offload =
(p_param->ParameterData.IntegerData != 0);
+
  /* Optional: WSDP support. */
  RtlInitUnicodeString( &keyword, L"WsdpEnabled" );
  NdisReadConfiguration(
@@ -1386,16 +1399,17 @@
  p_offload_chksum->V4Transmit.IpChecksum =
   p_adapter->params.send_chksum_offload;
 
- /*
-  * Only receive checksum can be offloaded thanks to
-  * the IB physical layer.
-  */
- p_offload_chksum->V4Receive.IpOptionsSupported = TRUE;
- p_offload_chksum->V4Receive.TcpOptionsSupported = TRUE;
- p_offload_chksum->V4Receive.TcpChecksum = TRUE;
- p_offload_chksum->V4Receive.UdpChecksum = TRUE;
- p_offload_chksum->V4Receive.IpChecksum = TRUE;
-
+ p_offload_chksum->V4Receive.IpOptionsSupported =
+  p_adapter->params.recv_chksum_offload;
+ p_offload_chksum->V4Receive.TcpOptionsSupported =
+  p_adapter->params.recv_chksum_offload;
+ p_offload_chksum->V4Receive.TcpChecksum =
+   p_adapter->params.recv_chksum_offload;
+ p_offload_chksum->V4Receive.UdpChecksum =
+  p_adapter->params.recv_chksum_offload;
+ p_offload_chksum->V4Receive.IpChecksum =
+  p_adapter->params.recv_chksum_offload;
+   
  p_offload_chksum->V6Transmit.IpOptionsSupported = FALSE;
  p_offload_chksum->V6Transmit.TcpOptionsSupported = FALSE;
  p_offload_chksum->V6Transmit.TcpChecksum = FALSE;
@@ -1471,6 +1485,16 @@
   return NDIS_STATUS_NOT_SUPPORTED;
  }
 
+ if( !p_adapter->params.recv_chksum_offload &&
+  (p_offload_chksum->V4Receive.IpOptionsSupported ||
+  p_offload_chksum->V4Receive.TcpOptionsSupported ||
+  p_offload_chksum->V4Receive.TcpChecksum ||
+  p_offload_chksum->V4Receive.UdpChecksum ||
+  p_offload_chksum->V4Receive.IpChecksum) )
+ {
+  return NDIS_STATUS_NOT_SUPPORTED;
+ }
+
  return NDIS_STATUS_SUCCESS;
 }
 
Index: ulp/ipoib/kernel/netipoib.inf
===================================================================
--- ulp/ipoib/kernel/netipoib.inf (revision 1369)
+++ ulp/ipoib/kernel/netipoib.inf (working copy)
@@ -83,6 +83,13 @@
 HKR, Ndi\Params\SendChksum\enum, "0", 0, "Disabled"
 HKR, Ndi\Params\SendChksum\enum, "1", 0, "Enabled"
 
+HKR, Ndi\Params\RecvChksum,  ParamDesc, 0, "Recv Checksum Offload"
+HKR, Ndi\Params\RecvChksum,  Type,  0, "enum"
+HKR, Ndi\Params\RecvChksum,  Default, 0, "0"
+HKR, Ndi\Params\RecvChksum,  Optional, 0, "0"
+HKR, Ndi\Params\RecvChksum\enum, "0", 0, "Disabled"
+HKR, Ndi\Params\RecvChksum\enum, "1", 0, "Enabled"
+
 HKR, Ndi\Params\WsdpEnabled, ParamDesc, 0, "WSDP Support"
 HKR, Ndi\Params\WsdpEnabled, Type,  0, "enum"
 HKR, Ndi\Params\WsdpEnabled, Default, 0, "0"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: checksum.patch
Type: application/octet-stream
Size: 4038 bytes
Desc: checksum.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060530/97e21ba8/attachment.obj>


More information about the ofw mailing list