Lines Matching refs:iu
129 struct srp_iu *iu; in srp_alloc_iu() local
131 iu = kmalloc(sizeof *iu, gfp_mask); in srp_alloc_iu()
132 if (!iu) in srp_alloc_iu()
135 iu->buf = kzalloc(size, gfp_mask); in srp_alloc_iu()
136 if (!iu->buf) in srp_alloc_iu()
139 iu->dma = ib_dma_map_single(host->srp_dev->dev, iu->buf, size, in srp_alloc_iu()
141 if (ib_dma_mapping_error(host->srp_dev->dev, iu->dma)) in srp_alloc_iu()
144 iu->size = size; in srp_alloc_iu()
145 iu->direction = direction; in srp_alloc_iu()
147 return iu; in srp_alloc_iu()
150 kfree(iu->buf); in srp_alloc_iu()
152 kfree(iu); in srp_alloc_iu()
157 static void srp_free_iu(struct srp_host *host, struct srp_iu *iu) in srp_free_iu() argument
159 if (!iu) in srp_free_iu()
162 ib_dma_unmap_single(host->srp_dev->dev, iu->dma, iu->size, in srp_free_iu()
163 iu->direction); in srp_free_iu()
164 kfree(iu->buf); in srp_free_iu()
165 kfree(iu); in srp_free_iu()
1047 static void srp_put_tx_iu(struct srp_target_port *target, struct srp_iu *iu, in srp_put_tx_iu() argument
1053 list_add(&iu->list, &target->free_tx); in srp_put_tx_iu()
1076 struct srp_iu *iu; in __srp_get_tx_iu() local
1093 iu = list_first_entry(&target->free_tx, struct srp_iu, list); in __srp_get_tx_iu()
1094 list_del(&iu->list); in __srp_get_tx_iu()
1095 return iu; in __srp_get_tx_iu()
1099 struct srp_iu *iu, int len) in srp_post_send() argument
1104 list.addr = iu->dma; in srp_post_send()
1109 wr.wr_id = (uintptr_t) iu; in srp_post_send()
1118 static int srp_post_recv(struct srp_target_port *target, struct srp_iu *iu) in srp_post_recv() argument
1123 list.addr = iu->dma; in srp_post_recv()
1124 list.length = iu->size; in srp_post_recv()
1128 wr.wr_id = (uintptr_t) iu; in srp_post_recv()
1191 struct srp_iu *iu; in srp_response_common() local
1196 iu = __srp_get_tx_iu(target, SRP_IU_RSP); in srp_response_common()
1199 if (!iu) { in srp_response_common()
1205 ib_dma_sync_single_for_cpu(dev, iu->dma, len, DMA_TO_DEVICE); in srp_response_common()
1206 memcpy(iu->buf, rsp, len); in srp_response_common()
1207 ib_dma_sync_single_for_device(dev, iu->dma, len, DMA_TO_DEVICE); in srp_response_common()
1209 err = srp_post_send(target, iu, len); in srp_response_common()
1213 srp_put_tx_iu(target, iu, SRP_IU_RSP); in srp_response_common()
1253 struct srp_iu *iu = (struct srp_iu *) (uintptr_t) wc->wr_id; in srp_handle_recv() local
1257 ib_dma_sync_single_for_cpu(dev, iu->dma, target->max_ti_iu_len, in srp_handle_recv()
1260 opcode = *(u8 *) iu->buf; in srp_handle_recv()
1266 iu->buf, wc->byte_len, true); in srp_handle_recv()
1271 srp_process_rsp(target, iu->buf); in srp_handle_recv()
1275 srp_process_cred_req(target, iu->buf); in srp_handle_recv()
1279 srp_process_aer_req(target, iu->buf); in srp_handle_recv()
1294 ib_dma_sync_single_for_device(dev, iu->dma, target->max_ti_iu_len, in srp_handle_recv()
1297 res = srp_post_recv(target, iu); in srp_handle_recv()
1335 struct srp_iu *iu; in srp_send_completion() local
1339 iu = (struct srp_iu *) (uintptr_t) wc.wr_id; in srp_send_completion()
1340 list_add(&iu->list, &target->free_tx); in srp_send_completion()
1351 struct srp_iu *iu; in srp_queuecommand() local
1364 iu = __srp_get_tx_iu(target, SRP_IU_CMD); in srp_queuecommand()
1365 if (!iu) in srp_queuecommand()
1373 ib_dma_sync_single_for_cpu(dev, iu->dma, target->max_iu_len, in srp_queuecommand()
1379 cmd = iu->buf; in srp_queuecommand()
1388 req->cmd = iu; in srp_queuecommand()
1397 ib_dma_sync_single_for_device(dev, iu->dma, target->max_iu_len, in srp_queuecommand()
1400 if (srp_post_send(target, iu, len)) { in srp_queuecommand()
1411 srp_put_tx_iu(target, iu, SRP_IU_CMD); in srp_queuecommand()
1535 struct srp_iu *iu = target->rx_ring[i]; in srp_cm_rep_handler() local
1536 ret = srp_post_recv(target, iu); in srp_cm_rep_handler()
1703 struct srp_iu *iu; in srp_send_tsk_mgmt() local
1712 iu = __srp_get_tx_iu(target, SRP_IU_TSK_MGMT); in srp_send_tsk_mgmt()
1715 if (!iu) in srp_send_tsk_mgmt()
1718 ib_dma_sync_single_for_cpu(dev, iu->dma, sizeof *tsk_mgmt, in srp_send_tsk_mgmt()
1720 tsk_mgmt = iu->buf; in srp_send_tsk_mgmt()
1729 ib_dma_sync_single_for_device(dev, iu->dma, sizeof *tsk_mgmt, in srp_send_tsk_mgmt()
1731 if (srp_post_send(target, iu, sizeof *tsk_mgmt)) { in srp_send_tsk_mgmt()
1732 srp_put_tx_iu(target, iu, SRP_IU_TSK_MGMT); in srp_send_tsk_mgmt()