[ofa-general] [PATCH v2] Add a Node Description check on light sweep to ensure that the ND has been found for each node.
Hal Rosenstock
hal.rosenstock at gmail.com
Fri Aug 8 05:58:15 PDT 2008
On Thu, Aug 7, 2008 at 5:53 PM, Ira Weiny <weiny2 at llnl.gov> wrote:
> >From 123a950a8bf0fc43331a1e715f0cdd756529437c Mon Sep 17 00:00:00 2001
> From: Ira K. Weiny <weiny2 at llnl.gov>
> Date: Wed, 30 Jul 2008 17:28:30 -0700
> Subject: [PATCH] Add a Node Description check on light sweep to ensure that the ND has been
> found for each node. This case covers the condition where a ND message is
> dropped/lost for some reason and OpenSM is left with a valid configured node
> which is not named correctly.
>
> This is not the same as a node which has changed it's Node Descriptioin. In
> this case the node needs to send a trap.
Nit below.
>
> Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
> ---
> opensm/include/opensm/osm_base.h | 11 ++++++++
> opensm/opensm/osm_node.c | 2 +-
> opensm/opensm/osm_state_mgr.c | 53 ++++++++++++++++++++++++++++++++++++++
> 3 files changed, 65 insertions(+), 1 deletions(-)
>
> diff --git a/opensm/include/opensm/osm_base.h b/opensm/include/opensm/osm_base.h
> index 3793804..2e8def7 100644
> --- a/opensm/include/opensm/osm_base.h
> +++ b/opensm/include/opensm/osm_base.h
> @@ -640,6 +640,17 @@ BEGIN_C_DECLS
> */
> #define OSM_NO_PATH 0xFF
> /**********/
> +/****d* OpenSM: Base/OSM_NODE_DESC_UNKNOWN
> +* NAME
> +* OSM_NODE_DESC_UNKNOWN
> +*
> +* DESCRIPTION
> +* Value indicating the Node Description is not set and is "unknown"
> +*
> +* SYNOPSIS
> +*/
> +#define OSM_NODE_DESC_UNKNOWN "<unknown>"
> +/**********/
> /****d* OpenSM: Base/osm_thread_state_t
> * NAME
> * osm_thread_state_t
> diff --git a/opensm/opensm/osm_node.c b/opensm/opensm/osm_node.c
> index d99c656..123feb8 100644
> --- a/opensm/opensm/osm_node.c
> +++ b/opensm/opensm/osm_node.c
> @@ -136,7 +136,7 @@ osm_node_t *osm_node_new(IN const osm_madw_t * const p_madw)
> osm_node_init_physp(p_node, p_madw);
> if (p_ni->node_type == IB_NODE_TYPE_SWITCH)
> node_init_physp0(p_node, p_madw);
> - p_node->print_desc = strdup("<unknown>");
> + p_node->print_desc = strdup(OSM_NODE_DESC_UNKNOWN);
>
> return (p_node);
> }
> diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
> index 3cdb2cf..ef4bddd 100644
> --- a/opensm/opensm/osm_state_mgr.c
> +++ b/opensm/opensm/osm_state_mgr.c
> @@ -516,6 +516,53 @@ static void query_sm_info(cl_map_item_t *item, void *cxt)
> }
>
> /**********************************************************************
> + During a light sweep check each node to see if the node descriptor is valid
> + if not issue a ND query.
> +**********************************************************************/
> +static void __osm_state_mgr_get_node_desc(IN cl_map_item_t * const p_object,
> + IN void *context)
> +{
> + osm_physp_t *p_physp = NULL;
> + osm_node_t *const p_node = (osm_node_t *) p_object;
> + ib_api_status_t status = IB_SUCCESS;
> + osm_madw_context_t mad_context;
> + osm_sm_t *sm = (osm_sm_t *)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 3314: Unknown node description \"%s\" for node "
> + "0x%016" PRIx64 ". Reissuing ND query\n",
> + p_node->print_desc ? p_node->print_desc : OSM_NODE_DESC_UNKNOWN,
> + cl_ntoh64(osm_node_get_node_guid (p_node)));
> +
> + /* get a physp to request from. */
> + p_physp = osm_node_get_any_physp_ptr(p_node);
> +
> + mad_context.nd_context.node_guid = osm_node_get_node_guid(p_node);
> +
> + status = osm_req_get(sm,
> + osm_physp_get_dr_path_ptr(p_physp),
> + IB_MAD_ATTR_NODE_DESC,
> + 0, CL_DISP_MSGID_NONE, &mad_context);
> + if (status != IB_SUCCESS)
> + OSM_LOG(sm->p_log, OSM_LOG_ERROR,
> + "__osm_state_mgr_get_node_desc: ERR 3315: "
> + "Failure initiating NodeDescription request (%s)\n",
> + ib_get_err_str(status));
Aren't error codes 3314 and 3315 already taken ?
-- Hal
> +
> +exit:
> + OSM_LOG_EXIT(sm->p_log);
> +}
> +
> +
> +/**********************************************************************
> Initiates a lightweight sweep of the subnet.
> Used during normal sweeps after the subnet is up.
> **********************************************************************/
> @@ -524,6 +571,7 @@ static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
> ib_api_status_t status = IB_SUCCESS;
> osm_bind_handle_t h_bind;
> cl_qmap_t *p_sw_tbl;
> + cl_qmap_t *p_node_tbl;
> cl_map_item_t *p_next;
> osm_node_t *p_node;
> osm_physp_t *p_physp;
> @@ -532,6 +580,7 @@ static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
> OSM_LOG_ENTER(sm->p_log);
>
> p_sw_tbl = &sm->p_subn->sw_guid_tbl;
> + p_node_tbl = &sm->p_subn->node_guid_tbl;
>
> /*
> * First, get the bind handle.
> @@ -550,6 +599,10 @@ static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
> cl_qmap_apply_func(p_sw_tbl, __osm_state_mgr_get_sw_info, sm);
> CL_PLOCK_RELEASE(sm->p_lock);
>
> + CL_PLOCK_ACQUIRE(sm->p_lock);
> + cl_qmap_apply_func(p_node_tbl, __osm_state_mgr_get_node_desc, sm);
> + CL_PLOCK_RELEASE(sm->p_lock);
> +
> /* now scan the list of physical ports that were not down but have no remote port */
> CL_PLOCK_ACQUIRE(sm->p_lock);
> p_next = cl_qmap_head(&sm->p_subn->node_guid_tbl);
> --
> 1.5.4.5
>
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
>
More information about the general
mailing list