Skip to content

Commit 6ea8e71

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Move recv_wr to struct rpcrdma_rep
Clean up: The fields in the recv_wr do not vary. There is no need to initialize them before each ib_post_recv(). This removes a large-ish data structure from the stack. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 90aab60 commit 6ea8e71

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

net/sunrpc/xprtrdma/verbs.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,10 @@ rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt)
880880
rep->rr_cqe.done = rpcrdma_receive_wc;
881881
rep->rr_rxprt = r_xprt;
882882
INIT_WORK(&rep->rr_work, rpcrdma_receive_worker);
883+
rep->rr_recv_wr.next = NULL;
884+
rep->rr_recv_wr.wr_cqe = &rep->rr_cqe;
885+
rep->rr_recv_wr.sg_list = &rep->rr_rdmabuf->rg_iov;
886+
rep->rr_recv_wr.num_sge = 1;
883887
return rep;
884888

885889
out_free:
@@ -1302,17 +1306,12 @@ int
13021306
rpcrdma_ep_post_recv(struct rpcrdma_ia *ia,
13031307
struct rpcrdma_rep *rep)
13041308
{
1305-
struct ib_recv_wr recv_wr, *recv_wr_fail;
1309+
struct ib_recv_wr *recv_wr_fail;
13061310
int rc;
13071311

1308-
recv_wr.next = NULL;
1309-
recv_wr.wr_cqe = &rep->rr_cqe;
1310-
recv_wr.sg_list = &rep->rr_rdmabuf->rg_iov;
1311-
recv_wr.num_sge = 1;
1312-
13131312
if (!rpcrdma_dma_map_regbuf(ia, rep->rr_rdmabuf))
13141313
goto out_map;
1315-
rc = ib_post_recv(ia->ri_id->qp, &recv_wr, &recv_wr_fail);
1314+
rc = ib_post_recv(ia->ri_id->qp, &rep->rr_recv_wr, &recv_wr_fail);
13161315
if (rc)
13171316
goto out_postrecv;
13181317
return 0;

net/sunrpc/xprtrdma/xprt_rdma.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct rpcrdma_rep {
189189
struct rpcrdma_xprt *rr_rxprt;
190190
struct work_struct rr_work;
191191
struct list_head rr_list;
192+
struct ib_recv_wr rr_recv_wr;
192193
struct rpcrdma_regbuf *rr_rdmabuf;
193194
};
194195

0 commit comments

Comments
 (0)