From patchwork Fri Aug 7 14:51:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Marciniszyn, Mike" X-Patchwork-Id: 6970191 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 58B4D9F46B for ; Fri, 7 Aug 2015 14:55:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 793FC204EA for ; Fri, 7 Aug 2015 14:55:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 68BD2204E3 for ; Fri, 7 Aug 2015 14:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754142AbbHGOzs (ORCPT ); Fri, 7 Aug 2015 10:55:48 -0400 Received: from mga03.intel.com ([134.134.136.65]:11600 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932249AbbHGOv1 (ORCPT ); Fri, 7 Aug 2015 10:51:27 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 07 Aug 2015 07:51:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,630,1432623600"; d="scan'208";a="621211728" Received: from sedona.ch.intel.com ([143.182.228.65]) by orsmga003.jf.intel.com with ESMTP; 07 Aug 2015 07:51:26 -0700 Received: from phlsvsles11.ph.intel.com (phlsvsles11.ph.intel.com [10.228.195.43]) by sedona.ch.intel.com (8.13.6/8.14.3/Standard MailSET/Hub) with ESMTP id t77EpQeN004206; Fri, 7 Aug 2015 07:51:26 -0700 Received: from phlsvslse11.ph.intel.com (localhost [127.0.0.1]) by phlsvsles11.ph.intel.com with ESMTP id t77EpP0n027590; Fri, 7 Aug 2015 10:51:25 -0400 Subject: [PATCH] IB/hfi1: Support ib_alloc_mr verb To: dledford@redhat.com From: Mike Marciniszyn Cc: linux-rdma@vger.kernel.org Date: Fri, 07 Aug 2015 10:51:25 -0400 Message-ID: <20150807145125.27568.22379.stgit@phlsvslse11.ph.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ported from upstream qib commit 68c02e232b8a ("qib: Support ib_alloc_mr verb") Tested-by: Jubin John Reviewed-by: Jubin John Signed-off-by: Mike Marciniszyn --- drivers/staging/hfi1/mr.c | 9 +++++++-- drivers/staging/hfi1/verbs.c | 1 + drivers/staging/hfi1/verbs.h | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/staging/hfi1/mr.c b/drivers/staging/hfi1/mr.c index 23567f8..bd64e4f 100644 --- a/drivers/staging/hfi1/mr.c +++ b/drivers/staging/hfi1/mr.c @@ -348,11 +348,16 @@ out: * * Return the memory region on success, otherwise return an errno. */ -struct ib_mr *hfi1_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len) +struct ib_mr *hfi1_alloc_mr(struct ib_pd *pd, + enum ib_mr_type mr_type, + u32 max_num_sg) { struct hfi1_mr *mr; - mr = alloc_mr(max_page_list_len, pd); + if (mr_type != IB_MR_TYPE_MEM_REG) + return ERR_PTR(-EINVAL); + + mr = alloc_mr(max_num_sg, pd); if (IS_ERR(mr)) return (struct ib_mr *)mr; diff --git a/drivers/staging/hfi1/verbs.c b/drivers/staging/hfi1/verbs.c index 5f4b661..53ac214 100644 --- a/drivers/staging/hfi1/verbs.c +++ b/drivers/staging/hfi1/verbs.c @@ -2045,6 +2045,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->reg_phys_mr = hfi1_reg_phys_mr; ibdev->reg_user_mr = hfi1_reg_user_mr; ibdev->dereg_mr = hfi1_dereg_mr; + ibdev->alloc_mr = hfi1_alloc_mr; ibdev->alloc_fast_reg_page_list = hfi1_alloc_fast_reg_page_list; ibdev->free_fast_reg_page_list = hfi1_free_fast_reg_page_list; ibdev->alloc_fmr = hfi1_alloc_fmr; diff --git a/drivers/staging/hfi1/verbs.h b/drivers/staging/hfi1/verbs.h index 8125361..ed903a9 100644 --- a/drivers/staging/hfi1/verbs.h +++ b/drivers/staging/hfi1/verbs.h @@ -1016,7 +1016,9 @@ struct ib_mr *hfi1_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, int hfi1_dereg_mr(struct ib_mr *ibmr); -struct ib_mr *hfi1_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len); +struct ib_mr *hfi1_alloc_mr(struct ib_pd *pd, + enum ib_mr_type mr_type, + u32 max_entries); struct ib_fast_reg_page_list *hfi1_alloc_fast_reg_page_list( struct ib_device *ibdev, int page_list_len);