mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 14:19:16 +00:00
xprtrdma: DMA map rr_rdma_buf as each rpcrdma_rep is created
Clean up: This simplifies the logic in rpcrdma_post_recvs. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
b7ff0185e9
commit
e515dd9d76
1 changed files with 11 additions and 20 deletions
|
@ -1110,8 +1110,9 @@ static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt)
|
||||||
/* No locking needed here. This function is called only by the
|
/* No locking needed here. This function is called only by the
|
||||||
* Receive completion handler.
|
* Receive completion handler.
|
||||||
*/
|
*/
|
||||||
static struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
|
static noinline
|
||||||
bool temp)
|
struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
|
||||||
|
bool temp)
|
||||||
{
|
{
|
||||||
struct rpcrdma_rep *rep;
|
struct rpcrdma_rep *rep;
|
||||||
|
|
||||||
|
@ -1124,6 +1125,9 @@ static struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
|
||||||
if (!rep->rr_rdmabuf)
|
if (!rep->rr_rdmabuf)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
|
if (!rpcrdma_regbuf_dma_map(r_xprt, rep->rr_rdmabuf))
|
||||||
|
goto out_free_regbuf;
|
||||||
|
|
||||||
xdr_buf_init(&rep->rr_hdrbuf, rdmab_data(rep->rr_rdmabuf),
|
xdr_buf_init(&rep->rr_hdrbuf, rdmab_data(rep->rr_rdmabuf),
|
||||||
rdmab_length(rep->rr_rdmabuf));
|
rdmab_length(rep->rr_rdmabuf));
|
||||||
rep->rr_cqe.done = rpcrdma_wc_receive;
|
rep->rr_cqe.done = rpcrdma_wc_receive;
|
||||||
|
@ -1136,6 +1140,8 @@ static struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
|
||||||
list_add(&rep->rr_all, &r_xprt->rx_buf.rb_all_reps);
|
list_add(&rep->rr_all, &r_xprt->rx_buf.rb_all_reps);
|
||||||
return rep;
|
return rep;
|
||||||
|
|
||||||
|
out_free_regbuf:
|
||||||
|
rpcrdma_regbuf_free(rep->rr_rdmabuf);
|
||||||
out_free:
|
out_free:
|
||||||
kfree(rep);
|
kfree(rep);
|
||||||
out:
|
out:
|
||||||
|
@ -1537,7 +1543,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
|
||||||
{
|
{
|
||||||
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
|
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
|
||||||
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
|
struct rpcrdma_ep *ep = &r_xprt->rx_ep;
|
||||||
struct ib_recv_wr *i, *wr, *bad_wr;
|
struct ib_recv_wr *wr, *bad_wr;
|
||||||
struct rpcrdma_rep *rep;
|
struct rpcrdma_rep *rep;
|
||||||
int needed, count, rc;
|
int needed, count, rc;
|
||||||
|
|
||||||
|
@ -1564,23 +1570,15 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
|
||||||
if (!rep)
|
if (!rep)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
trace_xprtrdma_post_recv(rep);
|
||||||
rep->rr_recv_wr.next = wr;
|
rep->rr_recv_wr.next = wr;
|
||||||
wr = &rep->rr_recv_wr;
|
wr = &rep->rr_recv_wr;
|
||||||
--needed;
|
--needed;
|
||||||
|
++count;
|
||||||
}
|
}
|
||||||
if (!wr)
|
if (!wr)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (i = wr; i; i = i->next) {
|
|
||||||
rep = container_of(i, struct rpcrdma_rep, rr_recv_wr);
|
|
||||||
|
|
||||||
if (!rpcrdma_regbuf_dma_map(r_xprt, rep->rr_rdmabuf))
|
|
||||||
goto release_wrs;
|
|
||||||
|
|
||||||
trace_xprtrdma_post_recv(rep);
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = ib_post_recv(r_xprt->rx_ia.ri_id->qp, wr,
|
rc = ib_post_recv(r_xprt->rx_ia.ri_id->qp, wr,
|
||||||
(const struct ib_recv_wr **)&bad_wr);
|
(const struct ib_recv_wr **)&bad_wr);
|
||||||
out:
|
out:
|
||||||
|
@ -1597,11 +1595,4 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
|
||||||
}
|
}
|
||||||
ep->rep_receive_count += count;
|
ep->rep_receive_count += count;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
release_wrs:
|
|
||||||
for (i = wr; i;) {
|
|
||||||
rep = container_of(i, struct rpcrdma_rep, rr_recv_wr);
|
|
||||||
i = i->next;
|
|
||||||
rpcrdma_recv_buffer_put(rep);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue