[IPoIB] Use ib_port_info_compute_rate rather than duplicating functionality.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 28 Feb 2006 05:47:11 +0000 (05:47 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 28 Feb 2006 05:47:11 +0000 (05:47 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@221 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_port.c

index 54f905c..62a2fb2 100644 (file)
@@ -132,12 +132,6 @@ static ib_api_status_t
 __ib_mgr_activate(\r
        IN                              ipoib_port_t* const                     p_port );\r
 \r
-static void\r
-__ib_mgr_set_rate(\r
-       IN                              ipoib_port_t* const                     p_port,\r
-       IN              const   uint8_t                                         link_width,\r
-       IN              const   uint8_t                                         link_speed );\r
-\r
 /******************************************************************************\r
 *\r
 * Buffer manager operations.\r
@@ -4399,24 +4393,7 @@ __endpt_mgr_add_local(
        av_attr.port_num = p_port->port_num;\r
        av_attr.sl = 0;\r
        av_attr.dlid = p_port_info->base_lid;\r
-       switch( p_port_info->link_width_active )\r
-       {\r
-       case IB_LINK_WIDTH_ACTIVE_1X:\r
-               av_attr.static_rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
-               break;\r
-\r
-       case IB_LINK_WIDTH_ACTIVE_4X:\r
-               av_attr.static_rate = IB_PATH_RECORD_RATE_10_GBS;\r
-               break;\r
-\r
-       case IB_LINK_WIDTH_ACTIVE_12X:\r
-               av_attr.static_rate = IB_PATH_RECORD_RATE_30_GBS;\r
-               break;\r
-\r
-       default:\r
-               cl_obj_destroy( &p_endpt->obj );\r
-               return IB_INVALID_SETTING;\r
-       }\r
+       av_attr.static_rate = ib_port_info_compute_rate( p_port_info );\r
        av_attr.path_bits = 0;\r
        status =\r
                p_port->p_adapter->p_ifc->create_av( p_port->ib_mgr.h_pd, &av_attr, &p_endpt->h_av );\r
@@ -4468,7 +4445,10 @@ __port_info_cb(
                                ("Received port info: link width = %d.\n",\r
                                p_port_rec->port_info.link_width_active) );\r
 \r
-                       __ib_mgr_set_rate( p_port,\r
+                       p_port->ib_mgr.rate =\r
+                               ib_port_info_compute_rate( &p_port_rec->port_info );\r
+\r
+                       ipoib_set_rate( p_port->p_adapter,\r
                                p_port_rec->port_info.link_width_active,\r
                                ib_port_info_get_link_speed_active( &p_port_rec->port_info ) );\r
 \r
@@ -5008,60 +4988,6 @@ __ib_mgr_activate(
        return IB_SUCCESS;\r
 }\r
 \r
-static void\r
-__ib_mgr_set_rate(\r
-       IN                              ipoib_port_t* const                     p_port,\r
-       IN              const   uint8_t                                         link_width,\r
-       IN              const   uint8_t                                         link_speed )\r
-{\r
-       IPOIB_ENTER( IPOIB_DBG_INIT );\r
-\r
-       /* Set the link speed based on the IB link speed (1x vs 4x, etc). */\r
-       switch( link_width * link_width * link_speed )\r
-       {\r
-       case 1:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
-               break;\r
-\r
-       case 2:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_5_GBS;\r
-               break;\r
-\r
-       case 4:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_10_GBS;\r
-               break;\r
-\r
-       case 8:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_20_GBS;\r
-               break;\r
-\r
-       case 16:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_40_GBS;\r
-               break;\r
-\r
-       case 64:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_30_GBS;\r
-               break;\r
-\r
-       case 128:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_60_GBS;\r
-               break;\r
-\r
-       case 256:\r
-               p_port->ib_mgr.rate = IB_PATH_RECORD_RATE_120_GBS;\r
-               break;\r
-\r
-       default:\r
-               IPOIB_TRACE( IPOIB_DBG_ERROR,\r
-                       ("Invalid link rate (%d).\n", link_width) );\r
-               p_port->ib_mgr.rate = 0;\r
-       }\r
-\r
-       ipoib_set_rate( p_port->p_adapter, link_width, link_speed );\r
-\r
-       IPOIB_EXIT( IPOIB_DBG_INIT );\r
-}\r
-\r
 \r
 /* Transition to a passive level thread. */\r
 ib_api_status_t\r