All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] opensm/perfmgr: update node name when Node Description is received from node
@ 2013-02-19 23:06 Ira Weiny
       [not found] ` <20130219150634.1afa3d6c2976cad4b2e28a91-i2BcT+NCU+M@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Ira Weiny @ 2013-02-19 23:06 UTC (permalink / raw)
  To: Hal Rosenstock; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org


Changes since V1:
	Fix use of parens nit from Hal

Signed-off-by: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
---
 include/opensm/osm_perfmgr.h    |    2 ++
 include/opensm/osm_perfmgr_db.h |    3 +++
 opensm/osm_node_desc_rcv.c      |    7 +++++++
 opensm/osm_perfmgr.c            |    6 ++++++
 opensm/osm_perfmgr_db.c         |   13 +++++++++++++
 5 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/include/opensm/osm_perfmgr.h b/include/opensm/osm_perfmgr.h
index 97fead1..26b1ae6 100644
--- a/include/opensm/osm_perfmgr.h
+++ b/include/opensm/osm_perfmgr.h
@@ -247,6 +247,8 @@ void osm_perfmgr_dump_counters(osm_perfmgr_t * p_perfmgr,
 			       perfmgr_db_dump_t dump_type);
 void osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename, FILE *fp,
 				char *port, int err_only);
+void osm_perfmgr_update_nodename(osm_perfmgr_t *pm, uint64_t node_guid,
+				char *nodename);
 
 ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * p_perfmgr,
 				 ib_net64_t port_guid);
diff --git a/include/opensm/osm_perfmgr_db.h b/include/opensm/osm_perfmgr_db.h
index 6333692..5491d2f 100644
--- a/include/opensm/osm_perfmgr_db.h
+++ b/include/opensm/osm_perfmgr_db.h
@@ -164,6 +164,9 @@ perfmgr_db_err_t perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid,
 perfmgr_db_err_t perfmgr_db_delete_entry(perfmgr_db_t * db, uint64_t guid);
 perfmgr_db_err_t perfmgr_db_delete_inactive(perfmgr_db_t * db, unsigned *cnt);
 
+perfmgr_db_err_t perfmgr_db_update_name(perfmgr_db_t * db, uint64_t node_guid,
+					char *name);
+
 perfmgr_db_err_t perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid,
 					    uint8_t port,
 					    perfmgr_db_err_reading_t * reading);
diff --git a/opensm/osm_node_desc_rcv.c b/opensm/osm_node_desc_rcv.c
index 741c944..065909b 100644
--- a/opensm/osm_node_desc_rcv.c
+++ b/opensm/osm_node_desc_rcv.c
@@ -79,6 +79,13 @@ static void nd_rcv_process_nd(IN osm_sm_t * sm, IN osm_node_t * p_node,
 		free(p_node->print_desc);
 	p_node->print_desc = tmp_desc;
 
+#ifdef ENABLE_OSM_PERF_MGR
+	/* update the perfmgr entry if available */
+	osm_perfmgr_update_nodename(&sm->p_subn->p_osm->perfmgr,
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				p_node->print_desc);
+#endif				/* ENABLE_OSM_PERF_MGR */
+
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 		"Node 0x%" PRIx64 "\n\t\t\t\tDescription = %s\n",
 		cl_ntoh64(osm_node_get_node_guid(p_node)), p_node->print_desc);
diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c
index 5207245..9bc1154 100644
--- a/opensm/osm_perfmgr.c
+++ b/opensm/osm_perfmgr.c
@@ -1459,4 +1459,10 @@ void osm_perfmgr_print_counters(osm_perfmgr_t * pm, char *nodename, FILE * fp,
 	} else
 		perfmgr_db_print_all(pm->db, fp, err_only);
 }
+void osm_perfmgr_update_nodename(osm_perfmgr_t *pm, uint64_t node_guid,
+				char *nodename)
+{
+	if (pm->db)
+		perfmgr_db_update_name(pm->db, node_guid, nodename);
+}
 #endif				/* ENABLE_OSM_PERF_MGR */
diff --git a/opensm/osm_perfmgr_db.c b/opensm/osm_perfmgr_db.c
index 6095e1a..238081b 100644
--- a/opensm/osm_perfmgr_db.c
+++ b/opensm/osm_perfmgr_db.c
@@ -197,6 +197,19 @@ Exit:
 }
 
 perfmgr_db_err_t
+perfmgr_db_update_name(perfmgr_db_t * db, uint64_t node_guid, char *name)
+{
+	db_node_t *node = NULL;
+
+	cl_plock_excl_acquire(&db->lock);
+	node = get(db, node_guid);
+	if (node)
+		snprintf(node->node_name, sizeof(node->node_name), "%s", name);
+	cl_plock_release(&db->lock);
+	return (PERFMGR_EVENT_DB_SUCCESS);
+}
+
+perfmgr_db_err_t
 perfmgr_db_delete_entry(perfmgr_db_t * db, uint64_t guid)
 {
 	cl_map_item_t * rc = cl_qmap_remove(&db->pc_data, guid);
-- 
1.7.1

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-21 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19 23:06 [PATCH V2] opensm/perfmgr: update node name when Node Description is received from node Ira Weiny
     [not found] ` <20130219150634.1afa3d6c2976cad4b2e28a91-i2BcT+NCU+M@public.gmane.org>
2013-02-21 15:27   ` Hal Rosenstock

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.