[ofa-general] [PATCH 3/3] opensm/opensm/osm_trap_rcv.c: respond to new trap 144 node descriptor update flag

Hal Rosenstock hrosenstock at xsigo.com
Fri Mar 21 06:52:19 PDT 2008


On Thu, 2008-03-20 at 18:13 -0700, Ira Weiny wrote:
> >From 99c54c9d5dead4098a0f0660d235a845300b1868 Mon Sep 17 00:00:00 2001
> From: Ira K. Weiny <weiny2 at llnl.gov>
> Date: Thu, 20 Mar 2008 17:59:01 -0700
> Subject: [PATCH] opensm/opensm/osm_trap_rcv.c: respond to new trap 144 node descriptor update
> flag

Some minor stylistic comments below.

> Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
> ---
>  opensm/opensm/osm_node_info_rcv.c |   40 +++++++++++++++++++++++++-----------
>  opensm/opensm/osm_trap_rcv.c      |   22 ++++++++++++++++++++
>  2 files changed, 50 insertions(+), 12 deletions(-)
> 
> diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
> index 9b2c74c..6818e05 100644
> --- a/opensm/opensm/osm_node_info_rcv.c
> +++ b/opensm/opensm/osm_node_info_rcv.c
> @@ -306,17 +306,41 @@ __osm_ni_rcv_process_new_node(IN osm_sm_t * sm,
>  /**********************************************************************
>   The plock must be held before calling this function.
>  **********************************************************************/
> +void
> +osm_req_get_node_desc(IN osm_sm_t * sm,
> +			osm_physp_t *p_physp)
> +{
> +	ib_api_status_t status = IB_SUCCESS;
> +	osm_madw_context_t context;
> +
> +	OSM_LOG_ENTER(sm->p_log);
> +
> +	context.nd_context.node_guid =
> +		osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));
> +
> +	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
> +			     IB_MAD_ATTR_NODE_DESC,
> +			     0, CL_DISP_MSGID_NONE, &context);
> +	if (status != IB_SUCCESS)
> +		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D03: "
> +			"Failure initiating NodeDescription request (%s)\n",
> +			ib_get_err_str(status));
> +
> +	OSM_LOG_EXIT(sm->p_log);
> +}
> +
> +/**********************************************************************
> + The plock must be held before calling this function.
> +**********************************************************************/
>  static void
>  __osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
>  			   IN osm_node_t * const p_node,
>  			   IN const osm_madw_t * const p_madw)
>  {
> -	ib_api_status_t status = IB_SUCCESS;
> -	osm_madw_context_t context;
> -	osm_physp_t *p_physp;
>  	ib_node_info_t *p_ni;
>  	ib_smp_t *p_smp;
>  	uint8_t port_num;
> +	osm_physp_t *p_physp = NULL;
>  
>  	OSM_LOG_ENTER(sm->p_log);
>  
> @@ -334,15 +358,7 @@ __osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
>  	 */
>  	p_physp = osm_node_get_physp_ptr(p_node, port_num);
>  
> -	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, &context);
> -	if (status != IB_SUCCESS)
> -		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D03: "
> -			"Failure initiating NodeDescription request (%s)\n",
> -			ib_get_err_str(status));
> +	osm_req_get_node_desc(sm, p_physp);
>  
>  	OSM_LOG_EXIT(sm->p_log);
>  }
> diff --git a/opensm/opensm/osm_trap_rcv.c b/opensm/opensm/osm_trap_rcv.c
> index 5cf5a21..7453929 100644
> --- a/opensm/opensm/osm_trap_rcv.c
> +++ b/opensm/opensm/osm_trap_rcv.c
> @@ -61,6 +61,8 @@
>  #include <opensm/osm_inform.h>
>  #include <opensm/osm_opensm.h>
>  
> +extern void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t *p_physp);

Shouldn't this be added to the osm_node_desc_rcv.h header and that
header included in osm_trap_rcv.c ?

> +
>  /**********************************************************************
>   *
>   * TRAP HANDLING:
> @@ -577,6 +579,26 @@ __osm_trap_rcv_process_request(IN osm_sm_t * sm,
>  		}
>  	}
>  
> +	/* Check for node descriptor update. IB Spec v1.2.1 pg 823*/
> +	if ((p_ntci->data_details.ntc_144.local_changes & TRAP_144_MASK_OTHER_LOCAL_CHANGES) &&
> +		(p_ntci->data_details.ntc_144.change_flgs & TRAP_144_MASK_NODE_DESCRIPTION_CHANGE)
> +		) {
> +
> +		osm_node_t *p_node = NULL;
> +
> +		OSM_LOG(sm->p_log, OSM_LOG_INFO, "Trap 144 Node descriptor update\n");
                                                                          
Node description r.t. Node descriptor

> +		if (p_physp) {
> +			CL_PLOCK_ACQUIRE(sm->p_lock);
> +			osm_req_get_node_desc(sm, p_physp);
> +			CL_PLOCK_RELEASE(sm->p_lock);
> +		} else {
> +			OSM_LOG(sm->p_log, OSM_LOG_ERROR,
> +				"ERR 3812: No physical port found for "
> +				"trap 144: \"node descriptor update\"\n");

Node description r.t. node descriptor

> +		}
> +	}
> +
>  	/* do a sweep if we received a trap */
>  	if (sm->p_subn->opt.sweep_on_trap) {
>  		/* if this is trap number 128 or run_heavy_sweep is TRUE - update the
> -- 
> 1.5.1
> _______________________________________________
> 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