drivers/net/ipa/gsi_trans.h

Source file repositories/reference/linux-study-clean/drivers/net/ipa/gsi_trans.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ipa/gsi_trans.h
Extension
.h
Size
7429 bytes
Lines
230
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct gsi_trans {
	struct gsi *gsi;
	u8 channel_id;

	bool cancelled;			/* true if transaction was cancelled */

	u8 rsvd_count;			/* # TREs requested */
	u8 used_count;			/* # entries used in sgl[] */
	u32 len;			/* total # bytes across sgl[] */

	union {
		void *data;
		u8 cmd_opcode[IPA_COMMAND_TRANS_TRE_MAX];
	};
	struct scatterlist *sgl;
	enum dma_data_direction direction;

	refcount_t refcount;
	struct completion completion;

	u64 byte_count;			/* channel byte_count when committed */
	u64 trans_count;		/* channel trans_count when committed */
};

/**
 * gsi_trans_pool_init() - Initialize a pool of structures for transactions
 * @pool:	GSI transaction pool pointer
 * @size:	Size of elements in the pool
 * @count:	Minimum number of elements in the pool
 * @max_alloc:	Maximum number of elements allocated at a time from pool
 *
 * Return:	0 if successful, or a negative error code
 */
int gsi_trans_pool_init(struct gsi_trans_pool *pool, size_t size, u32 count,
			u32 max_alloc);

/**
 * gsi_trans_pool_alloc() - Allocate one or more elements from a pool
 * @pool:	Pool pointer
 * @count:	Number of elements to allocate from the pool
 *
 * Return:	Virtual address of element(s) allocated from the pool
 */
void *gsi_trans_pool_alloc(struct gsi_trans_pool *pool, u32 count);

/**
 * gsi_trans_pool_exit() - Inverse of gsi_trans_pool_init()
 * @pool:	Pool pointer
 */
void gsi_trans_pool_exit(struct gsi_trans_pool *pool);

/**
 * gsi_trans_pool_init_dma() - Initialize a pool of DMA-able structures
 * @dev:	Device used for DMA
 * @pool:	Pool pointer
 * @size:	Size of elements in the pool
 * @count:	Minimum number of elements in the pool
 * @max_alloc:	Maximum number of elements allocated at a time from pool
 *
 * Return:	0 if successful, or a negative error code
 *
 * Structures in this pool reside in DMA-coherent memory.
 */
int gsi_trans_pool_init_dma(struct device *dev, struct gsi_trans_pool *pool,
			    size_t size, u32 count, u32 max_alloc);

/**
 * gsi_trans_pool_alloc_dma() - Allocate an element from a DMA pool
 * @pool:	DMA pool pointer
 * @addr:	DMA address "handle" associated with the allocation
 *
 * Return:	Virtual address of element allocated from the pool
 *
 * Only one element at a time may be allocated from a DMA pool.
 */
void *gsi_trans_pool_alloc_dma(struct gsi_trans_pool *pool, dma_addr_t *addr);

/**
 * gsi_trans_pool_exit_dma() - Inverse of gsi_trans_pool_init_dma()
 * @dev:	Device used for DMA
 * @pool:	Pool pointer
 */
void gsi_trans_pool_exit_dma(struct device *dev, struct gsi_trans_pool *pool);

/**
 * gsi_channel_trans_idle() - Return whether no transactions are allocated
 * @gsi:	GSI pointer
 * @channel_id:	Channel the transaction is associated with
 *
 * Return:	True if no transactions are allocated, false otherwise

Annotation

Implementation Notes