Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965418AbbDVAGz (ORCPT ); Tue, 21 Apr 2015 20:06:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:53819 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965400AbbDVAGv (ORCPT ); Tue, 21 Apr 2015 20:06:51 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,619,1422950400"; d="scan'208";a="698866737" Date: Tue, 21 Apr 2015 20:06:46 -0400 From: "ira.weiny" To: Michael Wang Cc: Roland Dreier , Sean Hefty , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, hal@dev.mellanox.co.il, Tom Tucker , Steve Wise , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Jack Morgenstein , Or Gerlitz , Haggai Eran , Tom Talpey , Jason Gunthorpe , Doug Ledford Subject: Re: [PATCH v5 08/27] IB/Verbs: Reform IB-ulp xprtrdma Message-ID: <20150422000645.GI15893@phlsvsds.ph.intel.com> References: <5534B8C9.506@profitbricks.com> <5534BA63.8010004@profitbricks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5534BA63.8010004@profitbricks.com> User-Agent: Mutt/1.4.2.2i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4079 Lines: 107 On Mon, Apr 20, 2015 at 10:35:47AM +0200, Michael Wang wrote: > > Use raw management helpers to reform IB-ulp xprtrdma. > > Cc: Hal Rosenstock > Cc: Steve Wise > Cc: Tom Talpey > Cc: Jason Gunthorpe > Cc: Doug Ledford > Cc: Ira Weiny > Cc: Sean Hefty > Signed-off-by: Michael Wang Reviewed-by: Ira Weiny > --- > net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 3 +-- > net/sunrpc/xprtrdma/svc_rdma_transport.c | 45 +++++++++++++------------------- > 2 files changed, 19 insertions(+), 29 deletions(-) > > diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c > index f9f13a3..a5bed5b 100644 > --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c > +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c > @@ -117,8 +117,7 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp, > > static int rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count) > { > - if (rdma_node_get_transport(xprt->sc_cm_id->device->node_type) == > - RDMA_TRANSPORT_IWARP) > + if (rdma_tech_iwarp(xprt->sc_cm_id->device, xprt->sc_cm_id->port_num)) > return 1; > else > return min_t(int, sge_count, xprt->sc_max_sge); > diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c > index f609c1c..a09b7a1 100644 > --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c > +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c > @@ -851,7 +851,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) > struct ib_qp_init_attr qp_attr; > struct ib_device_attr devattr; > int uninitialized_var(dma_mr_acc); > - int need_dma_mr; > + int need_dma_mr = 0; > int ret; > int i; > > @@ -985,35 +985,26 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) > /* > * Determine if a DMA MR is required and if so, what privs are required > */ > - switch (rdma_node_get_transport(newxprt->sc_cm_id->device->node_type)) { > - case RDMA_TRANSPORT_IWARP: > - newxprt->sc_dev_caps |= SVCRDMA_DEVCAP_READ_W_INV; > - if (!(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG)) { > - need_dma_mr = 1; > - dma_mr_acc = > - (IB_ACCESS_LOCAL_WRITE | > - IB_ACCESS_REMOTE_WRITE); > - } else if (!(devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY)) { > - need_dma_mr = 1; > - dma_mr_acc = IB_ACCESS_LOCAL_WRITE; > - } else > - need_dma_mr = 0; > - break; > - case RDMA_TRANSPORT_IB: > - if (!(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG)) { > - need_dma_mr = 1; > - dma_mr_acc = IB_ACCESS_LOCAL_WRITE; > - } else if (!(devattr.device_cap_flags & > - IB_DEVICE_LOCAL_DMA_LKEY)) { > - need_dma_mr = 1; > - dma_mr_acc = IB_ACCESS_LOCAL_WRITE; > - } else > - need_dma_mr = 0; > - break; > - default: > + if (!rdma_tech_iwarp(newxprt->sc_cm_id->device, > + newxprt->sc_cm_id->port_num) && > + !rdma_ib_or_iboe(newxprt->sc_cm_id->device, > + newxprt->sc_cm_id->port_num)) > goto errout; > + > + if (!(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG) || > + !(devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY)) { > + need_dma_mr = 1; > + dma_mr_acc = IB_ACCESS_LOCAL_WRITE; > + if (rdma_tech_iwarp(newxprt->sc_cm_id->device, > + newxprt->sc_cm_id->port_num) && > + !(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG)) > + dma_mr_acc |= IB_ACCESS_REMOTE_WRITE; > } > > + if (rdma_tech_iwarp(newxprt->sc_cm_id->device, > + newxprt->sc_cm_id->port_num)) > + newxprt->sc_dev_caps |= SVCRDMA_DEVCAP_READ_W_INV; > + > /* Create the DMA MR if needed, otherwise, use the DMA LKEY */ > if (need_dma_mr) { > /* Register all of physical memory */ > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/