[ofa-general] [PATCH] NOT For inclusion in master: Simple example of mad_fprintf in action.

Ira Weiny weiny2 at llnl.gov
Wed Mar 11 14:44:06 PDT 2009


Just an example of the use of mad_fprintf I don't think this needs to go into master.

Ira


From: Ira Weiny <weiny2 at llnl.gov>
Date: Wed, 11 Mar 2009 10:46:59 -0700
Subject: [PATCH] Simple example of mad_fprintf in action.


Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/src/ibnetdiscover.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c
index 25c1f7f..e61f59d 100644
--- a/infiniband-diags/src/ibnetdiscover.c
+++ b/infiniband-diags/src/ibnetdiscover.c
@@ -186,6 +186,23 @@ get_node(Node *node, Port *port, ib_portid_t *portid)
 		return -1;
 	decode_port_info(pi, port);
 
+	if (ibdebug || ibverbose)
+		mad_fprintf(stdout, pi, "Port info (%s):\n"
+			"   %-10s: %F\n"
+			"   %-10s: %F\n"
+			"   %-10s: %F\n"
+			"   %-10s: %F\n"
+			"   %-10s: %F\n"
+			"   %-10s: %F\n",
+			portid2str(portid),
+			"LID", IB_PORT_LID_F,
+			"LMC", IB_PORT_LMC_F,
+			"state", IB_PORT_STATE_F,
+			"physstate", IB_PORT_PHYS_STATE_F,
+			"linkwidth", IB_PORT_LINK_WIDTH_ACTIVE_F,
+			"linkspeed", IB_PORT_LINK_SPEED_ACTIVE_F
+			);
+
 	if (node->type != SWITCH_NODE)
 		return 0;
 
-- 
1.5.4.5




More information about the general mailing list