On 2018/1/24 21:21, Leon Romanovsky wrote: > On Wed, Jan 24, 2018 at 08:40:42PM +0800, Liuyixian (Eason) wrote: >> >> >> On 2018/1/23 19:07, Leon Romanovsky wrote: >>> On Thu, Jan 18, 2018 at 10:34:30AM +0800, Yixian Liu wrote: >>>> This patch updates to support rq record doorbell for >>>> the kernel space. >>>> >>>> Signed-off-by: Yixian Liu <liuyixian@xxxxxxxxxx> >>>> Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx> >>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@xxxxxxxxxx> >>>> Signed-off-by: Shaobo Xu <xushaobo2@xxxxxxxxxx> >>>> --- >>>> drivers/infiniband/hw/hns/hns_roce_db.c | 112 ++++++++++++++++++++++++++++ >>>> drivers/infiniband/hw/hns/hns_roce_device.h | 6 ++ >>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 15 +--- >>>> drivers/infiniband/hw/hns/hns_roce_main.c | 5 ++ >>>> drivers/infiniband/hw/hns/hns_roce_qp.c | 18 ++++- >>>> 5 files changed, 143 insertions(+), 13 deletions(-) >>>> >>>> diff --git a/drivers/infiniband/hw/hns/hns_roce_db.c b/drivers/infiniband/hw/hns/hns_roce_db.c >>>> index 0908208..de3fa94 100644 >>>> --- a/drivers/infiniband/hw/hns/hns_roce_db.c >>>> +++ b/drivers/infiniband/hw/hns/hns_roce_db.c >>>> @@ -92,3 +92,115 @@ void hns_roce_db_unmap_user(struct hns_roce_ucontext *context, >>>> mutex_unlock(&context->db_page_mutex); >>>> } >>>> EXPORT_SYMBOL(hns_roce_db_unmap_user); >>>> + >>>> +static struct hns_roce_db_pgdir *hns_roce_alloc_db_pgdir( >>>> + struct device *dma_device, gfp_t gfp) >>>> +{ >>>> + struct hns_roce_db_pgdir *pgdir; >>>> + >>>> + pgdir = kzalloc(sizeof(*pgdir), gfp); >>>> + if (!pgdir) >>>> + return NULL; >>>> + >>>> + bitmap_fill(pgdir->order1, HNS_ROCE_DB_PER_PAGE / 2); >>>> + pgdir->bits[0] = pgdir->order0; >>> >>> order0? isn't it equal to zero? >>> >> >> No. Here order0 is the name of a bitmap array and bits[0] points to it. > > pgdir was allocated with kzalloc() -> all fields are zero -> > pgdir->order0 == 0 or pgdir->order0 == NULL -> What is the point in such > assignment? The definition of hns_roce_db_pgdir is in patch [1/4] as following: struct hns_roce_db_pgdir { struct list_head list; DECLARE_BITMAP(order0, HNS_ROCE_DB_PER_PAGE); DECLARE_BITMAP(order1, HNS_ROCE_DB_PER_PAGE / 2); unsigned long *bits[2]; u32 *db_page; dma_addr_t db_dma; }; and, #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)] Therefore, pgdir->order0 is the base address of an array, not NULL. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html