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

Function dpaa2_dpdmai_dev_init

dpdk/drivers/dma/dpaa2/dpaa2_qdma.c:1509–1628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1507}
1508
1509static int
1510dpaa2_dpdmai_dev_init(struct rte_dma_dev *dev, int dpdmai_id)
1511{
1512 struct dpaa2_dpdmai_dev *dpdmai_dev = dev->data->dev_private;
1513 struct dpdmai_rx_queue_cfg rx_queue_cfg;
1514 struct dpdmai_attr attr;
1515 struct dpdmai_rx_queue_attr rx_attr;
1516 struct dpdmai_tx_queue_attr tx_attr;
1517 struct dpaa2_queue *rxq;
1518 int ret;
1519
1520 DPAA2_QDMA_FUNC_TRACE();
1521
1522 /* Open DPDMAI device */
1523 dpdmai_dev->dpdmai_id = dpdmai_id;
1524 dpdmai_dev->dpdmai.regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX);
1525 dpdmai_dev->qdma_dev = rte_malloc(NULL, sizeof(struct qdma_device),
1526 RTE_CACHE_LINE_SIZE);
1527 ret = dpdmai_open(&dpdmai_dev->dpdmai, CMD_PRI_LOW,
1528 dpdmai_dev->dpdmai_id, &dpdmai_dev->token);
1529 if (ret) {
1530 DPAA2_QDMA_ERR("dpdmai_open() failed with err: %d", ret);
1531 return ret;
1532 }
1533
1534 /* Get DPDMAI attributes */
1535 ret = dpdmai_get_attributes(&dpdmai_dev->dpdmai, CMD_PRI_LOW,
1536 dpdmai_dev->token, &attr);
1537 if (ret) {
1538 DPAA2_QDMA_ERR("dpdmai get attributes failed with err: %d",
1539 ret);
1540 goto init_err;
1541 }
1542 dpdmai_dev->num_queues = attr.num_of_queues;
1543
1544 /* Set up Rx Queue */
1545 memset(&rx_queue_cfg, 0, sizeof(struct dpdmai_rx_queue_cfg));
1546 ret = dpdmai_set_rx_queue(&dpdmai_dev->dpdmai,
1547 CMD_PRI_LOW,
1548 dpdmai_dev->token,
1549 0, 0, &rx_queue_cfg);
1550 if (ret) {
1551 DPAA2_QDMA_ERR("Setting Rx queue failed with err: %d",
1552 ret);
1553 goto init_err;
1554 }
1555
1556 /* Allocate DQ storage for the DPDMAI Rx queues */
1557 rxq = &(dpdmai_dev->rx_queue[0]);
1558 rxq->q_storage = rte_malloc("dq_storage",
1559 sizeof(struct queue_storage_info_t),
1560 RTE_CACHE_LINE_SIZE);
1561 if (!rxq->q_storage) {
1562 DPAA2_QDMA_ERR("q_storage allocation failed");
1563 ret = -ENOMEM;
1564 goto init_err;
1565 }
1566

Callers 1

dpaa2_qdma_probeFunction · 0.85

Calls 12

dpaa2_get_mcp_ptrFunction · 0.85
rte_mallocFunction · 0.85
dpdmai_openFunction · 0.85
dpdmai_get_attributesFunction · 0.85
memsetFunction · 0.85
dpdmai_set_rx_queueFunction · 0.85
dpaa2_alloc_dq_storageFunction · 0.85
dpdmai_get_rx_queueFunction · 0.85
dpdmai_get_tx_queueFunction · 0.85
dpdmai_enableFunction · 0.85
dpaa2_qdma_resetFunction · 0.85
dpaa2_dpdmai_dev_uninitFunction · 0.85

Tested by

no test coverage detected