[ofa-general] [PATCH] osm: QoS - adding CPI:CapabilityMask2 and turning on QOS_SUPPORTED bit

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Mon Oct 15 15:42:36 PDT 2007


Adding ClassPortInfo:CapabilityMask2 field and turning
on OSM QoS capabiliry bit (OSM_CAP2_IS_QOS_SUPPORTED).

Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 infiniband-diags/src/saquery.c         |    6 +-
 opensm/include/iba/ib_types.h          |  137 +++++++++++++++++++++++++++++++-
 opensm/include/opensm/osm_base.h       |   12 +++
 opensm/opensm/osm_sa_class_port_info.c |    4 +-
 opensm/osmtest/osmtest.c               |   13 +++-
 5 files changed, 162 insertions(+), 10 deletions(-)

diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index a9a8da4..e17ec5a 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -262,7 +262,8 @@ print_class_port_info(ib_class_port_info_t *class_port_info)
 	       "\t\tBase version.............%d\n"
 	       "\t\tClass version............%d\n"
 	       "\t\tCapability mask..........0x%04X\n"
-	       "\t\tResponse time value......0x%08X\n"
+	       "\t\tCapability mask 2........0x%08X\n"
+	       "\t\tResponse time value......0x%02X\n"
 	       "\t\tRedirect GID.............0x%s\n"
 	       "\t\tRedirect TC/SL/FL........0x%08X\n"
 	       "\t\tRedirect LID.............0x%04X\n"
@@ -279,7 +280,8 @@ print_class_port_info(ib_class_port_info_t *class_port_info)
 	       class_port_info->base_ver,
 	       class_port_info->class_ver,
 	       cl_ntoh16(class_port_info->cap_mask),
-	       class_port_info->resp_time_val,
+	       ib_class_cap_mask2(class_port_info),
+	       ib_class_resp_time_val(class_port_info),
 	       sprint_gid(&(class_port_info->redir_gid), gid_str, GID_STR_LEN),
 	       cl_ntoh32(class_port_info->redir_tc_sl_fl),
 	       cl_ntoh16(class_port_info->redir_lid),
diff --git a/opensm/include/iba/ib_types.h b/opensm/include/iba/ib_types.h
index 0969755..e1785f1 100644
--- a/opensm/include/iba/ib_types.h
+++ b/opensm/include/iba/ib_types.h
@@ -3247,8 +3247,7 @@ typedef struct _ib_class_port_info {
 	uint8_t base_ver;
 	uint8_t class_ver;
 	ib_net16_t cap_mask;
-	uint8_t reserved[3];
-	uint8_t resp_time_val;
+	uint32_t cap_mask2_resp_time;
 	ib_gid_t redir_gid;
 	ib_net32_t redir_tc_sl_fl;
 	ib_net16_t redir_lid;
@@ -3275,8 +3274,9 @@ typedef struct _ib_class_port_info {
 *	cap_mask
 *		Supported capabilities of this management class.
 *
-*	resp_time_value
-*		Maximum expected response time.
+*	cap_mask2_resp_time
+*		Maximum expected response time and additional
+*		supported capabilities of this management class.
 *
 *	redr_gid
 *		GID to use for redirection, or zero
@@ -3322,6 +3322,135 @@ typedef struct _ib_class_port_info {
 *
 *********/

+/****f* IBA Base: Types/ib_class_set_resp_time_val
+* NAME
+*	ib_class_set_resp_time_val
+*
+* DESCRIPTION
+*	Set maximum expected responce time.
+*
+* SYNOPSIS
+*/
+static inline void OSM_API
+ib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi,
+			   IN const uint8_t val)
+{
+	p_cpi->cap_mask2_resp_time =
+	    (p_cpi->cap_mask2_resp_time & CL_HTON32(IB_CLASS_RESP_TIME_MASK)) |
+	    cl_hton32(val & IB_CLASS_RESP_TIME_MASK);
+}
+
+/*
+* PARAMETERS
+*	p_cpi
+*		[in] Pointer to the class port info object.
+*
+*	val
+*		[in] Responce time value to set.
+*
+* RETURN VALUES
+*	None
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_class_port_info_t
+*********/
+
+/****f* IBA Base: Types/ib_class_resp_time_val
+* NAME
+*	ib_class_resp_time_val
+*
+* DESCRIPTION
+*	Get responce time value.
+*
+* SYNOPSIS
+*/
+static inline uint8_t OSM_API
+ib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi)
+{
+	return (uint8_t)(cl_ntoh32(p_cpi->cap_mask2_resp_time) &
+			 IB_CLASS_RESP_TIME_MASK);
+}
+
+/*
+* PARAMETERS
+*	p_cpi
+*		[in] Pointer to the class port info object.
+*
+* RETURN VALUES
+*	Responce time value.
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_class_port_info_t
+*********/
+
+/****f* IBA Base: Types/ib_class_set_cap_mask_2
+* NAME
+*	ib_class_set_cap_mask_2
+*
+* DESCRIPTION
+*	Set ClassPortInfo:CapabilityMask2.
+*
+* SYNOPSIS
+*/
+static inline void OSM_API
+ib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi,
+		       IN const uint32_t cap_mask2)
+{
+	p_cpi->cap_mask2_resp_time = (p_cpi->cap_mask2_resp_time &
+		CL_HTON32(IB_CLASS_RESP_TIME_MASK)) |
+		cl_hton32(cap_mask2 << 5);
+}
+
+/*
+* PARAMETERS
+*	p_cpi
+*		[in] Pointer to the class port info object.
+*
+*	cap_mask_2
+*		[in] CapabilityMask2 value to set.
+*
+* RETURN VALUES
+*	None
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_class_port_info_t
+*********/
+
+/****f* IBA Base: Types/ib_class_cap_mask2
+* NAME
+*	ib_class_cap_mask2
+*
+* DESCRIPTION
+*	Get ClassPortInfo:CapabilityMask2.
+*
+* SYNOPSIS
+*/
+static inline uint32_t OSM_API
+ib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi)
+{
+	return (cl_ntoh32(p_cpi->cap_mask2_resp_time) >> 5);
+}
+
+/*
+* PARAMETERS
+*	p_cpi
+*		[in] Pointer to the class port info object.
+*
+* RETURN VALUES
+*	CapabilityMask2 of the ClassPortInfo.
+*
+* NOTES
+*
+* SEE ALSO
+*	ib_class_port_info_t
+*********/
+
 /****s* IBA Base: Types/ib_sm_info_t
 * NAME
 *	ib_sm_info_t
diff --git a/opensm/include/opensm/osm_base.h b/opensm/include/opensm/osm_base.h
index e635dcb..26ef067 100644
--- a/opensm/include/opensm/osm_base.h
+++ b/opensm/include/opensm/osm_base.h
@@ -661,6 +661,18 @@ typedef enum _osm_thread_state {
 #define OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED (1 << 13)
 /***********/

