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

Function cnxk_eth_dev_init

dpdk/drivers/net/cnxk/cnxk_ethdev.c:1844–2002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1842}
1843
1844static int
1845cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
1846{
1847 struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
1848 struct rte_security_ctx *sec_ctx;
1849 struct roc_nix *nix = &dev->nix;
1850 struct rte_pci_device *pci_dev;
1851 int rc, max_entries;
1852
1853 eth_dev->dev_ops = &cnxk_eth_dev_ops;
1854 eth_dev->rx_queue_count = cnxk_nix_rx_queue_count;
1855 eth_dev->rx_descriptor_status = cnxk_nix_rx_descriptor_status;
1856 eth_dev->tx_descriptor_status = cnxk_nix_tx_descriptor_status;
1857
1858 /* Alloc security context */
1859 sec_ctx = plt_zmalloc(sizeof(struct rte_security_ctx), 0);
1860 if (!sec_ctx)
1861 return -ENOMEM;
1862 sec_ctx->device = eth_dev;
1863 sec_ctx->ops = &cnxk_eth_sec_ops;
1864 sec_ctx->flags = RTE_SEC_CTX_F_FAST_SET_MDATA;
1865 eth_dev->security_ctx = sec_ctx;
1866
1867 /* For secondary processes, the primary has done all the work */
1868 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
1869 return 0;
1870
1871 pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
1872 rte_eth_copy_pci_info(eth_dev, pci_dev);
1873
1874 /* Parse devargs string */
1875 rc = cnxk_ethdev_parse_devargs(eth_dev->device->devargs, dev);
1876 if (rc) {
1877 plt_err("Failed to parse devargs rc=%d", rc);
1878 goto error;
1879 }
1880
1881 /* Initialize base roc nix */
1882 nix->pci_dev = pci_dev;
1883 nix->hw_vlan_ins = true;
1884 nix->port_id = eth_dev->data->port_id;
1885 if (roc_feature_nix_has_own_meta_aura())
1886 nix->local_meta_aura_ena = true;
1887 rc = roc_nix_dev_init(nix);
1888 if (rc) {
1889 plt_err("Failed to initialize roc nix rc=%d", rc);
1890 goto error;
1891 }
1892
1893 /* Register up msg callbacks */
1894 roc_nix_mac_link_cb_register(nix, cnxk_eth_dev_link_status_cb);
1895
1896 /* Register up msg callbacks */
1897 roc_nix_mac_link_info_get_cb_register(nix,
1898 cnxk_eth_dev_link_status_get_cb);
1899
1900 /* Register up msg callbacks */
1901 roc_nix_q_err_cb_register(nix, cnxk_eth_dev_q_err_cb);

Callers 1

cnxk_nix_dev_resetFunction · 0.85

Tested by

no test coverage detected