From patchwork Tue Nov 10 10:44:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 7589351 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 1C6C29F1AF for ; Tue, 10 Nov 2015 10:44:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EA2F2078A for ; Tue, 10 Nov 2015 10:44:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0760720755 for ; Tue, 10 Nov 2015 10:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751757AbbKJKos (ORCPT ); Tue, 10 Nov 2015 05:44:48 -0500 Received: from [193.47.165.129] ([193.47.165.129]:60163 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751672AbbKJKor (ORCPT ); Tue, 10 Nov 2015 05:44:47 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from sagig@mellanox.com) with ESMTPS (AES256-SHA encrypted); 10 Nov 2015 12:44:25 +0200 Received: from r-vnc05.mtr.labs.mlnx (r-vnc05.mtr.labs.mlnx [10.208.0.115]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id tAAAiOSv016407 for ; Tue, 10 Nov 2015 12:44:24 +0200 Received: from r-vnc05.mtr.labs.mlnx (localhost [127.0.0.1]) by r-vnc05.mtr.labs.mlnx (8.14.4/8.14.4) with ESMTP id tAAAiOkS028369 for ; Tue, 10 Nov 2015 12:44:24 +0200 Received: (from sagig@localhost) by r-vnc05.mtr.labs.mlnx (8.14.4/8.14.4/Submit) id tAAAiORj028359 for linux-rdma@vger.kernel.org; Tue, 10 Nov 2015 12:44:24 +0200 From: Sagi Grimberg To: linux-rdma@vger.kernel.org Subject: [PATCH RFC 3/3] RDS_IW: Use device rdma_read_access_flags Date: Tue, 10 Nov 2015 12:44:15 +0200 Message-Id: <1447152255-28231-4-git-send-email-sagig@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1447152255-28231-1-git-send-email-sagig@mellanox.com> References: <1447152255-28231-1-git-send-email-sagig@mellanox.com> 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.2 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 Instead of hard-coding remote access (which is not secured issue in IB). Signed-off-by: Sagi Grimberg --- net/rds/iw_send.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/net/rds/iw_send.c b/net/rds/iw_send.c index e20bd503f4bd..47d684541342 100644 --- a/net/rds/iw_send.c +++ b/net/rds/iw_send.c @@ -763,7 +763,8 @@ out: static int rds_iw_build_send_reg(struct rds_iw_send_work *send, struct scatterlist *sg, - int sg_nents) + int sg_nents, + int access_flags) { int n; @@ -776,7 +777,7 @@ static int rds_iw_build_send_reg(struct rds_iw_send_work *send, send->s_reg_wr.wr.num_sge = 0; send->s_reg_wr.mr = send->s_mr; send->s_reg_wr.key = send->s_mr->rkey; - send->s_reg_wr.access = IB_ACCESS_REMOTE_WRITE; + send->s_reg_wr.access = access_flags; ib_update_fast_reg_key(send->s_mr, send->s_remap_count++); @@ -786,6 +787,7 @@ static int rds_iw_build_send_reg(struct rds_iw_send_work *send, int rds_iw_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) { struct rds_iw_connection *ic = conn->c_transport_data; + struct ib_device *device = ic->i_cm_id->device; struct rds_iw_send_work *send = NULL; struct rds_iw_send_work *first; struct rds_iw_send_work *prev; @@ -803,11 +805,11 @@ int rds_iw_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) int num_sge; int sg_nents; - rds_iwdev = ib_get_client_data(ic->i_cm_id->device, &rds_iw_client); + rds_iwdev = ib_get_client_data(device, &rds_iw_client); /* map the message the first time we see it */ if (!op->op_mapped) { - op->op_count = ib_dma_map_sg(ic->i_cm_id->device, + op->op_count = ib_dma_map_sg(device, op->op_sg, op->op_nents, (op->op_write) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); rdsdebug("ic %p mapping op %p: %d\n", ic, op, op->op_count); @@ -896,12 +898,12 @@ int rds_iw_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) for (j = 0; j < send->s_rdma_wr.wr.num_sge && scat != &op->op_sg[op->op_count]; j++) { - len = ib_sg_dma_len(ic->i_cm_id->device, scat); + len = ib_sg_dma_len(device, scat); if (send->s_rdma_wr.wr.opcode == IB_WR_RDMA_READ_WITH_INV) sg_nents++; else { - send->s_sge[j].addr = ib_sg_dma_address(ic->i_cm_id->device, scat); + send->s_sge[j].addr = ib_sg_dma_address(device, scat); send->s_sge[j].length = len; send->s_sge[j].lkey = rds_iw_local_dma_lkey(ic); } @@ -947,7 +949,8 @@ int rds_iw_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) */ if (!op->op_write) { ret = rds_iw_build_send_reg(&ic->i_sends[fr_pos], - &op->op_sg[0], sg_nents); + &op->op_sg[0], sg_nents, + device->rdma_read_access_flags); if (ret) { printk(KERN_WARNING "RDS/IW: failed to reg send mem\n"); goto out;