aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@voltaire.com>2006-02-02 13:43:45 -0500
committerRoland Dreier <rolandd@cisco.com>2006-03-20 13:08:10 -0500
commitd36f34aadf184d8cc4c240de2b6319ccea8334bb (patch)
tree20b7a77e03f3c75c9043a50ddd720a31048efa99
parent6dfc3901b04d1b79fa982d6de6d5af3b50c6cea8 (diff)
IB: Enable FMR pool user to set page size
This patch allows the consumer to set the page size of "pages" mapped by the pool FMRs, which is a feature already existing in the base verbs API. On the cosmetic side it changes ib_fmr_attr.page_size field to be named page_shift. Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/core/fmr_pool.c6
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c10
-rw-r--r--include/rdma/ib_fmr_pool.h2
-rw-r--r--include/rdma/ib_verbs.h2
4 files changed, 11 insertions, 9 deletions
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index d34a6f1c4f4c..838bf54458d2 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -278,9 +278,9 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
278 { 278 {
279 struct ib_pool_fmr *fmr; 279 struct ib_pool_fmr *fmr;
280 struct ib_fmr_attr attr = { 280 struct ib_fmr_attr attr = {
281 .max_pages = params->max_pages_per_fmr, 281 .max_pages = params->max_pages_per_fmr,
282 .max_maps = IB_FMR_MAX_REMAPS, 282 .max_maps = IB_FMR_MAX_REMAPS,
283 .page_size = PAGE_SHIFT 283 .page_shift = params->page_shift
284 }; 284 };
285 285
286 for (i = 0; i < params->pool_size; ++i) { 286 for (i = 0; i < params->pool_size; ++i) {
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 653f1321a13f..0b48048ad0f8 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -491,7 +491,7 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
491 int err = -ENOMEM; 491 int err = -ENOMEM;
492 int i; 492 int i;
493 493
494 if (mr->attr.page_size < 12 || mr->attr.page_size >= 32) 494 if (mr->attr.page_shift < 12 || mr->attr.page_shift >= 32)
495 return -EINVAL; 495 return -EINVAL;
496 496
497 /* For Arbel, all MTTs must fit in the same page. */ 497 /* For Arbel, all MTTs must fit in the same page. */
@@ -543,7 +543,7 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
543 MTHCA_MPT_FLAG_REGION | 543 MTHCA_MPT_FLAG_REGION |
544 access); 544 access);
545 545
546 mpt_entry->page_size = cpu_to_be32(mr->attr.page_size - 12); 546 mpt_entry->page_size = cpu_to_be32(mr->attr.page_shift - 12);
547 mpt_entry->key = cpu_to_be32(key); 547 mpt_entry->key = cpu_to_be32(key);
548 mpt_entry->pd = cpu_to_be32(pd); 548 mpt_entry->pd = cpu_to_be32(pd);
549 memset(&mpt_entry->start, 0, 549 memset(&mpt_entry->start, 0,
@@ -611,7 +611,7 @@ static inline int mthca_check_fmr(struct mthca_fmr *fmr, u64 *page_list,
611 if (list_len > fmr->attr.max_pages) 611 if (list_len > fmr->attr.max_pages)
612 return -EINVAL; 612 return -EINVAL;
613 613
614 page_mask = (1 << fmr->attr.page_size) - 1; 614 page_mask = (1 << fmr->attr.page_shift) - 1;
615 615
616 /* We are getting page lists, so va must be page aligned. */ 616 /* We are getting page lists, so va must be page aligned. */
617 if (iova & page_mask) 617 if (iova & page_mask)
@@ -659,7 +659,7 @@ int mthca_tavor_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
659 } 659 }
660 660
661 mpt_entry.lkey = cpu_to_be32(key); 661 mpt_entry.lkey = cpu_to_be32(key);
662 mpt_entry.length = cpu_to_be64(list_len * (1ull << fmr->attr.page_size)); 662 mpt_entry.length = cpu_to_be64(list_len * (1ull << fmr->attr.page_shift));
663 mpt_entry.start = cpu_to_be64(iova); 663 mpt_entry.start = cpu_to_be64(iova);
664 664
665 __raw_writel((__force u32) mpt_entry.lkey, &fmr->mem.tavor.mpt->key); 665 __raw_writel((__force u32) mpt_entry.lkey, &fmr->mem.tavor.mpt->key);
@@ -700,7 +700,7 @@ int mthca_arbel_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
700 700
701 fmr->mem.arbel.mpt->key = cpu_to_be32(key); 701 fmr->mem.arbel.mpt->key = cpu_to_be32(key);
702 fmr->mem.arbel.mpt->lkey = cpu_to_be32(key); 702 fmr->mem.arbel.mpt->lkey = cpu_to_be32(key);
703 fmr->mem.arbel.mpt->length = cpu_to_be64(list_len * (1ull << fmr->attr.page_size)); 703 fmr->mem.arbel.mpt->length = cpu_to_be64(list_len * (1ull << fmr->attr.page_shift));
704 fmr->mem.arbel.mpt->start = cpu_to_be64(iova); 704 fmr->mem.arbel.mpt->start = cpu_to_be64(iova);
705 705
706 wmb(); 706 wmb();
diff --git a/include/rdma/ib_fmr_pool.h b/include/rdma/ib_fmr_pool.h
index 86b7e93f198b..4ace54cd0cce 100644
--- a/include/rdma/ib_fmr_pool.h
+++ b/include/rdma/ib_fmr_pool.h
@@ -43,6 +43,7 @@ struct ib_fmr_pool;
43/** 43/**
44 * struct ib_fmr_pool_param - Parameters for creating FMR pool 44 * struct ib_fmr_pool_param - Parameters for creating FMR pool
45 * @max_pages_per_fmr:Maximum number of pages per map request. 45 * @max_pages_per_fmr:Maximum number of pages per map request.
46 * @page_shift: Log2 of sizeof "pages" mapped by this fmr
46 * @access:Access flags for FMRs in pool. 47 * @access:Access flags for FMRs in pool.
47 * @pool_size:Number of FMRs to allocate for pool. 48 * @pool_size:Number of FMRs to allocate for pool.
48 * @dirty_watermark:Flush is triggered when @dirty_watermark dirty 49 * @dirty_watermark:Flush is triggered when @dirty_watermark dirty
@@ -55,6 +56,7 @@ struct ib_fmr_pool;
55 */ 56 */
56struct ib_fmr_pool_param { 57struct ib_fmr_pool_param {
57 int max_pages_per_fmr; 58 int max_pages_per_fmr;
59 int page_shift;
58 enum ib_access_flags access; 60 enum ib_access_flags access;
59 int pool_size; 61 int pool_size;
60 int dirty_watermark; 62 int dirty_watermark;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 1d31c8cd5ce0..61a4390ae9d8 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -651,7 +651,7 @@ struct ib_mw_bind {
651struct ib_fmr_attr { 651struct ib_fmr_attr {
652 int max_pages; 652 int max_pages;
653 int max_maps; 653 int max_maps;
654 u8 page_size; 654 u8 page_shift;
655}; 655};
656 656
657struct ib_ucontext { 657struct ib_ucontext {