[ofa-general] [PATCH] opensm: use osm_get_node/port_by_guid() funcs

Sasha Khapyorsky sashak at voltaire.com
Sat Jun 30 14:05:03 PDT 2007


Similar to osm_get_switch_by_guid() use existing osm_get_node_by_guid()
and osm_get_port_by_guid() helper funcs for those objects by guid
resolving - this simplifies the flow in many cases.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_drop_mgr.c            |   29 +++++++++------------------
 opensm/opensm/osm_inform.c              |    5 +--
 opensm/opensm/osm_lid_mgr.c             |    6 +---
 opensm/opensm/osm_mcast_mgr.c           |   32 ++++++++++--------------------
 opensm/opensm/osm_node_desc_rcv.c       |    7 +----
 opensm/opensm/osm_node_info_rcv.c       |   32 +++++++++---------------------
 opensm/opensm/osm_perfmgr.c             |    8 ++----
 opensm/opensm/osm_pkey_rcv.c            |    7 +----
 opensm/opensm/osm_port.c                |    7 +----
 opensm/opensm/osm_port_info_rcv.c       |    7 +----
 opensm/opensm/osm_prtn.c                |    5 +--
 opensm/opensm/osm_sa_lft_record.c       |    5 +--
 opensm/opensm/osm_sa_mcmember_record.c  |    6 +---
 opensm/opensm/osm_sa_mft_record.c       |    6 +---
 opensm/opensm/osm_sa_multipath_record.c |    7 ++---
 opensm/opensm/osm_sa_path_record.c      |   17 ++++-----------
 opensm/opensm/osm_sa_service_record.c   |    4 +-
 opensm/opensm/osm_sa_sw_info_record.c   |    5 +--
 opensm/opensm/osm_slvl_map_rcv.c        |    6 +---
 opensm/opensm/osm_sm.c                  |   12 +++-------
 opensm/opensm/osm_sm_state_mgr.c        |   14 ++----------
 opensm/opensm/osm_sminfo_rcv.c          |    6 +---
 opensm/opensm/osm_state_mgr.c           |   13 +++--------
 opensm/opensm/osm_sw_info_rcv.c         |    6 +---
 opensm/opensm/osm_ucast_file.c          |    5 +--
 opensm/opensm/osm_vl_arb_rcv.c          |    7 +----
 26 files changed, 87 insertions(+), 177 deletions(-)

diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index 9d91b6b..20564cb 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
@@ -144,17 +144,16 @@ drop_mgr_clean_physp(
   IN const osm_drop_mgr_t* const p_mgr,
   IN osm_physp_t *p_physp)
 {
-  cl_qmap_t *p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
   osm_physp_t *p_remote_physp;
   osm_port_t* p_remote_port;
 
   p_remote_physp = osm_physp_get_remote( p_physp );
   if( p_remote_physp && osm_physp_is_valid( p_remote_physp ) )
   {
-    p_remote_port = (osm_port_t*)cl_qmap_get( p_port_guid_tbl,
-                                              p_remote_physp->port_guid );
+    p_remote_port = osm_get_port_by_guid(p_mgr->p_subn,
+                                         p_remote_physp->port_guid );
 
-    if ( p_remote_port != (osm_port_t*)cl_qmap_end( p_port_guid_tbl ) )
+    if ( p_remote_port )
     {
       /* Let's check if this is a case of link that is lost (both ports
          weren't recognized), or a "hiccup" in the subnet - in which case
@@ -220,7 +219,6 @@ __osm_drop_mgr_remove_port(
   osm_port_t *p_port_check;
   cl_list_t* p_new_ports_list;
   cl_list_iterator_t cl_list_item;
-  cl_qmap_t* p_port_guid_tbl;
   cl_qmap_t* p_sm_guid_tbl;
   osm_mcm_info_t* p_mcm;
   osm_mgrp_t*  p_mgrp;
@@ -261,8 +259,8 @@ __osm_drop_mgr_remove_port(
     cl_list_item = cl_list_next(cl_list_item);
   }
 
-  p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
-  p_port_check = (osm_port_t*)cl_qmap_remove( p_port_guid_tbl, port_guid );
+  p_port_check = (osm_port_t*)cl_qmap_remove( &p_mgr->p_subn->port_guid_tbl,
+                                              port_guid );
   if( p_port_check != p_port )
   {
     osm_log( p_mgr->p_log, OSM_LOG_ERROR,
@@ -406,11 +404,9 @@ __osm_drop_mgr_process_node(
   osm_physp_t *p_physp;
   osm_port_t *p_port;
   osm_node_t *p_node_check;
-  cl_qmap_t *p_node_guid_tbl;
   uint32_t port_num;
   uint32_t max_ports;
   ib_net64_t port_guid;
-  cl_qmap_t* p_port_guid_tbl;
   boolean_t return_val = FALSE;
 
   OSM_LOG_ENTER( p_mgr->p_log, __osm_drop_mgr_process_node );
@@ -424,8 +420,6 @@ __osm_drop_mgr_process_node(
     Delete all the logical and physical port objects
     associated with this node.
   */
-  p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
-
   max_ports = osm_node_get_num_physp( p_node );
   for( port_num = 0; port_num < max_ports; port_num++ )
   {
@@ -434,9 +428,9 @@ __osm_drop_mgr_process_node(
     {
       port_guid = osm_physp_get_port_guid( p_physp );
 
-      p_port = (osm_port_t*)cl_qmap_get( p_port_guid_tbl, port_guid );
+      p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid );
 
-      if( p_port != (osm_port_t*)cl_qmap_end( p_port_guid_tbl ) )
+      if( p_port )
         __osm_drop_mgr_remove_port( p_mgr, p_port );
       else
         drop_mgr_clean_physp( p_mgr, p_physp );
@@ -448,8 +442,7 @@ __osm_drop_mgr_process_node(
   if (p_node->sw)
     __osm_drop_mgr_remove_switch( p_mgr, p_node );
 
-  p_node_guid_tbl = &p_mgr->p_subn->node_guid_tbl;
-  p_node_check = (osm_node_t*)cl_qmap_remove( p_node_guid_tbl,
+  p_node_check = (osm_node_t*)cl_qmap_remove( &p_mgr->p_subn->node_guid_tbl,
                                               osm_node_get_node_guid( p_node ) );
   if( p_node_check != p_node )
   {
@@ -476,7 +469,6 @@ __osm_drop_mgr_check_node(
   ib_net64_t node_guid;
   osm_physp_t *p_physp;
   osm_port_t *p_port;
-  cl_qmap_t* p_port_guid_tbl;
   ib_net64_t port_guid;
 
   OSM_LOG_ENTER( p_mgr->p_log, __osm_drop_mgr_check_node );
@@ -506,7 +498,6 @@ __osm_drop_mgr_check_node(
   }
 
   /* Make sure we have a port object for port zero */
-  p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
   p_physp = osm_node_get_physp_ptr( p_node, 0 );
   if ( !osm_physp_is_valid( p_physp ) )
   {
@@ -521,9 +512,9 @@ __osm_drop_mgr_check_node(
    
   port_guid = osm_physp_get_port_guid( p_physp );
 
-  p_port = (osm_port_t*)cl_qmap_get( p_port_guid_tbl, port_guid );
+  p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid );
 
-  if( p_port == (osm_port_t*)cl_qmap_end( p_port_guid_tbl ) )
+  if( !p_port )
   {
     osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
              "__osm_drop_mgr_check_node: "
diff --git a/opensm/opensm/osm_inform.c b/opensm/opensm/osm_inform.c
index 63f3bfa..5929382 100644
--- a/opensm/opensm/osm_inform.c
+++ b/opensm/opensm/osm_inform.c
@@ -589,10 +589,9 @@ __match_notice_to_inf_rec(
   {
     source_gid = p_ntc->issuer_gid;
   }
-  p_src_port = (osm_port_t*)cl_qmap_get( &p_subn->port_guid_tbl,
-                                         source_gid.unicast.interface_id );
 
-  if( p_src_port == (osm_port_t*)cl_qmap_end( &(p_subn->port_guid_tbl)) )
+  p_src_port = osm_get_port_by_guid(p_subn, source_gid.unicast.interface_id);
+  if( !p_src_port )
   {
     osm_log( p_log, OSM_LOG_INFO,
              "__match_notice_to_inf_rec: "
diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index 8a0d288..f235a02 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -1289,10 +1289,8 @@ __osm_lid_mgr_process_our_sm_node(
   /*
     Acquire our own port object.
   */
-  p_port = (osm_port_t*)cl_qmap_get( &p_mgr->p_subn->port_guid_tbl,
-                                     p_mgr->p_subn->sm_port_guid );
-
-  if( p_port == (osm_port_t*)cl_qmap_end( &p_mgr->p_subn->port_guid_tbl ) )
+  p_port = osm_get_port_by_guid(p_mgr->p_subn, p_mgr->p_subn->sm_port_guid);
+  if( !p_port )
   {
     osm_log( p_mgr->p_log, OSM_LOG_ERROR,
              "__osm_lid_mgr_process_our_sm_node: ERR 0308: "
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index 2ecb34e..345dbd4 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -159,12 +159,10 @@ osm_mcast_mgr_compute_avg_hops(
   const osm_port_t* p_port;
   const osm_mcm_port_t* p_mcm_port;
   const cl_qmap_t* p_mcm_tbl;
-  const cl_qmap_t* p_port_tbl;
 
   OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_compute_avg_hops );
 
   p_mcm_tbl = &p_mgrp->mcm_port_tbl;
-  p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
 
   /*
     For each member of the multicast group, compute the
@@ -178,10 +176,10 @@ osm_mcast_mgr_compute_avg_hops(
       Acquire the port object for this port guid, then create
       the new worker object to build the list.
     */
-    p_port = (osm_port_t*)cl_qmap_get( p_port_tbl,
-                                       ib_gid_get_guid( &p_mcm_port->port_gid ) );
+    p_port = osm_get_port_by_guid(p_mgr->p_subn,
+                                  ib_gid_get_guid( &p_mcm_port->port_gid ) );
 
-    if( p_port == (osm_port_t*)cl_qmap_end( p_port_tbl ) )
+    if( !p_port )
     {
       osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                "osm_mcast_mgr_compute_avg_hops: ERR 0A18: "
@@ -221,12 +219,10 @@ osm_mcast_mgr_compute_max_hops(
   const osm_port_t* p_port;
   const osm_mcm_port_t* p_mcm_port;
   const cl_qmap_t* p_mcm_tbl;
-  const cl_qmap_t* p_port_tbl;
 
   OSM_LOG_ENTER( p_mgr->p_log, osm_mcast_mgr_compute_max_hops );
 
   p_mcm_tbl = &p_mgrp->mcm_port_tbl;
-  p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
 
   /*
     For each member of the multicast group, compute the
@@ -240,11 +236,10 @@ osm_mcast_mgr_compute_max_hops(
       Acquire the port object for this port guid, then create
       the new worker object to build the list.
     */
-    p_port = (osm_port_t*)cl_qmap_get(
-      p_port_tbl,
-      ib_gid_get_guid( &p_mcm_port->port_gid ) );
+    p_port = osm_get_port_by_guid(p_mgr->p_subn,
+                                  ib_gid_get_guid( &p_mcm_port->port_gid ));
 
-    if( p_port == (osm_port_t*)cl_qmap_end( p_port_tbl ) )
+    if( !p_port )
     {
       osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                "osm_mcast_mgr_compute_max_hops: ERR 0A1A: "
@@ -871,7 +866,6 @@ __osm_mcast_mgr_build_spanning_tree(
   osm_mgrp_t*              const p_mgrp )
 {
   const cl_qmap_t*         p_mcm_tbl;
-  const cl_qmap_t*         p_port_tbl;
   const osm_port_t*        p_port;
   const osm_mcm_port_t*    p_mcm_port;
   uint32_t                 num_ports;
@@ -895,7 +889,6 @@ __osm_mcast_mgr_build_spanning_tree(
   __osm_mcast_mgr_purge_tree( p_mgr, p_mgrp );
 
   p_mcm_tbl = &p_mgrp->mcm_port_tbl;
-  p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
   num_ports = cl_qmap_count( p_mcm_tbl );
   if( num_ports == 0 )
   {
@@ -947,10 +940,9 @@ __osm_mcast_mgr_build_spanning_tree(
       Acquire the port object for this port guid, then create
       the new worker object to build the list.
     */
-    p_port = (osm_port_t*)cl_qmap_get( p_port_tbl,
-                                       ib_gid_get_guid( &p_mcm_port->port_gid ) );
-
-    if( p_port == (osm_port_t*)cl_qmap_end( p_port_tbl ) )
+    p_port = osm_get_port_by_guid(p_mgr->p_subn,
+                                  ib_gid_get_guid( &p_mcm_port->port_gid ));
+    if( !p_port )
     {
       osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                "__osm_mcast_mgr_build_spanning_tree: ERR 0A09: "
@@ -1091,7 +1083,6 @@ osm_mcast_mgr_process_single(
   osm_physp_t*             p_physp;
   osm_physp_t*             p_remote_physp;
   osm_node_t*              p_remote_node;
-  cl_qmap_t*               p_port_tbl;
   osm_mcast_tbl_t*         p_mcast_tbl;
   ib_api_status_t          status = IB_SUCCESS;
 
@@ -1100,7 +1091,6 @@ osm_mcast_mgr_process_single(
   CL_ASSERT( mlid );
   CL_ASSERT( port_guid );
 
-  p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
   mlid_ho = cl_ntoh16( mlid );
 
   if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
@@ -1115,8 +1105,8 @@ osm_mcast_mgr_process_single(
   /*
     Acquire the Port object.
   */
-  p_port = (osm_port_t*)cl_qmap_get( p_port_tbl, port_guid );
-  if( p_port == (osm_port_t*)cl_qmap_end( p_port_tbl ) )
+  p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid );
+  if( !p_port )
   {
     osm_log( p_mgr->p_log, OSM_LOG_ERROR,
              "osm_mcast_mgr_process_single: ERR 0A01: "
diff --git a/opensm/opensm/osm_node_desc_rcv.c b/opensm/opensm/osm_node_desc_rcv.c
index fc96c12..656141d 100644
--- a/opensm/opensm/osm_node_desc_rcv.c
+++ b/opensm/opensm/osm_node_desc_rcv.c
@@ -143,7 +143,6 @@ osm_nd_rcv_process(
 {
   osm_nd_rcv_t *p_rcv = context;
   osm_madw_t *p_madw = data;
-  cl_qmap_t *p_guid_tbl;
   ib_node_desc_t *p_nd;
   ib_smp_t *p_smp;
   osm_node_t *p_node;
@@ -155,7 +154,6 @@ osm_nd_rcv_process(
 
   CL_ASSERT( p_madw );
 
-  p_guid_tbl = &p_rcv->p_subn->node_guid_tbl;
   p_smp = osm_madw_get_smp_ptr( p_madw );
   p_nd = (ib_node_desc_t*)ib_smp_get_payload_ptr( p_smp );
 
@@ -165,9 +163,8 @@ osm_nd_rcv_process(
 
   node_guid = osm_madw_get_nd_context_ptr( p_madw )->node_guid;
   CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-  p_node = (osm_node_t*)cl_qmap_get( p_guid_tbl, node_guid );
-
-  if( p_node == (osm_node_t*)cl_qmap_end( p_guid_tbl) )
+  p_node = osm_get_node_by_guid(p_rcv->p_subn, node_guid);
+  if( !p_node )
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
              "osm_nd_rcv_process: ERR 0B01: "
diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index 1eca625..b78a4ce 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -76,7 +76,6 @@ __osm_ni_rcv_set_links(
   const uint8_t port_num,
   const osm_ni_context_t* const p_ni_context )
 {
-  cl_qmap_t *p_guid_tbl;
   osm_node_t *p_neighbor_node;
   osm_node_t *p_old_neighbor_node;
   uint8_t old_neighbor_port_num;
@@ -91,10 +90,9 @@ __osm_ni_rcv_set_links(
   */
   if( p_ni_context->node_guid != 0 )
   {
-    p_guid_tbl = &p_rcv->p_subn->node_guid_tbl;
-    p_neighbor_node = (osm_node_t*)cl_qmap_get( p_guid_tbl,
-                                                p_ni_context->node_guid );
-    if( p_neighbor_node == (osm_node_t*)cl_qmap_end( p_guid_tbl ) )
+    p_neighbor_node = osm_get_node_by_guid(p_rcv->p_subn,
+                                           p_ni_context->node_guid);
+    if( !p_neighbor_node )
     {
       osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                "__osm_ni_rcv_set_links: ERR 0D10: "
@@ -434,7 +432,6 @@ __osm_ni_rcv_process_existing_ca_or_router(
   ib_smp_t *p_smp;
   osm_port_t *p_port;
   osm_port_t *p_port_check;
-  cl_qmap_t *p_guid_tbl;
   osm_madw_context_t context;
   uint8_t port_num;
   osm_physp_t *p_physp;
@@ -448,7 +445,6 @@ __osm_ni_rcv_process_existing_ca_or_router(
   p_smp = osm_madw_get_smp_ptr( p_madw );
   p_ni = (ib_node_info_t*)ib_smp_get_payload_ptr( p_smp );
   port_num = ib_node_info_get_local_port_num( p_ni );
-  p_guid_tbl = &p_rcv->p_subn->port_guid_tbl;
   h_bind = osm_madw_get_bind_handle( p_madw );
 
   /*
@@ -456,9 +452,8 @@ __osm_ni_rcv_process_existing_ca_or_router(
     previously undiscovered port.  If so, build the new
     port object.
   */
-  p_port = (osm_port_t*)cl_qmap_get( p_guid_tbl, p_ni->port_guid );
-
-  if( p_port == (osm_port_t*)cl_qmap_end( p_guid_tbl ) )
+  p_port = osm_get_port_by_guid( p_rcv->p_subn, p_ni->port_guid );
+  if( !p_port )
   {
     osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
              "__osm_ni_rcv_process_existing_ca_or_router: "
@@ -479,7 +474,7 @@ __osm_ni_rcv_process_existing_ca_or_router(
     /*
       Add the new port object to the database.
     */
-    p_port_check = (osm_port_t*)cl_qmap_insert( p_guid_tbl,
+    p_port_check = (osm_port_t*)cl_qmap_insert( &p_rcv->p_subn->port_guid_tbl,
                                                 p_ni->port_guid, &p_port->map_item );
     if( p_port_check != p_port )
     {
@@ -700,8 +695,6 @@ __osm_ni_rcv_process_new(
   osm_port_t *p_port_check;
   osm_router_t *p_rtr = NULL;
   osm_router_t *p_rtr_check;
-  cl_qmap_t *p_node_guid_tbl;
-  cl_qmap_t *p_port_guid_tbl;
   cl_qmap_t *p_rtr_guid_tbl;
   ib_node_info_t *p_ni;
   ib_smp_t *p_smp;
@@ -765,8 +758,7 @@ __osm_ni_rcv_process_new(
   /*
     Add the new port object to the database.
   */
-  p_port_guid_tbl = &p_rcv->p_subn->port_guid_tbl;
-  p_port_check = (osm_port_t*)cl_qmap_insert( p_port_guid_tbl,
+  p_port_check = (osm_port_t*)cl_qmap_insert( &p_rcv->p_subn->port_guid_tbl,
                                               p_ni->port_guid,
                                               &p_port->map_item );
   if( p_port_check != p_port )
@@ -838,8 +830,7 @@ __osm_ni_rcv_process_new(
     }
   }
 
-  p_node_guid_tbl = &p_rcv->p_subn->node_guid_tbl;
-  p_node_check = (osm_node_t*)cl_qmap_insert( p_node_guid_tbl,
+  p_node_check = (osm_node_t*)cl_qmap_insert( &p_rcv->p_subn->node_guid_tbl,
                                               p_ni->node_guid,
                                               &p_node->map_item );
   if( p_node_check != p_node )
@@ -1007,7 +998,6 @@ osm_ni_rcv_process(
 {
   osm_ni_rcv_t *p_rcv = context;
   osm_madw_t *p_madw = data;
-  cl_qmap_t *p_guid_tbl;
   ib_node_info_t *p_ni;
   ib_smp_t *p_smp;
   osm_node_t *p_node;
@@ -1042,8 +1032,6 @@ osm_ni_rcv_process(
     goto Exit;
   }
 
-  p_guid_tbl = &p_rcv->p_subn->node_guid_tbl;
-
   /*
     Determine if this node has already been discovered,
     and process accordingly.
@@ -1051,11 +1039,11 @@ osm_ni_rcv_process(
   */
 
   CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-  p_node = (osm_node_t*)cl_qmap_get( p_guid_tbl, p_ni->node_guid );
+  p_node = osm_get_node_by_guid(p_rcv->p_subn, p_ni->node_guid);
 
   osm_dump_node_info( p_rcv->p_log, p_ni, OSM_LOG_DEBUG );
 
-  if( p_node == (osm_node_t*)cl_qmap_end(p_guid_tbl) )
+  if( !p_node )
   {
     __osm_ni_rcv_process_new( p_rcv, p_madw );
     process_new_flag = TRUE;
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index 3780a37..b83bb45 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -375,9 +375,8 @@ __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context )
 	OSM_LOG_ENTER( pm->log, __osm_pm_query_counters );
 
 	cl_plock_acquire(pm->lock);
-	node = (osm_node_t *)cl_qmap_get(&(pm->subn->node_guid_tbl),
-			cl_hton64(mon_node->guid));
-	if (node == (osm_node_t *)cl_qmap_end(&(pm->subn->node_guid_tbl))) {
+	node = osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+	if (!node) {
 		osm_log(pm->log, OSM_LOG_ERROR,
 			"__osm_pm_query_counters: ERR 4C07: Node guid 0x%" PRIx64 " no longer exists so removing from PerfMgr monitoring\n",
 			mon_node->guid);
@@ -654,8 +653,7 @@ osm_perfmgr_check_overflow(osm_perfmgr_t *pm, uint64_t node_guid,
 		osm_node_t *p_node = NULL;
 		ib_net16_t  lid = 0;
 		cl_plock_acquire(pm->lock);
-		p_node = (osm_node_t *)cl_qmap_get(&(pm->subn->node_guid_tbl),
-						cl_hton64(node_guid));
+		p_node = osm_get_node_by_guid(pm->subn, cl_hton64(node_guid));
 		lid = get_lid(p_node, port);
 		cl_plock_release(pm->lock);
 		if (lid == 0)
diff --git a/opensm/opensm/osm_pkey_rcv.c b/opensm/opensm/osm_pkey_rcv.c
index 67fe067..fae6dd3 100644
--- a/opensm/opensm/osm_pkey_rcv.c
+++ b/opensm/opensm/osm_pkey_rcv.c
@@ -113,7 +113,6 @@ osm_pkey_rcv_process(
 {
   osm_pkey_rcv_t *p_rcv = context;
   osm_madw_t *p_madw = data;
-  cl_qmap_t *p_guid_tbl;
   ib_pkey_table_t *p_pkey_tbl;
   ib_smp_t *p_smp;
   osm_port_t *p_port;
@@ -141,11 +140,9 @@ osm_pkey_rcv_process(
 
   CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE );
 
-  p_guid_tbl = &p_rcv->p_subn->port_guid_tbl;
   cl_plock_excl_acquire( p_rcv->p_lock );
-  p_port = (osm_port_t*)cl_qmap_get( p_guid_tbl, port_guid );
-
-  if( p_port == (osm_port_t*)cl_qmap_end( p_guid_tbl) )
+  p_port = osm_get_port_by_guid( p_rcv->p_subn, port_guid );
+  if( !p_port )
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
              "osm_pkey_rcv_process: ERR 4806: "
diff --git a/opensm/opensm/osm_port.c b/opensm/opensm/osm_port.c
index f092334..97e6031 100644
--- a/opensm/opensm/osm_port.c
+++ b/opensm/opensm/osm_port.c
@@ -686,7 +686,6 @@ osm_physp_replace_dr_path_with_alternate_dr_path(
   osm_dr_path_t * p_dr_path;
   cl_list_t     *p_currPortsList;
   cl_list_t     *p_nextPortsList;
-  cl_qmap_t const     *p_port_tbl;
   osm_port_t    *p_port;
   osm_physp_t   *p_physp, *p_remote_physp;
   ib_net64_t    port_guid;
@@ -712,14 +711,12 @@ osm_physp_replace_dr_path_with_alternate_dr_path(
   cl_list_construct( p_nextPortsList );
   cl_list_init( p_nextPortsList, 10 );
 
-  p_port_tbl = &p_subn->port_guid_tbl;
   port_guid = p_subn->sm_port_guid;
 
   CL_ASSERT( port_guid );
 
-  p_port = (osm_port_t*)cl_qmap_get( p_port_tbl, port_guid );
-
-  if( p_port == (osm_port_t*)cl_qmap_end( p_port_tbl ) )
+  p_port = osm_get_port_by_guid( p_subn, port_guid );
+  if( !p_port )
   {
     osm_log( p_log, OSM_LOG_ERROR,
              "osm_physp_replace_dr_path_with_alternate_dr_path: ERR 4105: "
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index c41f984..7d42297 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -627,7 +627,6 @@ osm_pi_rcv_process(
 {
   osm_pi_rcv_t *p_rcv = context;
   osm_madw_t *p_madw = data;
-  cl_qmap_t *p_guid_tbl;
   ib_port_info_t *p_pi;
   ib_smp_t *p_smp;
   osm_port_t *p_port;
@@ -689,11 +688,9 @@ osm_pi_rcv_process(
     goto Exit;
   }
   
-  p_guid_tbl = &p_rcv->p_subn->port_guid_tbl;
   CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
-  p_port = (osm_port_t*)cl_qmap_get( p_guid_tbl, port_guid );
-
-  if( p_port == (osm_port_t*)cl_qmap_end( p_guid_tbl) )
+  p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+  if (!p_port)
   {
     CL_PLOCK_RELEASE( p_rcv->p_lock );
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
diff --git a/opensm/opensm/osm_prtn.c b/opensm/opensm/osm_prtn.c
index 027a5a4..ebf5889 100644
--- a/opensm/opensm/osm_prtn.c
+++ b/opensm/opensm/osm_prtn.c
@@ -105,14 +105,13 @@ void osm_prtn_delete(
 ib_api_status_t osm_prtn_add_port(osm_log_t *p_log, osm_subn_t *p_subn,
 				  osm_prtn_t *p, ib_net64_t guid, boolean_t full)
 {
-	cl_qmap_t *p_port_tbl = &p_subn->port_guid_tbl;
 	ib_api_status_t status = IB_SUCCESS;
 	cl_map_t *p_tbl;
 	osm_port_t *p_port;
 	osm_physp_t *p_physp;
 
-	p_port = (osm_port_t *)cl_qmap_get(p_port_tbl, guid);
-	if (!p_port || p_port == (osm_port_t *)cl_qmap_end(p_port_tbl)) {
+	p_port = osm_get_port_by_guid(p_subn, guid);
+	if (!p_port) {
 		osm_log(p_log, OSM_LOG_VERBOSE, "osm_prtn_add_port: "
 			"port 0x%" PRIx64 " not found\n",
 			cl_ntoh64(guid));
diff --git a/opensm/opensm/osm_sa_lft_record.c b/opensm/opensm/osm_sa_lft_record.c
index c5cd9ca..4943632 100644
--- a/opensm/opensm/osm_sa_lft_record.c
+++ b/opensm/opensm/osm_sa_lft_record.c
@@ -194,9 +194,8 @@ __osm_lftr_get_port_by_guid(
 
   CL_PLOCK_ACQUIRE(p_rcv->p_lock);
 
-  p_port = (osm_port_t *)cl_qmap_get(&p_rcv->p_subn->port_guid_tbl,
-                                     port_guid);
-  if (p_port == (osm_port_t *)cl_qmap_end(&p_rcv->p_subn->port_guid_tbl))
+  p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+  if (!p_port)
   {
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
              "__osm_lftr_get_port_by_guid ERR 4404: "
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 90fe103..82aa0db 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -1554,10 +1554,8 @@ __osm_mcmr_rcv_join_mgrp(
   CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
 
   /* make sure the requested port guid is known to the SM */
-  p_port = (osm_port_t *)cl_qmap_get(&p_rcv->p_subn->port_guid_tbl,
-                                     portguid);
-
-  if (p_port == (osm_port_t *)cl_qmap_end(&p_rcv->p_subn->port_guid_tbl))
+  p_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
+  if (!p_port)
   {
     CL_PLOCK_RELEASE( p_rcv->p_lock );
 
diff --git a/opensm/opensm/osm_sa_mft_record.c b/opensm/opensm/osm_sa_mft_record.c
index 7908583..c70cd65 100644
--- a/opensm/opensm/osm_sa_mft_record.c
+++ b/opensm/opensm/osm_sa_mft_record.c
@@ -198,15 +198,13 @@ __osm_mftr_get_port_by_guid(
 
   CL_PLOCK_ACQUIRE(p_rcv->p_lock);
 
-  p_port = (osm_port_t *)cl_qmap_get(&p_rcv->p_subn->port_guid_tbl,
-                                     port_guid);
-  if (p_port == (osm_port_t *)cl_qmap_end(&p_rcv->p_subn->port_guid_tbl))
+  p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+  if (!p_port)
   {
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
              "__osm_mftr_get_port_by_guid ERR 4A04: "
              "Invalid port GUID 0x%016" PRIx64 "\n",
              port_guid );
-    p_port = NULL;
   }
 
   CL_PLOCK_RELEASE(p_rcv->p_lock);
diff --git a/opensm/opensm/osm_sa_multipath_record.c b/opensm/opensm/osm_sa_multipath_record.c
index 06640d9..27b840d 100644
--- a/opensm/opensm/osm_sa_multipath_record.c
+++ b/opensm/opensm/osm_sa_multipath_record.c
@@ -1195,10 +1195,9 @@ __osm_mpr_rcv_get_gids(
       }
     }
 
-    p_port = (osm_port_t *)cl_qmap_get( &p_rcv->p_subn->port_guid_tbl,
-					 gids->unicast.interface_id );
-    if ( !p_port ||
-         p_port == (osm_port_t *)cl_qmap_end( &p_rcv->p_subn->port_guid_tbl ) ) {
+    p_port = osm_get_port_by_guid(p_rcv->p_subn, gids->unicast.interface_id);
+    if ( !p_port )
+    {
       /*
         This 'error' is the client's fault (bad gid) so
         don't enter it as an error in our own log.
diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index 47d9c33..56be25f 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
@@ -1214,12 +1214,9 @@ __osm_pr_rcv_get_end_points(
       }
     }
 
-    *pp_src_port = (osm_port_t*)cl_qmap_get(
-      &p_rcv->p_subn->port_guid_tbl,
-      p_pr->sgid.unicast.interface_id );
-
-    if( *pp_src_port == (osm_port_t*)cl_qmap_end(
-          &p_rcv->p_subn->port_guid_tbl ) )
+    *pp_src_port = osm_get_port_by_guid(p_rcv->p_subn,
+                                        p_pr->sgid.unicast.interface_id );
+    if( !*pp_src_port )
     {
       /*
         This 'error' is the client's fault (bad gid) so
@@ -1304,12 +1301,8 @@ __osm_pr_rcv_get_end_points(
       }
     }
 
-    *pp_dest_port = (osm_port_t*)cl_qmap_get(
-      &p_rcv->p_subn->port_guid_tbl,
-      dest_guid );
-
-    if( *pp_dest_port == (osm_port_t*)cl_qmap_end(
-          &p_rcv->p_subn->port_guid_tbl ) )
+    *pp_dest_port = osm_get_port_by_guid(p_rcv->p_subn, dest_guid);
+    if( !*pp_dest_port )
     {
       /*
         This 'error' is the client's fault (bad gid) so
diff --git a/opensm/opensm/osm_sa_service_record.c b/opensm/opensm/osm_sa_service_record.c
index c0f1057..3f32bd5 100644
--- a/opensm/opensm/osm_sa_service_record.c
+++ b/opensm/opensm/osm_sa_service_record.c
@@ -200,8 +200,8 @@ __match_service_pkey_with_ports_pkey(
     if((comp_mask & IB_SR_COMPMASK_SGID) == IB_SR_COMPMASK_SGID)
     {
       service_guid = p_service_rec->service_gid.unicast.interface_id;
-      service_port = (osm_port_t*)cl_qmap_get( &p_rcv->p_subn->port_guid_tbl, service_guid );
-      if (service_port == (osm_port_t*)cl_qmap_end( &p_rcv->p_subn->port_guid_tbl ))
+      service_port = osm_get_port_by_guid(p_rcv->p_subn, service_guid);
+      if (!service_port)
       {
         osm_log( p_rcv->p_log, OSM_LOG_ERROR,
                  "__match_service_pkey_with_ports_pkey: ERR 2405: "
diff --git a/opensm/opensm/osm_sa_sw_info_record.c b/opensm/opensm/osm_sa_sw_info_record.c
index 94b1ff9..129eeff 100644
--- a/opensm/opensm/osm_sa_sw_info_record.c
+++ b/opensm/opensm/osm_sa_sw_info_record.c
@@ -187,9 +187,8 @@ __osm_sir_get_port_by_guid(
 
   CL_PLOCK_ACQUIRE(p_rcv->p_lock);
 
-  p_port = (osm_port_t *)cl_qmap_get(&p_rcv->p_subn->port_guid_tbl,
-                                     port_guid);
-  if (p_port == (osm_port_t *)cl_qmap_end(&p_rcv->p_subn->port_guid_tbl))
+  p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+  if (!p_port)
   {
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
              "__osm_sir_get_port_by_guid ERR 5309: "
diff --git a/opensm/opensm/osm_slvl_map_rcv.c b/opensm/opensm/osm_slvl_map_rcv.c
index 3352627..d601456 100644
--- a/opensm/opensm/osm_slvl_map_rcv.c
+++ b/opensm/opensm/osm_slvl_map_rcv.c
@@ -126,7 +126,6 @@ osm_slvl_rcv_process(
 {
   osm_slvl_rcv_t *p_rcv = context;
   osm_madw_t *p_madw = p_data;
-  cl_qmap_t *p_guid_tbl;
   ib_slvl_table_t *p_slvl_tbl;
   ib_smp_t *p_smp;
   osm_port_t *p_port;
@@ -152,11 +151,10 @@ osm_slvl_rcv_process(
 
   CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_SLVL_TABLE );
 
-  p_guid_tbl = &p_rcv->p_subn->port_guid_tbl;
   cl_plock_excl_acquire( p_rcv->p_lock );
-  p_port = (osm_port_t*)cl_qmap_get( p_guid_tbl, port_guid );
+  p_port = osm_get_port_by_guid( p_rcv->p_subn, port_guid );
 
-  if( p_port == (osm_port_t*)cl_qmap_end( p_guid_tbl) )
+  if( !p_port )
   {
     cl_plock_release( p_rcv->p_lock );
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index dfe01a4..57851e6 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -637,10 +637,8 @@ osm_sm_mcgrp_join(
     * Acquire the port object for the port joining this group.
     */
    CL_PLOCK_EXCL_ACQUIRE( p_sm->p_lock );
-   p_port = ( osm_port_t * ) cl_qmap_get( &p_sm->p_subn->port_guid_tbl,
-                                          port_guid );
-   if( p_port ==
-       ( osm_port_t * ) cl_qmap_end( &p_sm->p_subn->port_guid_tbl ) )
+   p_port = osm_get_port_by_guid( p_sm->p_subn, port_guid );
+   if( !p_port )
    {
       CL_PLOCK_RELEASE( p_sm->p_lock );
       osm_log( p_sm->p_log, OSM_LOG_ERROR,
@@ -761,10 +759,8 @@ osm_sm_mcgrp_leave(
     */
    /* note: p_sm->p_lock is locked by caller, but will be released later
       this function */
-   p_port = ( osm_port_t * ) cl_qmap_get( &p_sm->p_subn->port_guid_tbl,
-                                          port_guid );
-   if( p_port ==
-       ( osm_port_t * ) cl_qmap_end( &p_sm->p_subn->port_guid_tbl ) )
+   p_port = osm_get_port_by_guid( p_sm->p_subn, port_guid );
+   if( !p_port )
    {
       CL_PLOCK_RELEASE( p_sm->p_lock );
       osm_log( p_sm->p_log, OSM_LOG_ERROR,
diff --git a/opensm/opensm/osm_sm_state_mgr.c b/opensm/opensm/osm_sm_state_mgr.c
index ccfb8b0..a39ba4c 100644
--- a/opensm/opensm/osm_sm_state_mgr.c
+++ b/opensm/opensm/osm_sm_state_mgr.c
@@ -168,10 +168,8 @@ __osm_sm_state_mgr_send_local_port_info_req(
     * update the master_sm_base_lid of the subnet.
     */
    memset( &context, 0, sizeof( context ) );
-   p_port = ( osm_port_t * ) cl_qmap_get( &p_sm_mgr->p_subn->port_guid_tbl,
-                                          port_guid );
-   if( p_port ==
-       ( osm_port_t * ) cl_qmap_end( &p_sm_mgr->p_subn->port_guid_tbl ) )
+   p_port = osm_get_port_by_guid(p_sm_mgr->p_subn, port_guid );
+   if( !p_port )
    {
       osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
                "__osm_sm_state_mgr_send_local_port_info_req: ERR 3205: "
@@ -231,13 +229,7 @@ __osm_sm_state_mgr_send_master_sm_info_req(
        * SM (according to master_guid)
        * Send a query of SubnGet(SMInfo) to the subn master_sm_base_lid object.
        */
-      p_port = ( osm_port_t * ) cl_qmap_get( &p_sm_mgr->p_subn->port_guid_tbl,
-                                             p_sm_mgr->master_guid );
-      if( p_port ==
-           ( osm_port_t * ) cl_qmap_end( &p_sm_mgr->p_subn->port_guid_tbl ) )
-      {
-        p_port = NULL;
-      }
+      p_port = osm_get_port_by_guid(p_sm_mgr->p_subn, p_sm_mgr->master_guid);
    }
    else
    {
diff --git a/opensm/opensm/osm_sminfo_rcv.c b/opensm/opensm/osm_sminfo_rcv.c
index 2be56a5..1489aa3 100644
--- a/opensm/opensm/osm_sminfo_rcv.c
+++ b/opensm/opensm/osm_sminfo_rcv.c
@@ -562,7 +562,6 @@ __osm_sminfo_rcv_process_get_response(
   const ib_smp_t*          p_smp;
   const ib_sm_info_t*      p_smi;
   cl_qmap_t*               p_sm_tbl;
-  cl_qmap_t*               p_port_tbl;
   osm_port_t*              p_port;
   ib_net64_t               port_guid;
   osm_remote_sm_t*         p_sm;
@@ -585,7 +584,6 @@ __osm_sminfo_rcv_process_get_response(
 
   p_smi = ib_smp_get_payload_ptr( p_smp );
   p_sm_tbl = &p_rcv->p_subn->sm_guid_tbl;
-  p_port_tbl = &p_rcv->p_subn->port_guid_tbl;
   port_guid = p_smi->guid;
 
   osm_dump_sm_info( p_rcv->p_log, p_smi, OSM_LOG_DEBUG );
@@ -611,8 +609,8 @@ __osm_sminfo_rcv_process_get_response(
   */
   CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
 
-  p_port = (osm_port_t*)cl_qmap_get( p_port_tbl, port_guid );
-  if( p_port == (osm_port_t*)cl_qmap_end( p_port_tbl ) )
+  p_port = osm_get_port_by_guid( p_rcv->p_subn, port_guid );
+  if( !p_port )
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
              "__osm_sminfo_rcv_process_get_response: ERR 2F12: "
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 7cf9d20..43317e5 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -811,7 +811,6 @@ __osm_state_mgr_is_sm_port_down(
    ib_net64_t port_guid;
    osm_port_t *p_port;
    osm_physp_t *p_physp;
-   cl_qmap_t *p_tbl;
    uint8_t state;
 
    OSM_LOG_ENTER( p_mgr->p_log, __osm_state_mgr_is_sm_port_down );
@@ -830,13 +829,11 @@ __osm_state_mgr_is_sm_port_down(
       goto Exit;
    }
 
-   p_tbl = &p_mgr->p_subn->port_guid_tbl;
-
    CL_ASSERT( port_guid );
 
    CL_PLOCK_ACQUIRE( p_mgr->p_lock );
-   p_port = ( osm_port_t * ) cl_qmap_get( p_tbl, port_guid );
-   if( p_port == ( osm_port_t * ) cl_qmap_end( p_tbl ) )
+   p_port = osm_get_port_by_guid( p_mgr->p_subn, port_guid );
+   if( !p_port )
    {
       osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                "__osm_state_mgr_is_sm_port_down: ERR 3309: "
@@ -879,7 +876,6 @@ __osm_state_mgr_sweep_hop_1(
    osm_dr_path_t hop_1_path;
    ib_net64_t port_guid;
    uint8_t port_num;
-   cl_qmap_t *p_port_tbl;
    uint8_t path_array[IB_SUBNET_PATH_HOPS_MAX];
    uint8_t num_ports;
    osm_physp_t *p_ext_physp;
@@ -889,7 +885,6 @@ __osm_state_mgr_sweep_hop_1(
    /*
     * First, get our own port and node objects.
     */
-   p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
    port_guid = p_mgr->p_subn->sm_port_guid;
 
    CL_ASSERT( port_guid );
@@ -902,8 +897,8 @@ __osm_state_mgr_sweep_hop_1(
     * continue through the switch. */
    p_mgr->p_subn->in_sweep_hop_0 = FALSE;
 
-   p_port = ( osm_port_t * ) cl_qmap_get( p_port_tbl, port_guid );
-   if( p_port == ( osm_port_t * ) cl_qmap_end( p_port_tbl ) )
+   p_port = osm_get_port_by_guid( p_mgr->p_subn, port_guid );
+   if( !p_port )
    {
       osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                "__osm_state_mgr_sweep_hop_1: ERR 3310: "
diff --git a/opensm/opensm/osm_sw_info_rcv.c b/opensm/opensm/osm_sw_info_rcv.c
index 0043ac4..563c126 100644
--- a/opensm/opensm/osm_sw_info_rcv.c
+++ b/opensm/opensm/osm_sw_info_rcv.c
@@ -586,7 +586,6 @@ osm_si_rcv_process(
 {
   osm_si_rcv_t *p_rcv = context;
   osm_madw_t *p_madw = data;
-  cl_qmap_t *p_node_guid_tbl;
   ib_switch_info_t *p_si;
   ib_smp_t *p_smp;
   osm_node_t *p_node;
@@ -599,7 +598,6 @@ osm_si_rcv_process(
 
   CL_ASSERT( p_madw );
 
-  p_node_guid_tbl = &p_rcv->p_subn->node_guid_tbl;
   p_smp = osm_madw_get_smp_ptr( p_madw );
   p_si = (ib_switch_info_t*)ib_smp_get_payload_ptr( p_smp );
 
@@ -623,8 +621,8 @@ osm_si_rcv_process(
 
   CL_PLOCK_EXCL_ACQUIRE( p_rcv->p_lock );
 
-  p_node = (osm_node_t*)cl_qmap_get( p_node_guid_tbl, node_guid );
-  if( p_node == (osm_node_t*)cl_qmap_end( p_node_guid_tbl ) )
+  p_node = osm_get_node_by_guid(p_rcv->p_subn, node_guid);
+  if( !p_node )
   {
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
              "osm_si_rcv_process: ERR 3606: "
diff --git a/opensm/opensm/osm_ucast_file.c b/opensm/opensm/osm_ucast_file.c
index 5d9ba01..97be7ea 100644
--- a/opensm/opensm/osm_ucast_file.c
+++ b/opensm/opensm/osm_ucast_file.c
@@ -63,9 +63,8 @@ static uint16_t remap_lid(osm_opensm_t *p_osm, uint16_t lid, ib_net64_t guid)
 	uint16_t min_lid, max_lid;
 	uint8_t lmc;
 
-	p_port = (osm_port_t *)cl_qmap_get(&p_osm->subn.port_guid_tbl, guid);
-	if (!p_port ||
-	    p_port == (osm_port_t *)cl_qmap_end(&p_osm->subn.port_guid_tbl)) {
+	p_port = osm_get_port_by_guid(&p_osm->subn, guid);
+	if (!p_port) {
 		osm_log(&p_osm->log, OSM_LOG_VERBOSE,
 			"remap_lid: cannot find port guid 0x%016" PRIx64
 			" , will use the same lid\n", cl_ntoh64(guid));
diff --git a/opensm/opensm/osm_vl_arb_rcv.c b/opensm/opensm/osm_vl_arb_rcv.c
index f36751e..95f7e7d 100644
--- a/opensm/opensm/osm_vl_arb_rcv.c
+++ b/opensm/opensm/osm_vl_arb_rcv.c
@@ -126,7 +126,6 @@ osm_vla_rcv_process(
 {
   osm_vla_rcv_t *p_rcv = context;
   osm_madw_t *p_madw = data;
-  cl_qmap_t *p_guid_tbl;
   ib_vl_arb_table_t *p_vla_tbl;
   ib_smp_t *p_smp;
   osm_port_t *p_port;
@@ -153,11 +152,9 @@ osm_vla_rcv_process(
 
   CL_ASSERT( p_smp->attr_id == IB_MAD_ATTR_VL_ARBITRATION );
 
-  p_guid_tbl = &p_rcv->p_subn->port_guid_tbl;
   cl_plock_excl_acquire( p_rcv->p_lock );
-  p_port = (osm_port_t*)cl_qmap_get( p_guid_tbl, port_guid );
-
-  if( p_port == (osm_port_t*)cl_qmap_end( p_guid_tbl ) )
+  p_port = osm_get_port_by_guid( p_rcv->p_subn, port_guid );
+  if( !p_port )
   {
     cl_plock_release( p_rcv->p_lock );
     osm_log( p_rcv->p_log, OSM_LOG_ERROR,
-- 
1.5.2.2.603.g7c851




More information about the general mailing list