Lines Matching defs:pool

48  * hisi_acc_create_sgl_pool() - Create a hw sgl pool.
49 * @dev: The device which hw sgl pool belongs to.
50 * @count: Count of hisi_acc_hw_sgl in pool.
53 * This function creates a hw sgl pool, after this user can get hw sgl memory
60 struct hisi_acc_sgl_pool *pool;
79 pool = kzalloc(sizeof(*pool), GFP_KERNEL);
80 if (!pool)
82 block = pool->mem_block;
104 pool->sgl_num_per_block = sgl_num_per_block;
105 pool->block_num = remain_sgl ? block_num + 1 : block_num;
106 pool->count = count;
107 pool->sgl_size = sgl_size;
108 pool->sge_nr = sge_nr;
110 return pool;
117 kfree_sensitive(pool);
123 * hisi_acc_free_sgl_pool() - Free a hw sgl pool.
124 * @dev: The device which hw sgl pool belongs to.
125 * @pool: Pointer of pool.
127 * This function frees memory of a hw sgl pool.
129 void hisi_acc_free_sgl_pool(struct device *dev, struct hisi_acc_sgl_pool *pool)
134 if (!dev || !pool)
137 block = pool->mem_block;
139 for (i = 0; i < pool->block_num; i++)
143 kfree(pool);
147 static struct hisi_acc_hw_sgl *acc_get_sgl(struct hisi_acc_sgl_pool *pool,
153 if (!pool || !hw_sgl_dma || index >= pool->count)
156 block = pool->mem_block;
157 block_index = index / pool->sgl_num_per_block;
158 offset = index % pool->sgl_num_per_block;
160 *hw_sgl_dma = block[block_index].sgl_dma + pool->sgl_size * offset;
161 return (void *)block[block_index].sgl + pool->sgl_size * offset;
188 * @pool: Pool which hw sgl memory will be allocated in.
189 * @index: Index of hisi_acc_hw_sgl in pool.
198 struct hisi_acc_sgl_pool *pool,
207 if (!dev || !sgl || !pool || !hw_sgl_dma)
216 if (sg_n_mapped > pool->sge_nr) {
221 curr_hw_sgl = acc_get_sgl(pool, index, &curr_sgl_dma);
227 curr_hw_sgl->entry_length_in_sgl = cpu_to_le16(pool->sge_nr);
236 update_hw_sgl_sum_sge(curr_hw_sgl, pool->sge_nr);
249 * @pool: Pool which hw sgl is allocated in.