From patchwork Wed Jan 13 15:34:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eli Dorfman (Voltaire)" X-Patchwork-Id: 72657 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0DFNTnA000343 for ; Wed, 13 Jan 2010 15:23:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755579Ab0AMPXT (ORCPT ); Wed, 13 Jan 2010 10:23:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755488Ab0AMPXT (ORCPT ); Wed, 13 Jan 2010 10:23:19 -0500 Received: from fwil.voltaire.com ([193.47.165.2]:59231 "EHLO exil.voltaire.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932105Ab0AMPXR (ORCPT ); Wed, 13 Jan 2010 10:23:17 -0500 Received: from [172.25.1.69] ([172.25.1.69]) by exil.voltaire.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 13 Jan 2010 17:23:14 +0200 Message-ID: <4B4DE7F5.3020407@gmail.com> Date: Wed, 13 Jan 2010 17:34:13 +0200 From: "Eli Dorfman (Voltaire)" User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: Sasha Khapyorsky CC: linux-rdma , Ira Weiny Subject: [PATCH v2] opensm: Add update_desc command to opensm console References: <4B4C3386.5040205@gmail.com> <20100112121423.GA574@me> In-Reply-To: <20100112121423.GA574@me> X-OriginalArrivalTime: 13 Jan 2010 15:23:14.0080 (UTC) FILETIME=[52D4D200:01CA9464] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c index 206e7f7..e90cb99 100644 --- a/opensm/opensm/osm_console.c +++ b/opensm/opensm/osm_console.c @@ -56,6 +56,8 @@ #include #include +extern void osm_update_node_desc(IN osm_sm_t *sm); + struct command { char *name; void (*help_function) (FILE * out, int detail); @@ -207,6 +209,14 @@ static void help_dump_conf(FILE *out, int detail) } } +static void help_update_desc(FILE *out, int detail) +{ + fprintf(out, "update_desc\n"); + if (detail) { + fprintf(out, "update node description for all nodes\n"); + } +} + #ifdef ENABLE_OSM_PERF_MGR static void help_perfmgr(FILE * out, int detail) { @@ -1134,6 +1144,11 @@ static void dump_conf_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) osm_subn_output_conf(out, &p_osm->subn.opt); } +static void update_desc_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) +{ + osm_update_node_desc(&p_osm->sm); +} + #ifdef ENABLE_OSM_PERF_MGR static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) { @@ -1326,6 +1341,7 @@ static const struct command console_cmds[] = { {"switchbalance", &help_switchbalance, &switchbalance_parse}, {"lidbalance", &help_lidbalance, &lidbalance_parse}, {"dump_conf", &help_dump_conf, &dump_conf_parse}, + {"update_desc", &help_update_desc, &update_desc_parse}, {"version", &help_version, &version_parse}, #ifdef ENABLE_OSM_PERF_MGR {"perfmgr", &help_perfmgr, &perfmgr_parse}, diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c index 6296f21..86aaff2 100644 --- a/opensm/opensm/osm_state_mgr.c +++ b/opensm/opensm/osm_state_mgr.c @@ -510,11 +510,7 @@ static void query_sm_info(cl_map_item_t * item, void *cxt) ib_get_err_str(ret)); } -/********************************************************************** - During a light sweep, check each node to see if the node description - is valid and if not issue a ND query. -**********************************************************************/ -static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context) +static void state_mgr_update_node_desc(IN cl_map_item_t * obj, IN void *context) { osm_madw_context_t mad_context; osm_node_t *p_node = (osm_node_t *) obj; @@ -527,14 +523,8 @@ static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context) CL_ASSERT(p_node); - if (p_node->print_desc - && strcmp(p_node->print_desc, OSM_NODE_DESC_UNKNOWN)) - /* if ND is valid, do nothing */ - goto exit; - - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "ERR 3319: Unknown node description for node GUID " - "0x%016" PRIx64 ". Reissuing ND query\n", + OSM_LOG(sm->p_log, OSM_LOG_DEBUG, + "Updating NodeDesc for 0x%016" PRIx64 "\n", cl_ntoh64(osm_node_get_node_guid(p_node))); /* get a physp to request from. */ @@ -563,6 +553,43 @@ exit: OSM_LOG_EXIT(sm->p_log); } +void osm_update_node_desc(IN osm_sm_t *sm) +{ + CL_PLOCK_ACQUIRE(sm->p_lock); + cl_qmap_apply_func(&sm->p_subn->node_guid_tbl, state_mgr_update_node_desc, + sm); + CL_PLOCK_RELEASE(sm->p_lock); +} + +/********************************************************************** + During a light sweep, check each node to see if the node description + is valid and if not issue a ND query. +**********************************************************************/ +static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context) +{ + osm_node_t *p_node = (osm_node_t *) obj; + osm_sm_t *sm = context; + + OSM_LOG_ENTER(sm->p_log); + + CL_ASSERT(p_node); + + if (p_node->print_desc + && strcmp(p_node->print_desc, OSM_NODE_DESC_UNKNOWN)) + /* if ND is valid, do nothing */ + goto exit; + + OSM_LOG(sm->p_log, OSM_LOG_ERROR, + "ERR 3319: Unknown node description for node GUID " + "0x%016" PRIx64 ". Reissuing ND query\n", + cl_ntoh64(osm_node_get_node_guid(p_node))); + + state_mgr_update_node_desc(obj, context); + +exit: + OSM_LOG_EXIT(sm->p_log); +} + /********************************************************************** Initiates a lightweight sweep of the subnet. Used during normal sweeps after the subnet is up.