提交 3de2c31c 编写于 作者: M Michael Wang 提交者: Doug Ledford

IB/Verbs: Reform IB-ulp xprtrdma

Use raw management helpers to reform IB-ulp xprtrdma.
Signed-off-by: NMichael Wang <yun.wang@profitbricks.com>
Reviewed-by: NIra Weiny <ira.weiny@intel.com>
Tested-by: NIra Weiny <ira.weiny@intel.com>
Reviewed-by: NSean Hefty <sean.hefty@intel.com>
Reviewed-by: NJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tested-by: NDoug Ledford <dledford@redhat.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 8e37ab68
...@@ -117,8 +117,8 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp, ...@@ -117,8 +117,8 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,
static int rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count) 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) == if (rdma_protocol_iwarp(xprt->sc_cm_id->device,
RDMA_TRANSPORT_IWARP) xprt->sc_cm_id->port_num))
return 1; return 1;
else else
return min_t(int, sge_count, xprt->sc_max_sge); return min_t(int, sge_count, xprt->sc_max_sge);
......
...@@ -851,7 +851,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) ...@@ -851,7 +851,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
struct ib_qp_init_attr qp_attr; struct ib_qp_init_attr qp_attr;
struct ib_device_attr devattr; struct ib_device_attr devattr;
int uninitialized_var(dma_mr_acc); int uninitialized_var(dma_mr_acc);
int need_dma_mr; int need_dma_mr = 0;
int ret; int ret;
int i; int i;
...@@ -985,35 +985,26 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) ...@@ -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 * 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)) { if (!rdma_protocol_iwarp(newxprt->sc_cm_id->device,
case RDMA_TRANSPORT_IWARP: newxprt->sc_cm_id->port_num) &&
newxprt->sc_dev_caps |= SVCRDMA_DEVCAP_READ_W_INV; !rdma_ib_or_iboe(newxprt->sc_cm_id->device,
if (!(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG)) { newxprt->sc_cm_id->port_num))
need_dma_mr = 1; goto errout;
dma_mr_acc =
(IB_ACCESS_LOCAL_WRITE | if (!(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG) ||
IB_ACCESS_REMOTE_WRITE); !(devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY)) {
} 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; need_dma_mr = 1;
dma_mr_acc = IB_ACCESS_LOCAL_WRITE; dma_mr_acc = IB_ACCESS_LOCAL_WRITE;
} else if (rdma_protocol_iwarp(newxprt->sc_cm_id->device,
need_dma_mr = 0; newxprt->sc_cm_id->port_num) &&
break; !(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG))
default: dma_mr_acc |= IB_ACCESS_REMOTE_WRITE;
goto errout;
} }
if (rdma_protocol_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 */ /* Create the DMA MR if needed, otherwise, use the DMA LKEY */
if (need_dma_mr) { if (need_dma_mr) {
/* Register all of physical memory */ /* Register all of physical memory */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册