| 2866 | } |
| 2867 | |
| 2868 | static int |
| 2869 | rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv, |
| 2870 | struct rte_dpaa2_device *dpaa2_dev) |
| 2871 | { |
| 2872 | struct rte_eth_dev *eth_dev; |
| 2873 | struct dpaa2_dev_priv *dev_priv; |
| 2874 | int diag; |
| 2875 | |
| 2876 | if ((DPAA2_MBUF_HW_ANNOTATION + DPAA2_FD_PTA_SIZE) > |
| 2877 | RTE_PKTMBUF_HEADROOM) { |
| 2878 | DPAA2_PMD_ERR( |
| 2879 | "RTE_PKTMBUF_HEADROOM(%d) shall be > DPAA2 Annotation req(%d)", |
| 2880 | RTE_PKTMBUF_HEADROOM, |
| 2881 | DPAA2_MBUF_HW_ANNOTATION + DPAA2_FD_PTA_SIZE); |
| 2882 | |
| 2883 | return -1; |
| 2884 | } |
| 2885 | |
| 2886 | if (rte_eal_process_type() == RTE_PROC_PRIMARY) { |
| 2887 | eth_dev = rte_eth_dev_allocate(dpaa2_dev->device.name); |
| 2888 | if (!eth_dev) |
| 2889 | return -ENODEV; |
| 2890 | dev_priv = rte_zmalloc("ethdev private structure", |
| 2891 | sizeof(struct dpaa2_dev_priv), |
| 2892 | RTE_CACHE_LINE_SIZE); |
| 2893 | if (dev_priv == NULL) { |
| 2894 | DPAA2_PMD_CRIT( |
| 2895 | "Unable to allocate memory for private data"); |
| 2896 | rte_eth_dev_release_port(eth_dev); |
| 2897 | return -ENOMEM; |
| 2898 | } |
| 2899 | eth_dev->data->dev_private = (void *)dev_priv; |
| 2900 | /* Store a pointer to eth_dev in dev_private */ |
| 2901 | dev_priv->eth_dev = eth_dev; |
| 2902 | } else { |
| 2903 | eth_dev = rte_eth_dev_attach_secondary(dpaa2_dev->device.name); |
| 2904 | if (!eth_dev) { |
| 2905 | DPAA2_PMD_DEBUG("returning enodev"); |
| 2906 | return -ENODEV; |
| 2907 | } |
| 2908 | } |
| 2909 | |
| 2910 | eth_dev->device = &dpaa2_dev->device; |
| 2911 | |
| 2912 | dpaa2_dev->eth_dev = eth_dev; |
| 2913 | eth_dev->data->rx_mbuf_alloc_failed = 0; |
| 2914 | |
| 2915 | if (dpaa2_drv->drv_flags & RTE_DPAA2_DRV_INTR_LSC) |
| 2916 | eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; |
| 2917 | |
| 2918 | eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; |
| 2919 | |
| 2920 | /* Invoke PMD device initialization function */ |
| 2921 | diag = dpaa2_dev_init(eth_dev); |
| 2922 | if (diag == 0) { |
| 2923 | if (!dpaa2_tx_sg_pool) { |
| 2924 | dpaa2_tx_sg_pool = |
| 2925 | rte_pktmbuf_pool_create("dpaa2_mbuf_tx_sg_pool", |
nothing calls this directly
no test coverage detected