On 11/19/2019 9:29 PM, Jason Gunthorpe wrote: > On Sun, Nov 17, 2019 at 09:41:28AM +0200, Haggai Eran wrote: >> +/* Use the new version of ibv_reg_mr only if flags that require it are used. */ >> +#define ibv_reg_mr(pd, addr, length, access) ({\ >> + const int optional_access_flags = IBV_ACCESS_RELAXED_ORDERING; >> \ > > We need to set aside more bits for optional as we can't keep revising > this Sure. Is 10 bits okay? #define IBV_ACCESS_OPTIONAL ((1 << 10) - 1) << 8 > >> + struct ibv_mr *__mr; \ >> + \ >> + if (__builtin_constant_p(access) && \ >> + !((access) & optional_access_flags)) \ >> + __mr = ibv_reg_mr(pd, addr, length, access); \ >> + else \ >> + __mr = ibv_reg_mr_iova2(pd, addr, length, (uintptr_t)addr, \ >> + access); \ > > Missing brackets around addr > > This also wants to be a ?: expression to avoid the ({}) extension Sure, I'll do that. Thanks, Haggai