public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
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>,
	Roland Dreier <rolandd@cisco•com>
Cc: Stefan Roscher <stefan.roscher@de•ibm.com>,
	Christoph Raisch <raisch@de•ibm.com>
Subject: [PATCH 05/10] IB/ehca: use #define for "pages per register_rpage" instead of hardcoded value
Date: Thu, 12 Jul 2007 17:51:04 +0200	[thread overview]
Message-ID: <200707121751.05587.fenkes@de.ibm.com> (raw)
In-Reply-To: <200707121745.27592.fenkes@de.ibm.com>

From: Hoang-Nam Nguyen <hnguyen@de•ibm.com>

Signed-off-by: Joachim Fenkes <fenkes@de•ibm.com>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 7c1656a..1fe4f72 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -48,6 +48,9 @@
 #include "hcp_if.h"
 #include "hipz_hw.h"
 
+/* max number of rpages (per hcall register_rpages) */
+#define MAX_RPAGES 512
+
 static struct kmem_cache *mr_cache;
 static struct kmem_cache *mw_cache;
 
@@ -1027,14 +1030,14 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
 	}
 
 	/* max 512 pages per shot */
-	for (i = 0; i < ((pginfo->num_4k + 512 - 1) / 512); i++) {
+	for (i = 0; i < ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES); i++) {
 
-		if (i == ((pginfo->num_4k + 512 - 1) / 512) - 1) {
-			rnum = pginfo->num_4k % 512; /* last shot */
+		if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
+			rnum = pginfo->num_4k % MAX_RPAGES; /* last shot */
 			if (rnum == 0)
-				rnum = 512;      /* last shot is full */
+				rnum = MAX_RPAGES;      /* last shot is full */
 		} else
-			rnum = 512;
+			rnum = MAX_RPAGES;
 
 		if (rnum > 1) {
 			ret = ehca_set_pagebuf(e_mr, pginfo, rnum, kpage);
@@ -1066,7 +1069,7 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
 						 0, /* pagesize 4k */
 						 0, rpage, rnum);
 
-		if (i == ((pginfo->num_4k + 512 - 1) / 512) - 1) {
+		if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
 			/*
 			 * check for 'registration complete'==H_SUCCESS
 			 * and for 'page registered'==H_PAGE_REGISTERED
@@ -1215,7 +1218,7 @@ int ehca_rereg_mr(struct ehca_shca *shca,
 	int rereg_3_hcall = 0; /* 1: use 3 hipz calls for reregistration */
 
 	/* first determine reregistration hCall(s) */
-	if ((pginfo->num_4k > 512) || (e_mr->num_4k > 512) ||
+	if ((pginfo->num_4k > MAX_RPAGES) || (e_mr->num_4k > MAX_RPAGES) ||
 	    (pginfo->num_4k > e_mr->num_4k)) {
 		ehca_dbg(&shca->ib_device, "Rereg3 case, pginfo->num_4k=%lx "
 			 "e_mr->num_4k=%x", pginfo->num_4k, e_mr->num_4k);
@@ -1306,7 +1309,7 @@ int ehca_unmap_one_fmr(struct ehca_shca *shca,
 	struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
 
 	/* first check if reregistration hCall can be used for unmap */
-	if (e_fmr->fmr_max_pages > 512) {
+	if (e_fmr->fmr_max_pages > MAX_RPAGES) {
 		rereg_1_hcall = 0;
 		rereg_3_hcall = 1;
 	}
-- 
1.5.2

  parent reply	other threads:[~2007-07-12 15:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-12 15:45 [PATCH 00/10] IB/ehca: Multiple Event Queues, MR/MW rework, large page MRs, fixes Joachim Fenkes
2007-07-12 15:46 ` [PATCH 01/10] IB/ehca: Support for multiple event queues Joachim Fenkes
2007-07-16 16:04   ` Roland Dreier
2007-07-16 20:34     ` Joachim Fenkes
2007-07-16 20:37     ` Hoang-Nam Nguyen
2007-07-17  3:48       ` Roland Dreier
2007-07-17  4:37         ` Michael S. Tsirkin
2007-07-17 17:52           ` Roland Dreier
2007-07-17 21:32             ` Michael S. Tsirkin
2007-07-19 15:03             ` Hoang-Nam Nguyen
2007-07-17  5:57         ` [ofa-general] " Shirley Ma
2007-07-12 15:47 ` [PATCH 02/10] IB/ehca: Fix HW level autodetection Joachim Fenkes
2007-07-12 15:48 ` [PATCH 03/10] IB/ehca: fix memory leak in error path of ehca_get_dma_mr() Joachim Fenkes
2007-07-12 15:49 ` [PATCH 04/10] IB/ehca: use common error code mapping instead of specific ones Joachim Fenkes
2007-07-16 17:14   ` Roland Dreier
2007-07-16 20:35     ` Joachim Fenkes
2007-07-12 15:51 ` Joachim Fenkes [this message]
2007-07-12 15:51 ` [PATCH 06/10] IB/ehca: use macro to calculate number of chunks in a mem block Joachim Fenkes
2007-07-12 15:52 ` [PATCH 07/10] IB/ehca: MR/MW structure refactoring Joachim Fenkes
2007-07-12 15:53 ` [PATCH 08/10] IB/ehca: Restructure ehca_set_pagebuf() Joachim Fenkes
2007-07-12 15:53 ` [PATCH 09/10] IB/ehca: Fix warnings issued by checkpatch.pl Joachim Fenkes
2007-07-12 15:54 ` [PATCH 10/10] IB/ehca: Support large page MRs Joachim Fenkes
2007-07-16 17:37   ` Roland Dreier
2007-07-16 21:11     ` Joachim Fenkes
2007-07-17  3:50       ` Roland Dreier
2007-07-17  6:29         ` Joachim Fenkes
2007-07-12 17:15 ` [PATCH 00/10] IB/ehca: Multiple Event Queues, MR/MW rework, large page MRs, fixes Roland Dreier
2007-07-13  8:26   ` Joachim Fenkes

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=200707121751.05587.fenkes@de.ibm.com \
    --to=fenkes@de$(echo .)ibm.com \
    --cc=general@lists$(echo .)openfabrics.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=raisch@de$(echo .)ibm.com \
    --cc=rolandd@cisco$(echo .)com \
    --cc=stefan.roscher@de$(echo .)ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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