Lines Matching refs:pool

49  * hisi_acc_create_sgl_pool() - Create a hw sgl pool.
50 * @dev: The device which hw sgl pool belongs to.
51 * @count: Count of hisi_acc_hw_sgl in pool.
54 * This function creates a hw sgl pool, after this user can get hw sgl memory
61 struct hisi_acc_sgl_pool *pool;
73 * the pool may allocate a block of memory of size PAGE_SIZE * 2^MAX_ORDER,
86 pool = kzalloc(sizeof(*pool), GFP_KERNEL);
87 if (!pool)
89 block = pool->mem_block;
115 pool->sgl_num_per_block = sgl_num_per_block;
116 pool->block_num = remain_sgl ? block_num + 1 : block_num;
117 pool->count = count;
118 pool->sgl_size = sgl_size;
119 pool->sge_nr = sge_nr;
121 return pool;
128 kfree_sensitive(pool);
134 * hisi_acc_free_sgl_pool() - Free a hw sgl pool.
135 * @dev: The device which hw sgl pool belongs to.
136 * @pool: Pointer of pool.
138 * This function frees memory of a hw sgl pool.
140 void hisi_acc_free_sgl_pool(struct device *dev, struct hisi_acc_sgl_pool *pool)
145 if (!dev || !pool)
148 block = pool->mem_block;
150 for (i = 0; i < pool->block_num; i++)
154 kfree(pool);
158 static struct hisi_acc_hw_sgl *acc_get_sgl(struct hisi_acc_sgl_pool *pool,
164 if (!pool || !hw_sgl_dma || index >= pool->count)
167 block = pool->mem_block;
168 block_index = index / pool->sgl_num_per_block;
169 offset = index % pool->sgl_num_per_block;
171 *hw_sgl_dma = block[block_index].sgl_dma + pool->sgl_size * offset;
172 return (void *)block[block_index].sgl + pool->sgl_size * offset;
212 * @pool: Pool which hw sgl memory will be allocated in.
213 * @index: Index of hisi_acc_hw_sgl in pool.
222 struct hisi_acc_sgl_pool *pool,
231 if (!dev || !sgl || !pool || !hw_sgl_dma)
242 if (sg_n_mapped > pool->sge_nr) {
243 dev_err(dev, "the number of entries in input scatterlist is bigger than SGL pool setting.\n");
247 curr_hw_sgl = acc_get_sgl(pool, index, &curr_sgl_dma);
253 curr_hw_sgl->entry_length_in_sgl = cpu_to_le16(pool->sge_nr);
262 update_hw_sgl_sum_sge(curr_hw_sgl, pool->sge_nr);