[IPoIB] Fix send and receive counters.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 30 Nov 2005 19:38:04 +0000 (19:38 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 30 Nov 2005 19:38:04 +0000 (19:38 +0000)
Signed-off-by: Yossi Leybovich (sleybo@mellanox.co.il)
Signed-off-by: Fab Tillier (ftillier@silverstorm.com)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@193 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_port.c

index 8f01cc9..9ab1a41 100644 (file)
@@ -1740,9 +1740,9 @@ __recv_mgr_filter(
                        continue;\r
                }\r
 \r
-               len = p_wc->length;\r
+               len = p_wc->length - sizeof(ib_grh_t);\r
 \r
-               if( len < (sizeof(ib_grh_t) + sizeof(ipoib_hdr_t)) )\r
+               if( len < sizeof(ipoib_hdr_t) )\r
                {\r
                        IPOIB_TRACE( IPOIB_DBG_ERROR,\r
                                ("Received ETH packet < min size\n") );\r
@@ -1782,8 +1782,7 @@ __recv_mgr_filter(
                switch( p_ipoib->hdr.type )\r
                {\r
                case ETH_PROT_TYPE_IP:\r
-                       if( len <\r
-                               (sizeof(ib_grh_t) + sizeof(ipoib_hdr_t) + sizeof(ip_hdr_t)) )\r
+                       if( len < (sizeof(ipoib_hdr_t) + sizeof(ip_hdr_t)) )\r
                        {\r
                                IPOIB_TRACE( IPOIB_DBG_ERROR,\r
                                        ("Received IP packet < min size\n") );\r
@@ -1802,8 +1801,8 @@ __recv_mgr_filter(
                        }\r
 \r
                        /* First packet of a UDP transfer. */\r
-                       if( len < (sizeof(ib_grh_t) + sizeof(ipoib_hdr_t) +\r
-                               sizeof(ip_hdr_t) + sizeof(udp_hdr_t)) )\r
+                       if( len <\r
+                               (sizeof(ipoib_hdr_t) + sizeof(ip_hdr_t) + sizeof(udp_hdr_t)) )\r
                        {\r
                                IPOIB_TRACE( IPOIB_DBG_ERROR,\r
                                        ("Received UDP packet < min size\n") );\r
@@ -1817,8 +1816,8 @@ __recv_mgr_filter(
                                (p_ipoib->type.ip.prot.udp.hdr.dst_port == DHCP_PORT_CLIENT &&\r
                                p_ipoib->type.ip.prot.udp.hdr.src_port == DHCP_PORT_SERVER) )\r
                        {\r
-                               if( len < (sizeof(ib_grh_t) + sizeof(ipoib_hdr_t) +\r
-                                       sizeof(ip_hdr_t) + sizeof(udp_hdr_t) + DHCP_MIN_SIZE ))\r
+                               if( len < (sizeof(ipoib_hdr_t) + sizeof(ip_hdr_t) +\r
+                                       sizeof(udp_hdr_t) + DHCP_MIN_SIZE) )\r
                                {\r
                                        IPOIB_TRACE( IPOIB_DBG_ERROR,\r
                                                ("Received DHCP < min size\n") );\r
@@ -1872,7 +1871,7 @@ __recv_mgr_filter(
                {\r
                        p_desc->len =\r
                                len + sizeof(eth_hdr_t) - sizeof(ipoib_hdr_t);\r
-                       if( p_dst )\r
+                       if( p_dst->h_mcast)\r
                        {\r
                                if( p_dst->dgid.multicast.raw_group_id[10] == 0xFF &&\r
                                        p_dst->dgid.multicast.raw_group_id[11] == 0xFF &&\r
@@ -3651,6 +3650,7 @@ __send_cb(
        ib_wc_t                         wc[MAX_SEND_WC], *p_wc, *p_free;\r
        cl_qlist_t                      done_list;\r
        NDIS_PACKET                     *p_packet;\r
+       uint32_t                        length;\r
        ipoib_endpt_t           *p_endpt;\r
        send_buf_t                      *p_send_buf;\r
        ip_stat_sel_t           type;\r
@@ -3720,8 +3720,8 @@ __send_cb(
                                {\r
                                        type = IP_STAT_UCAST_BYTES;\r
                                }\r
-                               ipoib_inc_send_stat( p_port->p_adapter, type,\r
-                                       p_wc->length - sizeof(ipoib_hdr_t) + sizeof(eth_hdr_t) );\r
+                               NdisQueryPacketLength( p_packet, &length );\r
+                               ipoib_inc_send_stat( p_port->p_adapter, type, length );\r
                                NdisMSendComplete( p_port->p_adapter->h_adapter,\r
                                        p_packet, NDIS_STATUS_SUCCESS );\r
                                break;\r