[ofa-general] RE: [PATCH] srptools: eliminate libibcommon dependencies

Ishai Rabinovitz ishai at mellanox.co.il
Thu Jan 8 05:29:50 PST 2009


OK, Thanks. (It is a stupid mistake, still, it is not a real bug, I only
need trans_id to be unique)
I missed your intention because you also changed the behavior from
trans_id++ to ++trans_id.

Your change was applied.

Ishai

> -----Original Message-----
> From: Sasha Khapyorsky [mailto:sashak at voltaire.com]
> Sent: Thursday, January 08, 2009 3:03 PM
> To: Ishai Rabinovitz
> Cc: Vladimir Sokolovsky; OpenFabrics General
> Subject: Re: [PATCH] srptools: eliminate libibcommon dependencies
> 
> Hi Ishai,
> 
> On 11:30 Thu 08 Jan     , Ishai Rabinovitz wrote:
> >
> > Thanks, I applied all but the lest change (trans_id).
> > Why did you make it?
> 
> ntohll() is macro (defined via bswap_64() macro), using x++ as macro
> parameter is not safe - '++' can be executed more than once. Finally
> I'm
> getting such code after srp_daemon/srp_handle_traps.c preprocessing
> (gcc-4.3.2 32-bit x86):
> 
>   mad_hdr->trans_id = (__extension__ ({ union { __extension__ unsigned
> long long int __ll; unsigned long int __l[2]; } __w, __r; if
> (__builtin_constant_p (trans_id++)) __r.__ll = ((((trans_id++) &
> 0xff00000000000000ull) >> 56) | (((trans_id++) &
0x00ff000000000000ull)
> >> 40) | (((trans_id++) & 0x0000ff0000000000ull) >> 24) |
> (((trans_id++) & 0x000000ff00000000ull) >> 8) | (((trans_id++) &
> 0x00000000ff000000ull) << 8) | (((trans_id++) & 0x0000000000ff0000ull)
> << 24) | (((trans_id++) & 0x000000000000ff00ull) << 40) |
> (((trans_id++) & 0x00000000000000ffull) << 56)); else { __w.__ll =
> (trans_id++); __r.__l[0] = (__extension__ ({ register unsigned int
__v,
> __x = (__w.__l[1]); if (__builtin_constant_p (__x)) __v = ((((__x) &
> 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) &
> 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__
("bswap
> %0" : "=r" (__v) : "0" (__x)); __v; })); __r.__l[1] = (__extension__
({
> register unsigned int __v, __x = (__w.__l[0]); if
(__builtin_constant_p
> (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >>
> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else
> __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); } __r.__ll;
> }));
> 
> Sasha



More information about the general mailing list