Re: [PATCH v10 05/22] IB/hns: Add initial profile resource

2016-06-28 Thread oulijun
Hi, leon
在 2016/6/24 23:10, Leon Romanovsky 写道:
> On Thu, Jun 16, 2016 at 10:35:13PM +0800, Lijun Ou wrote:
>> This patch added the operation for cmd, and added some functions
>> for initializing eq table and selecting cmd mode.
>>
>> Signed-off-by: Wei Hu 
>> Signed-off-by: Nenglong Zhao 
>> Signed-off-by: Lijun Ou 
>> ---
>> PATCH v9:
>> This fixes the comments given by Leon Romanovsky over the PATCH v8:
>>   Link: https://lkml.org/lkml/2016/6/9/65
>>
>> PATCH v8/v7/v6:
>> - No change over the PATCH v5
>>
>> PATCH v5:
>> - The initial patch which was redesigned based on the second patch
>>   in PATCH v4
>> ---
>> ---
>>  drivers/infiniband/hw/hns/hns_roce_common.h | 49 +++
>>  drivers/infiniband/hw/hns/hns_roce_device.h | 55 -
>>  drivers/infiniband/hw/hns/hns_roce_hw_v1.c  | 75 
>> +
>>  drivers/infiniband/hw/hns/hns_roce_hw_v1.h  | 36 ++
>>  drivers/infiniband/hw/hns/hns_roce_main.c   |  7 +++
>>  5 files changed, 221 insertions(+), 1 deletion(-)
>>  create mode 100644 drivers/infiniband/hw/hns/hns_roce_common.h
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_common.h 
>> b/drivers/infiniband/hw/hns/hns_roce_common.h
>> new file mode 100644
>> index 000..4cc4761
>> --- /dev/null
>> +++ b/drivers/infiniband/hw/hns/hns_roce_common.h
>> @@ -0,0 +1,49 @@
>> +/*
>> + * Copyright (c) 2016 Hisilicon Limited.
>> + *
>> + * This software is available to you under a choice of one of two
>> + * licenses.  You may choose to be licensed under the terms of the GNU
>> + * General Public License (GPL) Version 2, available from the file
>> + * COPYING in the main directory of this source tree, or the
>> + * OpenIB.org BSD license below:
>> + *
>> + * Redistribution and use in source and binary forms, with or
>> + * without modification, are permitted provided that the following
>> + * conditions are met:
>> + *
>> + *  - Redistributions of source code must retain the above
>> + *copyright notice, this list of conditions and the following
>> + *disclaimer.
>> + *
>> + *  - Redistributions in binary form must reproduce the above
>> + *copyright notice, this list of conditions and the following
>> + *disclaimer in the documentation and/or other materials
>> + *provided with the distribution.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
>> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
>> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
>> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
>> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>> + * SOFTWARE.
>> + */
>> +
>> +#ifndef _HNS_ROCE_COMMON_H
>> +#define _HNS_ROCE_COMMON_H
>> +
>> +#define roce_read(dev, reg) readl((dev)->reg_base + (reg))
>> +
>> +/*ROCEE_REG DEFINITION/
>> +#define ROCEE_VENDOR_ID_REG 0x0
>> +#define ROCEE_VENDOR_PART_ID_REG0x4
>> +
>> +#define ROCEE_HW_VERSION_REG0x8
>> +
>> +#define ROCEE_SYS_IMAGE_GUID_L_REG  0xC
>> +#define ROCEE_SYS_IMAGE_GUID_H_REG  0x10
>> +
>> +#define ROCEE_ACK_DELAY_REG 0x14
>> +
>> +#endif /* _HNS_ROCE_COMMON_H */
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h 
>> b/drivers/infiniband/hw/hns/hns_roce_device.h
>> index b857c76..e01ea34 100644
>> --- a/drivers/infiniband/hw/hns/hns_roce_device.h
>> +++ b/drivers/infiniband/hw/hns/hns_roce_device.h
>> @@ -45,6 +45,12 @@
>>  #define DRV_NAME "hns_roce"
>>  
>>  #define HNS_ROCE_MAX_IRQ_NUM34
>> +
>> +#define HNS_ROCE_COMP_VEC_NUM   32
>> +
>> +#define HNS_ROCE_AEQE_VEC_NUM   1
>> +#define HNS_ROCE_AEQE_OF_VEC_NUM1
>> +
>>  #define HNS_ROCE_MAX_PORTS  6
>>  
>>  struct hns_roce_ib_iboe {
>> @@ -53,11 +59,52 @@ struct hns_roce_ib_iboe {
>>  };
>>  
>>  struct hns_roce_caps {
>> -u8  num_ports;
>> +u64 fw_ver;
>> +u8  num_ports;
>> +int gid_table_len[HNS_ROCE_MAX_PORTS];
>> +int pkey_table_len[HNS_ROCE_MAX_PORTS];
>> +int local_ca_ack_delay;
>> +int num_uars;
>> +u32 phy_num_uars;
>> +u32 max_sq_sg;  /* 2 */
>> +u32 max_sq_inline;  /* 32 */
>> +u32 max_rq_sg;  /* 2 */
>> +int num_qps;/* 256k */
>> +u32 max_wqes;   /* 16k */
>> +u32 max_sq_desc_sz; /* 64 */
>> +u32 max_rq_desc_sz; /* 64 */
>> +int 

Re: [PATCH v10 05/22] IB/hns: Add initial profile resource

2016-06-24 Thread Leon Romanovsky
On Thu, Jun 16, 2016 at 10:35:13PM +0800, Lijun Ou wrote:
> This patch added the operation for cmd, and added some functions
> for initializing eq table and selecting cmd mode.
> 
> Signed-off-by: Wei Hu 
> Signed-off-by: Nenglong Zhao 
> Signed-off-by: Lijun Ou 
> ---
> PATCH v9:
> This fixes the comments given by Leon Romanovsky over the PATCH v8:
>   Link: https://lkml.org/lkml/2016/6/9/65
> 
> PATCH v8/v7/v6:
> - No change over the PATCH v5
> 
> PATCH v5:
> - The initial patch which was redesigned based on the second patch
>   in PATCH v4
> ---
> ---
>  drivers/infiniband/hw/hns/hns_roce_common.h | 49 +++
>  drivers/infiniband/hw/hns/hns_roce_device.h | 55 -
>  drivers/infiniband/hw/hns/hns_roce_hw_v1.c  | 75 
> +
>  drivers/infiniband/hw/hns/hns_roce_hw_v1.h  | 36 ++
>  drivers/infiniband/hw/hns/hns_roce_main.c   |  7 +++
>  5 files changed, 221 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/infiniband/hw/hns/hns_roce_common.h
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_common.h 
> b/drivers/infiniband/hw/hns/hns_roce_common.h
> new file mode 100644
> index 000..4cc4761
> --- /dev/null
> +++ b/drivers/infiniband/hw/hns/hns_roce_common.h
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (c) 2016 Hisilicon Limited.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + * Redistribution and use in source and binary forms, with or
> + * without modification, are permitted provided that the following
> + * conditions are met:
> + *
> + *  - Redistributions of source code must retain the above
> + *copyright notice, this list of conditions and the following
> + *disclaimer.
> + *
> + *  - Redistributions in binary form must reproduce the above
> + *copyright notice, this list of conditions and the following
> + *disclaimer in the documentation and/or other materials
> + *provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#ifndef _HNS_ROCE_COMMON_H
> +#define _HNS_ROCE_COMMON_H
> +
> +#define roce_read(dev, reg)  readl((dev)->reg_base + (reg))
> +
> +/*ROCEE_REG DEFINITION/
> +#define ROCEE_VENDOR_ID_REG  0x0
> +#define ROCEE_VENDOR_PART_ID_REG 0x4
> +
> +#define ROCEE_HW_VERSION_REG 0x8
> +
> +#define ROCEE_SYS_IMAGE_GUID_L_REG   0xC
> +#define ROCEE_SYS_IMAGE_GUID_H_REG   0x10
> +
> +#define ROCEE_ACK_DELAY_REG  0x14
> +
> +#endif /* _HNS_ROCE_COMMON_H */
> diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h 
> b/drivers/infiniband/hw/hns/hns_roce_device.h
> index b857c76..e01ea34 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_device.h
> +++ b/drivers/infiniband/hw/hns/hns_roce_device.h
> @@ -45,6 +45,12 @@
>  #define DRV_NAME "hns_roce"
>  
>  #define HNS_ROCE_MAX_IRQ_NUM 34
> +
> +#define HNS_ROCE_COMP_VEC_NUM32
> +
> +#define HNS_ROCE_AEQE_VEC_NUM1
> +#define HNS_ROCE_AEQE_OF_VEC_NUM 1
> +
>  #define HNS_ROCE_MAX_PORTS   6
>  
>  struct hns_roce_ib_iboe {
> @@ -53,11 +59,52 @@ struct hns_roce_ib_iboe {
>  };
>  
>  struct hns_roce_caps {
> - u8  num_ports;
> + u64 fw_ver;
> + u8  num_ports;
> + int gid_table_len[HNS_ROCE_MAX_PORTS];
> + int pkey_table_len[HNS_ROCE_MAX_PORTS];
> + int local_ca_ack_delay;
> + int num_uars;
> + u32 phy_num_uars;
> + u32 max_sq_sg;  /* 2 */
> + u32 max_sq_inline;  /* 32 */
> + u32 max_rq_sg;  /* 2 */
> + int num_qps;/* 256k */
> + u32 max_wqes;   /* 16k */
> + u32 max_sq_desc_sz; /* 64 */
> + u32 max_rq_desc_sz; /* 64 */
> + int max_qp_init_rdma;
> + int max_qp_dest_rdma;
> + int sqp_start;
> + int num_cqs;
> + int max_cqes;
> + 

[PATCH v10 05/22] IB/hns: Add initial profile resource

2016-06-16 Thread Lijun Ou
This patch added the operation for cmd, and added some functions
for initializing eq table and selecting cmd mode.

Signed-off-by: Wei Hu 
Signed-off-by: Nenglong Zhao 
Signed-off-by: Lijun Ou 
---
PATCH v9:
This fixes the comments given by Leon Romanovsky over the PATCH v8:
  Link: https://lkml.org/lkml/2016/6/9/65

PATCH v8/v7/v6:
- No change over the PATCH v5

PATCH v5:
- The initial patch which was redesigned based on the second patch
  in PATCH v4
---
---
 drivers/infiniband/hw/hns/hns_roce_common.h | 49 +++
 drivers/infiniband/hw/hns/hns_roce_device.h | 55 -
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c  | 75 +
 drivers/infiniband/hw/hns/hns_roce_hw_v1.h  | 36 ++
 drivers/infiniband/hw/hns/hns_roce_main.c   |  7 +++
 5 files changed, 221 insertions(+), 1 deletion(-)
 create mode 100644 drivers/infiniband/hw/hns/hns_roce_common.h

diff --git a/drivers/infiniband/hw/hns/hns_roce_common.h 
b/drivers/infiniband/hw/hns/hns_roce_common.h
new file mode 100644
index 000..4cc4761
--- /dev/null
+++ b/drivers/infiniband/hw/hns/hns_roce_common.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016 Hisilicon Limited.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _HNS_ROCE_COMMON_H
+#define _HNS_ROCE_COMMON_H
+
+#define roce_read(dev, reg)readl((dev)->reg_base + (reg))
+
+/*ROCEE_REG DEFINITION/
+#define ROCEE_VENDOR_ID_REG0x0
+#define ROCEE_VENDOR_PART_ID_REG   0x4
+
+#define ROCEE_HW_VERSION_REG   0x8
+
+#define ROCEE_SYS_IMAGE_GUID_L_REG 0xC
+#define ROCEE_SYS_IMAGE_GUID_H_REG 0x10
+
+#define ROCEE_ACK_DELAY_REG0x14
+
+#endif /* _HNS_ROCE_COMMON_H */
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h 
b/drivers/infiniband/hw/hns/hns_roce_device.h
index b857c76..e01ea34 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -45,6 +45,12 @@
 #define DRV_NAME "hns_roce"
 
 #define HNS_ROCE_MAX_IRQ_NUM   34
+
+#define HNS_ROCE_COMP_VEC_NUM  32
+
+#define HNS_ROCE_AEQE_VEC_NUM  1
+#define HNS_ROCE_AEQE_OF_VEC_NUM   1
+
 #define HNS_ROCE_MAX_PORTS 6
 
 struct hns_roce_ib_iboe {
@@ -53,11 +59,52 @@ struct hns_roce_ib_iboe {
 };
 
 struct hns_roce_caps {
-   u8  num_ports;
+   u64 fw_ver;
+   u8  num_ports;
+   int gid_table_len[HNS_ROCE_MAX_PORTS];
+   int pkey_table_len[HNS_ROCE_MAX_PORTS];
+   int local_ca_ack_delay;
+   int num_uars;
+   u32 phy_num_uars;
+   u32 max_sq_sg;  /* 2 */
+   u32 max_sq_inline;  /* 32 */
+   u32 max_rq_sg;  /* 2 */
+   int num_qps;/* 256k */
+   u32 max_wqes;   /* 16k */
+   u32 max_sq_desc_sz; /* 64 */
+   u32 max_rq_desc_sz; /* 64 */
+   int max_qp_init_rdma;
+   int max_qp_dest_rdma;
+   int sqp_start;
+   int num_cqs;
+   int max_cqes;
+   int reserved_cqs;
+   int num_aeq_vectors;/* 1 */
+   int num_comp_vectors;   /* 32 ceq */
+   int num_other_vectors;
+   int num_mtpts;
+   u32 num_mtt_segs;
+