diff options
-rw-r--r-- | net/sunrpc/xprtrdma/verbs.c | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 39a165202d8f..e3fe9054fef6 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -705,30 +705,13 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, | |||
705 | ep->rep_remote_cma.private_data_len = 0; | 705 | ep->rep_remote_cma.private_data_len = 0; |
706 | 706 | ||
707 | /* Client offers RDMA Read but does not initiate */ | 707 | /* Client offers RDMA Read but does not initiate */ |
708 | switch (ia->ri_memreg_strategy) { | 708 | ep->rep_remote_cma.initiator_depth = 0; |
709 | case RPCRDMA_BOUNCEBUFFERS: | 709 | if (ia->ri_memreg_strategy == RPCRDMA_BOUNCEBUFFERS) |
710 | ep->rep_remote_cma.responder_resources = 0; | 710 | ep->rep_remote_cma.responder_resources = 0; |
711 | break; | 711 | else if (devattr.max_qp_rd_atom > 32) /* arbitrary but <= 255 */ |
712 | case RPCRDMA_MTHCAFMR: | 712 | ep->rep_remote_cma.responder_resources = 32; |
713 | case RPCRDMA_REGISTER: | 713 | else |
714 | case RPCRDMA_FRMR: | ||
715 | ep->rep_remote_cma.responder_resources = cdata->max_requests * | ||
716 | (RPCRDMA_MAX_DATA_SEGS / 8); | ||
717 | break; | ||
718 | case RPCRDMA_MEMWINDOWS: | ||
719 | case RPCRDMA_MEMWINDOWS_ASYNC: | ||
720 | #if RPCRDMA_PERSISTENT_REGISTRATION | ||
721 | case RPCRDMA_ALLPHYSICAL: | ||
722 | #endif | ||
723 | ep->rep_remote_cma.responder_resources = cdata->max_requests * | ||
724 | (RPCRDMA_MAX_DATA_SEGS / 2); | ||
725 | break; | ||
726 | default: | ||
727 | break; | ||
728 | } | ||
729 | if (ep->rep_remote_cma.responder_resources > devattr.max_qp_rd_atom) | ||
730 | ep->rep_remote_cma.responder_resources = devattr.max_qp_rd_atom; | 714 | ep->rep_remote_cma.responder_resources = devattr.max_qp_rd_atom; |
731 | ep->rep_remote_cma.initiator_depth = 0; | ||
732 | 715 | ||
733 | ep->rep_remote_cma.retry_count = 7; | 716 | ep->rep_remote_cma.retry_count = 7; |
734 | ep->rep_remote_cma.flow_control = 0; | 717 | ep->rep_remote_cma.flow_control = 0; |
@@ -858,14 +841,6 @@ if (strnicmp(ia->ri_id->device->dma_device->bus->name, "pci", 3) == 0) { | |||
858 | } | 841 | } |
859 | } | 842 | } |
860 | 843 | ||
861 | /* Theoretically a client initiator_depth > 0 is not needed, | ||
862 | * but many peers fail to complete the connection unless they | ||
863 | * == responder_resources! */ | ||
864 | if (ep->rep_remote_cma.initiator_depth != | ||
865 | ep->rep_remote_cma.responder_resources) | ||
866 | ep->rep_remote_cma.initiator_depth = | ||
867 | ep->rep_remote_cma.responder_resources; | ||
868 | |||
869 | ep->rep_connected = 0; | 844 | ep->rep_connected = 0; |
870 | 845 | ||
871 | rc = rdma_connect(ia->ri_id, &ep->rep_remote_cma); | 846 | rc = rdma_connect(ia->ri_id, &ep->rep_remote_cma); |
@@ -894,14 +869,16 @@ if (strnicmp(ia->ri_id->device->dma_device->bus->name, "pci", 3) == 0) { | |||
894 | if (ep->rep_connected <= 0) { | 869 | if (ep->rep_connected <= 0) { |
895 | /* Sometimes, the only way to reliably connect to remote | 870 | /* Sometimes, the only way to reliably connect to remote |
896 | * CMs is to use same nonzero values for ORD and IRD. */ | 871 | * CMs is to use same nonzero values for ORD and IRD. */ |
897 | ep->rep_remote_cma.initiator_depth = | 872 | if (retry_count++ <= RDMA_CONNECT_RETRY_MAX + 1 && |
898 | ep->rep_remote_cma.responder_resources; | 873 | (ep->rep_remote_cma.responder_resources == 0 || |
899 | if (ep->rep_remote_cma.initiator_depth == 0) | 874 | ep->rep_remote_cma.initiator_depth != |
900 | ++ep->rep_remote_cma.initiator_depth; | 875 | ep->rep_remote_cma.responder_resources)) { |
901 | if (ep->rep_remote_cma.responder_resources == 0) | 876 | if (ep->rep_remote_cma.responder_resources == 0) |
902 | ++ep->rep_remote_cma.responder_resources; | 877 | ep->rep_remote_cma.responder_resources = 1; |
903 | if (retry_count++ == 0) | 878 | ep->rep_remote_cma.initiator_depth = |
879 | ep->rep_remote_cma.responder_resources; | ||
904 | goto retry; | 880 | goto retry; |
881 | } | ||
905 | rc = ep->rep_connected; | 882 | rc = ep->rep_connected; |
906 | } else { | 883 | } else { |
907 | dprintk("RPC: %s: connected\n", __func__); | 884 | dprintk("RPC: %s: connected\n", __func__); |