[PATCH] opensm: perfmgr, only set orig_lid when we have a valid port. Otherwise leave it as 0

2011-04-15 Thread Ira Weiny

Subject: [PATCH] opensm: perfmgr, only set orig_lid when we have a valid port.  
Otherwise leave it as 0


Signed-off-by: Ira Weiny wei...@llnl.gov
---
 opensm/osm_perfmgr.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c
index 6a1fa63..3e1575a 100644
--- a/opensm/osm_perfmgr.c
+++ b/opensm/osm_perfmgr.c
@@ -454,7 +454,9 @@ static void collect_guids(cl_map_item_t * p_map_item, void 
*context)
  ib_switch_info_is_enhanced_port0(node-sw-
   
switch_info));
for (port = mon_node-esp0 ? 0 : 1; port  num_ports; port++) {
-   mon_node-port[port].orig_lid = get_base_lid(node, 
port);
+   mon_node-port[port].orig_lid = 0;
+   if (osm_physp_is_valid(node-physp_table[port]))
+   mon_node-port[port].orig_lid = 
get_base_lid(node, port);
mon_node-port[port].valid = TRUE;
}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] opensm: fix strtoull error handling

2011-04-15 Thread Ira Weiny
Subject: [PATCH] opensm: fix strtoull error handling

The man page states that errno _may_ be returned when the string can not be
converted.  Check that the entire string was consumed otherwise assume this is
not a guid.

Signed-off-by: Ira Weiny wei...@llnl.gov
---
 opensm/osm_perfmgr.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c
index 3e1575a..1cbbb71 100644
--- a/opensm/osm_perfmgr.c
+++ b/opensm/osm_perfmgr.c
@@ -1419,8 +1419,9 @@ void osm_perfmgr_dump_counters(osm_perfmgr_t * pm, 
perfmgr_db_dump_t dump_type)
  ***/
 void osm_perfmgr_print_counters(osm_perfmgr_t * pm, char *nodename, FILE * fp)
 {
-   uint64_t guid = strtoull(nodename, NULL, 0);
-   if (guid == 0  errno)
+   char *end = NULL;
+   uint64_t guid = strtoull(nodename, end, 0);
+   if (nodename + strlen(nodename) != end)
perfmgr_db_print_by_name(pm-db, nodename, fp);
else
perfmgr_db_print_by_guid(pm-db, guid, fp);
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html