Re: [PATCH rdma-core 1/3] efa: Elastic Fabric Adapter (EFA) userspace RDMA provider

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26-Feb-19 17:19, Leon Romanovsky wrote:
> On Tue, Feb 26, 2019 at 02:12:52PM +0200, Gal Pressman wrote:
>> 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().
> 
> 
> Both of them deserve to be in ccan/bitmap.c or something like that.
> 
> Thanks
> 

I'll add an align.h file.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux