All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next 00/10] RDMA/hns: Updates for 5.14
@ 2021-06-18 10:10 Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 01/10] RDMA/hns: Force rewrite inline flag of WQE Weihang Li
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Weihang Li

As usual, this series collects some miscellaneous fixes and cleanups at the
end of 5.14 for the hns driver:
* #1 ~ #5 are fixes.
* #6 ~ #10 are some small cleanups.

Lang Cheng (2):
  RDMA/hns: Force rewrite inline flag of WQE
  RDMA/hns: Fix spelling mistakes of original

Wenpeng Liang (1):
  RDMA/hns: Encapsulate flushing CQE as a function

Xi Wang (1):
  RDMA/hns: Clean definitions of EQC structure

Yangyang Li (3):
  RDMA/hns: Add member assignments for qp_init_attr
  RDMA/hns: Delete unnecessary branch of hns_roce_v2_query_qp
  RDMA/hns: Modify function return value type

Yixing Liu (3):
  RDMA/hns: Fix uninitialized variable
  RDMA/hns: Fix some print issues
  RDMA/hns: Simplify the judgment in hns_roce_v2_post_send()

 drivers/infiniband/hw/hns/hns_roce_device.h |  5 ++-
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c  | 60 ++++++++---------------------
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h  | 19 ++-------
 drivers/infiniband/hw/hns/hns_roce_main.c   |  8 +---
 drivers/infiniband/hw/hns/hns_roce_mr.c     |  4 +-
 drivers/infiniband/hw/hns/hns_roce_qp.c     | 27 +++++++++----
 6 files changed, 44 insertions(+), 79 deletions(-)

-- 
2.7.4


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

* [PATCH for-next 01/10] RDMA/hns: Force rewrite inline flag of WQE
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 02/10] RDMA/hns: Fix uninitialized variable Weihang Li
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Lang Cheng, Weihang Li

From: Lang Cheng <chenglang@huawei.com>

When a non-inline WR reuses a WQE that was used for inline last time, the
remaining inline flag should be cleared.

Fixes: 62490fd5a865 ("RDMA/hns: Avoid unnecessary memset on WQEs in post_send")
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index fbc45b9..e71df58 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -274,8 +274,6 @@ static int set_rc_inl(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
 
 	dseg += sizeof(struct hns_roce_v2_rc_send_wqe);
 
-	roce_set_bit(rc_sq_wqe->byte_4, V2_RC_SEND_WQE_BYTE_4_INLINE_S, 1);
-
 	if (msg_len <= HNS_ROCE_V2_MAX_RC_INL_INN_SZ) {
 		roce_set_bit(rc_sq_wqe->byte_20,
 			     V2_RC_SEND_WQE_BYTE_20_INL_TYPE_S, 0);
@@ -320,6 +318,8 @@ static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
 		       V2_RC_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_S,
 		       (*sge_ind) & (qp->sge.sge_cnt - 1));
 
+	roce_set_bit(rc_sq_wqe->byte_4, V2_RC_SEND_WQE_BYTE_4_INLINE_S,
+		     !!(wr->send_flags & IB_SEND_INLINE));
 	if (wr->send_flags & IB_SEND_INLINE)
 		return set_rc_inl(qp, wr, rc_sq_wqe, sge_ind);
 
-- 
2.7.4


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

* [PATCH for-next 02/10] RDMA/hns: Fix uninitialized variable
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 01/10] RDMA/hns: Force rewrite inline flag of WQE Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 03/10] RDMA/hns: Fix some print issues Weihang Li
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Yixing Liu, Weihang Li

From: Yixing Liu <liuyixing1@huawei.com>

A random value will be returned if the condition below is not met, so it
needs to be initialized.

Fixes: 9ea9a53ea93b ("RDMA/hns: Add mapped page count checking for MTR")
Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index 8e6b1ae..c039743 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -776,7 +776,7 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
 	struct ib_device *ibdev = &hr_dev->ib_dev;
 	struct hns_roce_buf_region *r;
 	unsigned int i, mapped_cnt;
