Lines Matching refs:ctxt
158 struct svc_rdma_op_ctxt *ctxt; in svc_rdma_get_context() local
160 ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep, in svc_rdma_get_context()
162 ctxt->xprt = xprt; in svc_rdma_get_context()
163 INIT_LIST_HEAD(&ctxt->dto_q); in svc_rdma_get_context()
164 ctxt->count = 0; in svc_rdma_get_context()
165 ctxt->frmr = NULL; in svc_rdma_get_context()
167 return ctxt; in svc_rdma_get_context()
170 void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt) in svc_rdma_unmap_dma() argument
172 struct svcxprt_rdma *xprt = ctxt->xprt; in svc_rdma_unmap_dma()
174 for (i = 0; i < ctxt->count && ctxt->sge[i].length; i++) { in svc_rdma_unmap_dma()
181 if (ctxt->sge[i].lkey == xprt->sc_dma_lkey) { in svc_rdma_unmap_dma()
184 ctxt->sge[i].addr, in svc_rdma_unmap_dma()
185 ctxt->sge[i].length, in svc_rdma_unmap_dma()
186 ctxt->direction); in svc_rdma_unmap_dma()
191 void svc_rdma_put_context(struct svc_rdma_op_ctxt *ctxt, int free_pages) in svc_rdma_put_context() argument
196 xprt = ctxt->xprt; in svc_rdma_put_context()
198 for (i = 0; i < ctxt->count; i++) in svc_rdma_put_context()
199 put_page(ctxt->pages[i]); in svc_rdma_put_context()
201 kmem_cache_free(svc_rdma_ctxt_cachep, ctxt); in svc_rdma_put_context()
343 struct svc_rdma_op_ctxt *ctxt = NULL; in rq_cq_reap() local
352 ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id; in rq_cq_reap()
353 ctxt->wc_status = wc.status; in rq_cq_reap()
354 ctxt->byte_len = wc.byte_len; in rq_cq_reap()
355 svc_rdma_unmap_dma(ctxt); in rq_cq_reap()
358 dprintk("svcrdma: transport closing putting ctxt %p\n", ctxt); in rq_cq_reap()
360 svc_rdma_put_context(ctxt, 1); in rq_cq_reap()
365 list_add_tail(&ctxt->dto_q, &xprt->sc_rq_dto_q); in rq_cq_reap()
370 if (ctxt) in rq_cq_reap()
387 struct svc_rdma_op_ctxt *ctxt) in process_context() argument
389 svc_rdma_unmap_dma(ctxt); in process_context()
391 switch (ctxt->wr_op) { in process_context()
393 if (ctxt->frmr) in process_context()
395 svc_rdma_put_context(ctxt, 1); in process_context()
399 if (ctxt->frmr) in process_context()
401 svc_rdma_put_context(ctxt, 0); in process_context()
406 svc_rdma_put_frmr(xprt, ctxt->frmr); in process_context()
407 if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) { in process_context()
408 struct svc_rdma_op_ctxt *read_hdr = ctxt->read_hdr; in process_context()
420 svc_rdma_put_context(ctxt, 0); in process_context()
426 ctxt->wr_op); in process_context()
438 struct svc_rdma_op_ctxt *ctxt = NULL; in sq_cq_reap() local
469 ctxt = (struct svc_rdma_op_ctxt *) in sq_cq_reap()
471 if (ctxt) in sq_cq_reap()
472 process_context(xprt, ctxt); in sq_cq_reap()
478 if (ctxt) in sq_cq_reap()
549 struct svc_rdma_op_ctxt *ctxt; in svc_rdma_post_recv() local
556 ctxt = svc_rdma_get_context(xprt); in svc_rdma_post_recv()
558 ctxt->direction = DMA_FROM_DEVICE; in svc_rdma_post_recv()
565 ctxt->pages[sge_no] = page; in svc_rdma_post_recv()
572 ctxt->sge[sge_no].addr = pa; in svc_rdma_post_recv()
573 ctxt->sge[sge_no].length = PAGE_SIZE; in svc_rdma_post_recv()
574 ctxt->sge[sge_no].lkey = xprt->sc_dma_lkey; in svc_rdma_post_recv()
575 ctxt->count = sge_no + 1; in svc_rdma_post_recv()
579 recv_wr.sg_list = &ctxt->sge[0]; in svc_rdma_post_recv()
580 recv_wr.num_sge = ctxt->count; in svc_rdma_post_recv()
581 recv_wr.wr_id = (u64)(unsigned long)ctxt; in svc_rdma_post_recv()
586 svc_rdma_unmap_dma(ctxt); in svc_rdma_post_recv()
587 svc_rdma_put_context(ctxt, 1); in svc_rdma_post_recv()
593 svc_rdma_unmap_dma(ctxt); in svc_rdma_post_recv()
594 svc_rdma_put_context(ctxt, 1); in svc_rdma_post_recv()
1177 struct svc_rdma_op_ctxt *ctxt; in __svc_rdma_free() local
1178 ctxt = list_entry(rdma->sc_read_complete_q.next, in __svc_rdma_free()
1181 list_del_init(&ctxt->dto_q); in __svc_rdma_free()
1182 svc_rdma_put_context(ctxt, 1); in __svc_rdma_free()
1187 struct svc_rdma_op_ctxt *ctxt; in __svc_rdma_free() local
1188 ctxt = list_entry(rdma->sc_rq_dto_q.next, in __svc_rdma_free()
1191 list_del_init(&ctxt->dto_q); in __svc_rdma_free()
1192 svc_rdma_put_context(ctxt, 1); in __svc_rdma_free()
1319 struct svc_rdma_op_ctxt *ctxt; in svc_rdma_send_error() local
1330 ctxt = svc_rdma_get_context(xprt); in svc_rdma_send_error()
1331 ctxt->direction = DMA_FROM_DEVICE; in svc_rdma_send_error()
1332 ctxt->count = 1; in svc_rdma_send_error()
1333 ctxt->pages[0] = p; in svc_rdma_send_error()
1336 ctxt->sge[0].addr = ib_dma_map_page(xprt->sc_cm_id->device, in svc_rdma_send_error()
1338 if (ib_dma_mapping_error(xprt->sc_cm_id->device, ctxt->sge[0].addr)) { in svc_rdma_send_error()
1340 svc_rdma_put_context(ctxt, 1); in svc_rdma_send_error()
1344 ctxt->sge[0].lkey = xprt->sc_dma_lkey; in svc_rdma_send_error()
1345 ctxt->sge[0].length = length; in svc_rdma_send_error()
1349 ctxt->wr_op = IB_WR_SEND; in svc_rdma_send_error()
1350 err_wr.wr_id = (unsigned long)ctxt; in svc_rdma_send_error()
1351 err_wr.sg_list = ctxt->sge; in svc_rdma_send_error()
1361 svc_rdma_unmap_dma(ctxt); in svc_rdma_send_error()
1362 svc_rdma_put_context(ctxt, 1); in svc_rdma_send_error()