linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Weihang Li <liweihang@huawei.com>
To: <dledford@redhat.com>, <jgg@ziepe.ca>
Cc: <leon@kernel.org>, <linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH for-next 4/4] RDMA/hns: Make the end of sge process more clear
Date: Fri, 22 May 2020 21:02:59 +0800	[thread overview]
Message-ID: <1590152579-32364-5-git-send-email-liweihang@huawei.com> (raw)
In-Reply-To: <1590152579-32364-1-git-send-email-liweihang@huawei.com>

From: Yixian Liu <liuyixian@huawei.com>

Instead of i with the sge number of wr will make the comparision more
clear, that is, when the sge number in wr is small than the maximum
supported sge number in the queue, then a stop sge needed to be filled at
the end of sges in wr.

Signed-off-by: Yixian Liu <liuyixian@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 e02afd2..d8b3d86 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -646,7 +646,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
 			dseg++;
 		}
 
-		if (i < hr_qp->rq.max_gs) {
+		if (wr->num_sge < hr_qp->rq.max_gs) {
 			dseg->lkey = cpu_to_le32(HNS_ROCE_INVALID_LKEY);
 			dseg->addr = 0;
 			dseg->len = cpu_to_le32(HNS_ROCE_INVALID_SGE_LENGTH);
@@ -782,7 +782,7 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,
 			dseg[i].addr = cpu_to_le64(wr->sg_list[i].addr);
 		}
 
-		if (i < srq->max_gs) {
+		if (wr->num_sge < srq->max_gs) {
 			dseg[i].len = cpu_to_le32(HNS_ROCE_INVALID_SGE_LENGTH);
 			dseg[i].lkey = cpu_to_le32(HNS_ROCE_INVALID_LKEY);
 			dseg[i].addr = 0;
-- 
2.8.1


  parent reply	other threads:[~2020-05-22 13:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 13:02 [PATCH for-next 0/4] RDMA/hns: Misc cleanups Weihang Li
2020-05-22 13:02 ` [PATCH for-next 1/4] RDMA/hns: Remove redundant type cast for general pointers Weihang Li
2020-05-22 13:02 ` [PATCH for-next 2/4] RDMA/hns: Remove redundant parameters from free_srq/qp_wrid() Weihang Li
2020-05-22 13:02 ` [PATCH for-next 3/4] RDMA/hns: Simplify process related to poll cq Weihang Li
2020-05-22 13:02 ` Weihang Li [this message]
2020-05-25 17:22 ` [PATCH for-next 0/4] RDMA/hns: Misc cleanups Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1590152579-32364-5-git-send-email-liweihang@huawei.com \
    --to=liweihang@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).