[openib-general] Re[PATCH] Opensm - fix for osm_sa_portinfo_record.c

Yael Kalka yael at mellanox.co.il
Mon Jan 9 04:29:12 PST 2006


Hi Hal,

During some tests we've notices that not all compmask fields are
properly checked and compared in the portInfo record query.
Attached is a patch with the missing checks, and addition of some
set/get relevant functions added to the ib_types.h as well.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: include/iba/ib_types.h
===================================================================
--- include/iba/ib_types.h	(revision 4809)
+++ include/iba/ib_types.h	(working copy)
@@ -3960,6 +3960,33 @@ ib_port_info_get_vl_cap(
 *
 * SEE ALSO
 *********/
+/****f* IBA Base: Types/ib_port_info_get_init_type
+* NAME
+*	ib_port_info_get_init_type
+*
+* DESCRIPTION
+*	Gets the VL Capability of a port.
+*
+* SYNOPSIS
+*/
+static inline uint8_t
+ib_port_info_get_init_type(
+	IN const ib_port_info_t* const p_pi)
+{
+	return(p_pi->vl_cap & 0x0F);
+}
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	InitType field
+*
+* NOTES
+*
+* SEE ALSO
+*********/
 /****f* IBA Base: Types/ib_port_info_get_op_vls
 * NAME
 *	ib_port_info_get_op_vls
@@ -4457,7 +4484,6 @@ ib_path_get_ipd(
 * SEE ALSO
 *********/
 
-
 /****f* IBA Base: Types/ib_port_info_get_mtu_cap
 * NAME
 *	ib_port_info_get_mtu_cap
@@ -4546,6 +4572,65 @@ ib_port_info_set_neighbor_mtu(
 * SEE ALSO
 *********/
 
+/****f* IBA Base: Types/ib_port_info_get_master_smsl
+* NAME
+*	ib_port_info_get_master_smsl
+*
+* DESCRIPTION
+*	Returns the encoded value for the Master SMSL at this port.
+*
+* SYNOPSIS
+*/
+static inline uint8_t
+ib_port_info_get_master_smsl(
+	IN const ib_port_info_t* const p_pi )
+{
+  return( (uint8_t)(p_pi->mtu_smsl & 0x0F) );
+}
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	Returns the encoded value for the Master SMSL at this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_set_master_smsl
+* NAME
+*	ib_port_info_set_master_smsl
+*
+* DESCRIPTION
+*	Sets the Master SMSL value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+static inline void
+ib_port_info_set_master_smsl(
+	IN				ib_port_info_t* const		p_pi,
+	IN		const	uint8_t						smsl )
+{
+	p_pi->mtu_smsl = (uint8_t)((p_pi->mtu_smsl & 0xF0) | smsl );
+}
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+*	mtu
+*		[in] Encoded Master SMSL value to set
+*
+* RETURN VALUES
+*	None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
 /****f* IBA Base: Types/ib_port_info_set_timeout
 * NAME
 *	ib_port_info_set_timeout
@@ -4981,6 +5066,60 @@ ib_port_info_set_mpb(
 *
 * NOTES
 *
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd
+* NAME
+*	ib_port_info_get_local_phy_err_thd
+*
+* DESCRIPTION
+*	Returns the Phy Link Threshold
+*
+* SYNOPSIS
+*/
+static inline uint8_t
+ib_port_info_get_local_phy_err_thd(
+	IN		const	ib_port_info_t* const		p_pi )
+{
+  return (uint8_t)( (p_pi->error_threshold & 0xF0) >> 4);
+}
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	Returns the Phy Link error threshold assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd
+* NAME
+*	ib_port_info_get_local_overrun_err_thd
+*
+* DESCRIPTION
+*	Returns the Credits Overrun Errors Threshold
+*
+* SYNOPSIS
+*/
+static inline uint8_t
+ib_port_info_get_overrun_err_thd(
+	IN		const	ib_port_info_t* const		p_pi )
+{
+  return (uint8_t)(p_pi->error_threshold & 0x0F);
+}
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	Returns the Credits Overrun errors threshold assigned to this port.
+*
+* NOTES
+*
 * SEE ALSO
 *********/
 
Index: opensm/osm_sa_portinfo_record.c
===================================================================
--- opensm/osm_sa_portinfo_record.c	(revision 4809)
+++ opensm/osm_sa_portinfo_record.c	(working copy)
@@ -347,6 +347,12 @@ __osm_sa_pir_check_physp(
          ib_port_info_get_link_down_def_state( p_pi ) )
       goto Exit;
   }
+  if ( comp_mask & IB_PIR_COMPMASK_MKEYPROTBITS )
+  {
+    if( ib_port_info_get_mpb( p_comp_pi ) !=
+        ib_port_info_get_mpb( p_pi ) )
+      goto Exit;
+  }
   if( comp_mask & IB_PIR_COMPMASK_LMC )
   {
     if( ib_port_info_get_lmc( p_comp_pi ) !=
@@ -371,6 +377,24 @@ __osm_sa_pir_check_physp(
         ib_port_info_get_neighbor_mtu( p_pi ) )
       goto Exit;
   }
+  if( comp_mask & IB_PIR_COMPMASK_MASTERSMSL )
+  {
+    if( ib_port_info_get_master_smsl( p_comp_pi ) !=
+        ib_port_info_get_master_smsl( p_pi ) )
+      goto Exit;
+  }
+  if( comp_mask & IB_PIR_COMPMASK_VLCAP )
+  {
+    if( ib_port_info_get_vl_cap( p_comp_pi ) !=
+        ib_port_info_get_vl_cap( p_pi ) )
+      goto Exit;
+  }
+  if( comp_mask & IB_PIR_COMPMASK_INITTYPE )
+  {
+    if( ib_port_info_get_init_type( p_comp_pi ) !=
+        ib_port_info_get_init_type( p_pi ) )
+      goto Exit;
+  }
   if( comp_mask & IB_PIR_COMPMASK_VLHIGHLIMIT )
   {
     if( p_comp_pi->vl_high_limit != p_pi->vl_high_limit )
@@ -392,6 +416,12 @@ __osm_sa_pir_check_physp(
         ib_port_info_get_mtu_cap( p_pi ) )
       goto Exit;
   }
+  if( comp_mask & IB_PIR_COMPMASK_VLSTALLCNT )
+  {
+    if( ib_port_info_get_vl_stall_count( p_comp_pi ) !=
+        ib_port_info_get_vl_stall_count( p_pi ) )
+      goto Exit;
+  }
   if (comp_mask & IB_PIR_COMPMASK_HOQLIFE )
   {
     if ((p_comp_pi->vl_stall_life & 0x1F) != (p_pi->vl_stall_life & 0x1F) )
@@ -452,6 +482,18 @@ __osm_sa_pir_check_physp(
     if ((p_comp_pi->resp_time_value & 0x1F) != (p_pi->resp_time_value &0x1F) )
       goto Exit;
   }
+  if (comp_mask & IB_PIR_COMPMASK_LOCALPHYERR )
+  {
+    if( ib_port_info_get_local_phy_err_thd( p_comp_pi ) !=
+        ib_port_info_get_local_phy_err_thd( p_pi ) )
+      goto Exit;
+  }
+  if (comp_mask & IB_PIR_COMPMASK_OVERRUNERR)
+  {
+    if( ib_port_info_get_overrun_err_thd( p_comp_pi ) !=
+        ib_port_info_get_overrun_err_thd( p_pi ) )
+      goto Exit;
+  }
 
   __osm_sa_pir_create( p_rcv, p_physp, p_ctxt );
 




More information about the general mailing list