All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms
@ 2021-11-09 12:40 Wenpeng Liang
  2021-11-09 12:40 ` [PATCH rdma-core 1/7] libhns: Remove unused macros Wenpeng Liang
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:40 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

Patch #1~#3: Remove redundant code.
Patch #4~#5: Fix wrong type of printf format, variables and fields.
Patch #6~#7: Other miscellaneous cleanup.

Lang Cheng (1):
  libhns: Remove unused macros

Wenpeng Liang (1):
  libhns: Remove unsupported QP type

Xinhao Liu (4):
  libhns: Fix wrong print format for unsigned type
  libhns: Fix wrong type of variables and fields
  libhns: The content of the header file should be protected with
    #define
  libhns: The function declaration should be the same as the definition

Yixing Liu (1):
  libhns: Remove redundant variable initialization

 providers/hns/hns_roce_u.c       |  3 ---
 providers/hns/hns_roce_u.h       | 10 +++++-----
 providers/hns/hns_roce_u_db.h    |  6 +++---
 providers/hns/hns_roce_u_hw_v1.c |  7 +++----
 providers/hns/hns_roce_u_hw_v2.c | 16 +++++++---------
 providers/hns/hns_roce_u_verbs.c |  2 +-
 6 files changed, 19 insertions(+), 25 deletions(-)

--
2.33.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 1/7] libhns: Remove unused macros
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
@ 2021-11-09 12:40 ` Wenpeng Liang
  2021-11-09 12:40 ` [PATCH rdma-core 2/7] libhns: Remove unsupported QP type Wenpeng Liang
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:40 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

From: Lang Cheng <chenglang@huawei.com>

These macros used to work, but are no longer used, they should be removed.

Fixes: 516b8d4e4ebe ("providers: Use the new match_device and allocate_device ops")
Fixes: 887b78c80224 ("libhns: Add initial main frame")
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 providers/hns/hns_roce_u.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index 3b31ad37..9dc4905d 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -41,9 +41,6 @@
 
 static void hns_roce_free_context(struct ibv_context *ibctx);
 
-#define HID_LEN			15
-#define DEV_MATCH_LEN		128
-
 #ifndef PCI_VENDOR_ID_HUAWEI
 #define PCI_VENDOR_ID_HUAWEI			0x19E5
 #endif
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 2/7] libhns: Remove unsupported QP type
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
  2021-11-09 12:40 ` [PATCH rdma-core 1/7] libhns: Remove unused macros Wenpeng Liang
@ 2021-11-09 12:40 ` Wenpeng Liang
  2021-11-09 12:40 ` [PATCH rdma-core 3/7] libhns: Remove redundant variable initialization Wenpeng Liang
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:40 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

Currently, user space does not support UC type QP.

Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 providers/hns/hns_roce_u_hw_v1.c | 1 -
 providers/hns/hns_roce_u_hw_v2.c | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/providers/hns/hns_roce_u_hw_v1.c b/providers/hns/hns_roce_u_hw_v1.c
index 5385d1c4..ef346424 100644
--- a/providers/hns/hns_roce_u_hw_v1.c
+++ b/providers/hns/hns_roce_u_hw_v1.c
@@ -539,7 +539,6 @@ static int hns_roce_u_v1_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
 			ctrl->flag |= htole32(ps_opcode);
 			wqe  += sizeof(struct hns_roce_wqe_raddr_seg);
 			break;
