Re: [PATCH 1/3] infiniband: IB/hns: add Hisilicon RoCE support

From: Jiri Pirko
Date: Fri Mar 11 2016 - 05:42:53 EST


Fri, Mar 11, 2016 at 11:37:09AM CET, oulijun@xxxxxxxxxx wrote:
>The driver for Hisilicon RoCE is a platform driver.
>The driver will support mulitple versions of hardware. Currently only "v1"
>for hip06 SOC is supported.
>The driver includes two parts: common driver and hardware-specific
>operations. hns_roce_v1_hw.c and hns_roce_v1_hw.h are files for
>hardware-specific operations only for v1 engine, and other files(.c and .h)
>for common algorithm and common hardware operations
>
>Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx>
>Signed-off-by: Wei Hu(Xavier) <xavier.huwei@xxxxxxxxxx>
>Signed-off-by: Znlong <zhaonenglong@xxxxxxxxxx>

<snip>

I'm sorry to be nitpicking, but you still have style issues in your
code. I believe that for newly submitted code, this should be avoided. I
already pointed that out as a comment to your last version, but you
ignored it. So again, couple of examples:

>+struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd,
>+ struct ib_ah_attr *ah_attr)

<snip>

>+ ret = ib_get_cached_gid(ibpd->device, ah_attr->port_num,
>+ ah_attr->grh.sgid_index, &sgid, &gid_attr);

<snip>

>+int hns_roce_bitmap_alloc_range(
>+ struct hns_roce_bitmap *bitmap,
>+ int cnt, int align, u32 *obj)

<snip>

>+ pages =
>+ kmalloc(sizeof(*pages) * buf->nbufs,
>+ GFP_KERNEL);

<snip>

>+ dev_err(dev,
>+ "CQ alloc.Failed to find cq buf addr.\n");

<snip>

>+ resp.qp_tab_size = hr_dev->caps.num_qps;

<snip>

>+ buddy->bits[i] =
>+ kmalloc(s * sizeof(long), GFP_KERNEL);


and many, many others similar to this. Please fix this.


Also, I don't understand why you have "_" prefix for labels:

>+
>+_error_failed_register_device:
>+ hns_roce_engine_uninit(hr_dev);
>+
>+_error_failed_engine_init:
>+ hns_roce_cleanup_bitmap(hr_dev);
>+
>+_error_failed_setup_hca:
>+ hns_roce_cleanup_icm(hr_dev);
>+
>+_error_failed_init_icm:
>+ if (hr_dev->cmd_mod)
>+ hns_roce_cmd_use_polling(hr_dev);
>+
>+_error_failed_use_event:
>+ hns_roce_cleanup_eq_table(hr_dev);
>+
>+_error_failed_eq_tabel:
>+ hns_roce_cmd_cleanup(hr_dev);
>+
>+_error_failed_cmd_init:
>+ (void)hns_roce_engine_reset(hr_dev, 0);
>+
>+_error_failed_reset_engine:
>+ hns_roce_free_cfg(hr_dev);
>+
>+_error_failed_get_cfg:
>+ ib_dealloc_device(&hr_dev->ib_dev);
>+
>+ return ret;
>+}