MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fsl_qdma_alloc_queue_resources

Function fsl_qdma_alloc_queue_resources

dpdk/drivers/dma/dpaa/dpaa_qdma.c:274–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274static struct fsl_qdma_queue
275*fsl_qdma_alloc_queue_resources(struct fsl_qdma_engine *fsl_qdma)
276{
277 struct fsl_qdma_queue *queue_head, *queue_temp;
278 int len, i, j;
279 int queue_num;
280 int blocks;
281 unsigned int queue_size[FSL_QDMA_QUEUE_MAX];
282
283 queue_num = fsl_qdma->n_queues;
284 blocks = fsl_qdma->num_blocks;
285
286 len = sizeof(*queue_head) * queue_num * blocks;
287 queue_head = rte_zmalloc("qdma: queue head", len, 0);
288 if (!queue_head)
289 return NULL;
290
291 for (i = 0; i < FSL_QDMA_QUEUE_MAX; i++)
292 queue_size[i] = QDMA_QUEUE_SIZE;
293
294 for (j = 0; j < blocks; j++) {
295 for (i = 0; i < queue_num; i++) {
296 if (queue_size[i] > FSL_QDMA_CIRCULAR_DESC_SIZE_MAX ||
297 queue_size[i] < FSL_QDMA_CIRCULAR_DESC_SIZE_MIN) {
298 DPAA_QDMA_ERR("Get wrong queue-sizes.");
299 goto fail;
300 }
301 queue_temp = queue_head + i + (j * queue_num);
302
303 queue_temp->cq =
304 dma_pool_alloc(sizeof(struct fsl_qdma_format) *
305 queue_size[i],
306 sizeof(struct fsl_qdma_format) *
307 queue_size[i], &queue_temp->bus_addr);
308
309 if (!queue_temp->cq)
310 goto fail;
311
312 memset(queue_temp->cq, 0x0, queue_size[i] *
313 sizeof(struct fsl_qdma_format));
314
315 queue_temp->block_base = fsl_qdma->block_base +
316 FSL_QDMA_BLOCK_BASE_OFFSET(fsl_qdma, j);
317 queue_temp->n_cq = queue_size[i];
318 queue_temp->id = i;
319 queue_temp->count = 0;
320 queue_temp->pending = 0;
321 queue_temp->virt_head = queue_temp->cq;
322 queue_temp->stats = (struct rte_dma_stats){0};
323 }
324 }
325 return queue_head;
326
327fail:
328 for (j = 0; j < blocks; j++) {
329 for (i = 0; i < queue_num; i++) {
330 queue_temp = queue_head + i + (j * queue_num);
331 dma_pool_free(queue_temp->cq);

Callers 1

dpaa_qdma_initFunction · 0.85

Calls 5

rte_zmallocFunction · 0.85
memsetFunction · 0.85
rte_freeFunction · 0.85
dma_pool_allocFunction · 0.70
dma_pool_freeFunction · 0.70

Tested by

no test coverage detected