Skip to content

Commit a36e629

Browse files
Dag Moxnesdavem330
authored andcommitted
rds: ib: update WR sizes when bringing up connection
Currently WR sizes are updated from rds_ib_sysctl_max_send_wr and rds_ib_sysctl_max_recv_wr when a connection is shut down. As a result, a connection being down while rds_ib_sysctl_max_send_wr or rds_ib_sysctl_max_recv_wr are updated, will not update the sizes when it comes back up. Move resizing of WRs to rds_ib_setup_qp so that connections will be setup with the most current WR sizes. Signed-off-by: Dag Moxnes <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 18d647a commit a36e629

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

net/rds/ib_cm.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
450450
struct ib_qp_init_attr attr;
451451
struct ib_cq_init_attr cq_attr = {};
452452
struct rds_ib_device *rds_ibdev;
453+
unsigned long max_wrs;
453454
int ret, fr_queue_space;
454455

455456
/*
@@ -469,10 +470,15 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
469470
/* add the conn now so that connection establishment has the dev */
470471
rds_ib_add_conn(rds_ibdev, conn);
471472

472-
if (rds_ibdev->max_wrs < ic->i_send_ring.w_nr + 1)
473-
rds_ib_ring_resize(&ic->i_send_ring, rds_ibdev->max_wrs - 1);
474-
if (rds_ibdev->max_wrs < ic->i_recv_ring.w_nr + 1)
475-
rds_ib_ring_resize(&ic->i_recv_ring, rds_ibdev->max_wrs - 1);
473+
max_wrs = rds_ibdev->max_wrs < rds_ib_sysctl_max_send_wr + 1 ?
474+
rds_ibdev->max_wrs - 1 : rds_ib_sysctl_max_send_wr;
475+
if (ic->i_send_ring.w_nr != max_wrs)
476+
rds_ib_ring_resize(&ic->i_send_ring, max_wrs);
477+
478+
max_wrs = rds_ibdev->max_wrs < rds_ib_sysctl_max_recv_wr + 1 ?
479+
rds_ibdev->max_wrs - 1 : rds_ib_sysctl_max_recv_wr;
480+
if (ic->i_recv_ring.w_nr != max_wrs)
481+
rds_ib_ring_resize(&ic->i_recv_ring, max_wrs);
476482

477483
/* Protection domain and memory range */
478484
ic->i_pd = rds_ibdev->pd;
@@ -1099,8 +1105,9 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
10991105
ic->i_flowctl = 0;
11001106
atomic_set(&ic->i_credits, 0);
11011107

1102-
rds_ib_ring_init(&ic->i_send_ring, rds_ib_sysctl_max_send_wr);
1103-
rds_ib_ring_init(&ic->i_recv_ring, rds_ib_sysctl_max_recv_wr);
1108+
/* Re-init rings, but retain sizes. */
1109+
rds_ib_ring_init(&ic->i_send_ring, ic->i_send_ring.w_nr);
1110+
rds_ib_ring_init(&ic->i_recv_ring, ic->i_recv_ring.w_nr);
11041111

11051112
if (ic->i_ibinc) {
11061113
rds_inc_put(&ic->i_ibinc->ii_inc);
@@ -1147,8 +1154,8 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
11471154
* rds_ib_conn_shutdown() waits for these to be emptied so they
11481155
* must be initialized before it can be called.
11491156
*/
1150-
rds_ib_ring_init(&ic->i_send_ring, rds_ib_sysctl_max_send_wr);
1151-
rds_ib_ring_init(&ic->i_recv_ring, rds_ib_sysctl_max_recv_wr);
1157+
rds_ib_ring_init(&ic->i_send_ring, 0);
1158+
rds_ib_ring_init(&ic->i_recv_ring, 0);
11521159

11531160
ic->conn = conn;
11541161
conn->c_transport_data = ic;

0 commit comments

Comments
 (0)