On 26-Feb-19 13:45, Leon Romanovsky wrote: >> +static inline unsigned long align(unsigned long val, unsigned long align) >> +{ >> + return (val + align - 1) & ~(align - 1); >> +} > > Don't we already have helper for that? I can't find one. Seems like mlx5, mlx4, mthca, pvrdma, hns_roce, cxgb4 and efa are all defining this function. I can move this function to common code, not really sure if there is a common code for all providers? > >> + >> +static inline uint32_t align_up_queue_size(uint32_t req) >> +{ >> + req--; >> + req |= req >> 1; >> + req |= req >> 2; >> + req |= req >> 4; >> + req |= req >> 8; >> + req |= req >> 16; >> + req++; >> + return req; >> +} > > What did you want to achieve with this? roundup_pow_of_two().