[ofa-general] Re: [PATCH 2/3 v2] opensm: adding missing comparison by to_lid/from_lid in LinkRecord processing

Sasha Khapyorsky sashak at voltaire.com
Mon Dec 3 17:34:42 PST 2007


Hi Yevgeny,

On 17:16 Mon 03 Dec     , Yevgeny Kliteynik wrote:
> Comparison for IB_LR_COMPMASK_FROM_LID/IB_LR_COMPMASK_TO_LID
> component mask bits was missing in LinkRecord processing.
> 
> Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
> ---
>  opensm/opensm/osm_sa_link_record.c |   16 ++++++++++++++--
>  1 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/opensm/opensm/osm_sa_link_record.c b/opensm/opensm/osm_sa_link_record.c
> index ba52aea..1230b91 100644
> --- a/opensm/opensm/osm_sa_link_record.c
> +++ b/opensm/opensm/osm_sa_link_record.c
> @@ -177,6 +177,7 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
>  	uint8_t dest_port_num;
>  	ib_net16_t from_base_lid;
>  	ib_net16_t to_base_lid;
> +	uint16_t lmc_mask;
> 
>  	OSM_LOG_ENTER(p_rcv->p_log, __osm_lr_rcv_get_physp_link);
> 
> @@ -256,6 +257,19 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
>  		if (dest_port_num != p_lr->to_port_num)
>  			goto Exit;
> 
> +	__get_base_lid(p_src_physp, &from_base_lid);
> +	__get_base_lid(p_dest_physp, &to_base_lid);
> +
> +	lmc_mask = ~((1 << p_rcv->p_subn->opt.lmc) - 1);
> +
> +	if (comp_mask & IB_LR_COMPMASK_FROM_LID)
> +		if (from_base_lid != (p_lr->from_lid & lmc_mask))
> +			goto Exit;
> +
> +	if (comp_mask & IB_LR_COMPMASK_TO_LID)
> +		if (to_base_lid != (p_lr->to_lid & lmc_mask))
> +			goto Exit;

Actually it is broken too. Since all LIDs in comparison are in network
bit order lmc_mask should be converted too. I will patch separately.

Sasha

> +
>  	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
>  		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
>  			"__osm_lr_rcv_get_physp_link: "
> @@ -267,8 +281,6 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
>  			cl_ntoh64(osm_physp_get_port_guid(p_dest_physp)),
>  			dest_port_num);
> 
> -	__get_base_lid(p_src_physp, &from_base_lid);
> -	__get_base_lid(p_dest_physp, &to_base_lid);
> 
>  	__osm_lr_rcv_build_physp_link(p_rcv, from_base_lid,
>  				      to_base_lid, src_port_num,
> -- 
> 1.5.1.4
> 



More information about the general mailing list