Skip to content

Commit 53aa2e0

Browse files
Dag MoxnesSomasundaram Krishnasamy
Dag Moxnes
authored and
Somasundaram Krishnasamy
committed
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. Orabug: 30532304 Signed-off-by: Dag Moxnes <[email protected]> Reviewed-by: Ka-Cheong Poon <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 70ca72d commit 53aa2e0

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

net/rds/ib_cm.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
815815
struct ib_qp_init_attr qp_attr;
816816
struct rds_ib_device *rds_ibdev;
817817
struct dma_pool *pool;
818+
unsigned long max_wrs;
818819
int ret;
819820
int mr_reg;
820821

@@ -839,11 +840,15 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
839840
/* add the conn now so that connection establishment has the dev */
840841
rds_ib_add_conn(rds_ibdev, conn);
841842

842-
if (rds_ibdev->max_wrs < ic->i_send_ring.w_nr + 1 + mr_reg)
843-
rds_ib_ring_resize(&ic->i_send_ring,
844-
rds_ibdev->max_wrs - 1 - mr_reg);
845-
if (rds_ibdev->max_wrs < ic->i_recv_ring.w_nr + 1)
846-
rds_ib_ring_resize(&ic->i_recv_ring, rds_ibdev->max_wrs - 1);
843+
max_wrs = rds_ibdev->max_wrs < rds_ib_sysctl_max_send_wr + 1 + mr_reg ?
844+
rds_ibdev->max_wrs - 1 - mr_reg : rds_ib_sysctl_max_send_wr;
845+
if (ic->i_send_ring.w_nr != max_wrs)
846+
rds_ib_ring_resize(&ic->i_send_ring, max_wrs);
847+
848+
max_wrs = rds_ibdev->max_wrs < rds_ib_sysctl_max_recv_wr + 1 + mr_reg ?
849+
rds_ibdev->max_wrs - 1 - mr_reg : rds_ib_sysctl_max_recv_wr;
850+
if (ic->i_recv_ring.w_nr != max_wrs)
851+
rds_ib_ring_resize(&ic->i_recv_ring, max_wrs);
847852

848853
/* Protection domain and memory range */
849854
ic->i_pd = rds_ibdev->pd;
@@ -1658,8 +1663,9 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
16581663
ic->i_flowctl = 0;
16591664
atomic_set(&ic->i_credits, 0);
16601665

1661-
rds_ib_ring_init(&ic->i_send_ring, rds_ib_sysctl_max_send_wr);
1662-
rds_ib_ring_init(&ic->i_recv_ring, rds_ib_sysctl_max_recv_wr);
1666+
/* Re-init rings, but retain sizes. */
1667+
rds_ib_ring_init(&ic->i_send_ring, ic->i_send_ring.w_nr);
1668+
rds_ib_ring_init(&ic->i_recv_ring, ic->i_recv_ring.w_nr);
16631669
rds_ib_init_ic_frag(ic);
16641670

16651671
if (ic->i_ibinc) {
@@ -1710,8 +1716,8 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
17101716
* rds_ib_conn_path_shutdown() waits for these to be emptied so they
17111717
* must be initialized before it can be called.
17121718
*/
1713-
rds_ib_ring_init(&ic->i_send_ring, rds_ib_sysctl_max_send_wr);
1714-
rds_ib_ring_init(&ic->i_recv_ring, rds_ib_sysctl_max_recv_wr);
1719+
rds_ib_ring_init(&ic->i_send_ring, 0);
1720+
rds_ib_ring_init(&ic->i_recv_ring, 0);
17151721

17161722
/* Might want to change this hard-coded value to a variable in future.
17171723
* Updating this atomic counter will need an update to qp/cq size too.

0 commit comments

Comments
 (0)