Skip to content

Commit f10eafd

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Fall back to MTHCAFMR when FRMR is not supported
An audit of in-kernel RDMA providers that do not support the FRMR memory registration shows that several of them support MTHCAFMR. Prefer MTHCAFMR when FRMR is not supported. If MTHCAFMR is not supported, only then choose ALLPHYSICAL. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 0ac531c commit f10eafd

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

net/sunrpc/xprtrdma/verbs.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -491,33 +491,32 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
491491
ia->ri_dma_lkey = ia->ri_id->device->local_dma_lkey;
492492
}
493493

494-
switch (memreg) {
495-
case RPCRDMA_MTHCAFMR:
496-
if (!ia->ri_id->device->alloc_fmr) {
497-
dprintk("RPC: %s: MTHCAFMR registration "
498-
"specified but not supported by adapter, "
499-
"using riskier RPCRDMA_ALLPHYSICAL\n",
500-
__func__);
501-
memreg = RPCRDMA_ALLPHYSICAL;
502-
}
503-
break;
504-
case RPCRDMA_FRMR:
494+
if (memreg == RPCRDMA_FRMR) {
505495
/* Requires both frmr reg and local dma lkey */
506496
if ((devattr.device_cap_flags &
507497
(IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) !=
508498
(IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) {
509499
dprintk("RPC: %s: FRMR registration "
510-
"specified but not supported by adapter, "
511-
"using riskier RPCRDMA_ALLPHYSICAL\n",
512-
__func__);
513-
memreg = RPCRDMA_ALLPHYSICAL;
500+
"not supported by HCA\n", __func__);
501+
memreg = RPCRDMA_MTHCAFMR;
514502
} else {
515503
/* Mind the ia limit on FRMR page list depth */
516504
ia->ri_max_frmr_depth = min_t(unsigned int,
517505
RPCRDMA_MAX_DATA_SEGS,
518506
devattr.max_fast_reg_page_list_len);
519507
}
520-
break;
508+
}
509+
if (memreg == RPCRDMA_MTHCAFMR) {
510+
if (!ia->ri_id->device->alloc_fmr) {
511+
dprintk("RPC: %s: MTHCAFMR registration "
512+
"not supported by HCA\n", __func__);
513+
#if RPCRDMA_PERSISTENT_REGISTRATION
514+
memreg = RPCRDMA_ALLPHYSICAL;
515+
#else
516+
rc = -EINVAL;
517+
goto out2;
518+
#endif
519+
}
521520
}
522521

523522
/*

0 commit comments

Comments
 (0)