From patchwork Sun Jul 5 23:22:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 6718951 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8323CC05AD for ; Sun, 5 Jul 2015 23:22:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A3662063C for ; Sun, 5 Jul 2015 23:22:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BAA12064D for ; Sun, 5 Jul 2015 23:22:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753207AbbGEXWO (ORCPT ); Sun, 5 Jul 2015 19:22:14 -0400 Received: from smtp.opengridcomputing.com ([72.48.136.20]:51050 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786AbbGEXWN (ORCPT ); Sun, 5 Jul 2015 19:22:13 -0400 Received: from build2.ogc.int (build2.ogc.int [10.10.0.32]) by smtp.opengridcomputing.com (Postfix) with ESMTP id E9B0929EA2; Sun, 5 Jul 2015 18:22:12 -0500 (CDT) From: Steve Wise Subject: [PATCH V3 3/5] RDMA/isert: Use transport independent MR allocation To: dledford@redhat.com Cc: sagig@mellanox.com, ogerlitz@mellanox.com, roid@mellanox.com, linux-rdma@vger.kernel.org, eli@mellanox.com, target-devel@vger.kernel.org, linux-nfs@vger.kernel.org, trond.myklebust@primarydata.com, bfields@fieldses.org Date: Sun, 05 Jul 2015 18:22:12 -0500 Message-ID: <20150705232211.12029.78085.stgit@build2.ogc.int> In-Reply-To: <20150705231831.12029.80307.stgit@build2.ogc.int> References: <20150705231831.12029.80307.stgit@build2.ogc.int> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 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 Use rdma_get_dma_mr() to allocate the DMA MR. Use rdma_fast_reg_access_flags() to set the access_flags for fast register work requests. Signed-off-by: Steve Wise --- drivers/infiniband/ulp/isert/ib_isert.c | 36 +++++-------------------------- 1 files changed, 6 insertions(+), 30 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 35015c9..ea6f540 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -350,21 +350,11 @@ out_cq: return ret; } -static int any_port_is_iwarp(struct isert_device *device) -{ - int i; - - for (i = rdma_start_port(device->ib_device); - i <= rdma_end_port(device->ib_device); i++) - if (rdma_protocol_iwarp(device->ib_device, i)) - return 1; - return 0; -} - static int isert_create_device_ib_res(struct isert_device *device) { struct ib_device_attr *dev_attr; + int mr_roles; int ret; dev_attr = &device->dev_attr; @@ -396,16 +386,9 @@ isert_create_device_ib_res(struct isert_device *device) goto out_cq; } - /* - * IWARP transports need REMOTE_WRITE for MRs used as the target of - * an RDMA_READ. Since the DMA MR is used for all ports, then if - * any port is running IWARP, add REMOTE_WRITE. - */ - if (any_port_is_iwarp(device)) - device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE); - else - device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE); + mr_roles = RDMA_MRR_RECV | RDMA_MRR_SEND | RDMA_MRR_WRITE_SOURCE | + RDMA_MRR_READ_DEST; + device->mr = rdma_get_dma_mr(device->pd, mr_roles, 0); if (IS_ERR(device->mr)) { ret = PTR_ERR(device->mr); isert_err("failed to create dma mr, device %p, ret=%d\n", @@ -2644,15 +2627,8 @@ isert_fast_reg_mr(struct isert_conn *isert_conn, fr_wr.wr.fast_reg.page_shift = PAGE_SHIFT; fr_wr.wr.fast_reg.length = mem->len; fr_wr.wr.fast_reg.rkey = mr->rkey; - fr_wr.wr.fast_reg.access_flags = IB_ACCESS_LOCAL_WRITE; - - /* - * IWARP transports need REMOTE_WRITE for MRs used as the target of - * an RDMA_READ. - */ - if (rdma_protocol_iwarp(ib_dev, isert_conn->cm_id->port_num)) - fr_wr.wr.fast_reg.access_flags |= IB_ACCESS_REMOTE_WRITE; - + fr_wr.wr.fast_reg.access_flags = rdma_fast_reg_access_flags( + device->pd, RDMA_MRR_WRITE_SOURCE | RDMA_MRR_READ_DEST, 0); if (!wr) wr = &fr_wr; else