aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2018-05-07 15:27:59 -0400
committerJ. Bruce Fields <bfields@redhat.com>2018-05-11 15:48:57 -0400
commit232627905f12a05df75853c62451ce0886803cee (patch)
treea933773f551e8b8fc44a5215b7f2772c883b4d7a /net/sunrpc
parentf016f305f98159a9131ce200ed3b4ed92133012c (diff)
svcrdma: Clean up Send SGE accounting
Clean up: Since there's already a svc_rdma_op_ctxt being passed around with the running count of mapped SGEs, drop unneeded parameters to svc_rdma_post_send_wr(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_backchannel.c2
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c2
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c17
3 files changed, 10 insertions, 11 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
index d50152163190..0b9ba9f50a76 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
@@ -135,7 +135,7 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,
135 * the rq_buffer before all retransmits are complete. 135 * the rq_buffer before all retransmits are complete.
136 */ 136 */
137 get_page(virt_to_page(rqst->rq_buffer)); 137 get_page(virt_to_page(rqst->rq_buffer));
138 ret = svc_rdma_post_send_wr(rdma, ctxt, 1, 0); 138 ret = svc_rdma_post_send_wr(rdma, ctxt, 0);
139 if (ret) 139 if (ret)
140 goto out_unmap; 140 goto out_unmap;
141 141
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index 0445e75d76a2..af6d2f3b3242 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -639,7 +639,7 @@ static void svc_rdma_send_error(struct svcxprt_rdma *xprt,
639 return; 639 return;
640 } 640 }
641 641
642 ret = svc_rdma_post_send_wr(xprt, ctxt, 1, 0); 642 ret = svc_rdma_post_send_wr(xprt, ctxt, 0);
643 if (ret) { 643 if (ret) {
644 svc_rdma_unmap_dma(ctxt); 644 svc_rdma_unmap_dma(ctxt);
645 svc_rdma_put_context(ctxt, 1); 645 svc_rdma_put_context(ctxt, 1);
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index ee9ba0736ceb..4591017adc1e 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -365,8 +365,7 @@ int svc_rdma_map_reply_hdr(struct svcxprt_rdma *rdma,
365/* Load the xdr_buf into the ctxt's sge array, and DMA map each 365/* Load the xdr_buf into the ctxt's sge array, and DMA map each
366 * element as it is added. 366 * element as it is added.
367 * 367 *
368 * Returns the number of sge elements loaded on success, or 368 * Returns zero on success, or a negative errno on failure.
369 * a negative errno on failure.
370 */ 369 */
371static int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma, 370static int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,
372 struct svc_rdma_op_ctxt *ctxt, 371 struct svc_rdma_op_ctxt *ctxt,
@@ -429,7 +428,7 @@ tail:
429 return ret; 428 return ret;
430 } 429 }
431 430
432 return sge_no - 1; 431 return 0;
433} 432}
434 433
435/* The svc_rqst and all resources it owns are released as soon as 434/* The svc_rqst and all resources it owns are released as soon as
@@ -453,7 +452,6 @@ static void svc_rdma_save_io_pages(struct svc_rqst *rqstp,
453 * svc_rdma_post_send_wr - Set up and post one Send Work Request 452 * svc_rdma_post_send_wr - Set up and post one Send Work Request
454 * @rdma: controlling transport 453 * @rdma: controlling transport
455 * @ctxt: op_ctxt for transmitting the Send WR 454 * @ctxt: op_ctxt for transmitting the Send WR
456 * @num_sge: number of SGEs to send
457 * @inv_rkey: R_key argument to Send With Invalidate, or zero 455 * @inv_rkey: R_key argument to Send With Invalidate, or zero
458 * 456 *
459 * Returns: 457 * Returns:
@@ -463,18 +461,19 @@ static void svc_rdma_save_io_pages(struct svc_rqst *rqstp,
463 * %-ENOMEM if ib_post_send failed. 461 * %-ENOMEM if ib_post_send failed.
464 */ 462 */
465int svc_rdma_post_send_wr(struct svcxprt_rdma *rdma, 463int svc_rdma_post_send_wr(struct svcxprt_rdma *rdma,
466 struct svc_rdma_op_ctxt *ctxt, int num_sge, 464 struct svc_rdma_op_ctxt *ctxt,
467 u32 inv_rkey) 465 u32 inv_rkey)
468{ 466{
469 struct ib_send_wr *send_wr = &ctxt->send_wr; 467 struct ib_send_wr *send_wr = &ctxt->send_wr;
470 468
471 dprintk("svcrdma: posting Send WR with %u sge(s)\n", num_sge); 469 dprintk("svcrdma: posting Send WR with %u sge(s)\n",
470 ctxt->mapped_sges);
472 471
473 send_wr->next = NULL; 472 send_wr->next = NULL;
474 ctxt->cqe.done = svc_rdma_wc_send; 473 ctxt->cqe.done = svc_rdma_wc_send;
475 send_wr->wr_cqe = &ctxt->cqe; 474 send_wr->wr_cqe = &ctxt->cqe;
476 send_wr->sg_list = ctxt->sge; 475 send_wr->sg_list = ctxt->sge;
477 send_wr->num_sge = num_sge; 476 send_wr->num_sge = ctxt->mapped_sges;
478 send_wr->send_flags = IB_SEND_SIGNALED; 477 send_wr->send_flags = IB_SEND_SIGNALED;
479 if (inv_rkey) { 478 if (inv_rkey) {
480 send_wr->opcode = IB_WR_SEND_WITH_INV; 479 send_wr->opcode = IB_WR_SEND_WITH_INV;
@@ -532,7 +531,7 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma,
532 inv_rkey = 0; 531 inv_rkey = 0;
533 if (rdma->sc_snd_w_inv) 532 if (rdma->sc_snd_w_inv)
534 inv_rkey = svc_rdma_get_inv_rkey(rdma_argp, wr_lst, rp_ch); 533 inv_rkey = svc_rdma_get_inv_rkey(rdma_argp, wr_lst, rp_ch);
535 ret = svc_rdma_post_send_wr(rdma, ctxt, 1 + ret, inv_rkey); 534 ret = svc_rdma_post_send_wr(rdma, ctxt, inv_rkey);
536 if (ret) 535 if (ret)
537 goto err; 536 goto err;
538 537
@@ -574,7 +573,7 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
574 573
575 svc_rdma_save_io_pages(rqstp, ctxt); 574 svc_rdma_save_io_pages(rqstp, ctxt);
576 575
577 ret = svc_rdma_post_send_wr(rdma, ctxt, 1 + ret, 0); 576 ret = svc_rdma_post_send_wr(rdma, ctxt, 0);
578 if (ret) 577 if (ret)
579 goto err; 578 goto err;
580 579