aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtrdma/verbs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtrdma/verbs.c')
-rw-r--r--net/sunrpc/xprtrdma/verbs.c49
1 files changed, 3 insertions, 46 deletions
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index a7fb31441069..b697b3ed6273 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -622,11 +622,6 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
622 dprintk("RPC: %s: FRMR registration " 622 dprintk("RPC: %s: FRMR registration "
623 "not supported by HCA\n", __func__); 623 "not supported by HCA\n", __func__);
624 memreg = RPCRDMA_MTHCAFMR; 624 memreg = RPCRDMA_MTHCAFMR;
625 } else {
626 /* Mind the ia limit on FRMR page list depth */
627 ia->ri_max_frmr_depth = min_t(unsigned int,
628 RPCRDMA_MAX_DATA_SEGS,
629 devattr->max_fast_reg_page_list_len);
630 } 625 }
631 } 626 }
632 if (memreg == RPCRDMA_MTHCAFMR) { 627 if (memreg == RPCRDMA_MTHCAFMR) {
@@ -741,49 +736,11 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
741 736
742 ep->rep_attr.event_handler = rpcrdma_qp_async_error_upcall; 737 ep->rep_attr.event_handler = rpcrdma_qp_async_error_upcall;
743 ep->rep_attr.qp_context = ep; 738 ep->rep_attr.qp_context = ep;
744 /* send_cq and recv_cq initialized below */
745 ep->rep_attr.srq = NULL; 739 ep->rep_attr.srq = NULL;
746 ep->rep_attr.cap.max_send_wr = cdata->max_requests; 740 ep->rep_attr.cap.max_send_wr = cdata->max_requests;
747 switch (ia->ri_memreg_strategy) { 741 rc = ia->ri_ops->ro_open(ia, ep, cdata);
748 case RPCRDMA_FRMR: { 742 if (rc)
749 int depth = 7; 743 return rc;
750
751 /* Add room for frmr register and invalidate WRs.
752 * 1. FRMR reg WR for head
753 * 2. FRMR invalidate WR for head
754 * 3. N FRMR reg WRs for pagelist
755 * 4. N FRMR invalidate WRs for pagelist
756 * 5. FRMR reg WR for tail
757 * 6. FRMR invalidate WR for tail
758 * 7. The RDMA_SEND WR
759 */
760
761 /* Calculate N if the device max FRMR depth is smaller than
762 * RPCRDMA_MAX_DATA_SEGS.
763 */
764 if (ia->ri_max_frmr_depth < RPCRDMA_MAX_DATA_SEGS) {
765 int delta = RPCRDMA_MAX_DATA_SEGS -
766 ia->ri_max_frmr_depth;
767
768 do {
769 depth += 2; /* FRMR reg + invalidate */
770 delta -= ia->ri_max_frmr_depth;
771 } while (delta > 0);
772
773 }
774 ep->rep_attr.cap.max_send_wr *= depth;
775 if (ep->rep_attr.cap.max_send_wr > devattr->max_qp_wr) {
776 cdata->max_requests = devattr->max_qp_wr / depth;
777 if (!cdata->max_requests)
778 return -EINVAL;
779 ep->rep_attr.cap.max_send_wr = cdata->max_requests *
780 depth;
781 }
782 break;
783 }
784 default:
785 break;
786 }
787 ep->rep_attr.cap.max_recv_wr = cdata->max_requests; 744 ep->rep_attr.cap.max_recv_wr = cdata->max_requests;
788 ep->rep_attr.cap.max_send_sge = (cdata->padding ? 4 : 2); 745 ep->rep_attr.cap.max_send_sge = (cdata->padding ? 4 : 2);
789 ep->rep_attr.cap.max_recv_sge = 1; 746 ep->rep_attr.cap.max_recv_sge = 1;