diff options
author | Sean Hefty <sean.hefty@intel.com> | 2008-01-04 13:47:12 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-01-25 17:15:41 -0500 |
commit | 5851bb893e5bb87150817c180ccddcf4e78db1b6 (patch) | |
tree | ce0a5e2e7b0888df4379ac3be7e75f505349f5c4 /drivers/infiniband | |
parent | 1f813ca830f51ed404195750bdba86c41a8050ba (diff) |
RDMA/cma: Override default responder_resources with user value
By default, the responder_resources parameter is set to that received
in a connection request. The passive side may override this value
when accepting the connection. Use the value provided by the passive
side when transitioning the QP to RTR state, rather than the value
given in the connect request. Without this change, the RTR transition
may fail if the passive side supports fewer responder_resources than
that in the request.
For code consistency and to protect against QP destruction, restructure
overriding initiator_depth to match how responder_resources is set.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/cma.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 982836e69f55..637efead97a0 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -488,7 +488,8 @@ void rdma_destroy_qp(struct rdma_cm_id *id) | |||
488 | } | 488 | } |
489 | EXPORT_SYMBOL(rdma_destroy_qp); | 489 | EXPORT_SYMBOL(rdma_destroy_qp); |
490 | 490 | ||
491 | static int cma_modify_qp_rtr(struct rdma_id_private *id_priv) | 491 | static int cma_modify_qp_rtr(struct rdma_id_private *id_priv, |
492 | struct rdma_conn_param *conn_param) | ||
492 | { | 493 | { |
493 | struct ib_qp_attr qp_attr; | 494 | struct ib_qp_attr qp_attr; |
494 | int qp_attr_mask, ret; | 495 | int qp_attr_mask, ret; |
@@ -514,13 +515,16 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv) | |||
514 | if (ret) | 515 | if (ret) |
515 | goto out; | 516 | goto out; |
516 | 517 | ||
518 | if (conn_param) | ||
519 | qp_attr.max_dest_rd_atomic = conn_param->responder_resources; | ||
517 | ret = ib_modify_qp(id_priv->id.qp, &qp_attr, qp_attr_mask); | 520 | ret = ib_modify_qp(id_priv->id.qp, &qp_attr, qp_attr_mask); |
518 | out: | 521 | out: |
519 | mutex_unlock(&id_priv->qp_mutex); | 522 | mutex_unlock(&id_priv->qp_mutex); |
520 | return ret; | 523 | return ret; |
521 | } | 524 | } |
522 | 525 | ||
523 | static int cma_modify_qp_rts(struct rdma_id_private *id_priv) | 526 | static int cma_modify_qp_rts(struct rdma_id_private *id_priv, |
527 | struct rdma_conn_param *conn_param) | ||
524 | { | 528 | { |
525 | struct ib_qp_attr qp_attr; | 529 | struct ib_qp_attr qp_attr; |
526 | int qp_attr_mask, ret; | 530 | int qp_attr_mask, ret; |
@@ -536,6 +540,8 @@ static int cma_modify_qp_rts(struct rdma_id_private *id_priv) | |||
536 | if (ret) | 540 | if (ret) |
537 | goto out; | 541 | goto out; |
538 | 542 | ||
543 | if (conn_param) | ||
544 | qp_attr.max_rd_atomic = conn_param->initiator_depth; | ||
539 | ret = ib_modify_qp(id_priv->id.qp, &qp_attr, qp_attr_mask); | 545 | ret = ib_modify_qp(id_priv->id.qp, &qp_attr, qp_attr_mask); |
540 | out: | 546 | out: |
541 | mutex_unlock(&id_priv->qp_mutex); | 547 | mutex_unlock(&id_priv->qp_mutex); |
@@ -866,11 +872,11 @@ static int cma_rep_recv(struct rdma_id_private *id_priv) | |||
866 | { | 872 | { |
867 | int ret; | 873 | int ret; |
868 | 874 | ||
869 | ret = cma_modify_qp_rtr(id_priv); | 875 | ret = cma_modify_qp_rtr(id_priv, NULL); |
870 | if (ret) | 876 | if (ret) |
871 | goto reject; | 877 | goto reject; |
872 | 878 | ||
873 | ret = cma_modify_qp_rts(id_priv); | 879 | ret = cma_modify_qp_rts(id_priv, NULL); |
874 | if (ret) | 880 | if (ret) |
875 | goto reject; | 881 | goto reject; |
876 | 882 | ||
@@ -2284,7 +2290,7 @@ static int cma_connect_iw(struct rdma_id_private *id_priv, | |||
2284 | sin = (struct sockaddr_in*) &id_priv->id.route.addr.dst_addr; | 2290 | sin = (struct sockaddr_in*) &id_priv->id.route.addr.dst_addr; |
2285 | cm_id->remote_addr = *sin; | 2291 | cm_id->remote_addr = *sin; |
2286 | 2292 | ||
2287 | ret = cma_modify_qp_rtr(id_priv); | 2293 | ret = cma_modify_qp_rtr(id_priv, conn_param); |
2288 | if (ret) | 2294 | if (ret) |
2289 | goto out; | 2295 | goto out; |
2290 | 2296 | ||
@@ -2347,25 +2353,15 @@ static int cma_accept_ib(struct rdma_id_private *id_priv, | |||
2347 | struct rdma_conn_param *conn_param) | 2353 | struct rdma_conn_param *conn_param) |
2348 | { | 2354 | { |
2349 | struct ib_cm_rep_param rep; | 2355 | struct ib_cm_rep_param rep; |
2350 | struct ib_qp_attr qp_attr; | 2356 | int ret; |
2351 | int qp_attr_mask, ret; | ||
2352 | |||
2353 | if (id_priv->id.qp) { | ||
2354 | ret = cma_modify_qp_rtr(id_priv); | ||
2355 | if (ret) | ||
2356 | goto out; | ||
2357 | 2357 | ||
2358 | qp_attr.qp_state = IB_QPS_RTS; | 2358 | ret = cma_modify_qp_rtr(id_priv, conn_param); |
2359 | ret = ib_cm_init_qp_attr(id_priv->cm_id.ib, &qp_attr, | 2359 | if (ret) |
2360 | &qp_attr_mask); | 2360 | goto out; |
2361 | if (ret) | ||
2362 | goto out; | ||
2363 | 2361 | ||
2364 | qp_attr.max_rd_atomic = conn_param->initiator_depth; | 2362 | ret = cma_modify_qp_rts(id_priv, conn_param); |
2365 | ret = ib_modify_qp(id_priv->id.qp, &qp_attr, qp_attr_mask); | 2363 | if (ret) |
2366 | if (ret) | 2364 | goto out; |
2367 | goto out; | ||
2368 | } | ||
2369 | 2365 | ||
2370 | memset(&rep, 0, sizeof rep); | 2366 | memset(&rep, 0, sizeof rep); |
2371 | rep.qp_num = id_priv->qp_num; | 2367 | rep.qp_num = id_priv->qp_num; |
@@ -2390,7 +2386,7 @@ static int cma_accept_iw(struct rdma_id_private *id_priv, | |||
2390 | struct iw_cm_conn_param iw_param; | 2386 | struct iw_cm_conn_param iw_param; |
2391 | int ret; | 2387 | int ret; |
2392 | 2388 | ||
2393 | ret = cma_modify_qp_rtr(id_priv); | 2389 | ret = cma_modify_qp_rtr(id_priv, conn_param); |
2394 | if (ret) | 2390 | if (ret) |
2395 | return ret; | 2391 | return ret; |
2396 | 2392 | ||