Skip to content

Commit 018f340

Browse files
committed
svcrdma: Move the svc_rdma_cc_init() call
Now that the chunk_ctxt for Reads is no longer dynamically allocated it can be initialized once for the life of the object that contains it (struct svc_rdma_recv_ctxt). Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 57666bb commit 018f340

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

include/linux/sunrpc/svc_rdma.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ extern int svc_rdma_recvfrom(struct svc_rqst *);
211211

212212
/* svc_rdma_rw.c */
213213
extern void svc_rdma_destroy_rw_ctxts(struct svcxprt_rdma *rdma);
214+
extern void svc_rdma_cc_init(struct svcxprt_rdma *rdma,
215+
struct svc_rdma_chunk_ctxt *cc);
214216
extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma,
215217
const struct svc_rdma_chunk *chunk,
216218
const struct xdr_buf *xdr);

net/sunrpc/xprtrdma/svc_rdma_recvfrom.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma)
156156
ctxt->rc_recv_sge.length = rdma->sc_max_req_size;
157157
ctxt->rc_recv_sge.lkey = rdma->sc_pd->local_dma_lkey;
158158
ctxt->rc_recv_buf = buffer;
159+
svc_rdma_cc_init(rdma, &ctxt->rc_cc);
159160
return ctxt;
160161

161162
fail2:

net/sunrpc/xprtrdma/svc_rdma_rw.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,13 @@ static void svc_rdma_cc_cid_init(struct svcxprt_rdma *rdma,
153153
cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids);
154154
}
155155

156-
static void svc_rdma_cc_init(struct svcxprt_rdma *rdma,
157-
struct svc_rdma_chunk_ctxt *cc)
156+
/**
157+
* svc_rdma_cc_init - Initialize an svc_rdma_chunk_ctxt
158+
* @rdma: controlling transport instance
159+
* @cc: svc_rdma_chunk_ctxt to be initialized
160+
*/
161+
void svc_rdma_cc_init(struct svcxprt_rdma *rdma,
162+
struct svc_rdma_chunk_ctxt *cc)
158163
{
159164
svc_rdma_cc_cid_init(rdma, &cc->cc_cid);
160165

@@ -1101,8 +1106,8 @@ int svc_rdma_process_read_list(struct svcxprt_rdma *rdma,
11011106
struct svc_rdma_chunk_ctxt *cc = &head->rc_cc;
11021107
int ret;
11031108

1104-
svc_rdma_cc_init(rdma, cc);
11051109
cc->cc_cqe.done = svc_rdma_wc_read_done;
1110+
cc->cc_sqecount = 0;
11061111
head->rc_pageoff = 0;
11071112
head->rc_curpage = 0;
11081113
head->rc_readbytes = 0;

0 commit comments

Comments
 (0)