lkml.org 
[lkml]   [2018]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject答复: [PATCH 1/4] net-next/hinic:replace mult iply and division operators
    Date
    Hi:

    This wqebb size is 32 in rx and in tx is 64, so the value is a power of two.

    Thank you

    -----邮件原件-----
    发件人: David Miller [mailto:davem@davemloft.net]
    发送时间: 2018年11月20日 7:02
    收件人: xuechaojing <xuechaojing@huawei.com>
    抄送: linux-kernel@vger.kernel.org; netdev@vger.kernel.org; wulike (A) <wulike1@huawei.com>; chiqijun <chiqijun@huawei.com>; Wangfengying <fy.wang@huawei.com>; Quhuichun (Tony) <tony.qu@huawei.com>; Luoshaokai (luoshaokai) <luoshaokai@huawei.com>
    主题: Re: [PATCH 1/4] net-next/hinic:replace multiply and division operators

    From: Xue Chaojing <xuechaojing@huawei.com>
    Date: Mon, 19 Nov 2018 06:12:31 +0000

    > @@ -530,7 +536,9 @@ int hinic_wq_allocate(struct hinic_wqs *wqs, struct hinic_wq *wq,
    > return -EINVAL;
    > }
    >
    > - num_wqebbs_per_page = ALIGN(wq_page_size, wqebb_size) / wqebb_size;
    > + wqebb_size_shift = ilog2(wqebb_size);

    You now have introduced the assumption that these various sizes are a power of two.

    You should check for this, either at compile time or at run time, in order to avoid surprises and hard to debug issues in the future.

    Thank you.
    \
     
     \ /
      Last update: 2018-11-20 03:22    [W:6.897 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site