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

Function dpaa2_dev_init

dpdk/drivers/net/dpaa2/dpaa2_ethdev.c:2591–2861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2589}
2590
2591static int
2592dpaa2_dev_init(struct rte_eth_dev *eth_dev)
2593{
2594 struct rte_device *dev = eth_dev->device;
2595 struct rte_dpaa2_device *dpaa2_dev;
2596 struct fsl_mc_io *dpni_dev;
2597 struct dpni_attr attr;
2598 struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
2599 struct dpni_buffer_layout layout;
2600 int ret, hw_id, i;
2601
2602 PMD_INIT_FUNC_TRACE();
2603
2604 dpni_dev = rte_malloc(NULL, sizeof(struct fsl_mc_io), 0);
2605 if (!dpni_dev) {
2606 DPAA2_PMD_ERR("Memory allocation failed for dpni device");
2607 return -1;
2608 }
2609 dpni_dev->regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX);
2610 eth_dev->process_private = (void *)dpni_dev;
2611
2612 /* For secondary processes, the primary has done all the work */
2613 if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
2614 /* In case of secondary, only burst and ops API need to be
2615 * plugged.
2616 */
2617 eth_dev->dev_ops = &dpaa2_ethdev_ops;
2618 eth_dev->rx_queue_count = dpaa2_dev_rx_queue_count;
2619 if (dpaa2_get_devargs(dev->devargs, DRIVER_LOOPBACK_MODE))
2620 eth_dev->rx_pkt_burst = dpaa2_dev_loopback_rx;
2621 else if (dpaa2_get_devargs(dev->devargs,
2622 DRIVER_NO_PREFETCH_MODE))
2623 eth_dev->rx_pkt_burst = dpaa2_dev_rx;
2624 else
2625 eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx;
2626 eth_dev->tx_pkt_burst = dpaa2_dev_tx;
2627 return 0;
2628 }
2629
2630 dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device);
2631
2632 hw_id = dpaa2_dev->object_id;
2633 ret = dpni_open(dpni_dev, CMD_PRI_LOW, hw_id, &priv->token);
2634 if (ret) {
2635 DPAA2_PMD_ERR(
2636 "Failure in opening dpni@%d with err code %d",
2637 hw_id, ret);
2638 rte_free(dpni_dev);
2639 return -1;
2640 }
2641
2642 if (eth_dev->data->dev_conf.lpbk_mode)
2643 dpaa2_dev_recycle_deconfig(eth_dev);
2644
2645 /* Clean the device first */
2646 ret = dpni_reset(dpni_dev, CMD_PRI_LOW, priv->token);
2647 if (ret) {
2648 DPAA2_PMD_ERR("Failure cleaning dpni@%d with err code %d",

Callers 1

rte_dpaa2_probeFunction · 0.85

Calls 15

rte_mallocFunction · 0.85
dpaa2_get_mcp_ptrFunction · 0.85
rte_eal_process_typeFunction · 0.85
dpaa2_get_devargsFunction · 0.85
dpni_openFunction · 0.85
rte_freeFunction · 0.85
dpni_resetFunction · 0.85
dpni_get_attributesFunction · 0.85
rte_spinlock_initFunction · 0.85
dpaa2_alloc_rx_tx_queuesFunction · 0.85
rte_zmallocFunction · 0.85

Tested by

no test coverage detected