Lines Matching refs:target

104 int srp_target_alloc(struct srp_target *target, struct device *dev,  in srp_target_alloc()  argument
109 spin_lock_init(&target->lock); in srp_target_alloc()
111 target->dev = dev; in srp_target_alloc()
113 target->srp_iu_size = iu_size; in srp_target_alloc()
114 target->rx_ring_size = nr; in srp_target_alloc()
115 target->rx_ring = srp_ring_alloc(target->dev, nr, iu_size); in srp_target_alloc()
116 if (!target->rx_ring) in srp_target_alloc()
118 err = srp_iu_pool_alloc(&target->iu_queue, nr, target->rx_ring); in srp_target_alloc()
122 dev_set_drvdata(target->dev, target); in srp_target_alloc()
126 srp_ring_free(target->dev, target->rx_ring, nr, iu_size); in srp_target_alloc()
130 void srp_target_free(struct srp_target *target) in srp_target_free() argument
132 dev_set_drvdata(target->dev, NULL); in srp_target_free()
133 srp_ring_free(target->dev, target->rx_ring, target->rx_ring_size, in srp_target_free()
134 target->srp_iu_size); in srp_target_free()
135 srp_iu_pool_free(&target->iu_queue); in srp_target_free()
138 struct iu_entry *srp_iu_get(struct srp_target *target) in srp_iu_get() argument
142 if (kfifo_out_locked(&target->iu_queue.queue, (void *)&iue, in srp_iu_get()
144 &target->iu_queue.lock) != sizeof(void *)) { in srp_iu_get()
150 iue->target = target; in srp_iu_get()
157 kfifo_in_locked(&iue->target->iu_queue.queue, (void *)&iue, in srp_iu_put()
158 sizeof(void *), &iue->target->iu_queue.lock); in srp_iu_put()
172 nsg = dma_map_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents, in srp_direct_data()
187 dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL); in srp_direct_data()
218 md = dma_alloc_coherent(iue->target->dev, in srp_indirect_data()
243 nsg = dma_map_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents, in srp_indirect_data()
259 dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL); in srp_indirect_data()
263 dma_free_coherent(iue->target->dev, in srp_indirect_data()