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

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Tue Dec 4 00:13:31 PST 2007


Sasha Khapyorsky wrote:
> On 01:34 Tue 04 Dec     , Sasha Khapyorsky wrote:
>>> @@ -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.
> 
> Something like this.

Right, it does fix the problem. Thanks.

-- Yevgeny

> Sasha
> 
> commit 15e3721e822a2d93b32a6f08915a3f84e65424a4
> Author: Sasha Khapyorsky <sashak at voltaire.com>
> Date:   Tue Dec 4 01:37:57 2007 +0000
> 
>     opensm: fix lmc_mask bit order in osm_sa_link_record.c
>     
>     All LIDs here are in network byte order, so lmc_mask should be converted
>     too.
>     
>     Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> 
> diff --git a/opensm/opensm/osm_sa_link_record.c b/opensm/opensm/osm_sa_link_record.c
> index 1230b91..0497bcd 100644
> --- a/opensm/opensm/osm_sa_link_record.c
> +++ b/opensm/opensm/osm_sa_link_record.c
> @@ -177,7 +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;
> +	ib_net16_t lmc_mask;
>  
>  	OSM_LOG_ENTER(p_rcv->p_log, __osm_lr_rcv_get_physp_link);
>  
> @@ -261,6 +261,7 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
>  	__get_base_lid(p_dest_physp, &to_base_lid);
>  
>  	lmc_mask = ~((1 << p_rcv->p_subn->opt.lmc) - 1);
> +	lmc_mask = cl_hton16(lmc_mask);
>  
>  	if (comp_mask & IB_LR_COMPMASK_FROM_LID)
>  		if (from_base_lid != (p_lr->from_lid & lmc_mask))
> 




More information about the general mailing list