Lines Matching refs:trans_info

242 	channel->trans_info.map[index % channel->tre_ring.count] = trans;  in gsi_channel_trans_map()
250 return channel->trans_info.map[index % channel->tre_ring.count]; in gsi_channel_trans_mapped()
256 return list_first_entry_or_null(&channel->trans_info.complete, in gsi_channel_trans_complete()
264 struct gsi_trans_info *trans_info = &channel->trans_info; in gsi_trans_move_pending() local
266 spin_lock_bh(&trans_info->spinlock); in gsi_trans_move_pending()
268 list_move_tail(&trans->links, &trans_info->pending); in gsi_trans_move_pending()
270 spin_unlock_bh(&trans_info->spinlock); in gsi_trans_move_pending()
279 struct gsi_trans_info *trans_info = &channel->trans_info; in gsi_trans_move_complete() local
282 spin_lock_bh(&trans_info->spinlock); in gsi_trans_move_complete()
285 list_cut_position(&list, &trans_info->pending, &trans->links); in gsi_trans_move_complete()
286 list_splice_tail(&list, &trans_info->complete); in gsi_trans_move_complete()
288 spin_unlock_bh(&trans_info->spinlock); in gsi_trans_move_complete()
295 struct gsi_trans_info *trans_info = &channel->trans_info; in gsi_trans_move_polled() local
297 spin_lock_bh(&trans_info->spinlock); in gsi_trans_move_polled()
299 list_move_tail(&trans->links, &trans_info->polled); in gsi_trans_move_polled()
301 spin_unlock_bh(&trans_info->spinlock); in gsi_trans_move_polled()
306 gsi_trans_tre_reserve(struct gsi_trans_info *trans_info, u32 tre_count) in gsi_trans_tre_reserve() argument
308 int avail = atomic_read(&trans_info->tre_avail); in gsi_trans_tre_reserve()
315 } while (!atomic_try_cmpxchg(&trans_info->tre_avail, &avail, new)); in gsi_trans_tre_reserve()
322 gsi_trans_tre_release(struct gsi_trans_info *trans_info, u32 tre_count) in gsi_trans_tre_release() argument
324 atomic_add(tre_count, &trans_info->tre_avail); in gsi_trans_tre_release()
333 struct gsi_trans_info *trans_info; in gsi_channel_trans_alloc() local
338 trans_info = &channel->trans_info; in gsi_channel_trans_alloc()
343 if (!gsi_trans_tre_reserve(trans_info, tre_count)) in gsi_channel_trans_alloc()
347 trans = gsi_trans_pool_alloc(&trans_info->pool, 1); in gsi_channel_trans_alloc()
354 trans->sgl = gsi_trans_pool_alloc(&trans_info->sg_pool, tre_count); in gsi_channel_trans_alloc()
359 spin_lock_bh(&trans_info->spinlock); in gsi_channel_trans_alloc()
361 list_add_tail(&trans->links, &trans_info->alloc); in gsi_channel_trans_alloc()
363 spin_unlock_bh(&trans_info->spinlock); in gsi_channel_trans_alloc()
374 struct gsi_trans_info *trans_info; in gsi_trans_free() local
381 trans_info = &trans->gsi->channel[trans->channel_id].trans_info; in gsi_trans_free()
383 spin_lock_bh(&trans_info->spinlock); in gsi_trans_free()
390 spin_unlock_bh(&trans_info->spinlock); in gsi_trans_free()
400 gsi_trans_tre_release(trans_info, trans->tre_count); in gsi_trans_free()
595 if (ring_db || !atomic_read(&channel->trans_info.tre_avail)) { in __gsi_trans_commit()
668 struct gsi_trans_info *trans_info = &channel->trans_info; in gsi_channel_trans_cancel_pending() local
673 spin_lock_bh(&trans_info->spinlock); in gsi_channel_trans_cancel_pending()
675 cancelled = !list_empty(&trans_info->pending); in gsi_channel_trans_cancel_pending()
676 list_for_each_entry(trans, &trans_info->pending, links) in gsi_channel_trans_cancel_pending()
679 list_splice_tail_init(&trans_info->pending, &trans_info->complete); in gsi_channel_trans_cancel_pending()
681 spin_unlock_bh(&trans_info->spinlock); in gsi_channel_trans_cancel_pending()
693 struct gsi_trans_info *trans_info; in gsi_trans_read_byte() local
696 trans_info = &channel->trans_info; in gsi_trans_read_byte()
699 if (!gsi_trans_tre_reserve(trans_info, 1)) in gsi_trans_read_byte()
718 gsi_trans_tre_release(&channel->trans_info, 1); in gsi_trans_read_byte_done()
725 struct gsi_trans_info *trans_info; in gsi_channel_trans_init() local
736 trans_info = &channel->trans_info; in gsi_channel_trans_init()
737 trans_info->map = kcalloc(channel->tre_count, sizeof(*trans_info->map), in gsi_channel_trans_init()
739 if (!trans_info->map) in gsi_channel_trans_init()
752 ret = gsi_trans_pool_init(&trans_info->pool, sizeof(struct gsi_trans), in gsi_channel_trans_init()
767 ret = gsi_trans_pool_init(&trans_info->sg_pool, in gsi_channel_trans_init()
780 atomic_set(&trans_info->tre_avail, tre_max); in gsi_channel_trans_init()
782 spin_lock_init(&trans_info->spinlock); in gsi_channel_trans_init()
783 INIT_LIST_HEAD(&trans_info->alloc); in gsi_channel_trans_init()
784 INIT_LIST_HEAD(&trans_info->pending); in gsi_channel_trans_init()
785 INIT_LIST_HEAD(&trans_info->complete); in gsi_channel_trans_init()
786 INIT_LIST_HEAD(&trans_info->polled); in gsi_channel_trans_init()
791 gsi_trans_pool_exit(&trans_info->pool); in gsi_channel_trans_init()
793 kfree(trans_info->map); in gsi_channel_trans_init()
804 struct gsi_trans_info *trans_info = &channel->trans_info; in gsi_channel_trans_exit() local
806 gsi_trans_pool_exit(&trans_info->sg_pool); in gsi_channel_trans_exit()
807 gsi_trans_pool_exit(&trans_info->pool); in gsi_channel_trans_exit()
808 kfree(trans_info->map); in gsi_channel_trans_exit()