From: Joachim Fenkes <fenkes@de.ibm.com>
To: "LinuxPPC-Dev" <linuxppc-dev@ozlabs.org>,
LKML <linux-kernel@vger.kernel.org>,
"OF-General" <general@lists.openfabrics.org>,
"OF-EWG" <ewg@lists.openfabrics.org>
Cc: Roland Dreier <rolandd@cisco.com>,
"Hoang-Nam Nguyen" <hnguyen@de.ibm.com>,
Christoph Raisch <raisch@de.ibm.com>,
Stefan Roscher <stefan.roscher@de.ibm.com>
Subject: [PATCH 3/5] IB/ehca: Fix ehca_encode_hwpage_size() and alloc_fmr()
Date: Tue, 16 Oct 2007 17:26:54 +0200 [thread overview]
Message-ID: <200710161726.54648.fenkes@de.ibm.com> (raw)
In-Reply-To: <200710161722.29144.fenkes@de.ibm.com>
Simplify ehca_encode_hwpage_size(), fixing an infinite loop for pgsize == 0
in the process. Fix the bug in alloc_fmr() that triggered the loop.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
drivers/infiniband/hw/ehca/ehca_mrmw.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 16c9efd..b9a788c 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -72,17 +72,9 @@ enum ehca_mr_pgsize {
static u32 ehca_encode_hwpage_size(u32 pgsize)
{
- u32 idx = 0;
- pgsize >>= 12;
- /*
- * map mr page size into hw code:
- * 0, 1, 2, 3 for 4K, 64K, 1M, 64M
- */
- while (!(pgsize & 1)) {
- idx++;
- pgsize >>= 4;
- }
- return idx;
+ int log = ilog2(pgsize);
+ WARN_ON(log < 12 || log > 24 || log & 3);
+ return (log - 12) / 4;
}
static u64 ehca_get_max_hwpage_size(struct ehca_shca *shca)
@@ -826,6 +818,7 @@ struct ib_fmr *ehca_alloc_fmr(struct ib_pd *pd,
/* register MR on HCA */
memset(&pginfo, 0, sizeof(pginfo));
+ pginfo.hwpage_size = hw_pgsize;
/*
* pginfo.num_hwpages==0, ie register_rpages() will not be called
* but deferred to map_phys_fmr()
--
1.5.2
next prev parent reply other threads:[~2007-10-16 15:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-16 15:22 [PATCH 0/5] IB/ehca: SRQ and MR/MW fixes Joachim Fenkes
2007-10-16 15:24 ` [PATCH 1/5] IB/ehca: Supply QP token for SRQ base QPs Joachim Fenkes
2007-10-16 15:25 ` [PATCH 2/5] IB/ehca: Fix masking error in {,re}reg_phys_mr() Joachim Fenkes
2007-10-16 15:26 ` Joachim Fenkes [this message]
2007-10-16 15:31 ` [PATCH 4/5] IB/ehca: Change meaning of hca_cap_mr_pgsize Joachim Fenkes
2007-10-16 15:31 ` [PATCH 5/5] IB/ehca: Enable large page MRs by default Joachim Fenkes
2007-10-18 4:48 ` Roland Dreier
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=200710161726.54648.fenkes@de.ibm.com \
--to=fenkes@de.ibm.com \
--cc=ewg@lists.openfabrics.org \
--cc=general@lists.openfabrics.org \
--cc=hnguyen@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=raisch@de.ibm.com \
--cc=rolandd@cisco.com \
--cc=stefan.roscher@de.ibm.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