From patchwork Wed Feb 13 21:50:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 2139611 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2D36A3FCA4 for ; Wed, 13 Feb 2013 21:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760865Ab3BMVuj (ORCPT ); Wed, 13 Feb 2013 16:50:39 -0500 Received: from prdiron-1.llnl.gov ([128.15.143.171]:60474 "EHLO prdiron-1.llnl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760837Ab3BMVui (ORCPT ); Wed, 13 Feb 2013 16:50:38 -0500 X-Attachments: Received: from eris.llnl.gov (HELO trebuchet.chaos) ([128.115.7.7]) by prdiron-1.llnl.gov with SMTP; 13 Feb 2013 13:50:38 -0800 Date: Wed, 13 Feb 2013 13:50:37 -0800 From: Ira Weiny To: Hal Rosenstock Cc: "linux-rdma@vger.kernel.org" Subject: Subject: [PATCH] opensm/perfmgr: update node name when Node Description is received from node Message-Id: <20130213135037.b6ba879a9e3c3c65ed3d9673@llnl.gov> X-Mailer: Sylpheed 3.3.0 (GTK+ 2.18.9; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Signed-off-by: Ira Weiny --- 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..ff1b05e 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);