[openib-general] [PATCH] osm: Fix a rate code computation for DDR ports

Eitan Zahavi eitan at mellanox.co.il
Tue Aug 16 00:40:24 PDT 2005


Hi Hal

DDR Ports are not supported by the current implementation of 
the ib_type.h: ib_port_info_compute_rate

This patch fixes that issue (had to change order of functions too).

I tested the patch on :
2.6.12.3-smp SuSE Linux 9.3 (i586)

Signed-off-by:  Eitan Zahavi <eitan at mellanox.co.il>

Index: include/iba/ib_types.h
===================================================================
--- include/iba/ib_types.h	(revision 3103)
+++ include/iba/ib_types.h	(working copy)
@@ -4164,6 +4164,37 @@ ib_port_info_get_link_down_def_state(
 *
 * SEE ALSO
 *********/
+
+/****f* IBA Base: Types/ib_port_info_get_link_speed_active
+* NAME
+*	ib_port_info_get_link_speed_active
+*
+* DESCRIPTION
+*	Returns the Link Speed Active value assigned to this port.
+*
+* SYNOPSIS
+*/
+static inline uint8_t
+ib_port_info_get_link_speed_active(
+	IN		const	ib_port_info_t* const		p_pi )
+{
+  return( (uint8_t)((p_pi->link_speed &
+                     IB_PORT_LINK_SPEED_ACTIVE_MASK) >>
+                    IB_PORT_LINK_SPEED_SHIFT) );
+}
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	Returns the link speed active value assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
 /****f* IBA Base: Types/ib_port_info_set_link_down_def_state
 * NAME
 *	ib_port_info_set_link_down_def_state
@@ -4196,13 +4227,24 @@ ib_port_info_set_link_down_def_state(
 * SEE ALSO
 *********/
 
-#define IB_LINK_WIDTH_ACTIVE_1X			1
-#define IB_LINK_WIDTH_ACTIVE_4X			2
-#define IB_LINK_WIDTH_ACTIVE_12X		8
-
-#define IB_PATH_RECORD_RATE_2_5_GBS		2
-#define IB_PATH_RECORD_RATE_10_GBS		3
-#define IB_PATH_RECORD_RATE_30_GBS		4
+#define IB_LINK_WIDTH_ACTIVE_1X        1
+#define IB_LINK_WIDTH_ACTIVE_4X        2
+#define IB_LINK_WIDTH_ACTIVE_12X       8
+#define IB_LINK_SPEED_ACTIVE_2_5       1
+#define IB_LINK_SPEED_ACTIVE_5         2
+#define IB_LINK_SPEED_ACTIVE_10        4
+
+/* following v1 ver1.2 p901 */
+#define IB_MAX_RATE                    10
+#define IB_PATH_RECORD_RATE_2_5_GBS    2
+#define IB_PATH_RECORD_RATE_10_GBS     3
+#define IB_PATH_RECORD_RATE_30_GBS     4
+#define IB_PATH_RECORD_RATE_5_GBS      5
+#define IB_PATH_RECORD_RATE_20_GBS     6
+#define IB_PATH_RECORD_RATE_40_GBS     7
+#define IB_PATH_RECORD_RATE_60_GBS     8
+#define IB_PATH_RECORD_RATE_80_GBS     9
+#define IB_PATH_RECORD_RATE_120_GBS    10
 
 /****f* IBA Base: Types/ib_port_info_compute_rate
 * NAME
@@ -4218,22 +4260,60 @@ static inline uint8_t
 ib_port_info_compute_rate(
 	IN		const	ib_port_info_t* const		p_pi )
 {
-	switch(p_pi->link_width_active)
-	{
-		case IB_LINK_WIDTH_ACTIVE_1X:
-			 return IB_PATH_RECORD_RATE_2_5_GBS;
-
-		case IB_LINK_WIDTH_ACTIVE_4X:
-			return IB_PATH_RECORD_RATE_10_GBS;
-
-		case IB_LINK_WIDTH_ACTIVE_12X:
-			return IB_PATH_RECORD_RATE_30_GBS;
-
-		default:
-			return IB_PATH_RECORD_RATE_2_5_GBS;
-	}
+  switch (ib_port_info_get_link_speed_active(p_pi))
+  {
+  case IB_LINK_SPEED_ACTIVE_2_5:
+    switch (p_pi->link_width_active)
+    {
+    case IB_LINK_WIDTH_ACTIVE_1X:
+      return IB_PATH_RECORD_RATE_2_5_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_4X:
+      return IB_PATH_RECORD_RATE_10_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_12X:
+      return IB_PATH_RECORD_RATE_30_GBS;
+      
+    default:
+      return IB_PATH_RECORD_RATE_2_5_GBS;
+    }
+    break;
+  case IB_LINK_SPEED_ACTIVE_5:
+    switch (p_pi->link_width_active)
+    {
+    case IB_LINK_WIDTH_ACTIVE_1X:
+      return IB_PATH_RECORD_RATE_5_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_4X:
+      return IB_PATH_RECORD_RATE_20_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_12X:
+      return IB_PATH_RECORD_RATE_60_GBS;
+      
+    default:
+      return IB_PATH_RECORD_RATE_5_GBS;
+    }
+    break;
+  case IB_LINK_SPEED_ACTIVE_10:
+    switch (p_pi->link_width_active)
+    {
+    case IB_LINK_WIDTH_ACTIVE_1X:
+      return IB_PATH_RECORD_RATE_10_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_4X:
+      return IB_PATH_RECORD_RATE_40_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_12X:
+      return IB_PATH_RECORD_RATE_120_GBS;
+      
+    default:
+      return IB_PATH_RECORD_RATE_10_GBS;
+    }
+    break;
+  default:
+    return IB_PATH_RECORD_RATE_2_5_GBS;
+  }
 }
-
 /*
 * PARAMETERS
 *	p_pi
@@ -4658,36 +4738,6 @@ ib_port_info_set_lmc(
 *
 * NOTES
 *
-* SEE ALSO
-*********/
-
-/****f* IBA Base: Types/ib_port_info_get_link_speed_active
-* NAME
-*	ib_port_info_get_link_speed_active
-*
-* DESCRIPTION
-*	Returns the Link Speed Active value assigned to this port.
-*
-* SYNOPSIS
-*/
-static inline uint8_t
-ib_port_info_get_link_speed_active(
-	IN		const	ib_port_info_t* const		p_pi )
-{
-  return( (uint8_t)((p_pi->link_speed &
-                     IB_PORT_LINK_SPEED_ACTIVE_MASK) >>
-                    IB_PORT_LINK_SPEED_SHIFT) );
-}
-/*
-* PARAMETERS
-*	p_pi
-*		[in] Pointer to a PortInfo attribute.
-*
-* RETURN VALUES
-*	Returns the link speed active value assigned to this port.
-*
-* NOTES
-*
 * SEE ALSO
 *********/
 




More information about the general mailing list