Lines Matching refs:ctxt
123 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_recv_ctxt_alloc() local
127 ctxt = kmalloc(sizeof(*ctxt), GFP_KERNEL); in svc_rdma_recv_ctxt_alloc()
128 if (!ctxt) in svc_rdma_recv_ctxt_alloc()
138 ctxt->rc_recv_wr.next = NULL; in svc_rdma_recv_ctxt_alloc()
139 ctxt->rc_recv_wr.wr_cqe = &ctxt->rc_cqe; in svc_rdma_recv_ctxt_alloc()
140 ctxt->rc_recv_wr.sg_list = &ctxt->rc_recv_sge; in svc_rdma_recv_ctxt_alloc()
141 ctxt->rc_recv_wr.num_sge = 1; in svc_rdma_recv_ctxt_alloc()
142 ctxt->rc_cqe.done = svc_rdma_wc_receive; in svc_rdma_recv_ctxt_alloc()
143 ctxt->rc_recv_sge.addr = addr; in svc_rdma_recv_ctxt_alloc()
144 ctxt->rc_recv_sge.length = rdma->sc_max_req_size; in svc_rdma_recv_ctxt_alloc()
145 ctxt->rc_recv_sge.lkey = rdma->sc_pd->local_dma_lkey; in svc_rdma_recv_ctxt_alloc()
146 ctxt->rc_recv_buf = buffer; in svc_rdma_recv_ctxt_alloc()
147 ctxt->rc_temp = false; in svc_rdma_recv_ctxt_alloc()
148 return ctxt; in svc_rdma_recv_ctxt_alloc()
153 kfree(ctxt); in svc_rdma_recv_ctxt_alloc()
159 struct svc_rdma_recv_ctxt *ctxt) in svc_rdma_recv_ctxt_destroy() argument
161 ib_dma_unmap_single(rdma->sc_pd->device, ctxt->rc_recv_sge.addr, in svc_rdma_recv_ctxt_destroy()
162 ctxt->rc_recv_sge.length, DMA_FROM_DEVICE); in svc_rdma_recv_ctxt_destroy()
163 kfree(ctxt->rc_recv_buf); in svc_rdma_recv_ctxt_destroy()
164 kfree(ctxt); in svc_rdma_recv_ctxt_destroy()
174 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_recv_ctxts_destroy() local
178 ctxt = llist_entry(node, struct svc_rdma_recv_ctxt, rc_node); in svc_rdma_recv_ctxts_destroy()
179 svc_rdma_recv_ctxt_destroy(rdma, ctxt); in svc_rdma_recv_ctxts_destroy()
186 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_recv_ctxt_get() local
192 ctxt = llist_entry(node, struct svc_rdma_recv_ctxt, rc_node); in svc_rdma_recv_ctxt_get()
195 ctxt->rc_page_count = 0; in svc_rdma_recv_ctxt_get()
196 return ctxt; in svc_rdma_recv_ctxt_get()
199 ctxt = svc_rdma_recv_ctxt_alloc(rdma); in svc_rdma_recv_ctxt_get()
200 if (!ctxt) in svc_rdma_recv_ctxt_get()
212 struct svc_rdma_recv_ctxt *ctxt) in svc_rdma_recv_ctxt_put() argument
216 for (i = 0; i < ctxt->rc_page_count; i++) in svc_rdma_recv_ctxt_put()
217 put_page(ctxt->rc_pages[i]); in svc_rdma_recv_ctxt_put()
219 if (!ctxt->rc_temp) in svc_rdma_recv_ctxt_put()
220 llist_add(&ctxt->rc_node, &rdma->sc_recv_ctxts); in svc_rdma_recv_ctxt_put()
222 svc_rdma_recv_ctxt_destroy(rdma, ctxt); in svc_rdma_recv_ctxt_put()
226 struct svc_rdma_recv_ctxt *ctxt) in __svc_rdma_post_recv() argument
231 ret = ib_post_recv(rdma->sc_qp, &ctxt->rc_recv_wr, NULL); in __svc_rdma_post_recv()
232 trace_svcrdma_post_recv(&ctxt->rc_recv_wr, ret); in __svc_rdma_post_recv()
238 svc_rdma_recv_ctxt_put(rdma, ctxt); in __svc_rdma_post_recv()
245 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_post_recv() local
247 ctxt = svc_rdma_recv_ctxt_get(rdma); in svc_rdma_post_recv()
248 if (!ctxt) in svc_rdma_post_recv()
250 return __svc_rdma_post_recv(rdma, ctxt); in svc_rdma_post_recv()
261 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_post_recvs() local
266 ctxt = svc_rdma_recv_ctxt_get(rdma); in svc_rdma_post_recvs()
267 if (!ctxt) in svc_rdma_post_recvs()
269 ctxt->rc_temp = true; in svc_rdma_post_recvs()
270 ret = __svc_rdma_post_recv(rdma, ctxt); in svc_rdma_post_recvs()
289 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_wc_receive() local
294 ctxt = container_of(cqe, struct svc_rdma_recv_ctxt, rc_cqe); in svc_rdma_wc_receive()
303 ctxt->rc_byte_len = wc->byte_len; in svc_rdma_wc_receive()
305 ctxt->rc_recv_sge.addr, in svc_rdma_wc_receive()
309 list_add_tail(&ctxt->rc_list, &rdma->sc_rq_dto_q); in svc_rdma_wc_receive()
319 svc_rdma_recv_ctxt_put(rdma, ctxt); in svc_rdma_wc_receive()
333 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_flush_recv_queues() local
335 while ((ctxt = svc_rdma_next_recv_ctxt(&rdma->sc_read_complete_q))) { in svc_rdma_flush_recv_queues()
336 list_del(&ctxt->rc_list); in svc_rdma_flush_recv_queues()
337 svc_rdma_recv_ctxt_put(rdma, ctxt); in svc_rdma_flush_recv_queues()
339 while ((ctxt = svc_rdma_next_recv_ctxt(&rdma->sc_rq_dto_q))) { in svc_rdma_flush_recv_queues()
340 list_del(&ctxt->rc_list); in svc_rdma_flush_recv_queues()
341 svc_rdma_recv_ctxt_put(rdma, ctxt); in svc_rdma_flush_recv_queues()
346 struct svc_rdma_recv_ctxt *ctxt) in svc_rdma_build_arg_xdr() argument
350 arg->head[0].iov_base = ctxt->rc_recv_buf; in svc_rdma_build_arg_xdr()
351 arg->head[0].iov_len = ctxt->rc_byte_len; in svc_rdma_build_arg_xdr()
356 arg->buflen = ctxt->rc_byte_len; in svc_rdma_build_arg_xdr()
357 arg->len = ctxt->rc_byte_len; in svc_rdma_build_arg_xdr()
489 struct svc_rdma_recv_ctxt *ctxt) in svc_rdma_get_inv_rkey() argument
494 ctxt->rc_inv_rkey = 0; in svc_rdma_get_inv_rkey()
500 p = ctxt->rc_recv_buf; in svc_rdma_get_inv_rkey()
537 ctxt->rc_inv_rkey = be32_to_cpu(inv_rkey); in svc_rdma_get_inv_rkey()
652 struct svc_rdma_send_ctxt *ctxt; in svc_rdma_send_error() local
657 ctxt = svc_rdma_send_ctxt_get(xprt); in svc_rdma_send_error()
658 if (!ctxt) in svc_rdma_send_error()
661 p = ctxt->sc_xprt_buf; in svc_rdma_send_error()
677 length = (unsigned long)p - (unsigned long)ctxt->sc_xprt_buf; in svc_rdma_send_error()
678 svc_rdma_sync_reply_hdr(xprt, ctxt, length); in svc_rdma_send_error()
680 ctxt->sc_send_wr.opcode = IB_WR_SEND; in svc_rdma_send_error()
681 ret = svc_rdma_send(xprt, &ctxt->sc_send_wr); in svc_rdma_send_error()
683 svc_rdma_send_ctxt_put(xprt, ctxt); in svc_rdma_send_error()
755 struct svc_rdma_recv_ctxt *ctxt; in svc_rdma_recvfrom() local
760 ctxt = svc_rdma_next_recv_ctxt(&rdma_xprt->sc_read_complete_q); in svc_rdma_recvfrom()
761 if (ctxt) { in svc_rdma_recvfrom()
762 list_del(&ctxt->rc_list); in svc_rdma_recvfrom()
764 rdma_read_complete(rqstp, ctxt); in svc_rdma_recvfrom()
767 ctxt = svc_rdma_next_recv_ctxt(&rdma_xprt->sc_rq_dto_q); in svc_rdma_recvfrom()
768 if (!ctxt) { in svc_rdma_recvfrom()
774 list_del(&ctxt->rc_list); in svc_rdma_recvfrom()
779 svc_rdma_build_arg_xdr(rqstp, ctxt); in svc_rdma_recvfrom()
798 svc_rdma_recv_ctxt_put(rdma_xprt, ctxt); in svc_rdma_recvfrom()
801 svc_rdma_get_inv_rkey(rdma_xprt, ctxt); in svc_rdma_recvfrom()
808 rqstp->rq_xprt_ctxt = ctxt; in svc_rdma_recvfrom()
814 ret = svc_rdma_recv_read_chunk(rdma_xprt, rqstp, ctxt, p); in svc_rdma_recvfrom()
821 svc_rdma_recv_ctxt_put(rdma_xprt, ctxt); in svc_rdma_recvfrom()
827 svc_rdma_recv_ctxt_put(rdma_xprt, ctxt); in svc_rdma_recvfrom()
831 svc_rdma_recv_ctxt_put(rdma_xprt, ctxt); in svc_rdma_recvfrom()