diff options
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 | ||