[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160424075424.GE7974@leon.nu>
Date: Sun, 24 Apr 2016 10:54:24 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Lijun Ou <oulijun@...wei.com>
Cc: dledford@...hat.com, sean.hefty@...el.com,
hal.rosenstock@...il.com, davem@...emloft.net,
jeffrey.t.kirsher@...el.com, jiri@...lanox.com,
ogerlitz@...lanox.com, linuxarm@...wei.com,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, gongyangming@...wei.com,
xiaokun@...wei.com, tangchaofei@...wei.com, haifeng.wei@...wei.com,
yisen.zhuang@...wei.com, yankejian@...wei.com,
lisheng011@...wei.com, charles.chenxin@...wei.com
Subject: Re: [PATCH v5 09/21] IB/hns: Add hca support
On Sat, Apr 23, 2016 at 06:26:47PM +0800, Lijun Ou wrote:
> This patch mainly setup hca for RoCE. it will do a series of
> initial works as follows:
> 1. init uar table, allocate uar resource
> 2. init pd table
> 3. init cq table
> 4. init mr table
> 5. init qp table
>
> Signed-off-by: Lijun Ou <oulijun@...wei.com>
> Signed-off-by: Wei Hu(Xavier) <xavier.huwei@...wei.com>
> ---
> drivers/infiniband/hw/hns/hns_roce_alloc.c | 104 ++++++++++++++++
> drivers/infiniband/hw/hns/hns_roce_cq.c | 25 ++++
> drivers/infiniband/hw/hns/hns_roce_device.h | 69 ++++++++++
> drivers/infiniband/hw/hns/hns_roce_eq.c | 1 -
> drivers/infiniband/hw/hns/hns_roce_icm.c | 88 +++++++++++++
> drivers/infiniband/hw/hns/hns_roce_icm.h | 9 ++
> drivers/infiniband/hw/hns/hns_roce_main.c | 79 ++++++++++++
> drivers/infiniband/hw/hns/hns_roce_mr.c | 187 ++++++++++++++++++++++++++++
> drivers/infiniband/hw/hns/hns_roce_pd.c | 65 ++++++++++
> drivers/infiniband/hw/hns/hns_roce_qp.c | 30 +++++
> 10 files changed, 656 insertions(+), 1 deletion(-)
> create mode 100644 drivers/infiniband/hw/hns/hns_roce_alloc.c
> create mode 100644 drivers/infiniband/hw/hns/hns_roce_mr.c
> create mode 100644 drivers/infiniband/hw/hns/hns_roce_pd.c
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_alloc.c b/drivers/infiniband/hw/hns/hns_roce_alloc.c
> new file mode 100644
> index 0000000..0c76f1b
> --- /dev/null
> +++ b/drivers/infiniband/hw/hns/hns_roce_alloc.c
> @@ -0,0 +1,104 @@
> +/*
> + * Copyright (c) 2016 Hisilicon Limited.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/bitmap.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/errno.h>
> +#include <linux/mm.h>
> +#include <linux/slab.h>
> +#include <linux/vmalloc.h>
> +#include "hns_roce_device.h"
> +
> +int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, u32 *obj)
> +{
> + int ret = 0;
> +
> + spin_lock(&bitmap->lock);
> + *obj = find_next_zero_bit(bitmap->table, bitmap->max, bitmap->last);
> + if (*obj >= bitmap->max) {
> + bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
> + & bitmap->mask;
> + *obj = find_first_zero_bit(bitmap->table, bitmap->max);
find_first_zero_bit function returns "unsigned long" which may or may
not be equal to u32 on some architectures.
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists