| 358 | } |
| 359 | |
| 360 | static int |
| 361 | dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) |
| 362 | { |
| 363 | struct dpaa2_dev_priv *priv = dev->data->dev_private; |
| 364 | uint16_t dist_idx; |
| 365 | uint32_t vq_id; |
| 366 | uint8_t num_rxqueue_per_tc; |
| 367 | struct dpaa2_queue *mc_q, *mcq; |
| 368 | uint32_t tot_queues; |
| 369 | int i; |
| 370 | struct dpaa2_queue *dpaa2_q; |
| 371 | |
| 372 | PMD_INIT_FUNC_TRACE(); |
| 373 | |
| 374 | num_rxqueue_per_tc = (priv->nb_rx_queues / priv->num_rx_tc); |
| 375 | if (priv->flags & DPAA2_TX_CONF_ENABLE) |
| 376 | tot_queues = priv->nb_rx_queues + 2 * priv->nb_tx_queues; |
| 377 | else |
| 378 | tot_queues = priv->nb_rx_queues + priv->nb_tx_queues; |
| 379 | mc_q = rte_malloc(NULL, sizeof(struct dpaa2_queue) * tot_queues, |
| 380 | RTE_CACHE_LINE_SIZE); |
| 381 | if (!mc_q) { |
| 382 | DPAA2_PMD_ERR("Memory allocation failed for rx/tx queues"); |
| 383 | return -1; |
| 384 | } |
| 385 | |
| 386 | for (i = 0; i < priv->nb_rx_queues; i++) { |
| 387 | mc_q->eth_data = dev->data; |
| 388 | priv->rx_vq[i] = mc_q++; |
| 389 | dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i]; |
| 390 | dpaa2_q->q_storage = rte_malloc("dq_storage", |
| 391 | sizeof(struct queue_storage_info_t), |
| 392 | RTE_CACHE_LINE_SIZE); |
| 393 | if (!dpaa2_q->q_storage) |
| 394 | goto fail; |
| 395 | |
| 396 | memset(dpaa2_q->q_storage, 0, |
| 397 | sizeof(struct queue_storage_info_t)); |
| 398 | if (dpaa2_alloc_dq_storage(dpaa2_q->q_storage)) |
| 399 | goto fail; |
| 400 | } |
| 401 | |
| 402 | if (dpaa2_enable_err_queue) { |
| 403 | priv->rx_err_vq = rte_zmalloc("dpni_rx_err", |
| 404 | sizeof(struct dpaa2_queue), 0); |
| 405 | if (!priv->rx_err_vq) |
| 406 | goto fail; |
| 407 | |
| 408 | dpaa2_q = (struct dpaa2_queue *)priv->rx_err_vq; |
| 409 | dpaa2_q->q_storage = rte_malloc("err_dq_storage", |
| 410 | sizeof(struct queue_storage_info_t) * |
| 411 | RTE_MAX_LCORE, |
| 412 | RTE_CACHE_LINE_SIZE); |
| 413 | if (!dpaa2_q->q_storage) |
| 414 | goto fail; |
| 415 | |
| 416 | memset(dpaa2_q->q_storage, 0, |
| 417 | sizeof(struct queue_storage_info_t)); |
no test coverage detected