Lines Matching full:trans
239 struct gsi_trans *trans) in gsi_channel_trans_map() argument
242 channel->trans_info.map[index % channel->tre_ring.count] = trans; in gsi_channel_trans_map()
261 static void gsi_trans_move_pending(struct gsi_trans *trans) in gsi_trans_move_pending() argument
263 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; in gsi_trans_move_pending()
268 list_move_tail(&trans->links, &trans_info->pending); in gsi_trans_move_pending()
276 void gsi_trans_move_complete(struct gsi_trans *trans) in gsi_trans_move_complete() argument
278 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; in gsi_trans_move_complete()
285 list_cut_position(&list, &trans_info->pending, &trans->links); in gsi_trans_move_complete()
292 void gsi_trans_move_polled(struct gsi_trans *trans) in gsi_trans_move_polled() argument
294 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; in gsi_trans_move_polled()
299 list_move_tail(&trans->links, &trans_info->polled); in gsi_trans_move_polled()
334 struct gsi_trans *trans; in gsi_channel_trans_alloc() local
347 trans = gsi_trans_pool_alloc(&trans_info->pool, 1); in gsi_channel_trans_alloc()
348 trans->gsi = gsi; in gsi_channel_trans_alloc()
349 trans->channel_id = channel_id; in gsi_channel_trans_alloc()
350 trans->tre_count = tre_count; in gsi_channel_trans_alloc()
351 init_completion(&trans->completion); in gsi_channel_trans_alloc()
354 trans->sgl = gsi_trans_pool_alloc(&trans_info->sg_pool, tre_count); in gsi_channel_trans_alloc()
355 sg_init_marker(trans->sgl, tre_count); in gsi_channel_trans_alloc()
357 trans->direction = direction; in gsi_channel_trans_alloc()
361 list_add_tail(&trans->links, &trans_info->alloc); in gsi_channel_trans_alloc()
365 refcount_set(&trans->refcount, 1); in gsi_channel_trans_alloc()
367 return trans; in gsi_channel_trans_alloc()
371 void gsi_trans_free(struct gsi_trans *trans) in gsi_trans_free() argument
373 refcount_t *refcount = &trans->refcount; in gsi_trans_free()
381 trans_info = &trans->gsi->channel[trans->channel_id].trans_info; in gsi_trans_free()
388 list_del(&trans->links); in gsi_trans_free()
395 ipa_gsi_trans_release(trans); in gsi_trans_free()
400 gsi_trans_tre_release(trans_info, trans->tre_count); in gsi_trans_free()
404 void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, in gsi_trans_cmd_add() argument
409 u32 which = trans->used++; in gsi_trans_cmd_add()
412 /* assert(which < trans->tre_count); */ in gsi_trans_cmd_add()
428 sg = &trans->sgl[which]; in gsi_trans_cmd_add()
433 info = &trans->info[which]; in gsi_trans_cmd_add()
439 int gsi_trans_page_add(struct gsi_trans *trans, struct page *page, u32 size, in gsi_trans_page_add() argument
442 struct scatterlist *sg = &trans->sgl[0]; in gsi_trans_page_add()
445 /* assert(trans->tre_count == 1); */ in gsi_trans_page_add()
446 /* assert(!trans->used); */ in gsi_trans_page_add()
449 ret = dma_map_sg(trans->gsi->dev, sg, 1, trans->direction); in gsi_trans_page_add()
453 trans->used++; /* Transaction now owns the (DMA mapped) page */ in gsi_trans_page_add()
459 int gsi_trans_skb_add(struct gsi_trans *trans, struct sk_buff *skb) in gsi_trans_skb_add() argument
461 struct scatterlist *sg = &trans->sgl[0]; in gsi_trans_skb_add()
465 /* assert(trans->tre_count == 1); */ in gsi_trans_skb_add()
466 /* assert(!trans->used); */ in gsi_trans_skb_add()
474 ret = dma_map_sg(trans->gsi->dev, sg, used, trans->direction); in gsi_trans_skb_add()
478 trans->used += used; /* Transaction now owns the (DMA mapped) skb */ in gsi_trans_skb_add()
532 * @trans: Transaction to commit
541 static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db) in __gsi_trans_commit() argument
543 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; in __gsi_trans_commit()
554 /* assert(trans->used > 0); */ in __gsi_trans_commit()
561 info = trans->info ? &trans->info[0] : NULL; in __gsi_trans_commit()
564 for_each_sg(trans->sgl, sg, trans->used, i) { in __gsi_trans_commit()
565 bool last_tre = i == trans->used - 1; in __gsi_trans_commit()
578 ring->index += trans->used; in __gsi_trans_commit()
582 trans->len = byte_count; in __gsi_trans_commit()
583 trans->trans_count = channel->trans_count; in __gsi_trans_commit()
584 trans->byte_count = channel->byte_count; in __gsi_trans_commit()
590 gsi_channel_trans_map(channel, ring->index - 1, trans); in __gsi_trans_commit()
592 gsi_trans_move_pending(trans); in __gsi_trans_commit()
604 void gsi_trans_commit(struct gsi_trans *trans, bool ring_db) in gsi_trans_commit() argument
606 if (trans->used) in gsi_trans_commit()
607 __gsi_trans_commit(trans, ring_db); in gsi_trans_commit()
609 gsi_trans_free(trans); in gsi_trans_commit()
613 void gsi_trans_commit_wait(struct gsi_trans *trans) in gsi_trans_commit_wait() argument
615 if (!trans->used) in gsi_trans_commit_wait()
618 refcount_inc(&trans->refcount); in gsi_trans_commit_wait()
620 __gsi_trans_commit(trans, true); in gsi_trans_commit_wait()
622 wait_for_completion(&trans->completion); in gsi_trans_commit_wait()
625 gsi_trans_free(trans); in gsi_trans_commit_wait()
629 int gsi_trans_commit_wait_timeout(struct gsi_trans *trans, in gsi_trans_commit_wait_timeout() argument
635 if (!trans->used) in gsi_trans_commit_wait_timeout()
638 refcount_inc(&trans->refcount); in gsi_trans_commit_wait_timeout()
640 __gsi_trans_commit(trans, true); in gsi_trans_commit_wait_timeout()
642 remaining = wait_for_completion_timeout(&trans->completion, in gsi_trans_commit_wait_timeout()
645 gsi_trans_free(trans); in gsi_trans_commit_wait_timeout()
651 void gsi_trans_complete(struct gsi_trans *trans) in gsi_trans_complete() argument
654 if (trans->direction != DMA_NONE) in gsi_trans_complete()
655 dma_unmap_sg(trans->gsi->dev, trans->sgl, trans->used, in gsi_trans_complete()
656 trans->direction); in gsi_trans_complete()
658 ipa_gsi_trans_complete(trans); in gsi_trans_complete()
660 complete(&trans->completion); in gsi_trans_complete()
662 gsi_trans_free(trans); in gsi_trans_complete()
669 struct gsi_trans *trans; in gsi_channel_trans_cancel_pending() local
676 list_for_each_entry(trans, &trans_info->pending, links) in gsi_channel_trans_cancel_pending()
677 trans->cancelled = true; in gsi_channel_trans_cancel_pending()