aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/ib_cm.c
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-01-12 13:50:48 -0500
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:11:42 -0400
commit40589e74f7ba855f3a887c9d4abe9d100c5b039c (patch)
treef32b0414ae3cfe8868fbdb130f9b24ac19794ae3 /net/rds/ib_cm.c
parent15133f6e67d8d646d0744336b4daa3135452cb0d (diff)
RDS: Base init_depth and responder_resources on hw values
Instead of using a constant for initiator_depth and responder_resources, read the per-QP values when the device is enumerated, and then use these values when creating the connection. Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds/ib_cm.c')
-rw-r--r--net/rds/ib_cm.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index b46bc2f22ab6..3134336ca17d 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -153,18 +153,25 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even
153static void rds_ib_cm_fill_conn_param(struct rds_connection *conn, 153static void rds_ib_cm_fill_conn_param(struct rds_connection *conn,
154 struct rdma_conn_param *conn_param, 154 struct rdma_conn_param *conn_param,
155 struct rds_ib_connect_private *dp, 155 struct rds_ib_connect_private *dp,
156 u32 protocol_version) 156 u32 protocol_version,
157 u32 max_responder_resources,
158 u32 max_initiator_depth)
157{ 159{
160 struct rds_ib_connection *ic = conn->c_transport_data;
161 struct rds_ib_device *rds_ibdev;
162
158 memset(conn_param, 0, sizeof(struct rdma_conn_param)); 163 memset(conn_param, 0, sizeof(struct rdma_conn_param));
159 /* XXX tune these? */ 164
160 conn_param->responder_resources = 1; 165 rds_ibdev = ib_get_client_data(ic->i_cm_id->device, &rds_ib_client);
161 conn_param->initiator_depth = 1; 166
167 conn_param->responder_resources =
168 min_t(u32, rds_ibdev->max_responder_resources, max_responder_resources);
169 conn_param->initiator_depth =
170 min_t(u32, rds_ibdev->max_initiator_depth, max_initiator_depth);
162 conn_param->retry_count = min_t(unsigned int, rds_ib_retry_count, 7); 171 conn_param->retry_count = min_t(unsigned int, rds_ib_retry_count, 7);
163 conn_param->rnr_retry_count = 7; 172 conn_param->rnr_retry_count = 7;
164 173
165 if (dp) { 174 if (dp) {
166 struct rds_ib_connection *ic = conn->c_transport_data;
167
168 memset(dp, 0, sizeof(*dp)); 175 memset(dp, 0, sizeof(*dp));
169 dp->dp_saddr = conn->c_laddr; 176 dp->dp_saddr = conn->c_laddr;
170 dp->dp_daddr = conn->c_faddr; 177 dp->dp_daddr = conn->c_faddr;
@@ -479,7 +486,9 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
479 goto out; 486 goto out;
480 } 487 }
481 488
482 rds_ib_cm_fill_conn_param(conn, &conn_param, &dp_rep, version); 489 rds_ib_cm_fill_conn_param(conn, &conn_param, &dp_rep, version,
490 event->param.conn.responder_resources,
491 event->param.conn.initiator_depth);
483 492
484 /* rdma_accept() calls rdma_reject() internally if it fails */ 493 /* rdma_accept() calls rdma_reject() internally if it fails */
485 err = rdma_accept(cm_id, &conn_param); 494 err = rdma_accept(cm_id, &conn_param);
@@ -516,8 +525,8 @@ int rds_ib_cm_initiate_connect(struct rdma_cm_id *cm_id)
516 goto out; 525 goto out;
517 } 526 }
518 527
519 rds_ib_cm_fill_conn_param(conn, &conn_param, &dp, RDS_PROTOCOL_VERSION); 528 rds_ib_cm_fill_conn_param(conn, &conn_param, &dp, RDS_PROTOCOL_VERSION,
520 529 UINT_MAX, UINT_MAX);
521 ret = rdma_connect(cm_id, &conn_param); 530 ret = rdma_connect(cm_id, &conn_param);
522 if (ret) 531 if (ret)
523 rds_ib_conn_error(conn, "rdma_connect failed (%d)\n", ret); 532 rds_ib_conn_error(conn, "rdma_connect failed (%d)\n", ret);