[ofa-general] ***SPAM*** Re: [PATCH] opensm: Eliminate duplicated calls to osm_log_is_active in SA modules

Sasha Khapyorsky sashak at voltaire.com
Sat Apr 18 23:14:41 PDT 2009


Hi Hal,

On 11:26 Fri 17 Apr     , Hal Rosenstock wrote:
> 
> Helper routines call this routine

Right, but I leave this code as is during OSM_LOG() speed up reworking,
for the same performance reasons - without function calls it was faster
in non-debug mode (I measured then).

I agree that duplicated checks are someting ugly. Probably replcing
osm_dump_*() functions by macros could solve this somehow.

BTW OSM_LOG() has double check too - one in macro and another one
inside osm_log() function.

Sasha

> 
> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
> ---
> diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
> index 3521132..202a38e 100644
> --- a/opensm/opensm/osm_sa.c
> +++ b/opensm/opensm/osm_sa.c
> @@ -388,9 +388,7 @@ osm_sa_send_error(IN osm_sa_t * sa,
>  	if (p_resp_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD)
>  		p_resp_sa_mad->attr_id = IB_MAD_ATTR_PATH_RECORD;
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
> -		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
> -
> +	osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
>  	osm_sa_send(sa, p_resp_madw, FALSE);
>  
>  Exit:
> diff --git a/opensm/opensm/osm_sa_class_port_info.c b/opensm/opensm/osm_sa_class_port_info.c
> index d2ab96a..7ad08ef 100644
> --- a/opensm/opensm/osm_sa_class_port_info.c
> +++ b/opensm/opensm/osm_sa_class_port_info.c
> @@ -165,8 +165,7 @@ static void cpi_rcv_respond(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)
>  		p_resp_cpi->cap_mask |= OSM_CAP_IS_UD_MCAST_SUP;
>  	p_resp_cpi->cap_mask = cl_hton16(p_resp_cpi->cap_mask);
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
> -		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
> +	osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
>  
>  	osm_sa_send(sa, p_resp_madw, FALSE);
>  
> diff --git a/opensm/opensm/osm_sa_link_record.c b/opensm/opensm/osm_sa_link_record.c
> index bf0b5ee..20b94bd 100644
> --- a/opensm/opensm/osm_sa_link_record.c
> +++ b/opensm/opensm/osm_sa_link_record.c
> @@ -465,8 +465,7 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
>  		goto Exit;
>  	}
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_link_record(sa->p_log, p_lr, OSM_LOG_DEBUG);
> +	osm_dump_link_record(sa->p_log, p_lr, OSM_LOG_DEBUG);
>  
>  	cl_qlist_init(&lr_list);
>  
> diff --git a/opensm/opensm/osm_sa_mad_ctrl.c b/opensm/opensm/osm_sa_mad_ctrl.c
> index eeec51c..a791402 100644
> --- a/opensm/opensm/osm_sa_mad_ctrl.c
> +++ b/opensm/opensm/osm_sa_mad_ctrl.c
> @@ -315,8 +315,7 @@ static void sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw, IN void *context,
>  
>  	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
>  
> -	if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_FRAMES))
> -		osm_dump_sa_mad(p_ctrl->p_log, p_sa_mad, OSM_LOG_FRAMES);
> +	osm_dump_sa_mad(p_ctrl->p_log, p_sa_mad, OSM_LOG_FRAMES);
>  
>  	/*
>  	 * C15-0.1.5 - Table 185: SA Header - p884
> diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
> index 5543221..2cde504 100644
> --- a/opensm/opensm/osm_sa_mcmember_record.c
> +++ b/opensm/opensm/osm_sa_mcmember_record.c
> @@ -1331,8 +1331,7 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
>  
>  	}
>  	/* failed to route */
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
> +	osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
>  
>  	mcmr_rcv_respond(sa, p_madw, &mcmember_rec);
>  
> diff --git a/opensm/opensm/osm_sa_multipath_record.c b/opensm/opensm/osm_sa_multipath_record.c
> index 737d892..59bed2b 100644
> --- a/opensm/opensm/osm_sa_multipath_record.c
> +++ b/opensm/opensm/osm_sa_multipath_record.c
> @@ -1454,8 +1454,7 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
>  		goto Exit;
>  	}
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_multipath_record(sa->p_log, p_mpr, OSM_LOG_DEBUG);
> +	osm_dump_multipath_record(sa->p_log, p_mpr, OSM_LOG_DEBUG);
>  
>  	cl_qlist_init(&pr_list);
>  
> diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
> index 6e7d5f6..f3146ed 100644
> --- a/opensm/opensm/osm_sa_path_record.c
> +++ b/opensm/opensm/osm_sa_path_record.c
> @@ -1628,8 +1628,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
>  		goto Exit;
>  	}
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_path_record(sa->p_log, p_pr, OSM_LOG_DEBUG);
> +	osm_dump_path_record(sa->p_log, p_pr, OSM_LOG_DEBUG);
>  
>  	cl_qlist_init(&pr_list);
>  
> diff --git a/opensm/opensm/osm_sa_service_record.c b/opensm/opensm/osm_sa_service_record.c
> index b3c39b0..02496c1 100644
> --- a/opensm/opensm/osm_sa_service_record.c
> +++ b/opensm/opensm/osm_sa_service_record.c
> @@ -475,9 +475,7 @@ static void sr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
>  	p_recvd_service_rec =
>  	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_service_record(sa->p_log, p_recvd_service_rec,
> -					OSM_LOG_DEBUG);
> +	osm_dump_service_record(sa->p_log, p_recvd_service_rec, OSM_LOG_DEBUG);
>  
>  	cl_qlist_init(&sr_match_item.sr_list);
>  	sr_match_item.p_service_rec = p_recvd_service_rec;
> @@ -530,9 +528,7 @@ static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
>  
>  	comp_mask = p_sa_mad->comp_mask;
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_service_record(sa->p_log, p_recvd_service_rec,
> -					OSM_LOG_DEBUG);
> +	osm_dump_service_record(sa->p_log, p_recvd_service_rec, OSM_LOG_DEBUG);
>  
>  	if ((comp_mask & (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) !=
>  	    (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) {
> @@ -634,9 +630,7 @@ static void sr_rcv_process_delete_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
>  
>  	comp_mask = p_sa_mad->comp_mask;
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_service_record(sa->p_log, p_recvd_service_rec,
> -					OSM_LOG_DEBUG);
> +	osm_dump_service_record(sa->p_log, p_recvd_service_rec, OSM_LOG_DEBUG);
>  
>  	/* Grab the lock */
>  	cl_plock_excl_acquire(sa->p_lock);
> diff --git a/opensm/opensm/osm_sa_sminfo_record.c b/opensm/opensm/osm_sa_sminfo_record.c
> index 4d454af..9f11c91 100644
> --- a/opensm/opensm/osm_sa_sminfo_record.c
> +++ b/opensm/opensm/osm_sa_sminfo_record.c
> @@ -216,8 +216,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
>  		goto Exit;
>  	}
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_sm_info_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
> +	osm_dump_sm_info_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
>  
>  	p_smi = &p_rcvd_rec->sm_info;
>  
> diff --git a/opensm/opensm/osm_sa_sw_info_record.c b/opensm/opensm/osm_sa_sw_info_record.c
> index 2ea8baf..e6ac7fe 100644
> --- a/opensm/opensm/osm_sa_sw_info_record.c
> +++ b/opensm/opensm/osm_sa_sw_info_record.c
> @@ -239,9 +239,7 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
>  		goto Exit;
>  	}
>  
> -	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
> -		osm_dump_switch_info_record(sa->p_log, p_rcvd_rec,
> -					    OSM_LOG_DEBUG);
> +	osm_dump_switch_info_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
>  
>  	cl_qlist_init(&rec_list);
>  
> 



More information about the general mailing list