[ofa-general] [PATCH 2/4 v2] opensm: remove osm_port_get_phys_ptr()

Sasha Khapyorsky sashak at voltaire.com
Thu May 10 14:14:38 PDT 2007


Function osm_port_get_phys_ptr() returns pointer to physical port by its
number - and this should be node and not port related routine. So this
patch replaces osm_port_get_phys_ptr() by osm_node_get_physp_ptr().

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/include/opensm/osm_port.h       |   36 -----------------------------------
 osm/opensm/osm_drop_mgr.c           |    2 +-
 osm/opensm/osm_link_mgr.c           |    2 +-
 osm/opensm/osm_port_info_rcv.c      |   10 ++++----
 osm/opensm/osm_qos.c                |    2 +-
 osm/opensm/osm_sa_link_record.c     |   18 ++++++++--------
 osm/opensm/osm_sa_pkey_record.c     |    4 +-
 osm/opensm/osm_sa_portinfo_record.c |    4 +-
 osm/opensm/osm_sa_slvl_record.c     |    6 ++--
 osm/opensm/osm_sa_vlarb_record.c    |    4 +-
 osm/opensm/osm_state_mgr.c          |    2 +-
 osm/opensm/osm_subnet.c             |    4 +-
 osm/opensm/osm_trap_rcv.c           |    2 +-
 13 files changed, 30 insertions(+), 66 deletions(-)

