aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHoang-Nam Nguyen <hnguyen@de.ibm.com>2007-07-12 11:51:04 -0400
committerRoland Dreier <rolandd@cisco.com>2007-07-17 21:37:39 -0400
commit4e4e74cae73325c9f8513fae3a5bd9f79458f4a7 (patch)
tree0adcdffcc3f47eac3bb5bf41c39e386de99b23eb /drivers
parenta1a6ff11006c3a056cda9e8b13e7388fba3e69a1 (diff)
IB/ehca: Use #define for "pages per register_rpage" instead of hardcoded value
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_mrmw.c19
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 7c1656a7e1af..1fe4f726cee9 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -48,6 +48,9 @@
48#include "hcp_if.h" 48#include "hcp_if.h"
49#include "hipz_hw.h" 49#include "hipz_hw.h"
50 50
51/* max number of rpages (per hcall register_rpages) */
52#define MAX_RPAGES 512
53
51static struct kmem_cache *mr_cache; 54static struct kmem_cache *mr_cache;
52static struct kmem_cache *mw_cache; 55static struct kmem_cache *mw_cache;
53 56
@@ -1027,14 +1030,14 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
1027 } 1030 }
1028 1031
1029 /* max 512 pages per shot */ 1032 /* max 512 pages per shot */
1030 for (i = 0; i < ((pginfo->num_4k + 512 - 1) / 512); i++) { 1033 for (i = 0; i < ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES); i++) {
1031 1034
1032 if (i == ((pginfo->num_4k + 512 - 1) / 512) - 1) { 1035 if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
1033 rnum = pginfo->num_4k % 512; /* last shot */ 1036 rnum = pginfo->num_4k % MAX_RPAGES; /* last shot */
1034 if (rnum == 0) 1037 if (rnum == 0)
1035 rnum = 512; /* last shot is full */ 1038 rnum = MAX_RPAGES; /* last shot is full */
1036 } else 1039 } else
1037 rnum = 512; 1040 rnum = MAX_RPAGES;
1038 1041
1039 if (rnum > 1) { 1042 if (rnum > 1) {
1040 ret = ehca_set_pagebuf(e_mr, pginfo, rnum, kpage); 1043 ret = ehca_set_pagebuf(e_mr, pginfo, rnum, kpage);
@@ -1066,7 +1069,7 @@ int ehca_reg_mr_rpages(struct ehca_shca *shca,
1066 0, /* pagesize 4k */ 1069 0, /* pagesize 4k */
1067 0, rpage, rnum); 1070 0, rpage, rnum);
1068 1071
1069 if (i == ((pginfo->num_4k + 512 - 1) / 512) - 1) { 1072 if (i == ((pginfo->num_4k + MAX_RPAGES - 1) / MAX_RPAGES) - 1) {
1070 /* 1073 /*
1071 * check for 'registration complete'==H_SUCCESS 1074 * check for 'registration complete'==H_SUCCESS
1072 * and for 'page registered'==H_PAGE_REGISTERED 1075 * and for 'page registered'==H_PAGE_REGISTERED
@@ -1215,7 +1218,7 @@ int ehca_rereg_mr(struct ehca_shca *shca,
1215 int rereg_3_hcall = 0; /* 1: use 3 hipz calls for reregistration */ 1218 int rereg_3_hcall = 0; /* 1: use 3 hipz calls for reregistration */
1216 1219
1217 /* first determine reregistration hCall(s) */ 1220 /* first determine reregistration hCall(s) */
1218 if ((pginfo->num_4k > 512) || (e_mr->num_4k > 512) || 1221 if ((pginfo->num_4k > MAX_RPAGES) || (e_mr->num_4k > MAX_RPAGES) ||
1219 (pginfo->num_4k > e_mr->num_4k)) { 1222 (pginfo->num_4k > e_mr->num_4k)) {
1220 ehca_dbg(&shca->ib_device, "Rereg3 case, pginfo->num_4k=%lx " 1223 ehca_dbg(&shca->ib_device, "Rereg3 case, pginfo->num_4k=%lx "
1221 "e_mr->num_4k=%x", pginfo->num_4k, e_mr->num_4k); 1224 "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,
1306 struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0}; 1309 struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
1307 1310
1308 /* first check if reregistration hCall can be used for unmap */ 1311 /* first check if reregistration hCall can be used for unmap */
1309 if (e_fmr->fmr_max_pages > 512) { 1312 if (e_fmr->fmr_max_pages > MAX_RPAGES) {
1310 rereg_1_hcall = 0; 1313 rereg_1_hcall = 0;
1311 rereg_3_hcall = 1; 1314 rereg_3_hcall = 1;
1312 } 1315 }