drivers/net: enable device detach on secondary process
[dpdk.git] / drivers / net / liquidio / lio_ethdev.c
index eeb8350..0f59e44 100644 (file)
@@ -373,8 +373,6 @@ lio_dev_info_get(struct rte_eth_dev *eth_dev,
        struct lio_device *lio_dev = LIO_DEV(eth_dev);
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
-       devinfo->pci_dev = pci_dev;
-
        switch (pci_dev->id.subsystem_device_id) {
        /* CN23xx 10G cards */
        case PCI_SUBSYS_DEV_ID_CN2350_210:
@@ -1407,6 +1405,11 @@ lio_dev_start(struct rte_eth_dev *eth_dev)
        /* Configure RSS if device configured with multiple RX queues. */
        lio_dev_mq_rx_configure(eth_dev);
 
+       /* Before update the link info,
+        * must set linfo.link.link_status64 to 0.
+        */
+       lio_dev->linfo.link.link_status64 = 0;
+
        /* start polling for lsc */
        ret = rte_eal_alarm_set(LIO_LSC_TIMEOUT,
                                lio_sync_link_state_check,
@@ -2035,7 +2038,7 @@ lio_eth_dev_uninit(struct rte_eth_dev *eth_dev)
        PMD_INIT_FUNC_TRACE();
 
        if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-               return -EPERM;
+               return 0;
 
        /* lio_free_sc_buffer_pool */
        lio_free_sc_buffer_pool(lio_dev);
@@ -2112,19 +2115,8 @@ static int
 lio_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                      struct rte_pci_device *pci_dev)
 {
-       struct rte_eth_dev *eth_dev;
-       int ret;
-
-       eth_dev = rte_eth_dev_pci_allocate(pci_dev,
-                                          sizeof(struct lio_device));
-       if (eth_dev == NULL)
-               return -ENOMEM;
-
-       ret = lio_eth_dev_init(eth_dev);
-       if (ret)
-               rte_eth_dev_pci_release(eth_dev);
-
-       return ret;
+       return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct lio_device),
+                       lio_eth_dev_init);
 }
 
 static int
@@ -2151,9 +2143,7 @@ RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio-pci");
 
-RTE_INIT(lio_init_log);
-static void
-lio_init_log(void)
+RTE_INIT(lio_init_log)
 {
        lio_logtype_init = rte_log_register("pmd.net.liquidio.init");
        if (lio_logtype_init >= 0)