diff options
author | Andy Grover <andy.grover@oracle.com> | 2010-01-12 13:50:48 -0500 |
---|---|---|
committer | Andy Grover <andy.grover@oracle.com> | 2010-09-08 21:11:42 -0400 |
commit | 40589e74f7ba855f3a887c9d4abe9d100c5b039c (patch) | |
tree | f32b0414ae3cfe8868fbdb130f9b24ac19794ae3 /net/rds | |
parent | 15133f6e67d8d646d0744336b4daa3135452cb0d (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')
-rw-r--r-- | net/rds/ib.c | 3 | ||||
-rw-r--r-- | net/rds/ib.h | 2 | ||||
-rw-r--r-- | net/rds/ib_cm.c | 27 | ||||
-rw-r--r-- | net/rds/rdma.c | 3 |
4 files changed, 24 insertions, 11 deletions
diff --git a/net/rds/ib.c b/net/rds/ib.c index f0d29656baff..72a5116c11de 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c | |||
@@ -91,6 +91,9 @@ void rds_ib_add_one(struct ib_device *device) | |||
91 | min_t(unsigned int, dev_attr->max_fmr, fmr_pool_size) : | 91 | min_t(unsigned int, dev_attr->max_fmr, fmr_pool_size) : |
92 | fmr_pool_size; | 92 | fmr_pool_size; |
93 | 93 | ||
94 | rds_ibdev->max_initiator_depth = dev_attr->max_qp_init_rd_atom; | ||
95 | rds_ibdev->max_responder_resources = dev_attr->max_qp_rd_atom; | ||
96 | |||
94 | rds_ibdev->dev = device; | 97 | rds_ibdev->dev = device; |
95 | rds_ibdev->pd = ib_alloc_pd(device); | 98 | rds_ibdev->pd = ib_alloc_pd(device); |
96 | if (IS_ERR(rds_ibdev->pd)) | 99 | if (IS_ERR(rds_ibdev->pd)) |
diff --git a/net/rds/ib.h b/net/rds/ib.h index d2fd0aa4fde7..a303f13111c2 100644 --- a/net/rds/ib.h +++ b/net/rds/ib.h | |||
@@ -164,6 +164,8 @@ struct rds_ib_device { | |||
164 | unsigned int max_fmrs; | 164 | unsigned int max_fmrs; |
165 | int max_sge; | 165 | int max_sge; |
166 | unsigned int max_wrs; | 166 | unsigned int max_wrs; |
167 | unsigned int max_initiator_depth; | ||
168 | unsigned int max_responder_resources; | ||
167 | spinlock_t spinlock; /* protect the above */ | 169 | spinlock_t spinlock; /* protect the above */ |
168 | }; | 170 | }; |
169 | 171 | ||
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 | |||
153 | static void rds_ib_cm_fill_conn_param(struct rds_connection *conn, | 153 | static 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); |
diff --git a/net/rds/rdma.c b/net/rds/rdma.c index a7019df38c70..abbc2979e7e5 100644 --- a/net/rds/rdma.c +++ b/net/rds/rdma.c | |||
@@ -745,7 +745,6 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm, | |||
745 | rm->atomic.op_swap_add = args->fadd.add; | 745 | rm->atomic.op_swap_add = args->fadd.add; |
746 | } | 746 | } |
747 | 747 | ||
748 | rm->m_rdma_cookie = args->cookie; | ||
749 | rm->atomic.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME); | 748 | rm->atomic.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME); |
750 | rm->atomic.op_recverr = rs->rs_recverr; | 749 | rm->atomic.op_recverr = rs->rs_recverr; |
751 | rm->atomic.op_sg = rds_message_alloc_sgs(rm, 1); | 750 | rm->atomic.op_sg = rds_message_alloc_sgs(rm, 1); |
@@ -779,7 +778,7 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm, | |||
779 | rm->atomic.op_notifier->n_status = RDS_RDMA_SUCCESS; | 778 | rm->atomic.op_notifier->n_status = RDS_RDMA_SUCCESS; |
780 | } | 779 | } |
781 | 780 | ||
782 | rm->atomic.op_rkey = rds_rdma_cookie_key(rm->m_rdma_cookie); | 781 | rm->atomic.op_rkey = rds_rdma_cookie_key(args->cookie); |
783 | rm->atomic.op_remote_addr = args->remote_addr + rds_rdma_cookie_offset(args->cookie); | 782 | rm->atomic.op_remote_addr = args->remote_addr + rds_rdma_cookie_offset(args->cookie); |
784 | 783 | ||
785 | rm->atomic.op_active = 1; | 784 | rm->atomic.op_active = 1; |