[IPoIB] Add support for Voltaire IP Router.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 7 Aug 2006 23:28:26 +0000 (23:28 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 7 Aug 2006 23:28:26 +0000 (23:28 +0000)
Submitted by: Guy Corem (guyc@voltaire.com)

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@444 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_port.c
ulp/ipoib/kernel/ipoib_xfr_mgr.h

index e6c2fa3..64a71d7 100644 (file)
@@ -1787,7 +1787,8 @@ __recv_get_endpts(
                CL_ASSERT( *pp_dst );\r
        }\r
 \r
-       if( *pp_src && (*pp_src)->qpn != p_wc->recv.ud.remote_qp )\r
+       if( *pp_src && !ipoib_is_voltaire_router_gid( &(*pp_src)->dgid ) &&\r
+               (*pp_src)->qpn != p_wc->recv.ud.remote_qp )\r
        {\r
                /* Update the QPN for the endpoint. */\r
                IPOIB_PRINT(TRACE_LEVEL_INFORMATION, IPOIB_DBG_RECV,\r
@@ -2273,8 +2274,25 @@ __recv_arp(
                         */\r
                        *pp_src = NULL;\r
                }\r
-               else if( ((*pp_src)->dlid != p_wc->recv.ud.remote_lid ||\r
-                       (*pp_src)->qpn != p_wc->recv.ud.remote_qp) )\r
+               else if( (*pp_src)->dlid != p_wc->recv.ud.remote_lid )\r
+               {\r
+                       /* Out of date!  Destroy the endpoint and replace it. */\r
+                       __endpt_mgr_remove( p_port, *pp_src );\r
+                       *pp_src = NULL;\r
+               }\r
+               else if( ipoib_is_voltaire_router_gid( &(*pp_src)->dgid ) )\r
+               {\r
+                       if( (*pp_src)->qpn !=\r
+                               (p_ib_arp->src_hw.flags_qpn & CL_HTON32(0x00FFFFFF)) &&\r
+                               p_wc->recv.ud.remote_qp !=\r
+                               (p_ib_arp->src_hw.flags_qpn & CL_HTON32(0x00FFFFFF)) )\r
+                       {\r
+                               /* Out of date!  Destroy the endpoint and replace it. */\r
+                               __endpt_mgr_remove( p_port, *pp_src );\r
+                               *pp_src = NULL;\r
+                       }\r
+               }\r
+               else if( (*pp_src)->qpn != p_wc->recv.ud.remote_qp )\r
                {\r
                        /* Out of date!  Destroy the endpoint and replace it. */\r
                        __endpt_mgr_remove( p_port, *pp_src );\r
@@ -2326,7 +2344,8 @@ __recv_arp(
 \r
        CL_ASSERT( !cl_memcmp(\r
                &(*pp_src)->dgid, &p_ib_arp->src_hw.gid, sizeof(ib_gid_t) ) );\r
-       CL_ASSERT( (*pp_src)->qpn ==\r
+       CL_ASSERT( ipoib_is_voltaire_router_gid( &(*pp_src)->dgid ) ||\r
+               (*pp_src)->qpn ==\r
                (p_ib_arp->src_hw.flags_qpn & CL_HTON32(0x00FFFFFF)) );\r
        /* Now swizzle the data. */\r
        p_arp->hw_type = ARP_HW_TYPE_ETH;\r
@@ -2336,15 +2355,18 @@ __recv_arp(
 \r
        if( cl_memcmp( &p_ib_arp->dst_hw, &null_hw, sizeof(ipoib_hw_addr_t) ) )\r
        {\r
-\r
-               if( cl_memcmp(&p_dst->dgid, &p_ib_arp->dst_hw.gid, sizeof(ib_gid_t) ) )\r
+               if( cl_memcmp( &p_dst->dgid, &p_ib_arp->dst_hw.gid, sizeof(ib_gid_t) ) )\r
                {\r
                        /*\r
                         * We received bcast ARP packet that means\r
                         * remote port lets everyone know it was changed IP/MAC\r
                         * or just activated\r
                         */\r
-                       if ( !ib_gid_is_multicast((const ib_gid_t *)&p_dst->dgid ) )\r
+\r
+                       /* Guy: TODO: Check why this check fails in case of Voltaire IPR */\r
+\r
+                       if ( !ipoib_is_voltaire_router_gid( &(*pp_src)->dgid ) &&\r
+                                !ib_gid_is_multicast( (const ib_gid_t*)&p_dst->dgid ) )\r
                        {\r
                                IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                                        ("ARP: is not ARP MCAST\n") );\r
@@ -2358,7 +2380,6 @@ __recv_arp(
                         * as long as OS' ARP table is global  ???\r
                         */\r
                        p_arp->dst_ip = (net32_t)0;\r
-\r
                }\r
                else /* we've got reply to our ARP request */\r
                {\r
index 2796194..230238f 100644 (file)
@@ -509,6 +509,27 @@ ipoib_mlx_guid_from_mac(
 *********/\r
 \r
 \r
+/****f* IPOIB/ipoib_is_voltaire_router_gid\r
+* NAME\r
+*      ipoib_is_voltaire_router_gid\r
+*\r
+* DESCRIPTION\r
+*      Checks whether the GID belongs to Voltaire IP router\r
+*\r
+* SYNOPSIS\r
+*/\r
+boolean_t\r
+static inline\r
+ipoib_is_voltaire_router_gid(\r
+       IN              const   ib_gid_t                                        *p_gid )\r
+{\r
+       static const uint8_t VOLTAIRE_GUID_PREFIX[] = {0, 0x08, 0xf1, 0, 0x1};\r
+\r
+       return !cl_memcmp( &p_gid->unicast.interface_id, VOLTAIRE_GUID_PREFIX,\r
+               sizeof(VOLTAIRE_GUID_PREFIX) );\r
+}\r
+\r
+\r
 #ifdef __cplusplus\r
 }\r
 #endif\r