Skip to content

Commit dcff9ed

Browse files
chuckleverTrond Myklebust
authored andcommitted
xprtrdma: Move the Work Request union to struct rpcrdma_mr
Clean up. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 9a301ca commit dcff9ed

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

net/sunrpc/xprtrdma/frwr_ops.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt,
333333
key = (u8)(ibmr->rkey & 0x000000FF);
334334
ib_update_fast_reg_key(ibmr, ++key);
335335

336-
reg_wr = &mr->frwr.fr_regwr;
336+
reg_wr = &mr->mr_regwr;
337337
reg_wr->mr = ibmr;
338338
reg_wr->key = ibmr->rkey;
339339
reg_wr->access = writing ?
@@ -398,19 +398,15 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
398398
num_wrs = 1;
399399
post_wr = send_wr;
400400
list_for_each_entry(mr, &req->rl_registered, mr_list) {
401-
struct rpcrdma_frwr *frwr;
402-
403401
trace_xprtrdma_mr_fastreg(mr);
404-
frwr = &mr->frwr;
405402

406403
mr->mr_cqe.done = frwr_wc_fastreg;
407-
frwr->fr_regwr.wr.next = post_wr;
408-
frwr->fr_regwr.wr.wr_cqe = &mr->mr_cqe;
409-
frwr->fr_regwr.wr.num_sge = 0;
410-
frwr->fr_regwr.wr.opcode = IB_WR_REG_MR;
411-
frwr->fr_regwr.wr.send_flags = 0;
412-
413-
post_wr = &frwr->fr_regwr.wr;
404+
mr->mr_regwr.wr.next = post_wr;
405+
mr->mr_regwr.wr.wr_cqe = &mr->mr_cqe;
406+
mr->mr_regwr.wr.num_sge = 0;
407+
mr->mr_regwr.wr.opcode = IB_WR_REG_MR;
408+
mr->mr_regwr.wr.send_flags = 0;
409+
post_wr = &mr->mr_regwr.wr;
414410
++num_wrs;
415411
}
416412

@@ -506,7 +502,6 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
506502
struct ib_send_wr *first, **prev, *last;
507503
struct rpcrdma_ep *ep = r_xprt->rx_ep;
508504
const struct ib_send_wr *bad_wr;
509-
struct rpcrdma_frwr *frwr;
510505
struct rpcrdma_mr *mr;
511506
int rc;
512507

@@ -515,15 +510,13 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
515510
* Chain the LOCAL_INV Work Requests and post them with
516511
* a single ib_post_send() call.
517512
*/
518-
frwr = NULL;
519513
prev = &first;
520514
while ((mr = rpcrdma_mr_pop(&req->rl_registered))) {
521515

522516
trace_xprtrdma_mr_localinv(mr);
523517
r_xprt->rx_stats.local_inv_needed++;
524518

525-
frwr = &mr->frwr;
526-
last = &frwr->fr_invwr;
519+
last = &mr->mr_invwr;
527520
last->next = NULL;
528521
last->wr_cqe = &mr->mr_cqe;
529522
last->sg_list = NULL;
@@ -608,22 +601,19 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
608601
{
609602
struct ib_send_wr *first, *last, **prev;
610603
struct rpcrdma_ep *ep = r_xprt->rx_ep;
611-
struct rpcrdma_frwr *frwr;
612604
struct rpcrdma_mr *mr;
613605
int rc;
614606

615607
/* Chain the LOCAL_INV Work Requests and post them with
616608
* a single ib_post_send() call.
617609
*/
618-
frwr = NULL;
619610
prev = &first;
620611
while ((mr = rpcrdma_mr_pop(&req->rl_registered))) {
621612

622613
trace_xprtrdma_mr_localinv(mr);
623614
r_xprt->rx_stats.local_inv_needed++;
624615

625-
frwr = &mr->frwr;
626-
last = &frwr->fr_invwr;
616+
last = &mr->mr_invwr;
627617
last->next = NULL;
628618
last->wr_cqe = &mr->mr_cqe;
629619
last->sg_list = NULL;

net/sunrpc/xprtrdma/xprt_rdma.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ struct rpcrdma_sendctx {
231231
*/
232232
struct rpcrdma_frwr {
233233
struct ib_mr *fr_mr;
234-
union {
235-
struct ib_reg_wr fr_regwr;
236-
struct ib_send_wr fr_invwr;
237-
};
238234
};
239235

240236
struct rpcrdma_req;
@@ -247,6 +243,10 @@ struct rpcrdma_mr {
247243
enum dma_data_direction mr_dir;
248244
struct ib_cqe mr_cqe;
249245
struct completion mr_linv_done;
246+
union {
247+
struct ib_reg_wr mr_regwr;
248+
struct ib_send_wr mr_invwr;
249+
};
250250
struct rpcrdma_frwr frwr;
251251
struct rpcrdma_xprt *mr_xprt;
252252
u32 mr_handle;

0 commit comments

Comments
 (0)