aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTom Tucker <tom@opengridcomputing.com>2008-10-09 15:00:30 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-10-10 15:09:56 -0400
commitb334eaabf4f92226d2df13c613888a507f03da99 (patch)
treeda3ce699ec10898dd41483e52c6e99805be6f363 /net
parent3197d309f5fb042499b2c4c8f2fcb67372df5201 (diff)
RPC/RDMA: fix connection IRD/ORD setting
This logic sets the connection parameter that configures the local device and informs the remote peer how many concurrent incoming RDMA_READ requests are supported. The original logic didn't really do what was intended for two reasons: - The max number supported by the device is typically smaller than any one factor in the calculation used, and - The field in the connection parameter structure where the value is stored is a u8 and always overflows for the default settings. So what really happens is the value requested for responder resources is the left over 8 bits from the "desired value". If the desired value happened to be a multiple of 256, the result was zero and it wouldn't connect at all. Given the above and the fact that max_requests is almost always larger than the max responder resources supported by the adapter, this patch simplifies this logic and simply requests the max supported by the device, subject to a reasonable limit. This bug was found by Jim Schutt at Sandia. Signed-off-by: Tom Tucker <tom@opengridcomputing.com> Acked-by: Tom Talpey <talpey@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtrdma/verbs.c51
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__);