Lines Matching full:rdma
49 * be read. "Data Ready" is signaled when an RDMA Receive completes,
50 * or when a set of RDMA Reads complete.
61 * svc_rdma_recvfrom must post RDMA Reads to pull the RPC Call's
63 * RDMA Reads using pages in svc_rqst::rq_pages, which are
76 * of the RPC Call message, using the RDMA Read sink pages kept in
86 * The first svc_rqst supplies pages for RDMA Reads. These are moved
91 * During the second svc_rdma_recvfrom call, RDMA Read sink pages
98 #include <rdma/ib_verbs.h>
99 #include <rdma/rdma_cm.h>
120 static void svc_rdma_recv_cid_init(struct svcxprt_rdma *rdma, in svc_rdma_recv_cid_init() argument
123 cid->ci_queue_id = rdma->sc_rq_cq->res.id; in svc_rdma_recv_cid_init()
124 cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids); in svc_rdma_recv_cid_init()
128 svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma) in svc_rdma_recv_ctxt_alloc() argument
137 buffer = kmalloc(rdma->sc_max_req_size, GFP_KERNEL); in svc_rdma_recv_ctxt_alloc()
140 addr = ib_dma_map_single(rdma->sc_pd->device, buffer, in svc_rdma_recv_ctxt_alloc()
141 rdma->sc_max_req_size, DMA_FROM_DEVICE); in svc_rdma_recv_ctxt_alloc()
142 if (ib_dma_mapping_error(rdma->sc_pd->device, addr)) in svc_rdma_recv_ctxt_alloc()
145 svc_rdma_recv_cid_init(rdma, &ctxt->rc_cid); in svc_rdma_recv_ctxt_alloc()
153 ctxt->rc_recv_sge.length = rdma->sc_max_req_size; in svc_rdma_recv_ctxt_alloc()
154 ctxt->rc_recv_sge.lkey = rdma->sc_pd->local_dma_lkey; in svc_rdma_recv_ctxt_alloc()
167 static void svc_rdma_recv_ctxt_destroy(struct svcxprt_rdma *rdma, in svc_rdma_recv_ctxt_destroy() argument
170 ib_dma_unmap_single(rdma->sc_pd->device, ctxt->rc_recv_sge.addr, in svc_rdma_recv_ctxt_destroy()
178 * @rdma: svcxprt_rdma being torn down
181 void svc_rdma_recv_ctxts_destroy(struct svcxprt_rdma *rdma) in svc_rdma_recv_ctxts_destroy() argument
186 while ((node = llist_del_first(&rdma->sc_recv_ctxts))) { in svc_rdma_recv_ctxts_destroy()
188 svc_rdma_recv_ctxt_destroy(rdma, ctxt); in svc_rdma_recv_ctxts_destroy()
193 svc_rdma_recv_ctxt_get(struct svcxprt_rdma *rdma) in svc_rdma_recv_ctxt_get() argument
198 node = llist_del_first(&rdma->sc_recv_ctxts); in svc_rdma_recv_ctxt_get()
209 ctxt = svc_rdma_recv_ctxt_alloc(rdma); in svc_rdma_recv_ctxt_get()
217 * @rdma: controlling svcxprt_rdma
221 void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma, in svc_rdma_recv_ctxt_put() argument
230 llist_add(&ctxt->rc_node, &rdma->sc_recv_ctxts); in svc_rdma_recv_ctxt_put()
232 svc_rdma_recv_ctxt_destroy(rdma, ctxt); in svc_rdma_recv_ctxt_put()
247 struct svcxprt_rdma *rdma = in svc_rdma_release_rqst() local
252 svc_rdma_recv_ctxt_put(rdma, ctxt); in svc_rdma_release_rqst()
255 static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma, in __svc_rdma_post_recv() argument
261 ret = ib_post_recv(rdma->sc_qp, &ctxt->rc_recv_wr, NULL); in __svc_rdma_post_recv()
267 trace_svcrdma_rq_post_err(rdma, ret); in __svc_rdma_post_recv()
268 svc_rdma_recv_ctxt_put(rdma, ctxt); in __svc_rdma_post_recv()
272 static int svc_rdma_post_recv(struct svcxprt_rdma *rdma) in svc_rdma_post_recv() argument
276 if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags)) in svc_rdma_post_recv()
278 ctxt = svc_rdma_recv_ctxt_get(rdma); in svc_rdma_post_recv()
281 return __svc_rdma_post_recv(rdma, ctxt); in svc_rdma_post_recv()
286 * @rdma: fresh svcxprt_rdma
290 bool svc_rdma_post_recvs(struct svcxprt_rdma *rdma) in svc_rdma_post_recvs() argument
296 for (i = 0; i < rdma->sc_max_requests; i++) { in svc_rdma_post_recvs()
297 ctxt = svc_rdma_recv_ctxt_get(rdma); in svc_rdma_post_recvs()
301 ret = __svc_rdma_post_recv(rdma, ctxt); in svc_rdma_post_recvs()
309 * svc_rdma_wc_receive - Invoked by RDMA provider for each polled Receive WC
318 struct svcxprt_rdma *rdma = cq->cq_context; in svc_rdma_wc_receive() local
329 if (svc_rdma_post_recv(rdma)) in svc_rdma_wc_receive()
334 ib_dma_sync_single_for_cpu(rdma->sc_pd->device, in svc_rdma_wc_receive()
338 spin_lock(&rdma->sc_rq_dto_lock); in svc_rdma_wc_receive()
339 list_add_tail(&ctxt->rc_list, &rdma->sc_rq_dto_q); in svc_rdma_wc_receive()
341 set_bit(XPT_DATA, &rdma->sc_xprt.xpt_flags); in svc_rdma_wc_receive()
342 spin_unlock(&rdma->sc_rq_dto_lock); in svc_rdma_wc_receive()
343 if (!test_bit(RDMAXPRT_CONN_PENDING, &rdma->sc_flags)) in svc_rdma_wc_receive()
344 svc_xprt_enqueue(&rdma->sc_xprt); in svc_rdma_wc_receive()
349 svc_rdma_recv_ctxt_put(rdma, ctxt); in svc_rdma_wc_receive()
350 set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags); in svc_rdma_wc_receive()
351 svc_xprt_enqueue(&rdma->sc_xprt); in svc_rdma_wc_receive()
356 * @rdma: svcxprt_rdma being shut down
359 void svc_rdma_flush_recv_queues(struct svcxprt_rdma *rdma) in svc_rdma_flush_recv_queues() argument
363 while ((ctxt = svc_rdma_next_recv_ctxt(&rdma->sc_read_complete_q))) { in svc_rdma_flush_recv_queues()
365 svc_rdma_recv_ctxt_put(rdma, ctxt); in svc_rdma_flush_recv_queues()
367 while ((ctxt = svc_rdma_next_recv_ctxt(&rdma->sc_rq_dto_q))) { in svc_rdma_flush_recv_queues()
369 svc_rdma_recv_ctxt_put(rdma, ctxt); in svc_rdma_flush_recv_queues()
549 /* RPC-over-RDMA Version One private extension: Remote Invalidation.
559 static void svc_rdma_get_inv_rkey(struct svcxprt_rdma *rdma, in svc_rdma_get_inv_rkey() argument
567 if (!rdma->sc_snd_w_inv) in svc_rdma_get_inv_rkey()
613 * @rq_arg: xdr_buf containing ingress RPC/RDMA message
617 * RPC-over-RDMA transport header.
620 * RPC-over-RDMA header. For RDMA_MSG, this is the RPC message.
622 * The length of the RPC-over-RDMA header is returned.
721 static void svc_rdma_send_error(struct svcxprt_rdma *rdma, in svc_rdma_send_error() argument
727 sctxt = svc_rdma_send_ctxt_get(rdma); in svc_rdma_send_error()
730 svc_rdma_send_error_msg(rdma, sctxt, rctxt, status); in svc_rdma_send_error()
735 * the RPC/RDMA header small and fixed in size, so it is