[IPoIB] Fix multicast send support to not drop packets if the adapter
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 16 Nov 2005 17:29:31 +0000 (17:29 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 16 Nov 2005 17:29:31 +0000 (17:29 +0000)
hasn't been configured as a member of that multicast group.

Based on code submitted by Yossi Leybovich (sleybo@mellanox.co.il)

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

ulp/ipoib/kernel/ipoib_endpoint.c
ulp/ipoib/kernel/ipoib_port.c

index 2c62c2a..b665099 100644 (file)
@@ -159,6 +159,12 @@ ipoib_endpt_set_mcast(
 \r
        IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
 \r
+       IPOIB_TRACE( (IPOIB_DBG_ENDPT | IPOIB_DBG_INFO),\r
+               ("Create av for MAC: %02X-%02X-%02X-%02X-%02X-%02X\n",\r
+               p_endpt->mac.addr[0], p_endpt->mac.addr[1],\r
+               p_endpt->mac.addr[2], p_endpt->mac.addr[3],\r
+               p_endpt->mac.addr[4], p_endpt->mac.addr[5]) );\r
+               \r
        status = __create_mcast_av( h_pd, port_num, p_mcast_rec->p_member_rec,\r
                &p_endpt->h_av );\r
        if( status != IB_SUCCESS )\r
@@ -277,7 +283,8 @@ ipoib_endpt_queue(
                return NDIS_STATUS_SUCCESS;\r
        }\r
 \r
-       if( p_endpt->h_query )\r
+       if( p_endpt->h_query ||\r
+               p_endpt->qpn == CL_HTON32(0x00FFFFFF) )\r
        {\r
                ipoib_endpt_deref( p_endpt );\r
                IPOIB_EXIT( IPOIB_DBG_ENDPT );\r
index 3c21429..8f01cc9 100644 (file)
@@ -1674,6 +1674,17 @@ __recv_get_endpts(
                CL_ASSERT( *pp_dst );\r
        }\r
 \r
+       IPOIB_TRACE( (IPOIB_DBG_RECV | IPOIB_DBG_INFO),\r
+               ("Recv:\n"\r
+               "\tsrc MAC: %02X-%02X-%02X-%02X-%02X-%02X\n"\r
+               "\tdst MAC: %02X-%02X-%02X-%02X-%02X-%02X\n",\r
+               (*pp_src )->mac.addr[0], (*pp_src )->mac.addr[1],\r
+               (*pp_src )->mac.addr[2], (*pp_src )->mac.addr[3],\r
+               (*pp_src )->mac.addr[4], (*pp_src )->mac.addr[5],\r
+               (*pp_dst )->mac.addr[0], (*pp_dst )->mac.addr[1],\r
+               (*pp_dst )->mac.addr[2], (*pp_dst )->mac.addr[3],\r
+               (*pp_dst )->mac.addr[4], (*pp_dst )->mac.addr[5]) );\r
+\r
        IPOIB_EXIT( IPOIB_DBG_RECV );\r
 }\r
 \r
@@ -3294,6 +3305,19 @@ __send_mgr_queue(
        status = __endpt_mgr_ref( p_port, p_eth_hdr->dst, pp_endpt );\r
        cl_perf_stop( &p_port->p_adapter->perf, GetEndpt );\r
 \r
+       if( status == NDIS_STATUS_NO_ROUTE_TO_DESTINATION &&\r
+               p_eth_hdr->dst.addr[0] == 0x01 &&\r
+               p_eth_hdr->dst.addr[1] == 0x00 &&\r
+               p_eth_hdr->dst.addr[2] == 0x5E )\r
+       {\r
+               if( ipoib_port_join_mcast( p_port, p_eth_hdr->dst ) == IB_SUCCESS )\r
+               {\r
+                       IPOIB_TRACE_EXIT( IPOIB_DBG_ENDPT,\r
+                               ("Multicast Mac - trying to join.\n") );\r
+                       return NDIS_STATUS_PENDING;\r
+               }\r
+       }\r
+\r
        IPOIB_EXIT( IPOIB_DBG_SEND );\r
        return status;\r
 }\r
@@ -3555,6 +3579,22 @@ ipoib_port_resume(
                else if( status != NDIS_STATUS_SUCCESS )\r
                {\r
                        ASSERT( status == NDIS_STATUS_NO_ROUTE_TO_DESTINATION );\r
+\r
+                       if( p_eth_hdr->dst.addr[0] == 0x01 &&\r
+                               p_eth_hdr->dst.addr[1] == 0x00 &&\r
+                               p_eth_hdr->dst.addr[2] == 0x5E )\r
+                       {\r
+                               if( ipoib_port_join_mcast( p_port, p_eth_hdr->dst ) ==\r
+                                       IB_SUCCESS )\r
+                               {\r
+                                       IPOIB_TRACE_EXIT( IPOIB_DBG_ENDPT,\r
+                                               ("Multicast Mac - trying to join.\n") );\r
+                                       cl_qlist_insert_head( &p_port->send_mgr.pending_list,\r
+                                               IPOIB_LIST_ITEM_FROM_PACKET( desc.p_pkt ) );\r
+                                       break;\r
+                               }\r
+                       }\r
+\r
                        /*\r
                         * Complete the send as if we sent it - WHQL tests don't like the\r
                         * sends to fail.\r
@@ -3876,6 +3916,11 @@ __endpt_mgr_ref(
 \r
        cl_obj_lock( &p_port->obj );\r
 \r
+       IPOIB_TRACE( (IPOIB_DBG_ENDPT | IPOIB_DBG_INFO),\r
+               ("Look for :\t  MAC: %02X-%02X-%02X-%02X-%02X-%02X\n",\r
+               mac.addr[0], mac.addr[1], mac.addr[2],\r
+               mac.addr[3], mac.addr[4], mac.addr[5]) );\r
+\r
        p_item = cl_qmap_get( &p_port->endpt_mgr.mac_endpts, key );\r
        if( p_item == cl_qmap_end( &p_port->endpt_mgr.mac_endpts ) )\r
        {\r
@@ -3988,6 +4033,11 @@ __endpt_mgr_insert_locked(
 {\r
        IPOIB_ENTER( IPOIB_DBG_ENDPT );\r
 \r
+       IPOIB_TRACE( (IPOIB_DBG_ENDPT | IPOIB_DBG_INFO),\r
+               ("insert  :\t  MAC: %02X-%02X-%02X-%02X-%02X-%02X\n",\r
+               mac.addr[0], mac.addr[1], mac.addr[2],\r
+               mac.addr[3], mac.addr[4], mac.addr[5]) );\r
+\r
        cl_obj_lock( &p_port->obj );\r
        while( p_port->endpt_rdr )\r
        {\r
@@ -4866,6 +4916,19 @@ ipoib_port_join_mcast(
 \r
        IPOIB_ENTER( IPOIB_DBG_MCAST );\r
 \r
+       switch( __endpt_mgr_ref( p_port, mac, &p_endpt ) )\r
+       {\r
+       case NDIS_STATUS_NO_ROUTE_TO_DESTINATION:\r
+               break;\r
+\r
+       case NDIS_STATUS_SUCCESS:\r
+               ipoib_endpt_deref( p_endpt );\r
+               /* Fall through */\r
+\r
+       case NDIS_STATUS_PENDING:\r
+               return IB_SUCCESS;\r
+       }\r
+\r
        /*\r
         * Issue the mcast request, using the parameters of the broadcast group.\r
         * This allows us to do a create request that should always succeed since\r
@@ -5030,6 +5093,10 @@ __mcast_cb(
                CL_ASSERT( p_qitem == &p_endpt->lid_item );\r
        }\r
        cl_obj_unlock( &p_port->obj );\r
+       \r
+       /* Try to send all pending sends. */\r
+       ipoib_port_resume( p_port );\r
+\r
        cl_obj_deref( &p_port->obj );\r
 \r
        IPOIB_EXIT( IPOIB_DBG_MCAST );\r