From patchwork Mon Jun 29 21:36:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 6692321 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 9731C9F1C1 for ; Mon, 29 Jun 2015 21:36:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B731C204E4 for ; Mon, 29 Jun 2015 21:36:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD45D204D9 for ; Mon, 29 Jun 2015 21:36:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752709AbbF2VgY (ORCPT ); Mon, 29 Jun 2015 17:36:24 -0400 Received: from smtp.opengridcomputing.com ([72.48.136.20]:45034 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003AbbF2VgY (ORCPT ); Mon, 29 Jun 2015 17:36:24 -0400 Received: from build.ogc.int (build.ogc.int [10.10.0.2]) by smtp.opengridcomputing.com (Postfix) with ESMTP id 3EDFA29E64; Mon, 29 Jun 2015 16:36:24 -0500 (CDT) Subject: [PATCH V2 4/5] RDMA/iser: support iWARP devices From: Steve Wise To: dledford@redhat.com Cc: roid@mellanox.com, sagig@mellanox.com, linux-rdma@vger.kernel.org, jgunthorpe@obsidianresearch.com, infinipath@intel.com, eli@mellanox.com, ogerlitz@mellanox.com, sean.hefty@intel.com Date: Mon, 29 Jun 2015 16:36:24 -0500 Message-ID: <20150629213624.4188.94135.stgit@build.ogc.int> In-Reply-To: <20150629213332.4188.87551.stgit@build.ogc.int> References: <20150629213332.4188.87551.stgit@build.ogc.int> User-Agent: StGit/0.17-dirty 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Limit the sg tablesize based on the device fast reg depth. 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/iser/iscsi_iser.c | 7 +++++++ drivers/infiniband/ulp/iser/iser_memory.c | 7 +++---- drivers/infiniband/ulp/iser/iser_verbs.c | 7 ++++--- 3 files changed, 14 insertions(+), 7 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/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 6a594aa..ec692f7 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -640,6 +640,13 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, SHOST_DIX_GUARD_CRC); } + /* + * Limit the sg_tablesize based on the device max fastreg page + * list length. + */ + shost->sg_tablesize = min_t(u32, shost->sg_tablesize, + ib_conn->device->dev_attr.max_fast_reg_page_list_len); + if (iscsi_host_add(shost, ib_conn->device->ib_device->dma_device)) { mutex_unlock(&iser_conn->state_mutex); diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index f0cdc96..3a19483 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c @@ -757,10 +757,9 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task, fastreg_wr.wr.fast_reg.page_shift = SHIFT_4K; fastreg_wr.wr.fast_reg.length = size; fastreg_wr.wr.fast_reg.rkey = mr->rkey; - fastreg_wr.wr.fast_reg.access_flags = (IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE | - IB_ACCESS_REMOTE_READ); - + fastreg_wr.wr.fast_reg.access_flags = + rdma_fast_reg_access_flags(device->pd, RDMA_MRR_WRITE_DEST | + RDMA_MRR_READ_SOURCE, 0); if (!wr) wr = &fastreg_wr; else diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 5c9f565..4da368c 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c @@ -80,6 +80,7 @@ static int iser_create_device_ib_res(struct iser_device *device) { struct ib_device_attr *dev_attr = &device->dev_attr; int ret, i, max_cqe; + int mr_roles; ret = ib_query_device(device->ib_device, dev_attr); if (ret) { @@ -149,9 +150,9 @@ static int iser_create_device_ib_res(struct iser_device *device) (unsigned long)comp); } - device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE | - IB_ACCESS_REMOTE_READ); + mr_roles = RDMA_MRR_SEND | RDMA_MRR_RECV | RDMA_MRR_WRITE_DEST | + RDMA_MRR_READ_SOURCE; + device->mr = rdma_get_dma_mr(device->pd, mr_roles, 0); if (IS_ERR(device->mr)) goto dma_mr_err;