[openib-general] [PATCHv2] OpenSM: Fix osm_vendor_send for GSI classes

Hal Rosenstock halr at voltaire.com
Wed Apr 5 05:54:59 PDT 2006


Hi Yael,

Below is a slightly modified version of the previous patch. It is a
complete fix for the problem you identified. Let me know if
this works for you and I will check it into both the trunk and 1.0
branch.

Thanks.

-- Hal

OpenSM: Fix osm_vendor_send for GSI classes

Currently, the default for GSI classes assumes RMPP. There are two
groups of GSI classes: those which support RMPP and those which don't.
This patch handles them properly in osm_vendor_send.

Problem pointed out by Yael Kalka <yael at mellanox.co.il>

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: include/iba/ib_types.h
===================================================================
--- include/iba/ib_types.h	(revision 6219)
+++ include/iba/ib_types.h	(working copy)
@@ -515,6 +515,30 @@ BEGIN_C_DECLS
 #define IB_MCLASS_VENDOR_LOW_RANGE_MAX 0x0f
 /**********/
 
+/****d* IBA Base: Constants/IB_MCLASS_DEV_ADM
+* NAME
+*	IB_MCLASS_DEV_ADM
+*
+* DESCRIPTION
+*	Subnet Management Class, Device Administration
+*
+* SOURCE
+*/
+#define IB_MCLASS_DEV_ADM 0x10
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_BIS
+* NAME
+*	IB_MCLASS_BIS
+*
+* DESCRIPTION
+*	Subnet Management Class, BIS
+*
+* SOURCE
+*/
+#define IB_MCLASS_BIS 0x12
+/**********/
+
 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN
 * NAME
 *	IB_MCLASS_VENDOR_HIGH_RANGE_MIN
@@ -544,7 +568,7 @@ BEGIN_C_DECLS
 *	ib_class_is_vendor_specific_low
 *
 * DESCRIPTION
-*	Indicitates if the Class Code if a vendor specific class from 
+*	Indicates if the Class Code if a vendor specific class from 
 *  the low range
 *
 * SYNOPSIS
@@ -576,7 +600,7 @@ ib_class_is_vendor_specific_low(
 *	ib_class_is_vendor_specific_high
 *
 * DESCRIPTION
-*	Indicitates if the Class Code if a vendor specific class from 
+*	Indicates if the Class Code if a vendor specific class from 
 *  the high range
 *
 * SYNOPSIS
@@ -609,7 +633,7 @@ ib_class_is_vendor_specific_high(
 *	ib_class_is_vendor_specific
 *
 * DESCRIPTION
-*	Indicitates if the Class Code if a vendor specific class
+*	Indicates if the Class Code if a vendor specific class
 *
 * SYNOPSIS
 */
@@ -635,6 +659,38 @@ ib_class_is_vendor_specific(
 *  ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high
 *********/
 
+/****f* IBA Base: Types/ib_class_is_rmpp
+* NAME
+*	ib_class_is_rmpp
+*
+* DESCRIPTION
+*	Indicates if the Class Code supports RMPP
+*
+* SYNOPSIS
+*/
+static inline boolean_t
+ib_class_is_rmpp(
+        IN              const   uint8_t class_code )
+{
+	return( (class_code == IB_MCLASS_SUBN_ADM) ||
+		(class_code == IB_MCLASS_DEV_MGMT) ||
+		(class_code == IB_MCLASS_DEV_ADM) ||
+		(class_code == IB_MCLASS_BIS) ||
+		ib_class_is_vendor_specific_high( class_code ) ); 
+}
+/*
+* PARAMETERS
+*	class_code
+*		[in] The Management Datagram Class Code
+*
+* RETURN VALUE
+*	TRUE if the class supports RMPP
+*	FALSE otherwise.
+*
+* NOTES
+*
+*********/
+
 /*
  *	MAD methods
  */
@@ -1811,7 +1867,7 @@ ib_pkey_get_base(
 *	ib_pkey_is_full_member
 *
 * DESCRIPTION
-*	Indicitates if the port is a full member of the parition.
+*	Indicates if the port is a full member of the parition.
 *
 * SYNOPSIS
 */
Index: libvendor/osm_vendor_ibumad.c
===================================================================
--- libvendor/osm_vendor_ibumad.c	(revision 6219)
+++ libvendor/osm_vendor_ibumad.c	(working copy)
@@ -1044,16 +1044,17 @@ osm_vendor_send(
 	CL_ASSERT( p_vw->h_bind == h_bind );
 	CL_ASSERT( p_mad == umad_get_mad(p_vw->umad) );
 
-	switch (p_mad->mgmt_class) {
-	case IB_MCLASS_SUBN_DIR:
+	if (p_mad->mgmt_class == IB_MCLASS_SUBN_DIR) {
 		umad_set_addr_net(p_vw->umad, 0xffff, 0, 0, 0);
 		umad_set_grh(p_vw->umad, 0);
-		break;
-	case IB_MCLASS_SUBN_LID:
+		goto Resp;
+	}
+	if (p_mad->mgmt_class == IB_MCLASS_SUBN_LID) {
 		umad_set_addr_net(p_vw->umad, p_mad_addr->dest_lid, 0, 0, 0);
 		umad_set_grh(p_vw->umad, 0);
-		break;
-	default:	/* GSI		FIXME: no GRH */
+		goto Resp;
+	}
+	if (ib_class_is_rmpp(p_mad->mgmt_class)) {	/* RMPP GSI classes	FIXME: no GRH */
 		umad_set_addr_net(p_vw->umad, p_mad_addr->dest_lid,
 				  p_mad_addr->addr_type.gsi.remote_qp,
 				  p_mad_addr->addr_type.gsi.service_level,
@@ -1086,9 +1087,16 @@ osm_vendor_send(
 			p_sa->paylen_newwin = cl_ntoh32(paylen);
 		}
 #endif
-		break;
+	} else {	/* non RMPP GSI classes 	FIXME: no GRH */
+		umad_set_addr_net(p_vw->umad, p_mad_addr->dest_lid,
+				  p_mad_addr->addr_type.gsi.remote_qp,
+				  p_mad_addr->addr_type.gsi.service_level,
+				  IB_QP1_WELL_KNOWN_Q_KEY);
+		umad_set_grh(p_vw->umad, 0);    /* FIXME: GRH support */
+		umad_set_pkey(p_vw->umad, p_mad_addr->addr_type.gsi.pkey);
 	}
 
+Resp:
 	if (resp_expected)
 		put_madw(p_vend, p_madw, &p_mad->trans_id);
 






More information about the general mailing list