New upstream version 18.08
[deb_dpdk.git] / lib / librte_ethdev / rte_ethdev_pci.h
similarity index 93%
rename from lib/librte_ether/rte_ethdev_pci.h
rename to lib/librte_ethdev/rte_ethdev_pci.h
index 897ce5b..f652596 100644 (file)
@@ -53,8 +53,8 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
        struct rte_pci_device *pci_dev)
 {
        if ((eth_dev == NULL) || (pci_dev == NULL)) {
-               RTE_PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
-                               eth_dev, pci_dev);
+               RTE_ETHDEV_LOG(ERR, "NULL pointer eth_dev=%p pci_dev=%p",
+                       (void *)eth_dev, (void *)pci_dev);
                return;
        }
 
@@ -70,6 +70,18 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
        eth_dev->data->numa_node = pci_dev->device.numa_node;
 }
 
+static inline int
+eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) {
+       struct rte_pci_device *pci_dev = bus_device;
+
+       if (!pci_dev)
+               return -ENODEV;
+
+       rte_eth_copy_pci_info(eth_dev, pci_dev);
+
+       return 0;
+}
+
 /**
  * @internal
  * Allocates a new ethdev slot for an ethernet device and returns the pointer
@@ -123,9 +135,6 @@ rte_eth_dev_pci_allocate(struct rte_pci_device *dev, size_t private_data_size)
 static inline void
 rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
 {
-       /* free ether device */
-       rte_eth_dev_release_port(eth_dev);
-
        if (rte_eal_process_type() == RTE_PROC_PRIMARY)
                rte_free(eth_dev->data->dev_private);
 
@@ -139,6 +148,9 @@ rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
 
        eth_dev->device = NULL;
        eth_dev->intr_handle = NULL;
+
+       /* free ether device */
+       rte_eth_dev_release_port(eth_dev);
 }
 
 typedef int (*eth_dev_pci_callback_t)(struct rte_eth_dev *eth_dev);
@@ -163,6 +175,8 @@ rte_eth_dev_pci_generic_probe(struct rte_pci_device *pci_dev,
        ret = dev_init(eth_dev);
        if (ret)
                rte_eth_dev_pci_release(eth_dev);
+       else
+               rte_eth_dev_probing_finish(eth_dev);
 
        return ret;
 }