[ofa-general] [PATCH V2] Add ib_trap_str function to ib_types.h and use it in INFO prints of OpenSM

Ira Weiny weiny2 at llnl.gov
Wed Jul 23 08:03:39 PDT 2008


On Tue, 22 Jul 2008 21:06:40 -0400
"Hal Rosenstock" <hal.rosenstock at gmail.com> wrote:

> One nit below...
> 
> On Tue, Jul 22, 2008 at 8:28 PM, Ira Weiny <weiny2 at llnl.gov> wrote:
> > >From be896a92f5e78fc315b4dbfcb77e7d8f07612769 Mon Sep 17 00:00:00 2001
> > From: Ira K. Weiny <weiny2 at llnl.gov>
> > Date: Tue, 22 Jul 2008 16:31:36 -0700
> > Subject: [PATCH] Add ib_trap_str function to ib_types.h and use it in INFO prints of OpenSM
> >
> >

<snip>

> > +               case 144:
> > +                       return ("CapabilityMask, NodeDescriptor, Link [Width|Speed]
> 
>  ^^^^^^^^^^^
> 
>  Description
>  Enabled changed");
>

<snip>

I have always called it that?!?!?  I may never learn... V2 attached below.

Ira



>From 013a5027ac2f9ffd01569618aac14cecb54e5428 Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Tue, 22 Jul 2008 16:31:36 -0700
Subject: [PATCH] Add ib_trap_str function to ib_types.h and use it in INFO prints of OpenSM


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 opensm/include/iba/ib_types.h |   43 +++++++++++++++++++++++++++++++++++++++++
 opensm/opensm/osm_inform.c    |    3 +-
 opensm/opensm/osm_trap_rcv.c  |   10 +++++++-
 3 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/opensm/include/iba/ib_types.h b/opensm/include/iba/ib_types.h
index 09ec257..8d618f3 100644
--- a/opensm/include/iba/ib_types.h
+++ b/opensm/include/iba/ib_types.h
@@ -7219,6 +7219,49 @@ typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
 #define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002))
 #define TRAP_144_MASK_NODE_DESCRIPTION_CHANGE  (CL_HTON16(0x0001))
 
+static inline char * OSM_API
+ib_trap_str(uint16_t trap_num)
+{
+	switch(trap_num)
+	{
+		case 64:
+			return ("GID in service");
+		case 65:
+			return ("GID out of service");
+		case 66:
+			return ("New mcast group created");
+		case 67:
+			return ("Mcast group deleted");
+		case 68:
+			return ("UnPath, Path no longer valid");
+		case 69:
+			return ("RePath, Path recomputed");
+		case 128:
+			return ("Link state change");
+		case 129:
+			return ("Local Link integrity threshold reached");
+		case 130:
+			return ("Excessive Buffer Overrun Threshold reached");
+		case 131:
+			return ("Flow Control Update watchdog timer expired");
+		case 144:
+			return ("CapabilityMask, NodeDescription, Link [Width|Speed] Enabled changed");
+		case 145:
+			return ("System Image GUID changed");
+		case 256:
+			return ("Bad M_Key");
+		case 257:
+			return ("Bad P_Key");
+		case 258:
+			return ("Bad Q_Key");
+		case 259:
+			return ("Bad P_Key (switch external port)");
+		default:
+			break;
+	}
+	return ("Unknown");
+}
+
 /****f* IBA Base: Types/ib_notice_is_generic
 * NAME
 *	ib_notice_is_generic
diff --git a/opensm/opensm/osm_inform.c b/opensm/opensm/osm_inform.c
index e6146f7..77dad32 100644
--- a/opensm/opensm/osm_inform.c
+++ b/opensm/opensm/osm_inform.c
@@ -581,11 +581,12 @@ osm_report_notice(IN osm_log_t * const p_log,
 	/* an official Event information log */
 	if (ib_notice_is_generic(p_ntc)) {
 		OSM_LOG(p_log, OSM_LOG_INFO,
-			"Reporting Generic Notice type:%u num:%u"
+			"Reporting Generic Notice type:%u num:%u (%s)"
 			" from LID:%u GID:0x%016" PRIx64
 			",0x%016" PRIx64 "\n",
 			ib_notice_get_type(p_ntc),
 			cl_ntoh16(p_ntc->g_or_v.generic.trap_num),
+			ib_trap_str(cl_ntoh16(p_ntc->g_or_v.generic.trap_num)),
 			cl_ntoh16(p_ntc->issuer_lid),
 			cl_ntoh64(p_ntc->issuer_gid.unicast.prefix),
 			cl_ntoh64(p_ntc->issuer_gid.unicast.interface_id)
diff --git a/opensm/opensm/osm_trap_rcv.c b/opensm/opensm/osm_trap_rcv.c
index ae7ab05..bcb4260 100644
--- a/opensm/opensm/osm_trap_rcv.c
+++ b/opensm/opensm/osm_trap_rcv.c
@@ -327,11 +327,14 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 			    || (p_ntci->g_or_v.generic.trap_num ==
 				CL_HTON16(131)))
 				OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-					"Received Generic Notice type:0x%02X num:%u Producer:%u (%s) "
+					"Received Generic Notice type:0x%02X "
+					"num:%u (%s) Producer:%u (%s) "
 					"from LID:%u Port %d TID:0x%016"
 					PRIx64 "\n", ib_notice_get_type(p_ntci),
 					cl_ntoh16(p_ntci->g_or_v.generic.
 						  trap_num),
+					ib_trap_str(cl_ntoh16(p_ntci->g_or_v.generic.
+						  trap_num)),
 					cl_ntoh32(ib_notice_get_prod_type
 						  (p_ntci)),
 					ib_get_producer_type_str
@@ -342,11 +345,14 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
 				    );
 			else
 				OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-					"Received Generic Notice type:0x%02X num:%u Producer:%u (%s) "
+					"Received Generic Notice type:0x%02X "
+					"num:%u (%s) Producer:%u (%s) "
 					"from LID:%u TID:0x%016" PRIx64
 					"\n", ib_notice_get_type(p_ntci),
 					cl_ntoh16(p_ntci->g_or_v.generic.
 						  trap_num),
+					ib_trap_str(cl_ntoh16(p_ntci->g_or_v.generic.
+						  trap_num)),
 					cl_ntoh32(ib_notice_get_prod_type
 						  (p_ntci)),
 					ib_get_producer_type_str
-- 
1.5.4.5




More information about the general mailing list