-		case IBV_QPT_UC:
 		case IBV_QPT_UD:
 		default:
 			break;
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 66ecd84a..1e8df6ef 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -460,8 +460,7 @@ static int hns_roce_handle_recv_inl_wqe(struct hns_roce_v2_cqe *cqe,
 					struct hns_roce_qp **cur_qp,
 					struct ibv_wc *wc, uint32_t opcode)
 {
-	if (((*cur_qp)->verbs_qp.qp.qp_type == IBV_QPT_RC ||
-	     (*cur_qp)->verbs_qp.qp.qp_type == IBV_QPT_UC) &&
+	if (((*cur_qp)->verbs_qp.qp.qp_type == IBV_QPT_RC) &&
 	    (opcode == HNS_ROCE_RECV_OP_SEND ||
 	     opcode == HNS_ROCE_RECV_OP_SEND_WITH_IMM ||
 	     opcode == HNS_ROCE_RECV_OP_SEND_WITH_INV) &&
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 3/7] libhns: Remove redundant variable initialization
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
  2021-11-09 12:40 ` [PATCH rdma-core 1/7] libhns: Remove unused macros Wenpeng Liang
  2021-11-09 12:40 ` [PATCH rdma-core 2/7] libhns: Remove unsupported QP type Wenpeng Liang
@ 2021-11-09 12:40 ` Wenpeng Liang
  2021-11-09 12:41 ` [PATCH rdma-core 4/7] libhns: Fix wrong print format for unsigned type Wenpeng Liang
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:40 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

From: Yixing Liu <liuyixing1@huawei.com>

The variable of owner_bit has been assigned before the reference, so there
is no need to initialize.

Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 providers/hns/hns_roce_u_hw_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 1e8df6ef..31a0681d 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -1375,9 +1375,9 @@ static void __hns_roce_v2_cq_clean(struct hns_roce_cq *cq, uint32_t qpn,
 {
 	int nfreed = 0;
 	bool is_recv_cqe;
+	uint8_t owner_bit;
 	uint16_t wqe_index;
 	uint32_t prod_index;
-	uint8_t owner_bit = 0;
 	struct hns_roce_v2_cqe *cqe, *dest;
 	struct hns_roce_context *ctx = to_hr_ctx(cq->ibv_cq.context);
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 4/7] libhns: Fix wrong print format for unsigned type
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
                   ` (2 preceding siblings ...)
  2021-11-09 12:40 ` [PATCH rdma-core 3/7] libhns: Remove redundant variable initialization Wenpeng Liang
@ 2021-11-09 12:41 ` Wenpeng Liang
  2021-11-09 12:41 ` [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields Wenpeng Liang
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:41 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

From: Xinhao Liu <liuxinhao5@hisilicon.com>

Change %d printf fortmat to %u for unsigned int variant.

Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 providers/hns/hns_roce_u_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index 382d2bd7..c0069b8b 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -73,7 +73,7 @@ int hns_roce_u_query_device(struct ibv_context *context,
 	sub_minor = raw_fw_ver & 0xffff;
 
 	snprintf(attr->orig_attr.fw_ver, sizeof(attr->orig_attr.fw_ver),
-		 "%d.%d.%03d", major, minor, sub_minor);
+		 "%u.%u.%03u", major, minor, sub_minor);
 
 	return 0;
 }
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
                   ` (3 preceding siblings ...)
  2021-11-09 12:41 ` [PATCH rdma-core 4/7] libhns: Fix wrong print format for unsigned type Wenpeng Liang
@ 2021-11-09 12:41 ` Wenpeng Liang
  2021-11-23 14:13   ` Jason Gunthorpe
  2021-11-09 12:41 ` [PATCH rdma-core 6/7] libhns: The content of the header file should be protected with #define Wenpeng Liang
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:41 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

From: Xinhao Liu <liuxinhao5@hisilicon.com>

Some variables and fields should be in type of unsigned instead of signed.

Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 providers/hns/hns_roce_u.h       |  6 +++---
 providers/hns/hns_roce_u_hw_v1.c |  6 +++---
 providers/hns/hns_roce_u_hw_v2.c | 11 +++++------
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
index 0d7abd81..d5963941 100644
--- a/providers/hns/hns_roce_u.h
+++ b/providers/hns/hns_roce_u.h
@@ -99,7 +99,7 @@
 #define roce_set_bit(origin, shift, val) \
 	roce_set_field((origin), (1ul << (shift)), (shift), (val))
 
-#define hr_ilog32(n)		ilog32((n) - 1)
+#define hr_ilog32(n)		ilog32((unsigned int)(n) - 1)
 
 enum {
 	HNS_ROCE_QP_TABLE_BITS		= 8,
@@ -203,7 +203,7 @@ struct hns_roce_cq {
 
 struct hns_roce_idx_que {
 	struct hns_roce_buf		buf;
-	int				entry_shift;
+	unsigned int			entry_shift;
 	unsigned long			*bitmap;
 	int				bitmap_cnt;
 	unsigned int			head;
@@ -249,7 +249,7 @@ struct hns_roce_sge_info {
 struct hns_roce_sge_ex {
 	int				offset;
 	unsigned int			sge_cnt;
-	int				sge_shift;
+	unsigned int			sge_shift;
 };
 
 struct hns_roce_rinl_sge {
diff --git a/providers/hns/hns_roce_u_hw_v1.c b/providers/hns/hns_roce_u_hw_v1.c
index ef346424..cc97de30 100644
--- a/providers/hns/hns_roce_u_hw_v1.c
+++ b/providers/hns/hns_roce_u_hw_v1.c
@@ -220,7 +220,7 @@ static int hns_roce_wq_overflow(struct hns_roce_wq *wq, int nreq,
 static struct hns_roce_qp *hns_roce_find_qp(struct hns_roce_context *ctx,
 					    uint32_t qpn)
 {
-	int tind = (qpn & (ctx->num_qps - 1)) >> ctx->qp_table_shift;
+	uint32_t tind = (qpn & (ctx->num_qps - 1)) >> ctx->qp_table_shift;
 
 	if (ctx->qp_table[tind].refcnt) {
 		return ctx->qp_table[tind].table[qpn & ctx->qp_table_mask];
@@ -232,7 +232,7 @@ static struct hns_roce_qp *hns_roce_find_qp(struct hns_roce_context *ctx,
 
 static void hns_roce_clear_qp(struct hns_roce_context *ctx, uint32_t qpn)
 {
-	int tind = (qpn & (ctx->num_qps - 1)) >> ctx->qp_table_shift;
+	uint32_t tind = (qpn & (ctx->num_qps - 1)) >> ctx->qp_table_shift;
 
 	if (!--ctx->qp_table[tind].refcnt)
 		free(ctx->qp_table[tind].table);
@@ -739,7 +739,7 @@ static int hns_roce_u_v1_post_recv(struct ibv_qp *ibvqp, struct ibv_recv_wr *wr,
 				   struct ibv_recv_wr **bad_wr)
 {
 	int ret = 0;
-	int nreq;
+	unsigned int nreq;
 	struct ibv_sge *sg;
 	struct hns_roce_rc_rq_wqe *rq_wqe;
 	struct hns_roce_qp *qp = to_hr_qp(ibvqp);
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 31a0681d..4943a5b1 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -247,7 +247,7 @@ static void *get_srq_wqe(struct hns_roce_srq *srq, unsigned int n)
 	return srq->wqe_buf.buf + (n << srq->wqe_shift);
 }
 
-static void *get_idx_buf(struct hns_roce_idx_que *idx_que, int n)
+static void *get_idx_buf(struct hns_roce_idx_que *idx_que, unsigned int n)
 {
 	return idx_que->buf.buf + (n << idx_que->entry_shift);
 }
@@ -331,7 +331,7 @@ static void hns_roce_v2_update_cq_cons_index(struct hns_roce_context *ctx,
 static struct hns_roce_qp *hns_roce_v2_find_qp(struct hns_roce_context *ctx,
 					       uint32_t qpn)
 {
-	int tind = (qpn & (ctx->num_qps - 1)) >> ctx->qp_table_shift;
+	uint32_t tind = (qpn & (ctx->num_qps - 1)) >> ctx->qp_table_shift;
 
 	if (ctx->qp_table[tind].refcnt)
 		return ctx->qp_table[tind].table[qpn & ctx->qp_table_mask];
@@ -961,9 +961,8 @@ static int fill_ud_data_seg(struct hns_roce_ud_sq_wqe *ud_sq_wqe,
 	return ret;
 }
 
-static int set_ud_wqe(void *wqe, struct hns_roce_qp *qp,
-		      struct ibv_send_wr *wr, int nreq,
-		      struct hns_roce_sge_info *sge_info)
+static int set_ud_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr,
+		      unsigned int nreq, struct hns_roce_sge_info *sge_info)
 {
 	struct hns_roce_ah *ah = to_hr_ah(wr->wr.ud.ah);
 	struct hns_roce_ud_sq_wqe *ud_sq_wqe = wqe;
@@ -1119,7 +1118,7 @@ static int check_rc_opcode(struct hns_roce_rc_sq_wqe *wqe,
 }
 
 static int set_rc_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr,
-		      int nreq, struct hns_roce_sge_info *sge_info)
+		      unsigned int nreq, struct hns_roce_sge_info *sge_info)
 {
 	struct hns_roce_rc_sq_wqe *rc_sq_wqe = wqe;
 	struct hns_roce_v2_wqe_data_seg *dseg;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 6/7] libhns: The content of the header file should be protected with #define
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
                   ` (4 preceding siblings ...)
  2021-11-09 12:41 ` [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields Wenpeng Liang
@ 2021-11-09 12:41 ` Wenpeng Liang
  2021-11-09 12:41 ` [PATCH rdma-core 7/7] libhns: The function declaration should be the same as the definition Wenpeng Liang
  2021-11-10 14:30 ` [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Leon Romanovsky
  7 siblings, 0 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:41 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

From: Xinhao Liu <liuxinhao5@hisilicon.com>

Header files should be protected with #define to prevent repeated
inclusion.

Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 providers/hns/hns_roce_u_db.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/providers/hns/hns_roce_u_db.h b/providers/hns/hns_roce_u_db.h
index b44e64d4..c3dd583a 100644
--- a/providers/hns/hns_roce_u_db.h
+++ b/providers/hns/hns_roce_u_db.h
@@ -30,13 +30,13 @@
  * SOFTWARE.
  */
 
+#ifndef _HNS_ROCE_U_DB_H
+#define _HNS_ROCE_U_DB_H
+
 #include <linux/types.h>
 
 #include "hns_roce_u.h"
 
-#ifndef _HNS_ROCE_U_DB_H
-#define _HNS_ROCE_U_DB_H
-
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define HNS_ROCE_PAIR_TO_64(val) ((uint64_t) val[1] << 32 | val[0])
 #elif __BYTE_ORDER == __BIG_ENDIAN
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH rdma-core 7/7] libhns: The function declaration should be the same as the definition
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
                   ` (5 preceding siblings ...)
  2021-11-09 12:41 ` [PATCH rdma-core 6/7] libhns: The content of the header file should be protected with #define Wenpeng Liang
@ 2021-11-09 12:41 ` Wenpeng Liang
  2021-11-10 14:30 ` [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Leon Romanovsky
  7 siblings, 0 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-09 12:41 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm

From: Xinhao Liu <liuxinhao5@hisilicon.com>

The parameter names should be the same when the function is declared and
defined.

Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
 providers/hns/hns_roce_u.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
index d5963941..1616db9f 100644
--- a/providers/hns/hns_roce_u.h
+++ b/providers/hns/hns_roce_u.h
@@ -368,9 +368,9 @@ int hns_roce_u_free_pd(struct ibv_pd *pd);
 
 struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 				 uint64_t hca_va, int access);
-int hns_roce_u_rereg_mr(struct verbs_mr *mr, int flags, struct ibv_pd *pd,
+int hns_roce_u_rereg_mr(struct verbs_mr *vmr, int flags, struct ibv_pd *pd,
 			void *addr, size_t length, int access);
-int hns_roce_u_dereg_mr(struct verbs_mr *mr);
+int hns_roce_u_dereg_mr(struct verbs_mr *vmr);
 
 struct ibv_mw *hns_roce_u_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type);
 int hns_roce_u_dealloc_mw(struct ibv_mw *mw);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms
  2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
                   ` (6 preceding siblings ...)
  2021-11-09 12:41 ` [PATCH rdma-core 7/7] libhns: The function declaration should be the same as the definition Wenpeng Liang
@ 2021-11-10 14:30 ` Leon Romanovsky
  7 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2021-11-10 14:30 UTC (permalink / raw)
  To: Wenpeng Liang; +Cc: jgg, linux-rdma, linuxarm

On Tue, Nov 09, 2021 at 08:40:56PM +0800, Wenpeng Liang wrote:
> Patch #1~#3: Remove redundant code.
> Patch #4~#5: Fix wrong type of printf format, variables and fields.
> Patch #6~#7: Other miscellaneous cleanup.
> 
> Lang Cheng (1):
>   libhns: Remove unused macros
> 
> Wenpeng Liang (1):
>   libhns: Remove unsupported QP type
> 
> Xinhao Liu (4):
>   libhns: Fix wrong print format for unsigned type
>   libhns: Fix wrong type of variables and fields
>   libhns: The content of the header file should be protected with
>     #define
>   libhns: The function declaration should be the same as the definition
> 
> Yixing Liu (1):
>   libhns: Remove redundant variable initialization

Applied, pending CI results
https://github.com/linux-rdma/rdma-core/pull/1082

Thanks

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields
  2021-11-09 12:41 ` [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields Wenpeng Liang
@ 2021-11-23 14:13   ` Jason Gunthorpe
  2021-11-24 11:39     ` Wenpeng Liang
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2021-11-23 14:13 UTC (permalink / raw)
  To: Wenpeng Liang; +Cc: leon, linux-rdma, linuxarm

On Tue, Nov 09, 2021 at 08:41:01PM +0800, Wenpeng Liang wrote:
> From: Xinhao Liu <liuxinhao5@hisilicon.com>
> 
> Some variables and fields should be in type of unsigned instead of signed.
> 
> Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
>  providers/hns/hns_roce_u.h       |  6 +++---
>  providers/hns/hns_roce_u_hw_v1.c |  6 +++---
>  providers/hns/hns_roce_u_hw_v2.c | 11 +++++------
>  3 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
> index 0d7abd81..d5963941 100644
> +++ b/providers/hns/hns_roce_u.h
> @@ -99,7 +99,7 @@
>  #define roce_set_bit(origin, shift, val) \
>  	roce_set_field((origin), (1ul << (shift)), (shift), (val))
>  
> -#define hr_ilog32(n)		ilog32((n) - 1)
> +#define hr_ilog32(n)		ilog32((unsigned int)(n) - 1)

This should be a static inline function not a macro, then it can have
the correct type.

Also please send this series as a PR on the github

Thanks,
Jason

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields
  2021-11-23 14:13   ` Jason Gunthorpe
@ 2021-11-24 11:39     ` Wenpeng Liang
  2021-11-24 15:40       ` Jason Gunthorpe
  0 siblings, 1 reply; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-24 11:39 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: leon, linux-rdma, linuxarm



On 2021/11/23 22:13, Jason Gunthorpe wrote:
> On Tue, Nov 09, 2021 at 08:41:01PM +0800, Wenpeng Liang wrote:
>> From: Xinhao Liu <liuxinhao5@hisilicon.com>
>>
>> Some variables and fields should be in type of unsigned instead of signed.
>>
>> Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
>> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
>>  providers/hns/hns_roce_u.h       |  6 +++---
>>  providers/hns/hns_roce_u_hw_v1.c |  6 +++---
>>  providers/hns/hns_roce_u_hw_v2.c | 11 +++++------
>>  3 files changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
>> index 0d7abd81..d5963941 100644
>> +++ b/providers/hns/hns_roce_u.h
>> @@ -99,7 +99,7 @@
>>  #define roce_set_bit(origin, shift, val) \
>>  	roce_set_field((origin), (1ul << (shift)), (shift), (val))
>>  
>> -#define hr_ilog32(n)		ilog32((n) - 1)
>> +#define hr_ilog32(n)		ilog32((unsigned int)(n) - 1)
> 
> This should be a static inline function not a macro, then it can have
> the correct type.
> 
> Also please send this series as a PR on the github
> 
> Thanks,
> Jason
> .
> 

I submitted a PR on the github:

https://github.com/linux-rdma/rdma-core/pull/1090

Thanks
Wenpeng

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields
  2021-11-24 11:39     ` Wenpeng Liang
@ 2021-11-24 15:40       ` Jason Gunthorpe
  2021-11-25 12:35         ` Wenpeng Liang
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2021-11-24 15:40 UTC (permalink / raw)
  To: Wenpeng Liang; +Cc: leon, linux-rdma, linuxarm

On Wed, Nov 24, 2021 at 07:39:34PM +0800, Wenpeng Liang wrote:
> 
> 
> On 2021/11/23 22:13, Jason Gunthorpe wrote:
> > On Tue, Nov 09, 2021 at 08:41:01PM +0800, Wenpeng Liang wrote:
> >> From: Xinhao Liu <liuxinhao5@hisilicon.com>
> >>
> >> Some variables and fields should be in type of unsigned instead of signed.
> >>
> >> Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
> >> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
> >>  providers/hns/hns_roce_u.h       |  6 +++---
> >>  providers/hns/hns_roce_u_hw_v1.c |  6 +++---
> >>  providers/hns/hns_roce_u_hw_v2.c | 11 +++++------
> >>  3 files changed, 11 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
> >> index 0d7abd81..d5963941 100644
> >> +++ b/providers/hns/hns_roce_u.h
> >> @@ -99,7 +99,7 @@
> >>  #define roce_set_bit(origin, shift, val) \
> >>  	roce_set_field((origin), (1ul << (shift)), (shift), (val))
> >>  
> >> -#define hr_ilog32(n)		ilog32((n) - 1)
> >> +#define hr_ilog32(n)		ilog32((unsigned int)(n) - 1)
> > 
> > This should be a static inline function not a macro, then it can have
> > the correct type.
> > 
> > Also please send this series as a PR on the github
> > 
> > Thanks,
> > Jason
> > .
> > 
> 
> I submitted a PR on the github:
> 
> https://github.com/linux-rdma/rdma-core/pull/1090

I mean of your whole series

Jason

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields
  2021-11-24 15:40       ` Jason Gunthorpe
@ 2021-11-25 12:35         ` Wenpeng Liang
  0 siblings, 0 replies; 13+ messages in thread
From: Wenpeng Liang @ 2021-11-25 12:35 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: leon, linux-rdma, linuxarm

On 2021/11/24 23:40, Jason Gunthorpe wrote:
> On Wed, Nov 24, 2021 at 07:39:34PM +0800, Wenpeng Liang wrote:
>>
>>
>> On 2021/11/23 22:13, Jason Gunthorpe wrote:
>>> On Tue, Nov 09, 2021 at 08:41:01PM +0800, Wenpeng Liang wrote:
>>>> From: Xinhao Liu <liuxinhao5@hisilicon.com>
>>>>
>>>> Some variables and fields should be in type of unsigned instead of signed.
>>>>
>>>> Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
>>>> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
>>>>  providers/hns/hns_roce_u.h       |  6 +++---
>>>>  providers/hns/hns_roce_u_hw_v1.c |  6 +++---
>>>>  providers/hns/hns_roce_u_hw_v2.c | 11 +++++------
>>>>  3 files changed, 11 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
>>>> index 0d7abd81..d5963941 100644
>>>> +++ b/providers/hns/hns_roce_u.h
>>>> @@ -99,7 +99,7 @@
>>>>  #define roce_set_bit(origin, shift, val) \
>>>>  	roce_set_field((origin), (1ul << (shift)), (shift), (val))
>>>>  
>>>> -#define hr_ilog32(n)		ilog32((n) - 1)
>>>> +#define hr_ilog32(n)		ilog32((unsigned int)(n) - 1)
>>>
>>> This should be a static inline function not a macro, then it can have
>>> the correct type.
>>>
>>> Also please send this series as a PR on the github
>>>
>>> Thanks,
>>> Jason
>>> .
>>>
>>
>> I submitted a PR on the github:
>>
>> https://github.com/linux-rdma/rdma-core/pull/1090
> 
> I mean of your whole series
> 
> Jason
> .
> 

This series has been merged into the master branch,
so I submit an independent PR to fix it.

Thanks
Wenpeng

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-11-25 12:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 12:40 [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Wenpeng Liang
2021-11-09 12:40 ` [PATCH rdma-core 1/7] libhns: Remove unused macros Wenpeng Liang
2021-11-09 12:40 ` [PATCH rdma-core 2/7] libhns: Remove unsupported QP type Wenpeng Liang
2021-11-09 12:40 ` [PATCH rdma-core 3/7] libhns: Remove redundant variable initialization Wenpeng Liang
2021-11-09 12:41 ` [PATCH rdma-core 4/7] libhns: Fix wrong print format for unsigned type Wenpeng Liang
2021-11-09 12:41 ` [PATCH rdma-core 5/7] libhns: Fix wrong type of variables and fields Wenpeng Liang
2021-11-23 14:13   ` Jason Gunthorpe
2021-11-24 11:39     ` Wenpeng Liang
2021-11-24 15:40       ` Jason Gunthorpe
2021-11-25 12:35         ` Wenpeng Liang
2021-11-09 12:41 ` [PATCH rdma-core 6/7] libhns: The content of the header file should be protected with #define Wenpeng Liang
2021-11-09 12:41 ` [PATCH rdma-core 7/7] libhns: The function declaration should be the same as the definition Wenpeng Liang
2021-11-10 14:30 ` [PATCH rdma-core 0/7] libhns: Cleanup about removing redundant code and cleaning up static alarms Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.