[ofa-general] [PATCH] opensm/osm_ucast_ftree.c Fixed bad init value for down port index

Nicolas Morey Chaisemartin nicolas.morey-chaisemartin at ext.bull.net
Tue Feb 10 01:29:28 PST 2009


Yevgeny Kliteynik wrote:
> Nicolas Morey Chaisemartin wrote:
>> Yevgeny Kliteynik wrote:
>>> Hi Nicolas,
>>>
>>>>  
>>>>      /* foreach down-going port group (in indexing order) */
>>>> -    i = p_sw->down_port_groups_idx;
>>>> +    i = (p_sw->down_port_groups_idx +
>>>> +         p_sw->down_port_groups_num) % p_sw->down_port_groups_num;
>>>
>>> Perhaps it would be simpler just to init the down_port_groups_idx to 
>>> 0 instead of -1?
>>> Something like this:
>>>
>>> diff --git a/opensm/opensm/osm_ucast_ftree.c 
>>> b/opensm/opensm/osm_ucast_ftree.c
>>> index 4e65c87..eae1ed8 100644
>>> --- a/opensm/opensm/osm_ucast_ftree.c
>>> +++ b/opensm/opensm/osm_ucast_ftree.c
>>> @@ -563,7 +563,7 @@ static ftree_sw_t *__osm_ftree_sw_create(IN 
>>> ftree_fabric_t * p_ftree,
>>>      /* initialize lft buffer */
>>>      memset(p_osm_sw->new_lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
>>>
>>> -    p_sw->down_port_groups_idx = -1;
>>> +    p_sw->down_port_groups_idx = 0;
>>>
>>>      return p_sw;
>>>  }                /* __osm_ftree_sw_create() */
>>
>> Sure. I wanted to ensure that whatever happens to the index it would 
>> always be in the right interval but after checking I doubt anything 
>> else than initialization could set it outside its normal interval.
>> Do you want me to make the patch and send it or will you just push 
>> yours?
>
> I'm ok with both options.
> I can send a clean patch to Sasha tomorrow (I'm OOO today), or you can 
> do it today.
>
> -- Yevgeny
>
>> Nicolas
>>
>
>
>
Yours should be faster and I recheck and I see no reason to enforce a 
"check" in the function so I prefer your solution.
I'll repost the patch today as it's breaking opensm/ftree.

Nicolas



More information about the general mailing list