From: ftillier Date: Wed, 6 Jul 2005 19:19:26 +0000 (+0000) Subject: - Fixed locking issue with resuming pended sends that could X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=b6ce92f38a8d53c1fc6ca74914434f712834162c;p=~shefty%2Frdma-win.git - Fixed locking issue with resuming pended sends that could result in QP overrun. - Changed receive processing to silently drop all loopback traffic since the driver reports itself as needing SW loopback (which is higher performing). - Fixed bug where code assumed that a success result from the SA implied non-zero records. Code now checks the number of records in addition to status. - Fixed initialization to perform PnP registration after flagging the device as a deserialized miniport with NdisMSetAttributesEx to allow calling NdisMSetInformation at DISPATCH level. Without this, the driver causes an assertion in checked versions of NDIS.sys. git-svn-id: svn://openib.tc.cornell.edu/gen1@28 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.c b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.c index ccbd53ff..276c8e02 100644 --- a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.c +++ b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.c @@ -205,6 +205,21 @@ ipoib_create_adapter( } +ib_api_status_t +ipoib_start_adapter( + IN ipoib_adapter_t* const p_adapter ) +{ + ib_api_status_t status; + + IPOIB_ENTER( IPOIB_DBG_INIT ); + + status = __ipoib_pnp_reg( p_adapter, IB_PNP_FLAG_REG_SYNC ); + + IPOIB_EXIT( IPOIB_DBG_INIT ); + return status; +} + + void ipoib_destroy_adapter( IN ipoib_adapter_t* const p_adapter ) @@ -340,8 +355,6 @@ adapter_init( return status; } - status = __ipoib_pnp_reg( p_adapter, IB_PNP_FLAG_REG_SYNC ); - IPOIB_EXIT( IPOIB_DBG_INIT ); return status; } @@ -562,6 +575,9 @@ __ipoib_pnp_cb( case IB_PNP_PORT_ADD: /* If we were initializing, we might have pended some OIDs. */ ipoib_resume_oids( p_adapter ); + NdisMIndicateStatus( p_adapter->h_adapter, + NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 ); + NdisMIndicateStatusComplete( p_adapter->h_adapter ); break; default: @@ -819,13 +835,17 @@ ipoib_set_active( * If we had a pending OID request for OID_GEN_LINK_SPEED, * complete it now. */ - if( old_state == IB_PNP_PORT_ADD || - old_state == IB_PNP_PORT_REMOVE ) + switch( old_state ) { + case IB_PNP_PORT_ADD: + ipoib_reg_addrs( p_adapter ); + /* Fall through. */ + + case IB_PNP_PORT_REMOVE: ipoib_resume_oids( p_adapter ); - } - else - { + break; + + default: /* Join all programmed multicast groups. */ for( i = 0; i < p_adapter->mcast_array_size; i++ ) { diff --git a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.h b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.h index 1d71c55c..c82572cc 100644 --- a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.h +++ b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_adapter.h @@ -303,6 +303,11 @@ ipoib_create_adapter( OUT ipoib_adapter_t** const pp_adapter ); +ib_api_status_t +ipoib_start_adapter( + IN ipoib_adapter_t* const p_adapter ); + + void ipoib_destroy_adapter( IN ipoib_adapter_t* const p_adapter ); diff --git a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_driver.c b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_driver.c index 72cb514d..bedeaf8b 100644 --- a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_driver.c +++ b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_driver.c @@ -522,7 +522,6 @@ ipoib_initialize( *p_selected_medium_index = medium_index; - /* Create the adapter adapter */ ib_status = ipoib_create_adapter( wrapper_config_context, h_adapter, &p_adapter ); if( ib_status != IB_SUCCESS ) @@ -550,6 +549,16 @@ ipoib_initialize( } #endif + /* Create the adapter adapter */ + ib_status = ipoib_start_adapter( p_adapter ); + if( ib_status != IB_SUCCESS ) + { + ipoib_destroy_adapter( p_adapter ); + IPOIB_TRACE_EXIT( IPOIB_DBG_ERROR, + ("ipoib_start_adapter returned status %d.\n", ib_status ) ); + return NDIS_STATUS_FAILURE; + } + IPOIB_EXIT( IPOIB_DBG_INIT ); return status; } diff --git a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_endpoint.c b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_endpoint.c index 90384d6e..5fe1c547 100644 --- a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_endpoint.c +++ b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_endpoint.c @@ -358,7 +358,7 @@ __path_query_cb( } cl_obj_unlock( &p_endpt->obj ); - if( p_query_rec->status != IB_SUCCESS ) + if( p_query_rec->status != IB_SUCCESS || !p_query_rec->result_cnt ) { p_port->p_adapter->hung = TRUE; ipoib_endpt_deref( p_endpt ); diff --git a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_port.c b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_port.c index cbd5f9d7..3589d410 100644 --- a/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_port.c +++ b/branches/fab_cm_branch/ulp/ipoib/kernel/ipoib_port.c @@ -1754,6 +1754,20 @@ __recv_mgr_filter( p_eth = &p_desc->p_buf->eth.pkt; #endif /*IPOIB_INLINE_RECV */ + /* Don't report loopback traffic - we requested SW loopback. */ + if( !cl_memcmp( &p_port->p_adapter->mac, &p_eth->hdr.src, + sizeof(p_port->p_adapter->mac) ) ) + { + /* + * "This is not the packet you're looking for" - don't update + * receive statistics, the packet never happened. + */ + cl_qlist_insert_tail( p_bad_list, &p_desc->item.list_item ); + /* Dereference the port object on behalf of the failed receive. */ + cl_obj_deref( &p_port->obj ); + continue; + } + switch( p_ipoib->hdr.type ) { case ETH_PROT_TYPE_IP: @@ -1921,6 +1935,8 @@ __recv_dhcp( IPOIB_ENTER( IPOIB_DBG_RECV ); + UNUSED_PARAM( p_port ); + /* Create the ethernet header. */ status = __recv_gen( p_ipoib, p_eth, p_src, p_dst ); if( status != IB_SUCCESS ) @@ -1938,17 +1954,6 @@ __recv_dhcp( IPOIB_TRACE_EXIT( IPOIB_DBG_ERROR, ("Invalid DHCP op code.\n") ); return IB_INVALID_SETTING; } - /* find a better way to check for echo packets ? */ - if ( p_port->p_adapter->mac.addr[0] == p_eth->hdr.src.addr[0] && - p_port->p_adapter->mac.addr[1] == p_eth->hdr.src.addr[1] && - p_port->p_adapter->mac.addr[2] == p_eth->hdr.src.addr[2] && - p_port->p_adapter->mac.addr[3] == p_eth->hdr.src.addr[3] && - p_port->p_adapter->mac.addr[4] == p_eth->hdr.src.addr[4] && - p_port->p_adapter->mac.addr[5] == p_eth->hdr.src.addr[5] ) - { - IPOIB_TRACE_EXIT( IPOIB_DBG_ERROR, ("Local echo dhcp msg.\n") ); - return IB_INVALID_PARAMETER; - } /* * Find the client identifier option, making sure to skip @@ -3405,6 +3410,7 @@ ipoib_port_send( IPOIB_ENTER( IPOIB_DBG_SEND ); + cl_spinlock_acquire( &p_port->send_lock ); for( i = 0; i < num_packets; i++ ) { desc.p_pkt = p_packet_array[i]; @@ -3424,7 +3430,6 @@ ipoib_port_send( continue; } - cl_spinlock_acquire( &p_port->send_lock ); cl_perf_start( SendMgrQueue ); status = __send_mgr_queue( p_port, p_eth_hdr, &desc.p_endpt ); cl_perf_stop( &p_port->p_adapter->perf, SendMgrQueue ); @@ -3438,10 +3443,8 @@ ipoib_port_send( IPOIB_LIST_ITEM_FROM_PACKET( p_packet_array[i++] ) ); } cl_perf_stop( &p_port->p_adapter->perf, QueuePacket ); - cl_spinlock_release( &p_port->send_lock ); - return; + break; } - cl_spinlock_release( &p_port->send_lock ); if( status != NDIS_STATUS_SUCCESS ) { ASSERT( status == NDIS_STATUS_NO_ROUTE_TO_DESTINATION ); @@ -3455,7 +3458,6 @@ ipoib_port_send( continue; } - /* No lock needed to build the work request. */ cl_perf_start( BuildSendDesc ); status = __build_send_desc( p_port, p_eth_hdr, p_buf, buf_len, &desc ); cl_perf_stop( &p_port->p_adapter->perf, BuildSendDesc ); @@ -3486,6 +3488,7 @@ ipoib_port_send( cl_atomic_inc( &p_port->send_mgr.depth ); } + cl_spinlock_release( &p_port->send_lock ); IPOIB_EXIT( IPOIB_DBG_SEND ); }