Lines Matching refs:iu
230 struct srp_iu *iu; in srp_alloc_iu() local
232 iu = kmalloc(sizeof *iu, gfp_mask); in srp_alloc_iu()
233 if (!iu) in srp_alloc_iu()
236 iu->buf = kzalloc(size, gfp_mask); in srp_alloc_iu()
237 if (!iu->buf) in srp_alloc_iu()
240 iu->dma = ib_dma_map_single(host->srp_dev->dev, iu->buf, size, in srp_alloc_iu()
242 if (ib_dma_mapping_error(host->srp_dev->dev, iu->dma)) in srp_alloc_iu()
245 iu->size = size; in srp_alloc_iu()
246 iu->direction = direction; in srp_alloc_iu()
248 return iu; in srp_alloc_iu()
251 kfree(iu->buf); in srp_alloc_iu()
253 kfree(iu); in srp_alloc_iu()
258 static void srp_free_iu(struct srp_host *host, struct srp_iu *iu) in srp_free_iu() argument
260 if (!iu) in srp_free_iu()
263 ib_dma_unmap_single(host->srp_dev->dev, iu->dma, iu->size, in srp_free_iu()
264 iu->direction); in srp_free_iu()
265 kfree(iu->buf); in srp_free_iu()
266 kfree(iu); in srp_free_iu()
1814 static void srp_put_tx_iu(struct srp_rdma_ch *ch, struct srp_iu *iu, in srp_put_tx_iu() argument
1820 list_add(&iu->list, &ch->free_tx); in srp_put_tx_iu()
1844 struct srp_iu *iu; in __srp_get_tx_iu() local
1863 iu = list_first_entry(&ch->free_tx, struct srp_iu, list); in __srp_get_tx_iu()
1864 list_del(&iu->list); in __srp_get_tx_iu()
1865 return iu; in __srp_get_tx_iu()
1875 struct srp_iu *iu = container_of(wc->wr_cqe, struct srp_iu, cqe); in srp_send_done() local
1885 list_add(&iu->list, &ch->free_tx); in srp_send_done()
1894 static int srp_post_send(struct srp_rdma_ch *ch, struct srp_iu *iu, int len) in srp_post_send() argument
1899 if (WARN_ON_ONCE(iu->num_sge > SRP_MAX_SGE)) in srp_post_send()
1902 iu->sge[0].addr = iu->dma; in srp_post_send()
1903 iu->sge[0].length = len; in srp_post_send()
1904 iu->sge[0].lkey = target->lkey; in srp_post_send()
1906 iu->cqe.done = srp_send_done; in srp_post_send()
1909 wr.wr_cqe = &iu->cqe; in srp_post_send()
1910 wr.sg_list = &iu->sge[0]; in srp_post_send()
1911 wr.num_sge = iu->num_sge; in srp_post_send()
1918 static int srp_post_recv(struct srp_rdma_ch *ch, struct srp_iu *iu) in srp_post_recv() argument
1924 list.addr = iu->dma; in srp_post_recv()
1925 list.length = iu->size; in srp_post_recv()
1928 iu->cqe.done = srp_recv_done; in srp_post_recv()
1931 wr.wr_cqe = &iu->cqe; in srp_post_recv()
2007 struct srp_iu *iu; in srp_response_common() local
2012 iu = __srp_get_tx_iu(ch, SRP_IU_RSP); in srp_response_common()
2015 if (!iu) { in srp_response_common()
2021 iu->num_sge = 1; in srp_response_common()
2022 ib_dma_sync_single_for_cpu(dev, iu->dma, len, DMA_TO_DEVICE); in srp_response_common()
2023 memcpy(iu->buf, rsp, len); in srp_response_common()
2024 ib_dma_sync_single_for_device(dev, iu->dma, len, DMA_TO_DEVICE); in srp_response_common()
2026 err = srp_post_send(ch, iu, len); in srp_response_common()
2030 srp_put_tx_iu(ch, iu, SRP_IU_RSP); in srp_response_common()
2070 struct srp_iu *iu = container_of(wc->wr_cqe, struct srp_iu, cqe); in srp_recv_done() local
2082 ib_dma_sync_single_for_cpu(dev, iu->dma, ch->max_ti_iu_len, in srp_recv_done()
2085 opcode = *(u8 *) iu->buf; in srp_recv_done()
2091 iu->buf, wc->byte_len, true); in srp_recv_done()
2096 srp_process_rsp(ch, iu->buf); in srp_recv_done()
2100 srp_process_cred_req(ch, iu->buf); in srp_recv_done()
2104 srp_process_aer_req(ch, iu->buf); in srp_recv_done()
2119 ib_dma_sync_single_for_device(dev, iu->dma, ch->max_ti_iu_len, in srp_recv_done()
2122 res = srp_post_recv(ch, iu); in srp_recv_done()
2166 struct srp_iu *iu; in srp_queuecommand() local
2182 iu = __srp_get_tx_iu(ch, SRP_IU_CMD); in srp_queuecommand()
2185 if (!iu) in srp_queuecommand()
2189 ib_dma_sync_single_for_cpu(dev, iu->dma, ch->max_it_iu_len, in srp_queuecommand()
2192 cmd = iu->buf; in srp_queuecommand()
2207 req->cmd = iu; in srp_queuecommand()
2224 ib_dma_sync_single_for_device(dev, iu->dma, ch->max_it_iu_len, in srp_queuecommand()
2227 if (srp_post_send(ch, iu, len)) { in srp_queuecommand()
2239 srp_put_tx_iu(ch, iu, SRP_IU_CMD); in srp_queuecommand()
2388 struct srp_iu *iu = ch->rx_ring[i]; in srp_cm_rep_handler() local
2390 ret = srp_post_recv(ch, iu); in srp_cm_rep_handler()
2729 struct srp_iu *iu; in srp_send_tsk_mgmt() local
2742 iu = __srp_get_tx_iu(ch, SRP_IU_TSK_MGMT); in srp_send_tsk_mgmt()
2745 if (!iu) { in srp_send_tsk_mgmt()
2751 iu->num_sge = 1; in srp_send_tsk_mgmt()
2753 ib_dma_sync_single_for_cpu(dev, iu->dma, sizeof *tsk_mgmt, in srp_send_tsk_mgmt()
2755 tsk_mgmt = iu->buf; in srp_send_tsk_mgmt()
2770 ib_dma_sync_single_for_device(dev, iu->dma, sizeof *tsk_mgmt, in srp_send_tsk_mgmt()
2772 if (srp_post_send(ch, iu, sizeof(*tsk_mgmt))) { in srp_send_tsk_mgmt()
2773 srp_put_tx_iu(ch, iu, SRP_IU_TSK_MGMT); in srp_send_tsk_mgmt()