Lines Matching refs:ctxt

100 	struct svc_rdma_op_ctxt *ctxt;  in svc_rdma_get_context()  local
103 ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep, GFP_KERNEL); in svc_rdma_get_context()
104 if (ctxt) in svc_rdma_get_context()
108 ctxt->xprt = xprt; in svc_rdma_get_context()
109 INIT_LIST_HEAD(&ctxt->dto_q); in svc_rdma_get_context()
110 ctxt->count = 0; in svc_rdma_get_context()
111 ctxt->frmr = NULL; in svc_rdma_get_context()
113 return ctxt; in svc_rdma_get_context()
116 void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt) in svc_rdma_unmap_dma() argument
118 struct svcxprt_rdma *xprt = ctxt->xprt; in svc_rdma_unmap_dma()
120 for (i = 0; i < ctxt->count && ctxt->sge[i].length; i++) { in svc_rdma_unmap_dma()
127 if (ctxt->sge[i].lkey == xprt->sc_dma_lkey) { in svc_rdma_unmap_dma()
130 ctxt->sge[i].addr, in svc_rdma_unmap_dma()
131 ctxt->sge[i].length, in svc_rdma_unmap_dma()
132 ctxt->direction); in svc_rdma_unmap_dma()
137 void svc_rdma_put_context(struct svc_rdma_op_ctxt *ctxt, int free_pages) in svc_rdma_put_context() argument
142 xprt = ctxt->xprt; in svc_rdma_put_context()
144 for (i = 0; i < ctxt->count; i++) in svc_rdma_put_context()
145 put_page(ctxt->pages[i]); in svc_rdma_put_context()
147 kmem_cache_free(svc_rdma_ctxt_cachep, ctxt); in svc_rdma_put_context()
291 struct svc_rdma_op_ctxt *ctxt = NULL; in rq_cq_reap() local
300 ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id; in rq_cq_reap()
301 ctxt->wc_status = wc.status; in rq_cq_reap()
302 ctxt->byte_len = wc.byte_len; in rq_cq_reap()
303 svc_rdma_unmap_dma(ctxt); in rq_cq_reap()
306 dprintk("svcrdma: transport closing putting ctxt %p\n", ctxt); in rq_cq_reap()
308 svc_rdma_put_context(ctxt, 1); in rq_cq_reap()
313 list_add_tail(&ctxt->dto_q, &xprt->sc_rq_dto_q); in rq_cq_reap()
318 if (ctxt) in rq_cq_reap()
335 struct svc_rdma_op_ctxt *ctxt) in process_context() argument
337 svc_rdma_unmap_dma(ctxt); in process_context()
339 switch (ctxt->wr_op) { in process_context()
341 if (ctxt->frmr) in process_context()
343 svc_rdma_put_context(ctxt, 1); in process_context()
347 if (ctxt->frmr) in process_context()
349 svc_rdma_put_context(ctxt, 0); in process_context()
354 svc_rdma_put_frmr(xprt, ctxt->frmr); in process_context()
355 if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) { in process_context()
356 struct svc_rdma_op_ctxt *read_hdr = ctxt->read_hdr; in process_context()
368 svc_rdma_put_context(ctxt, 0); in process_context()
374 ctxt->wr_op); in process_context()
386 struct svc_rdma_op_ctxt *ctxt = NULL; in sq_cq_reap() local
416 ctxt = (struct svc_rdma_op_ctxt *) in sq_cq_reap()
418 if (ctxt) in sq_cq_reap()
419 process_context(xprt, ctxt); in sq_cq_reap()
425 if (ctxt) in sq_cq_reap()
508 struct svc_rdma_op_ctxt *ctxt; in svc_rdma_post_recv() local
515 ctxt = svc_rdma_get_context(xprt); in svc_rdma_post_recv()
517 ctxt->direction = DMA_FROM_DEVICE; in svc_rdma_post_recv()
524 ctxt->pages[sge_no] = page; in svc_rdma_post_recv()
531 ctxt->sge[sge_no].addr = pa; in svc_rdma_post_recv()
532 ctxt->sge[sge_no].length = PAGE_SIZE; in svc_rdma_post_recv()
533 ctxt->sge[sge_no].lkey = xprt->sc_dma_lkey; in svc_rdma_post_recv()
534 ctxt->count = sge_no + 1; in svc_rdma_post_recv()
538 recv_wr.sg_list = &ctxt->sge[0]; in svc_rdma_post_recv()
539 recv_wr.num_sge = ctxt->count; in svc_rdma_post_recv()
540 recv_wr.wr_id = (u64)(unsigned long)ctxt; in svc_rdma_post_recv()
545 svc_rdma_unmap_dma(ctxt); in svc_rdma_post_recv()
546 svc_rdma_put_context(ctxt, 1); in svc_rdma_post_recv()
552 svc_rdma_unmap_dma(ctxt); in svc_rdma_post_recv()
553 svc_rdma_put_context(ctxt, 1); in svc_rdma_post_recv()
1145 struct svc_rdma_op_ctxt *ctxt; in __svc_rdma_free() local
1146 ctxt = list_entry(rdma->sc_read_complete_q.next, in __svc_rdma_free()
1149 list_del_init(&ctxt->dto_q); in __svc_rdma_free()
1150 svc_rdma_put_context(ctxt, 1); in __svc_rdma_free()
1155 struct svc_rdma_op_ctxt *ctxt; in __svc_rdma_free() local
1156 ctxt = list_entry(rdma->sc_rq_dto_q.next, in __svc_rdma_free()
1159 list_del_init(&ctxt->dto_q); in __svc_rdma_free()
1160 svc_rdma_put_context(ctxt, 1); in __svc_rdma_free()
1321 struct svc_rdma_op_ctxt *ctxt; in svc_rdma_send_error() local
1332 ctxt = svc_rdma_get_context(xprt); in svc_rdma_send_error()
1333 ctxt->direction = DMA_FROM_DEVICE; in svc_rdma_send_error()
1334 ctxt->count = 1; in svc_rdma_send_error()
1335 ctxt->pages[0] = p; in svc_rdma_send_error()
1338 ctxt->sge[0].addr = ib_dma_map_page(xprt->sc_cm_id->device, in svc_rdma_send_error()
1340 if (ib_dma_mapping_error(xprt->sc_cm_id->device, ctxt->sge[0].addr)) { in svc_rdma_send_error()
1342 svc_rdma_put_context(ctxt, 1); in svc_rdma_send_error()
1346 ctxt->sge[0].lkey = xprt->sc_dma_lkey; in svc_rdma_send_error()
1347 ctxt->sge[0].length = length; in svc_rdma_send_error()
1351 ctxt->wr_op = IB_WR_SEND; in svc_rdma_send_error()
1352 err_wr.wr_id = (unsigned long)ctxt; in svc_rdma_send_error()
1353 err_wr.sg_list = ctxt->sge; in svc_rdma_send_error()
1363 svc_rdma_unmap_dma(ctxt); in svc_rdma_send_error()
1364 svc_rdma_put_context(ctxt, 1); in svc_rdma_send_error()