[IPoIB] Make receive checksum offload a tunable, default to disabled.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 31 May 2006 21:39:48 +0000 (21:39 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 31 May 2006 21:39:48 +0000 (21:39 +0000)
Signed-off-by: Yossi Leybovich (sleybo@mellanox.co.il)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@367 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_adapter.h
ulp/ipoib/kernel/ipoib_driver.c
ulp/ipoib/kernel/netipoib.inf

index 717948b..b3abf90 100644 (file)
@@ -65,6 +65,7 @@ typedef struct _ipoib_params
        int32_t         rq_depth;\r
        int32_t         sq_depth;\r
        boolean_t       send_chksum_offload;\r
+       boolean_t       recv_chksum_offload;\r
        boolean_t       wsdp_enabled;\r
        uint16_t        static_lid;\r
        uint32_t        sa_timeout;\r
@@ -87,6 +88,9 @@ typedef struct _ipoib_params
 *              so that IPoIB packets should never be forwarded out of the IB subnet\r
 *              without recalculating the checksum.\r
 *\r
+*      recv_chksum_offload\r
+*              Flag to indicate whether to offload recv checksums.\r
+*\r
 *      wsdp_enabled\r
 *              Flag to indicate whether WSDP is enabled for an adapter adapter.\r
 *\r
index 5b5c19d..f23ccd3 100644 (file)
@@ -462,6 +462,18 @@ ipoib_get_adapter_params(
        }\r
        p_adapter->params.send_chksum_offload = (p_param->ParameterData.IntegerData != 0);\r
 \r
+       /* Required: Send Checksum Offload. */\r
+       RtlInitUnicodeString( &keyword, L"RecvChksum" );\r
+       NdisReadConfiguration(\r
+               &status, &p_param, h_config, &keyword, NdisParameterInteger );\r
+       if( status != NDIS_STATUS_SUCCESS )\r
+       {\r
+               IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+                       ("Recv Checksum Offload parameter missing.\n") );\r
+               return status;\r
+       }\r
+       p_adapter->params.recv_chksum_offload = (p_param->ParameterData.IntegerData != 0);\r
+\r
        /* Optional: WSDP support. */\r
        RtlInitUnicodeString( &keyword, L"WsdpEnabled" );\r
        NdisReadConfiguration(\r
@@ -1387,15 +1399,16 @@ __ipoib_get_tcp_task_offload(
        p_offload_chksum->V4Transmit.IpChecksum =\r
                p_adapter->params.send_chksum_offload;\r
 \r
-       /*\r
-        * Only receive checksum can be offloaded thanks to\r
-        * the IB physical layer.\r
-        */\r
-       p_offload_chksum->V4Receive.IpOptionsSupported = TRUE;\r
-       p_offload_chksum->V4Receive.TcpOptionsSupported = TRUE;\r
-       p_offload_chksum->V4Receive.TcpChecksum = TRUE;\r
-       p_offload_chksum->V4Receive.UdpChecksum = TRUE;\r
-       p_offload_chksum->V4Receive.IpChecksum = TRUE;\r
+       p_offload_chksum->V4Receive.IpOptionsSupported =\r
+               p_adapter->params.recv_chksum_offload;\r
+       p_offload_chksum->V4Receive.TcpOptionsSupported =\r
+               p_adapter->params.recv_chksum_offload;\r
+       p_offload_chksum->V4Receive.TcpChecksum =\r
+                       p_adapter->params.recv_chksum_offload;\r
+       p_offload_chksum->V4Receive.UdpChecksum =\r
+               p_adapter->params.recv_chksum_offload;\r
+       p_offload_chksum->V4Receive.IpChecksum =\r
+               p_adapter->params.recv_chksum_offload;\r
 \r
        p_offload_chksum->V6Transmit.IpOptionsSupported = FALSE;\r
        p_offload_chksum->V6Transmit.TcpOptionsSupported = FALSE;\r
@@ -1472,6 +1485,16 @@ __ipoib_set_tcp_task_offload(
                return NDIS_STATUS_NOT_SUPPORTED;\r
        }\r
 \r
+       if( !p_adapter->params.recv_chksum_offload &&\r
+               (p_offload_chksum->V4Receive.IpOptionsSupported ||\r
+               p_offload_chksum->V4Receive.TcpOptionsSupported ||\r
+               p_offload_chksum->V4Receive.TcpChecksum ||\r
+               p_offload_chksum->V4Receive.UdpChecksum ||\r
+               p_offload_chksum->V4Receive.IpChecksum) )\r
+       {\r
+               return NDIS_STATUS_NOT_SUPPORTED;\r
+       }\r
+\r
        return NDIS_STATUS_SUCCESS;\r
 }\r
 \r
index af6cb69..a163518 100644 (file)
@@ -83,6 +83,13 @@ HKR, Ndi\Params\SendChksum,          Optional,       0, "0"
 HKR, Ndi\Params\SendChksum\enum,       "0",    0, "Disabled"\r
 HKR, Ndi\Params\SendChksum\enum,       "1",    0, "Enabled"\r
 \r
+HKR, Ndi\Params\RecvChksum,            ParamDesc,      0, "Recv Checksum Offload"\r
+HKR, Ndi\Params\RecvChksum,            Type,           0, "enum"\r
+HKR, Ndi\Params\RecvChksum,            Default,        0, "0"\r
+HKR, Ndi\Params\RecvChksum,            Optional,       0, "0"\r
+HKR, Ndi\Params\RecvChksum\enum,       "0",    0, "Disabled"\r
+HKR, Ndi\Params\RecvChksum\enum,       "1",    0, "Enabled"\r
+\r
 HKR, Ndi\Params\WsdpEnabled,   ParamDesc,      0, "WSDP Support"\r
 HKR, Ndi\Params\WsdpEnabled,   Type,           0, "enum"\r
 HKR, Ndi\Params\WsdpEnabled,   Default,        0, "0"\r