From b0fcee6a9423362e78cd507d23da4b225ba061d0 Mon Sep 17 00:00:00 2001 From: ftillier Date: Tue, 28 Feb 2006 05:47:11 +0000 Subject: [PATCH] [IPoIB] Use ib_port_info_compute_rate rather than duplicating functionality. git-svn-id: svn://openib.tc.cornell.edu/gen1@221 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/ulp/ipoib/kernel/ipoib_port.c | 84 ++--------------------------- 1 file changed, 5 insertions(+), 79 deletions(-) diff --git a/trunk/ulp/ipoib/kernel/ipoib_port.c b/trunk/ulp/ipoib/kernel/ipoib_port.c index 54f905c8..62a2fb23 100644 --- a/trunk/ulp/ipoib/kernel/ipoib_port.c +++ b/trunk/ulp/ipoib/kernel/ipoib_port.c @@ -132,12 +132,6 @@ static ib_api_status_t __ib_mgr_activate( IN ipoib_port_t* const p_port ); -static void -__ib_mgr_set_rate( - IN ipoib_port_t* const p_port, - IN const uint8_t link_width, - IN const uint8_t link_speed ); - /****************************************************************************** * * Buffer manager operations. @@ -4399,24 +4393,7 @@ __endpt_mgr_add_local( av_attr.port_num = p_port->port_num; av_attr.sl = 0; av_attr.dlid = p_port_info->base_lid; - switch( p_port_info->link_width_active ) - { - case IB_LINK_WIDTH_ACTIVE_1X: - av_attr.static_rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_4X: - av_attr.static_rate = IB_PATH_RECORD_RATE_10_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_12X: - av_attr.static_rate = IB_PATH_RECORD_RATE_30_GBS; - break; - - default: - cl_obj_destroy( &p_endpt->obj ); - return IB_INVALID_SETTING; - } + av_attr.static_rate = ib_port_info_compute_rate( p_port_info ); av_attr.path_bits = 0; status = p_port->p_adapter->p_ifc->create_av( p_port->ib_mgr.h_pd, &av_attr, &p_endpt->h_av ); @@ -4468,7 +4445,10 @@ __port_info_cb( ("Received port info: link width = %d.\n", p_port_rec->port_info.link_width_active) ); - __ib_mgr_set_rate( p_port, + p_port->ib_mgr.rate = + ib_port_info_compute_rate( &p_port_rec->port_info ); + + ipoib_set_rate( p_port->p_adapter, p_port_rec->port_info.link_width_active, ib_port_info_get_link_speed_active( &p_port_rec->port_info ) ); @@ -5008,60 +4988,6 @@ __ib_mgr_activate( return IB_SUCCESS; } -static void -__ib_mgr_set_rate( - IN ipoib_port_t* const p_port, - IN const uint8_t link_width, - IN const uint8_t link_speed ) -{ - IPOIB_ENTER( IPOIB_DBG_INIT ); - - /* Set the link speed based on the IB link speed (1x vs 4x, etc). */ - switch( link_width * link_width * link_speed ) - { - case 1: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; - - case 2: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_5_GBS; - break; - - case 4: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_10_GBS; - break; - - case 8: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_20_GBS; - break; - - case 16: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_40_GBS; - break; - - case 64: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_30_GBS; - break; - - case 128: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_60_GBS; - break; - - case 256: - p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_120_GBS; - break; - - default: - IPOIB_TRACE( IPOIB_DBG_ERROR, - ("Invalid link rate (%d).\n", link_width) ); - p_port->ib_mgr.rate = 0; - } - - ipoib_set_rate( p_port->p_adapter, link_width, link_speed ); - - IPOIB_EXIT( IPOIB_DBG_INIT ); -} - /* Transition to a passive level thread. */ ib_api_status_t -- 2.41.0