-	int ret;
+	int ret = 0;
 
 	/*
 	 * Only use the first page address as root ba when hopnum is 0, this
-- 
2.7.4


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

* [PATCH for-next 03/10] RDMA/hns: Fix some print issues
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 01/10] RDMA/hns: Force rewrite inline flag of WQE Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 02/10] RDMA/hns: Fix uninitialized variable Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 04/10] RDMA/hns: Add member assignments for qp_init_attr Weihang Li
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Yixing Liu, Weihang Li

From: Yixing Liu <liuyixing1@huawei.com>

Remove redundant print and fix a character type mismatch.

Fixes: 0e0ab04b5bbe ("RDMA/hns: Refactor the MTR creation flow")
Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_mr.c | 2 +-
 drivers/infiniband/hw/hns/hns_roce_qp.c | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index c039743..d9b779d 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -992,7 +992,7 @@ int hns_roce_mtr_create(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
 					&buf_page_shift,
 					udata ? user_addr & ~PAGE_MASK : 0);
 	if (buf_page_cnt < 1 || buf_page_shift < HNS_HW_PAGE_SHIFT) {
-		ibdev_err(ibdev, "failed to init mtr cfg, count %d shift %d.\n",
+		ibdev_err(ibdev, "failed to init mtr cfg, count %d shift %u.\n",
 			  buf_page_cnt, buf_page_shift);
 		return -EINVAL;
 	}
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 3a018a3..17b6ce2 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -648,9 +648,7 @@ static int set_kernel_sq_size(struct hns_roce_dev *hr_dev,
 
 	if (!cap->max_send_wr || cap->max_send_wr > hr_dev->caps.max_wqes ||
 	    cap->max_send_sge > hr_dev->caps.max_sq_sg) {
-		ibdev_err(ibdev,
-			  "failed to check SQ WR or SGE num, ret = %d.\n",
-			  -EINVAL);
+		ibdev_err(ibdev, "failed to check SQ WR or SGE num.\n");
 		return -EINVAL;
 	}
 
-- 
2.7.4


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

* [PATCH for-next 04/10] RDMA/hns: Add member assignments for qp_init_attr
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (2 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 03/10] RDMA/hns: Fix some print issues Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 05/10] RDMA/hns: Delete unnecessary branch of hns_roce_v2_query_qp Weihang Li
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Yangyang Li, Weihang Li

From: Yangyang Li <liyangyang20@huawei.com>

Some kernel ULPs need to use the return value of qp_init_attr, so add
member assignments for qp_init_attr.

Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08 SoC")
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index e71df58..65ed472 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -5411,6 +5411,11 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
 		qp_attr->cap.max_send_sge = 0;
 	}
 
+	qp_init_attr->qp_context = ibqp->qp_context;
+	qp_init_attr->qp_type = ibqp->qp_type;
+	qp_init_attr->recv_cq = ibqp->recv_cq;
+	qp_init_attr->send_cq = ibqp->send_cq;
+	qp_init_attr->srq = ibqp->srq;
 	qp_init_attr->cap = qp_attr->cap;
 	qp_init_attr->sq_sig_type = hr_qp->sq_signal_bits;
 
-- 
2.7.4


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

* [PATCH for-next 05/10] RDMA/hns: Delete unnecessary branch of hns_roce_v2_query_qp
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (3 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 04/10] RDMA/hns: Add member assignments for qp_init_attr Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 06/10] RDMA/hns: Clean definitions of EQC structure Weihang Li
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Yangyang Li, Weihang Li

From: Yangyang Li <liyangyang20@huawei.com>

When query_qp is called by userspace, max_send_wr and max_send_sge are set
to 0 by the kernel driver. However, the userspace does not use these two
return values from the kernel driver, but uses its own calculated values.
So there is no need for special treatment.

Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08 SoC")
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 65ed472..8d8f4d4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -5403,13 +5403,8 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
 	qp_attr->cap.max_recv_sge = hr_qp->rq.max_gs - hr_qp->rq.rsv_sge;
 	qp_attr->cap.max_inline_data = hr_qp->max_inline_data;
 
-	if (!ibqp->uobject) {
-		qp_attr->cap.max_send_wr = hr_qp->sq.wqe_cnt;
-		qp_attr->cap.max_send_sge = hr_qp->sq.max_gs;
-	} else {
-		qp_attr->cap.max_send_wr = 0;
-		qp_attr->cap.max_send_sge = 0;
-	}
+	qp_attr->cap.max_send_wr = hr_qp->sq.wqe_cnt;
+	qp_attr->cap.max_send_sge = hr_qp->sq.max_gs;
 
 	qp_init_attr->qp_context = ibqp->qp_context;
 	qp_init_attr->qp_type = ibqp->qp_type;
-- 
2.7.4


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

* [PATCH for-next 06/10] RDMA/hns: Clean definitions of EQC structure
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (4 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 05/10] RDMA/hns: Delete unnecessary branch of hns_roce_v2_query_qp Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 07/10] RDMA/hns: Modify function return value type Weihang Li
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Xi Wang, Weihang Li

From: Xi Wang <wangxi11@huawei.com>

Remove unused members in EQ context structure.

Fixes: 782832f25404 ("RDMA/hns: Simplify the function config_eqc()")
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
index cd361c0..8eb392b 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
@@ -1729,21 +1729,6 @@ struct hns_roce_v2_priv {
 	struct hns_roce_link_table ext_llm;
 };
 
-struct hns_roce_eq_context {
-	__le32	byte_4;
-	__le32	byte_8;
-	__le32	byte_12;
-	__le32	eqe_report_timer;
-	__le32	eqe_ba0;
-	__le32	eqe_ba1;
-	__le32	byte_28;
-	__le32	byte_32;
-	__le32	byte_36;
-	__le32	byte_40;
-	__le32	byte_44;
-	__le32	rsv[5];
-};
-
 struct hns_roce_dip {
 	u8 dgid[GID_LEN_V2];
 	u8 dip_idx;
@@ -1805,6 +1790,10 @@ struct hns_roce_dip {
 #define HNS_ROCE_V2_VF_ABN_INT_CFG_M GENMASK(2, 0)
 #define HNS_ROCE_V2_VF_EVENT_INT_EN_M GENMASK(0, 0)
 
+struct hns_roce_eq_context {
+	__le32	data[16];
+};
+
 #define EQC_FIELD_LOC(h, l) FIELD_LOC(struct hns_roce_eq_context, h, l)
 
 #define EQC_EQ_ST EQC_FIELD_LOC(1, 0)
-- 
2.7.4


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

* [PATCH for-next 07/10] RDMA/hns: Modify function return value type
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (5 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 06/10] RDMA/hns: Clean definitions of EQC structure Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 08/10] RDMA/hns: Encapsulate flushing CQE as a function Weihang Li
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Yangyang Li, Weihang Li

From: Yangyang Li <liyangyang20@huawei.com>

hns_roce_init_qp_table() will only return 0, because this function does not
need to return a value, so it is modified to void type.

Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_device.h | 2 +-
 drivers/infiniband/hw/hns/hns_roce_main.c   | 8 +-------
 drivers/infiniband/hw/hns/hns_roce_qp.c     | 4 +---
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 7d00d4c..c5524f1 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -1144,7 +1144,7 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
 int hns_roce_init_pd_table(struct hns_roce_dev *hr_dev);
 int hns_roce_init_mr_table(struct hns_roce_dev *hr_dev);
 void hns_roce_init_cq_table(struct hns_roce_dev *hr_dev);
-int hns_roce_init_qp_table(struct hns_roce_dev *hr_dev);
+void hns_roce_init_qp_table(struct hns_roce_dev *hr_dev);
 int hns_roce_init_srq_table(struct hns_roce_dev *hr_dev);
 int hns_roce_init_xrcd_table(struct hns_roce_dev *hr_dev);
 
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 6c6e82b..0ca0634 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -771,11 +771,7 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
 
 	hns_roce_init_cq_table(hr_dev);
 
-	ret = hns_roce_init_qp_table(hr_dev);
-	if (ret) {
-		dev_err(dev, "Failed to init queue pair table.\n");
-		goto err_cq_table_free;
-	}
+	hns_roce_init_qp_table(hr_dev);
 
 	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
 		ret = hns_roce_init_srq_table(hr_dev);
@@ -790,8 +786,6 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
 
 err_qp_table_free:
 	hns_roce_cleanup_qp_table(hr_dev);
-
-err_cq_table_free:
 	hns_roce_cleanup_cq_table(hr_dev);
 	hns_roce_cleanup_mr_table(hr_dev);
 
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 17b6ce2..5196369 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -1414,7 +1414,7 @@ bool hns_roce_wq_overflow(struct hns_roce_wq *hr_wq, u32 nreq,
 	return cur + nreq >= hr_wq->wqe_cnt;
 }
 
-int hns_roce_init_qp_table(struct hns_roce_dev *hr_dev)
+void hns_roce_init_qp_table(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;
 	unsigned int reserved_from_bot;
@@ -1437,8 +1437,6 @@ int hns_roce_init_qp_table(struct hns_roce_dev *hr_dev)
 					       HNS_ROCE_QP_BANK_NUM - 1;
 		hr_dev->qp_table.bank[i].next = hr_dev->qp_table.bank[i].min;
 	}
-
-	return 0;
 }
 
 void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev)
-- 
2.7.4


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

* [PATCH for-next 08/10] RDMA/hns: Encapsulate flushing CQE as a function
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (6 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 07/10] RDMA/hns: Modify function return value type Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 09/10] RDMA/hns: Simplify the judgment in hns_roce_v2_post_send() Weihang Li
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Wenpeng Liang, Weihang Li

From: Wenpeng Liang <liangwenpeng@huawei.com>

The process of flushing CQE can be encapsultated into a function, which can
reduce duplicate code.

Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_device.h |  1 +
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c  | 36 +++--------------------------
 drivers/infiniband/hw/hns/hns_roce_qp.c     | 19 +++++++++++++--
 3 files changed, 21 insertions(+), 35 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index c5524f1..9467b3e 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -1259,6 +1259,7 @@ void hns_roce_free_db(struct hns_roce_dev *hr_dev, struct hns_roce_db *db);
 
 void hns_roce_cq_completion(struct hns_roce_dev *hr_dev, u32 cqn);
 void hns_roce_cq_event(struct hns_roce_dev *hr_dev, u32 cqn, int event_type);
+void flush_cqe(struct hns_roce_dev *dev, struct hns_roce_qp *qp);
 void hns_roce_qp_event(struct hns_roce_dev *hr_dev, u32 qpn, int event_type);
 void hns_roce_srq_event(struct hns_roce_dev *hr_dev, u32 srqn, int event_type);
 u8 hns_get_gid_index(struct hns_roce_dev *hr_dev, u32 port, int gid_index);
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 8d8f4d4..921899f 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -629,18 +629,8 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
 static inline void update_sq_db(struct hns_roce_dev *hr_dev,
 				struct hns_roce_qp *qp)
 {
-	/*
-	 * Hip08 hardware cannot flush the WQEs in SQ if the QP state
-	 * gets into errored mode. Hence, as a workaround to this
-	 * hardware limitation, driver needs to assist in flushing. But
-	 * the flushing operation uses mailbox to convey the QP state to
-	 * the hardware and which can sleep due to the mutex protection
-	 * around the mailbox calls. Hence, use the deferred flush for
-	 * now.
-	 */
 	if (unlikely(qp->state == IB_QPS_ERR)) {
-		if (!test_and_set_bit(HNS_ROCE_FLUSH_FLAG, &qp->flush_flag))
-			init_flush_work(hr_dev, qp);
+		flush_cqe(hr_dev, qp);
 	} else {
 		struct hns_roce_v2_db sq_db = {};
 
@@ -663,18 +653,8 @@ static inline void update_sq_db(struct hns_roce_dev *hr_dev,
 static inline void update_rq_db(struct hns_roce_dev *hr_dev,
 				struct hns_roce_qp *qp)
 {
-	/*
-	 * Hip08 hardware cannot flush the WQEs in RQ if the QP state
-	 * gets into errored mode. Hence, as a workaround to this
-	 * hardware limitation, driver needs to assist in flushing. But
-	 * the flushing operation uses mailbox to convey the QP state to
-	 * the hardware and which can sleep due to the mutex protection
-	 * around the mailbox calls. Hence, use the deferred flush for
-	 * now.
-	 */
 	if (unlikely(qp->state == IB_QPS_ERR)) {
-		if (!test_and_set_bit(HNS_ROCE_FLUSH_FLAG, &qp->flush_flag))
-			init_flush_work(hr_dev, qp);
+		flush_cqe(hr_dev, qp);
 	} else {
 		if (likely(qp->en_flags & HNS_ROCE_QP_CAP_RQ_RECORD_DB)) {
 			*qp->rdb.db_record =
@@ -3514,17 +3494,7 @@ static void get_cqe_status(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp,
 	if (cqe_status == HNS_ROCE_CQE_V2_GENERAL_ERR)
 		return;
 
-	/*
-	 * Hip08 hardware cannot flush the WQEs in SQ/RQ if the QP state gets
-	 * into errored mode. Hence, as a workaround to this hardware
-	 * limitation, driver needs to assist in flushing. But the flushing
-	 * operation uses mailbox to convey the QP state to the hardware and
-	 * which can sleep due to the mutex protection around the mailbox calls.
-	 * Hence, use the deferred flush for now. Once wc error detected, the
-	 * flushing operation is needed.
-	 */
-	if (!test_and_set_bit(HNS_ROCE_FLUSH_FLAG, &qp->flush_flag))
-		init_flush_work(hr_dev, qp);
+	flush_cqe(hr_dev, qp);
 }
 
 static int get_cur_qp(struct hns_roce_cq *hr_cq, struct hns_roce_v2_cqe *cqe,
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 5196369..8a2076d 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -79,6 +79,21 @@ void init_flush_work(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp)
 	queue_work(hr_dev->irq_workq, &flush_work->work);
 }
 
+void flush_cqe(struct hns_roce_dev *dev, struct hns_roce_qp *qp)
+{
+	/*
+	 * Hip08 hardware cannot flush the WQEs in SQ/RQ if the QP state
+	 * gets into errored mode. Hence, as a workaround to this
+	 * hardware limitation, driver needs to assist in flushing. But
+	 * the flushing operation uses mailbox to convey the QP state to
+	 * the hardware and which can sleep due to the mutex protection
+	 * around the mailbox calls. Hence, use the deferred flush for
+	 * now.
+	 */
+	if (!test_and_set_bit(HNS_ROCE_FLUSH_FLAG, &qp->flush_flag))
+		init_flush_work(dev, qp);
+}
+
 void hns_roce_qp_event(struct hns_roce_dev *hr_dev, u32 qpn, int event_type)
 {
 	struct device *dev = hr_dev->dev;
@@ -102,8 +117,8 @@ void hns_roce_qp_event(struct hns_roce_dev *hr_dev, u32 qpn, int event_type)
 	     event_type == HNS_ROCE_EVENT_TYPE_XRCD_VIOLATION ||
 	     event_type == HNS_ROCE_EVENT_TYPE_INVALID_XRCETH)) {
 		qp->state = IB_QPS_ERR;
-		if (!test_and_set_bit(HNS_ROCE_FLUSH_FLAG, &qp->flush_flag))
-			init_flush_work(hr_dev, qp);
+
+		flush_cqe(hr_dev, qp);
 	}
 
 	qp->event(qp, (enum hns_roce_event)event_type);
-- 
2.7.4


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

* [PATCH for-next 09/10] RDMA/hns: Simplify the judgment in hns_roce_v2_post_send()
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (7 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 08/10] RDMA/hns: Encapsulate flushing CQE as a function Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-18 10:10 ` [PATCH for-next 10/10] RDMA/hns: Fix spelling mistakes of original Weihang Li
  2021-06-22 18:25 ` [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Jason Gunthorpe
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Yixing Liu, Weihang Li

From: Yixing Liu <liuyixing1@huawei.com>

The QP type has been checked in check_send_valid(), if it's not RC, it will
process the UD/GSI branch.

Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 921899f..cd641cb 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -755,10 +755,10 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
 		       ~(((qp->sq.head + nreq) >> ilog2(qp->sq.wqe_cnt)) & 0x1);
 
 		/* Corresponding to the QP type, wqe process separately */
-		if (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_UD)
-			ret = set_ud_wqe(qp, wr, wqe, &sge_idx, owner_bit);
-		else if (ibqp->qp_type == IB_QPT_RC)
+		if (ibqp->qp_type == IB_QPT_RC)
 			ret = set_rc_wqe(qp, wr, wqe, &sge_idx, owner_bit);
+		else
+			ret = set_ud_wqe(qp, wr, wqe, &sge_idx, owner_bit);
 
 		if (unlikely(ret)) {
 			*bad_wr = wr;
-- 
2.7.4


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

* [PATCH for-next 10/10] RDMA/hns: Fix spelling mistakes of original
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (8 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 09/10] RDMA/hns: Simplify the judgment in hns_roce_v2_post_send() Weihang Li
@ 2021-06-18 10:10 ` Weihang Li
  2021-06-22 18:25 ` [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Jason Gunthorpe
  10 siblings, 0 replies; 12+ messages in thread
From: Weihang Li @ 2021-06-18 10:10 UTC (permalink / raw)
  To: dledford, jgg; +Cc: leon, linux-rdma, linuxarm, Lang Cheng, Weihang Li

From: Lang Cheng <chenglang@huawei.com>

'orignal' should be 'original'.

Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 9467b3e..3a519e8 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -336,7 +336,7 @@ struct hns_roce_mw {
 
 struct hns_roce_mr {
 	struct ib_mr		ibmr;
-	u64			iova; /* MR's virtual orignal addr */
+	u64			iova; /* MR's virtual original addr */
 	u64			size; /* Address range of MR */
 	u32			key; /* Key of MR */
 	u32			pd;   /* PD num of MR */
-- 
2.7.4


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

* Re: [PATCH for-next 00/10] RDMA/hns: Updates for 5.14
  2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
                   ` (9 preceding siblings ...)
  2021-06-18 10:10 ` [PATCH for-next 10/10] RDMA/hns: Fix spelling mistakes of original Weihang Li
@ 2021-06-22 18:25 ` Jason Gunthorpe
  10 siblings, 0 replies; 12+ messages in thread
From: Jason Gunthorpe @ 2021-06-22 18:25 UTC (permalink / raw)
  To: Weihang Li; +Cc: dledford, leon, linux-rdma, linuxarm

On Fri, Jun 18, 2021 at 06:10:10PM +0800, Weihang Li wrote:
> As usual, this series collects some miscellaneous fixes and cleanups at the
> end of 5.14 for the hns driver:
> * #1 ~ #5 are fixes.
> * #6 ~ #10 are some small cleanups.
> 
> Lang Cheng (2):
>   RDMA/hns: Force rewrite inline flag of WQE
>   RDMA/hns: Fix spelling mistakes of original
> 
> Wenpeng Liang (1):
>   RDMA/hns: Encapsulate flushing CQE as a function
> 
> Xi Wang (1):
>   RDMA/hns: Clean definitions of EQC structure
> 
> Yangyang Li (3):
>   RDMA/hns: Add member assignments for qp_init_attr
>   RDMA/hns: Delete unnecessary branch of hns_roce_v2_query_qp
>   RDMA/hns: Modify function return value type
> 
> Yixing Liu (3):
>   RDMA/hns: Fix uninitialized variable
>   RDMA/hns: Fix some print issues
>   RDMA/hns: Simplify the judgment in hns_roce_v2_post_send()

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2021-06-22 18:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 10:10 [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Weihang Li
2021-06-18 10:10 ` [PATCH for-next 01/10] RDMA/hns: Force rewrite inline flag of WQE Weihang Li
2021-06-18 10:10 ` [PATCH for-next 02/10] RDMA/hns: Fix uninitialized variable Weihang Li
2021-06-18 10:10 ` [PATCH for-next 03/10] RDMA/hns: Fix some print issues Weihang Li
2021-06-18 10:10 ` [PATCH for-next 04/10] RDMA/hns: Add member assignments for qp_init_attr Weihang Li
2021-06-18 10:10 ` [PATCH for-next 05/10] RDMA/hns: Delete unnecessary branch of hns_roce_v2_query_qp Weihang Li
2021-06-18 10:10 ` [PATCH for-next 06/10] RDMA/hns: Clean definitions of EQC structure Weihang Li
2021-06-18 10:10 ` [PATCH for-next 07/10] RDMA/hns: Modify function return value type Weihang Li
2021-06-18 10:10 ` [PATCH for-next 08/10] RDMA/hns: Encapsulate flushing CQE as a function Weihang Li
2021-06-18 10:10 ` [PATCH for-next 09/10] RDMA/hns: Simplify the judgment in hns_roce_v2_post_send() Weihang Li
2021-06-18 10:10 ` [PATCH for-next 10/10] RDMA/hns: Fix spelling mistakes of original Weihang Li
2021-06-22 18:25 ` [PATCH for-next 00/10] RDMA/hns: Updates for 5.14 Jason Gunthorpe

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.