All of lore.kernel.org
 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 5/9] RDMA/hns: Fix error with to_hr_hem_entries_count()
Date: Fri, 8 May 2020 17:45:55 +0800	[thread overview]
Message-ID: <1588931159-56875-6-git-send-email-liweihang@huawei.com> (raw)
In-Reply-To: <1588931159-56875-1-git-send-email-liweihang@huawei.com>

For ilog2(x), if x is 0 and not a constant variable, it will return -1. And
there will be an error as below:

hns3 0000:7d:00.0 hns_0: Local work queue 0x8 catast error, sub_event type is: 2

So modify to_hr_hem_entries_shift() to return 0 if conut is 0.

Fixes: 54d6638765b0 ("RDMA/hns: Optimize WQE buffer size calculating process")
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_device.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 5cac14d..5564773 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -1111,6 +1111,9 @@ static inline u32 to_hr_hem_entries_count(u32 count, u32 buf_shift)
 
 static inline u32 to_hr_hem_entries_shift(u32 count, u32 buf_shift)
 {
+	if (!count)
+		return 0;
+
 	return ilog2(to_hr_hem_entries_count(count, buf_shift));
 }
 
-- 
2.8.1


  parent reply	other threads:[~2020-05-08  9:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08  9:45 [PATCH for-next 0/9] RDMA/hns: Various fixes and cleanups Weihang Li
2020-05-08  9:45 ` [PATCH for-next 1/9] RDMA/hns: Bugfix for querying qkey Weihang Li
2020-05-08  9:45 ` [PATCH for-next 2/9] RDMA/hns: Fix cmdq parameter of querying pf timer resource Weihang Li
2020-05-08  9:45 ` [PATCH for-next 3/9] RDMA/hns: Fix assignment to ba_pg_sz of eqe Weihang Li
2020-05-08  9:45 ` [PATCH for-next 4/9] RDMA/hns: Fix wrong assignment of SRQ's max_wr Weihang Li
2020-05-08  9:45 ` Weihang Li [this message]
2020-05-08  9:45 ` [PATCH for-next 6/9] RDMA/hns: Store mr len information into mr obj Weihang Li
2020-05-08  9:45 ` [PATCH for-next 7/9] RDMA/hns: Remove redundant memcpy() Weihang Li
2020-05-08  9:45 ` [PATCH for-next 8/9] RDMA/hns: Rename macro for defining hns hardware page size Weihang Li
2020-05-08  9:45 ` [PATCH for-next 9/9] RDMA/hns: Reserve one sge in order to avoid local length error Weihang Li
2020-05-22  7:39 ` [PATCH for-next 0/9] RDMA/hns: Various fixes and cleanups liweihang
2020-05-22  9:01   ` liweihang
2020-05-22 14:28   ` 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=1588931159-56875-6-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 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.