diff --git a/osm/include/opensm/osm_port.h b/osm/include/opensm/osm_port.h
index 134012c..feebf63 100644
--- a/osm/include/opensm/osm_port.h
+++ b/osm/include/opensm/osm_port.h
@@ -1467,42 +1467,6 @@ osm_port_get_guid(
 *	Port
 *********/
 
-/****f* OpenSM: Port/osm_port_get_phys_ptr
-* NAME
-*	osm_port_get_phys_ptr
-*
-* DESCRIPTION
-*	Gets the pointer to the specified Physical Port object.
-*
-* SYNOPSIS
-*/
-static inline osm_physp_t*
-osm_port_get_phys_ptr(
-	IN const osm_port_t* const p_port,
-	IN const uint8_t port_num )
-{
-	CL_ASSERT( port_num < p_port->physp_tbl_size );
-	return( p_port->tbl[port_num] );
-}
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to a Port object.
-*
-*	port_num
-*		[in] Number of physical port for which to return the
-*		osm_physp_t object.  If this port is on an HCA, then
-*		this value is ignored.
-*
-* RETURN VALUE
-*	Pointer to the Physical Port object.
-*
-* NOTES
-*
-* SEE ALSO
-*	Port
-*********/
-
 /****f* OpenSM: Port/osm_port_get_default_phys_ptr
 * NAME
 *	osm_port_get_default_phys_ptr
diff --git a/osm/opensm/osm_drop_mgr.c b/osm/opensm/osm_drop_mgr.c
index d091347..97a95c2 100644
--- a/osm/opensm/osm_drop_mgr.c
+++ b/osm/opensm/osm_drop_mgr.c
@@ -240,7 +240,7 @@ __osm_drop_mgr_remove_port(
   num_physp = osm_node_get_num_physp( p_port->p_node );
   for( port_num = 0; port_num < num_physp; port_num++ )
   {
-    p_physp = osm_port_get_phys_ptr( p_port, (uint8_t)port_num );
+    p_physp = osm_node_get_physp_ptr( p_port->p_node, (uint8_t)port_num );
 
     if( p_physp )
     {
diff --git a/osm/opensm/osm_link_mgr.c b/osm/opensm/osm_link_mgr.c
index 71c0495..a38d179 100644
--- a/osm/opensm/osm_link_mgr.c
+++ b/osm/opensm/osm_link_mgr.c
@@ -434,7 +434,7 @@ __osm_link_mgr_process_port(
       or if the state of the port is already better then the
       specified state.
     */
-    p_physp = osm_port_get_phys_ptr( p_port, (uint8_t)i );
+    p_physp = osm_node_get_physp_ptr( p_port->p_node, (uint8_t)i );
     if( p_physp && osm_physp_is_valid( p_physp ) )
     {
       current_state = osm_physp_get_port_state( p_physp );
diff --git a/osm/opensm/osm_port_info_rcv.c b/osm/opensm/osm_port_info_rcv.c
index 9bd75b5..5d9c5c7 100644
--- a/osm/opensm/osm_port_info_rcv.c
+++ b/osm/opensm/osm_port_info_rcv.c
@@ -555,13 +555,13 @@ osm_pi_rcv_process_set(
 
   p_context = osm_madw_get_pi_context_ptr( p_madw );
 
-  p_physp = osm_port_get_phys_ptr( p_port, port_num );
-  CL_ASSERT( p_physp );
-  CL_ASSERT( osm_physp_is_valid( p_physp ) );
+  p_node = p_port->p_node;
+  CL_ASSERT( p_node );
+
+  p_physp = osm_node_get_physp_ptr( p_node, port_num );
+  CL_ASSERT( p_physp && osm_physp_is_valid( p_physp ) );
 
   port_guid = osm_physp_get_port_guid( p_physp );
-  p_node = osm_port_get_parent_node( p_port );
-  CL_ASSERT( p_node );
 
   p_smp = osm_madw_get_smp_ptr( p_madw );
   p_pi = (ib_port_info_t*)ib_smp_get_payload_ptr( p_smp );
diff --git a/osm/opensm/osm_qos.c b/osm/opensm/osm_qos.c
index 11beaae..1255169 100644
--- a/osm/opensm/osm_qos.c
+++ b/osm/opensm/osm_qos.c
@@ -336,7 +336,7 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 		if (p_node->sw) {
 			num_physp = osm_node_get_num_physp(p_node);
 			for (i = 1; i < num_physp; i++) {
-				p_physp = osm_port_get_phys_ptr(p_port, i);
+				p_physp = osm_node_get_physp_ptr(p_node, i);
 				if (!p_physp || !osm_physp_is_valid(p_physp))
 					continue;
 				status =
diff --git a/osm/opensm/osm_sa_link_record.c b/osm/opensm/osm_sa_link_record.c
index 18f655c..c6b7a7c 100644
--- a/osm/opensm/osm_sa_link_record.c
+++ b/osm/opensm/osm_sa_link_record.c
@@ -350,12 +350,12 @@ __osm_lr_rcv_get_port_links(
       dest_num_ports = osm_node_get_num_physp( p_dest_port->p_node );
       for( port_num = 1; port_num < num_ports; port_num++ )
       {
-        p_src_physp = osm_port_get_phys_ptr( p_src_port, port_num );
+        p_src_physp = osm_node_get_physp_ptr( p_src_port->p_node, port_num );
         for( dest_port_num = 1; dest_port_num < dest_num_ports;
              dest_port_num++ )
         {
-          p_dest_physp = osm_port_get_phys_ptr( p_dest_port,
-                                                dest_port_num );
+          p_dest_physp = osm_node_get_physp_ptr( p_dest_port->p_node,
+                                                 dest_port_num );
           /* both physical ports should be with data */
           if (p_src_physp && p_dest_physp)
             __osm_lr_rcv_get_physp_link( p_rcv, p_lr, p_src_physp,
@@ -376,7 +376,7 @@ __osm_lr_rcv_get_port_links(
            this couldn't be a relevant record. */
         if (port_num < p_src_port->physp_tbl_size) 
         {          
-          p_src_physp = osm_port_get_phys_ptr( p_src_port, port_num );
+          p_src_physp = osm_node_get_physp_ptr( p_src_port->p_node, port_num );
           if (p_src_physp)
             __osm_lr_rcv_get_physp_link( p_rcv, p_lr, p_src_physp,
                                          NULL, comp_mask, p_list,
@@ -388,7 +388,7 @@ __osm_lr_rcv_get_port_links(
         num_ports = osm_node_get_num_physp( p_src_port->p_node );
         for( port_num = 1; port_num < num_ports; port_num++ )
         {
-          p_src_physp = osm_port_get_phys_ptr( p_src_port, port_num );
+          p_src_physp = osm_node_get_physp_ptr( p_src_port->p_node, port_num );
           if (p_src_physp)
             __osm_lr_rcv_get_physp_link( p_rcv, p_lr, p_src_physp,
                                          NULL, comp_mask, p_list,
@@ -411,8 +411,8 @@ __osm_lr_rcv_get_port_links(
            this couldn't be a relevant record. */
         if (port_num < p_dest_port->physp_tbl_size ) 
         {
-          p_dest_physp = osm_port_get_phys_ptr(
-            p_dest_port, port_num );
+          p_dest_physp = osm_node_get_physp_ptr(
+            p_dest_port->p_node, port_num );
           if (p_dest_physp)
             __osm_lr_rcv_get_physp_link( p_rcv, p_lr, NULL,
                                          p_dest_physp, comp_mask,
@@ -424,8 +424,8 @@ __osm_lr_rcv_get_port_links(
         num_ports = osm_node_get_num_physp( p_dest_port->p_node );
         for( port_num = 1; port_num < num_ports; port_num++ )
         {
-          p_dest_physp = osm_port_get_phys_ptr(
-            p_dest_port, port_num );
+          p_dest_physp = osm_node_get_physp_ptr(
+            p_dest_port->p_node, port_num );
           if (p_dest_physp)
             __osm_lr_rcv_get_physp_link( p_rcv, p_lr, NULL,
                                          p_dest_physp, comp_mask,
diff --git a/osm/opensm/osm_sa_pkey_record.c b/osm/opensm/osm_sa_pkey_record.c
index 0a199f1..a943fe0 100644
--- a/osm/opensm/osm_sa_pkey_record.c
+++ b/osm/opensm/osm_sa_pkey_record.c
@@ -251,7 +251,7 @@ __osm_sa_pkey_by_comp_mask(
   {
     if (port_num < osm_node_get_num_physp( p_port->p_node ))
     {
-      p_physp = osm_port_get_phys_ptr( p_port, port_num );
+      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
       /* Check that the p_physp is valid, and that is shares a pkey
          with the p_req_physp. */
       if( p_physp && osm_physp_is_valid( p_physp ) &&
@@ -272,7 +272,7 @@ __osm_sa_pkey_by_comp_mask(
     num_ports = osm_node_get_num_physp( p_port->p_node );
     for( port_num = 0; port_num < num_ports; port_num++ )
     {
-      p_physp = osm_port_get_phys_ptr( p_port, port_num );
+      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
       if( p_physp == NULL )
         continue;
 
diff --git a/osm/opensm/osm_sa_portinfo_record.c b/osm/opensm/osm_sa_portinfo_record.c
index 9d4f18e..74f53d6 100644
--- a/osm/opensm/osm_sa_portinfo_record.c
+++ b/osm/opensm/osm_sa_portinfo_record.c
@@ -544,7 +544,7 @@ __osm_sa_pir_by_comp_mask(
   {
     if (p_rcvd_rec->port_num < num_ports)
     {
-      p_physp = osm_port_get_phys_ptr( p_port, p_rcvd_rec->port_num );
+      p_physp = osm_node_get_physp_ptr( p_port->p_node, p_rcvd_rec->port_num );
       /* Check that the p_physp is valid, and that the p_physp and the
          p_req_physp share a pkey. */
       if( p_physp && osm_physp_is_valid( p_physp ) &&
@@ -556,7 +556,7 @@ __osm_sa_pir_by_comp_mask(
   {
     for( port_num = 0; port_num < num_ports; port_num++ )
     {
-      p_physp = osm_port_get_phys_ptr( p_port, port_num );
+      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
       if( p_physp == NULL )
         continue;
 
diff --git a/osm/opensm/osm_sa_slvl_record.c b/osm/opensm/osm_sa_slvl_record.c
index 3c4ff02..2f250d9 100644
--- a/osm/opensm/osm_sa_slvl_record.c
+++ b/osm/opensm/osm_sa_slvl_record.c
@@ -226,7 +226,7 @@ __osm_sa_slvl_by_comp_mask(
              "__osm_sa_slvl_by_comp_mask:  "
              "Using Physical Default Port Number: 0x%X (for End Node)\n",
              p_port->default_port_num );
-    p_out_physp = osm_port_get_phys_ptr( p_port, p_port->default_port_num );
+    p_out_physp = osm_port_get_default_phys_ptr( p_port );
     /* check that the p_out_physp and the p_req_physp share a pkey */
     if (osm_physp_share_pkey( p_rcv->p_log, p_req_physp, p_out_physp ))
     __osm_sa_slvl_create( p_rcv, p_out_physp, p_ctxt, 0 );
@@ -243,7 +243,7 @@ __osm_sa_slvl_by_comp_mask(
     }
 
     for( out_port_num = out_port_start; out_port_num <= out_port_end; out_port_num++ ) {
-      p_out_physp = osm_port_get_phys_ptr( p_port, out_port_num );
+      p_out_physp = osm_node_get_physp_ptr( p_port->p_node, out_port_num );
       if( p_out_physp == NULL )
         continue;
 
@@ -256,7 +256,7 @@ __osm_sa_slvl_by_comp_mask(
           continue;
 #endif
 
-        p_in_physp = osm_port_get_phys_ptr( p_port, in_port_num );
+        p_in_physp = osm_node_get_physp_ptr( p_port->p_node, in_port_num );
         if( p_in_physp == NULL )
           continue;
 
diff --git a/osm/opensm/osm_sa_vlarb_record.c b/osm/opensm/osm_sa_vlarb_record.c
index 6df5ed9..9cd346c 100644
--- a/osm/opensm/osm_sa_vlarb_record.c
+++ b/osm/opensm/osm_sa_vlarb_record.c
@@ -255,7 +255,7 @@ __osm_sa_vl_arb_by_comp_mask(
   {
     if (port_num < osm_node_get_num_physp( p_port->p_node ))
     {
-      p_physp = osm_port_get_phys_ptr( p_port, port_num );
+      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
       /* check that the p_physp is valid, and that the requester
          and the p_physp share a pkey. */
       if( p_physp && osm_physp_is_valid( p_physp ) &&
@@ -276,7 +276,7 @@ __osm_sa_vl_arb_by_comp_mask(
     num_ports = osm_node_get_num_physp( p_port->p_node );
     for( port_num = 0; port_num < num_ports; port_num++ )
     {
-      p_physp = osm_port_get_phys_ptr( p_port, port_num );
+      p_physp = osm_node_get_physp_ptr( p_port->p_node, port_num );
       if( p_physp == NULL )
         continue;
 
diff --git a/osm/opensm/osm_state_mgr.c b/osm/opensm/osm_state_mgr.c
index 6f53e60..9aeec74 100644
--- a/osm/opensm/osm_state_mgr.c
+++ b/osm/opensm/osm_state_mgr.c
@@ -1287,7 +1287,7 @@ __osm_state_mgr_report(
       num_ports = osm_node_get_num_physp( p_node );
       for( port_num = start_port; port_num < num_ports; port_num++ )
       {
-         p_physp = osm_port_get_phys_ptr( p_port, port_num );
+         p_physp = osm_node_get_physp_ptr( p_node, port_num );
          if( ( p_physp == NULL ) || ( !osm_physp_is_valid( p_physp ) ) )
             continue;
 
diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index c8c3ddc..8e0c53b 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -266,7 +266,7 @@ osm_get_gid_by_mad_addr(
                );
       return(IB_INVALID_PARAMETER);
     }
-    p_physp = osm_port_get_phys_ptr( p_port, p_port->default_port_num);
+    p_physp = osm_port_get_default_phys_ptr( p_port );
     p_gid->unicast.interface_id = p_physp->port_guid;
     p_gid->unicast.prefix = p_subn->opt.subnet_prefix;
   }
@@ -316,7 +316,7 @@ osm_get_physp_by_mad_addr(
     
       goto Exit;
     }
-    p_physp = osm_port_get_phys_ptr( p_port, p_port->default_port_num);
+    p_physp = osm_port_get_default_phys_ptr( p_port );
   }
   else
   {
diff --git a/osm/opensm/osm_trap_rcv.c b/osm/opensm/osm_trap_rcv.c
index ed507b6..0ec9a1f 100644
--- a/osm/opensm/osm_trap_rcv.c
+++ b/osm/opensm/osm_trap_rcv.c
@@ -111,7 +111,7 @@ __get_physp_by_lid_and_num(
   if (osm_node_get_num_physp(p_port->p_node) < num)
     return NULL;
 
-  return( osm_port_get_phys_ptr(p_port, num) );
+  return( osm_node_get_physp_ptr(p_port->p_node, num) );
 }
 
 /**********************************************************************
-- 
1.5.2.rc2.20.gac2a




More information about the general mailing list