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()
1818 static void srp_put_tx_iu(struct srp_rdma_ch *ch, struct srp_iu *iu, in srp_put_tx_iu() argument
1824 list_add(&iu->list, &ch->free_tx); in srp_put_tx_iu()
1848 struct srp_iu *iu; in __srp_get_tx_iu() local
1867 iu = list_first_entry(&ch->free_tx, struct srp_iu, list); in __srp_get_tx_iu()
1868 list_del(&iu->list); in __srp_get_tx_iu()
1869 return iu; in __srp_get_tx_iu()
1879 struct srp_iu *iu = container_of(wc->wr_cqe, struct srp_iu, cqe); in srp_send_done() local
1889 list_add(&iu->list, &ch->free_tx); in srp_send_done()
1898 static int srp_post_send(struct srp_rdma_ch *ch, struct srp_iu *iu, int len) in srp_post_send() argument
1903 if (WARN_ON_ONCE(iu->num_sge > SRP_MAX_SGE)) in srp_post_send()
1906 iu->sge[0].addr = iu->dma; in srp_post_send()
1907 iu->sge[0].length = len; in srp_post_send()
1908 iu->sge[0].lkey = target->lkey; in srp_post_send()
1910 iu->cqe.done = srp_send_done; in srp_post_send()
1913 wr.wr_cqe = &iu->cqe; in srp_post_send()
1914 wr.sg_list = &iu->sge[0]; in srp_post_send()
1915 wr.num_sge = iu->num_sge; in srp_post_send()
1922 static int srp_post_recv(struct srp_rdma_ch *ch, struct srp_iu *iu) in srp_post_recv() argument
1928 list.addr = iu->dma; in srp_post_recv()
1929 list.length = iu->size; in srp_post_recv()
1932 iu->cqe.done = srp_recv_done; in srp_post_recv()
1935 wr.wr_cqe = &iu->cqe; in srp_post_recv()
2014 struct srp_iu *iu; in srp_response_common() local
2019 iu = __srp_get_tx_iu(ch, SRP_IU_RSP); in srp_response_common()
2022 if (!iu) { in srp_response_common()
2028 iu->num_sge = 1; in srp_response_common()
2029 ib_dma_sync_single_for_cpu(dev, iu->dma, len, DMA_TO_DEVICE); in srp_response_common()
2030 memcpy(iu->buf, rsp, len); in srp_response_common()
2031 ib_dma_sync_single_for_device(dev, iu->dma, len, DMA_TO_DEVICE); in srp_response_common()
2033 err = srp_post_send(ch, iu, len); in srp_response_common()
2037 srp_put_tx_iu(ch, iu, SRP_IU_RSP); in srp_response_common()
2077 struct srp_iu *iu = container_of(wc->wr_cqe, struct srp_iu, cqe); in srp_recv_done() local
2089 ib_dma_sync_single_for_cpu(dev, iu->dma, ch->max_ti_iu_len, in srp_recv_done()
2092 opcode = *(u8 *) iu->buf; in srp_recv_done()
2098 iu->buf, wc->byte_len, true); in srp_recv_done()
2103 srp_process_rsp(ch, iu->buf); in srp_recv_done()
2107 srp_process_cred_req(ch, iu->buf); in srp_recv_done()
2111 srp_process_aer_req(ch, iu->buf); in srp_recv_done()
2126 ib_dma_sync_single_for_device(dev, iu->dma, ch->max_ti_iu_len, in srp_recv_done()
2129 res = srp_post_recv(ch, iu); in srp_recv_done()
2172 struct srp_iu *iu; in srp_queuecommand() local
2193 iu = __srp_get_tx_iu(ch, SRP_IU_CMD); in srp_queuecommand()
2196 if (!iu) in srp_queuecommand()
2201 ib_dma_sync_single_for_cpu(dev, iu->dma, ch->max_it_iu_len, in srp_queuecommand()
2206 cmd = iu->buf; in srp_queuecommand()
2221 req->cmd = iu; in srp_queuecommand()
2238 ib_dma_sync_single_for_device(dev, iu->dma, ch->max_it_iu_len, in srp_queuecommand()
2241 if (srp_post_send(ch, iu, len)) { in srp_queuecommand()
2253 srp_put_tx_iu(ch, iu, SRP_IU_CMD); in srp_queuecommand()
2402 struct srp_iu *iu = ch->rx_ring[i]; in srp_cm_rep_handler() local
2404 ret = srp_post_recv(ch, iu); in srp_cm_rep_handler()
2743 struct srp_iu *iu; in srp_send_tsk_mgmt() local
2756 iu = __srp_get_tx_iu(ch, SRP_IU_TSK_MGMT); in srp_send_tsk_mgmt()
2759 if (!iu) { in srp_send_tsk_mgmt()
2765 iu->num_sge = 1; in srp_send_tsk_mgmt()
2767 ib_dma_sync_single_for_cpu(dev, iu->dma, sizeof *tsk_mgmt, in srp_send_tsk_mgmt()
2769 tsk_mgmt = iu->buf; in srp_send_tsk_mgmt()
2784 ib_dma_sync_single_for_device(dev, iu->dma, sizeof *tsk_mgmt, in srp_send_tsk_mgmt()
2786 if (srp_post_send(ch, iu, sizeof(*tsk_mgmt))) { in srp_send_tsk_mgmt()
2787 srp_put_tx_iu(ch, iu, SRP_IU_TSK_MGMT); in srp_send_tsk_mgmt()