+/****d* OpenSM: Base/OSM_CAP2_IS_QOS_SUPPORTED
+* Name
+*	OSM_CAP2_IS_QOS_SUPPORTED
+*
+* DESCRIPTION
+*	QoS is supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_QOS_SUPPORTED (1 << 1)
+/***********/
+
 /****d* OpenSM: Base/osm_sm_state_t
 * NAME
 *	osm_sm_state_t
diff --git a/opensm/opensm/osm_sa_class_port_info.c b/opensm/opensm/osm_sa_class_port_info.c
index d5c9f82..96d8898 100644
--- a/opensm/opensm/osm_sa_class_port_info.c
+++ b/opensm/opensm/osm_sa_class_port_info.c
@@ -170,7 +170,7 @@ __osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
 		}
 	}
 	rtv += 8;
-	p_resp_cpi->resp_time_val = rtv;
+	ib_class_set_resp_time_val(p_resp_cpi, rtv);
 	p_resp_cpi->redir_gid = zero_gid;
 	p_resp_cpi->redir_tc_sl_fl = 0;
 	p_resp_cpi->redir_lid = 0;
@@ -209,6 +209,8 @@ __osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
 	p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
 	    OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED;
 #endif
+	ib_class_set_cap_mask2(p_resp_cpi, OSM_CAP2_IS_QOS_SUPPORTED);
+
 	if (p_rcv->p_subn->opt.no_multicast_option != TRUE)
 		p_resp_cpi->cap_mask |= OSM_CAP_IS_UD_MCAST_SUP;
 	p_resp_cpi->cap_mask = cl_hton16(p_resp_cpi->cap_mask);
diff --git a/opensm/osmtest/osmtest.c b/opensm/osmtest/osmtest.c
index 73933a3..de54f2d 100644
--- a/opensm/osmtest/osmtest.c
+++ b/opensm/osmtest/osmtest.c
@@ -713,10 +713,17 @@ ib_api_status_t osmtest_validate_sa_class_port_info(IN osmtest_t * const p_osmt)
 	    (ib_class_port_info_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_madp);

 	osm_log(&p_osmt->log, OSM_LOG_INFO,
-		"osmtest_validate_sa_class_port_info:\n-----------------------------\nSA Class Port Info:\n"
-		" base_ver:%u\n class_ver:%u\n cap_mask:0x%X\n resp_time_val:0x%X\n-----------------------------\n",
+		"osmtest_validate_sa_class_port_info:\n"
+		"-----------------------------\n"
+		"SA Class Port Info:\n"
+		" base_ver:%u\n"
+		" class_ver:%u\n"
+		" cap_mask:0x%X\n"
+		" cap_mask2:0x%X\n"
+		" resp_time_val:0x%X\n"
+		"-----------------------------\n",
 		p_cpi->base_ver, p_cpi->class_ver, cl_ntoh16(p_cpi->cap_mask),
-		p_cpi->resp_time_val);
+		ib_class_cap_mask2(p_cpi), ib_class_resp_time_val(p_cpi));

       Exit:
 #if 0
-- 
1.5.1.4




More information about the general mailing list