[MTHCA, MLX4, IPoIB] Checksum (Csum) offload bugfix.
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 10 Sep 2008 15:57:16 +0000 (15:57 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 10 Sep 2008 15:57:16 +0000 (15:57 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1582 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mlx4/kernel/bus/inc/cq.h
hw/mthca/kernel/mthca_cq.c
ulp/ipoib/kernel/ipoib_port.c

index bef17d5..93b56ea 100644 (file)
@@ -115,12 +115,12 @@ enum {
 };
 
 enum { 
-       MLX4_NdisPacketTcpChecksumFailed        = 1 << 1,
-       MLX4_NdisPacketUdpChecksumFailed        = 1 << 2,
-       MLX4_NdisPacketIpChecksumFailed         = 1 << 3,
-       MLX4_NdisPacketTcpChecksumSucceeded = 1 << 4,
-       MLX4_NdisPacketUdpChecksumSucceeded = 1 << 5,
-       MLX4_NdisPacketIpChecksumSucceeded      = 1 << 6
+       MLX4_NdisPacketTcpChecksumFailed        = 1 << 0,
+       MLX4_NdisPacketUdpChecksumFailed        = 1 << 1,
+       MLX4_NdisPacketIpChecksumFailed         = 1 << 2,
+       MLX4_NdisPacketTcpChecksumSucceeded = 1 << 3,
+       MLX4_NdisPacketUdpChecksumSucceeded = 1 << 4,
+       MLX4_NdisPacketIpChecksumSucceeded      = 1 << 5
 };
 
 static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd,
index 7376f0c..558b215 100644 (file)
@@ -118,12 +118,12 @@ enum {
 };\r
 \r
 enum { \r
-       MTHCA_NdisPacketTcpChecksumFailed               = 1 << 1,\r
-       MTHCA_NdisPacketUdpChecksumFailed               = 1 << 2,\r
-       MTHCA_NdisPacketIpChecksumFailed                = 1 << 3,\r
-       MTHCA_NdisPacketTcpChecksumSucceeded    = 1 << 4,\r
-       MTHCA_NdisPacketUdpChecksumSucceeded    = 1 << 5,\r
-       MTHCA_NdisPacketIpChecksumSucceeded     = 1 << 6\r
+       MTHCA_NdisPacketTcpChecksumFailed               = 1 << 0,\r
+       MTHCA_NdisPacketUdpChecksumFailed               = 1 << 1,\r
+       MTHCA_NdisPacketIpChecksumFailed                = 1 << 2,\r
+       MTHCA_NdisPacketTcpChecksumSucceeded    = 1 << 3,\r
+       MTHCA_NdisPacketUdpChecksumSucceeded    = 1 << 4,\r
+       MTHCA_NdisPacketIpChecksumSucceeded     = 1 << 5\r
 };\r
 \r
 struct mthca_cqe {\r
index 14d1d21..f98981a 100644 (file)
@@ -2542,6 +2542,8 @@ __recv_mgr_prepare_pkt(
        NDIS_STATUS                                                     status;\r
        uint32_t                                                        pkt_filter;\r
        ip_stat_sel_t                                           type;\r
+       NDIS_TCP_IP_CHECKSUM_PACKET_INFO        chksum;\r
+\r
        PERF_DECLARE( GetNdisPkt );\r
 \r
        IPOIB_ENTER( IPOIB_DBG_RECV );\r
@@ -2621,21 +2623,32 @@ __recv_mgr_prepare_pkt(
                        ("__buf_mgr_get_ndis_pkt failed\n") );\r
                return IB_INSUFFICIENT_RESOURCES;\r
        }\r
-       if (p_port->p_adapter->params.recv_chksum_offload != CSUM_BYPASS) {\r
-       /* Get the checksums directly from packet information. */\r
-       /* In this case, no one of cheksum's cat get false value */\r
-       /* If hardware checksum failed or wasn't calculated, NDIS will recalculate it again */\r
+\r
+       chksum.Value = 0;\r
+       switch (p_port->p_adapter->params.recv_chksum_offload) {\r
+         case CSUM_DISABLED:\r
+               NDIS_PER_PACKET_INFO_FROM_PACKET( *pp_packet, TcpIpChecksumPacketInfo ) =\r
+               (void*)(uintn_t)chksum.Value;\r
+               break;\r
+         case CSUM_ENABLED:\r
+               /* Get the checksums directly from packet information. */\r
+               /* In this case, no one of cheksum's cat get false value */\r
+               /* If hardware checksum failed or wasn't calculated, NDIS will recalculate it again */\r
                NDIS_PER_PACKET_INFO_FROM_PACKET( *pp_packet, TcpIpChecksumPacketInfo ) = \r
-                       (PVOID) (uintn_t) (p_desc->ndis_csum.Value);\r
-       } else {\r
-               NDIS_TCP_IP_CHECKSUM_PACKET_INFO        chksum;\r
+                       (void*)(uintn_t)(p_desc->ndis_csum.Value);\r
+               break;\r
+         case CSUM_BYPASS:\r
                /* Flag the checksums as having been calculated. */\r
-               chksum.Value = 0;\r
                chksum.Receive.NdisPacketTcpChecksumSucceeded = TRUE;\r
                chksum.Receive.NdisPacketUdpChecksumSucceeded = TRUE;\r
                chksum.Receive.NdisPacketIpChecksumSucceeded = TRUE;\r
                NDIS_PER_PACKET_INFO_FROM_PACKET( *pp_packet, TcpIpChecksumPacketInfo ) =\r
                (void*)(uintn_t)chksum.Value;\r
+               break;\r
+         default:\r
+               ASSERT(FALSE);\r
+               NDIS_PER_PACKET_INFO_FROM_PACKET( *pp_packet, TcpIpChecksumPacketInfo ) =\r
+               (void*)(uintn_t)chksum.Value;\r
        }\r
        ipoib_inc_recv_stat( p_port->p_adapter, type, p_desc->len );\r
 \r