ethdev: move info filling of PCI into drivers
[dpdk.git] / drivers / net / bnx2x / bnx2x_ethdev.c
index e38c238..7237bcc 100644 (file)
@@ -119,12 +119,12 @@ bnx2x_interrupt_action(struct rte_eth_dev *dev)
 }
 
 static __rte_unused void
-bnx2x_interrupt_handler(__rte_unused struct rte_intr_handle *handle, void *param)
+bnx2x_interrupt_handler(struct rte_intr_handle *handle, void *param)
 {
        struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
        bnx2x_interrupt_action(dev);
-       rte_intr_enable(&(dev->pci_dev->intr_handle));
+       rte_intr_enable(handle);
 }
 
 /*
@@ -187,10 +187,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
        }
 
        if (IS_PF(sc)) {
-               rte_intr_callback_register(&(dev->pci_dev->intr_handle),
+               rte_intr_callback_register(&sc->pci_dev->intr_handle,
                                bnx2x_interrupt_handler, (void *)dev);
 
-               if(rte_intr_enable(&(dev->pci_dev->intr_handle)))
+               if (rte_intr_enable(&sc->pci_dev->intr_handle))
                        PMD_DRV_LOG(ERR, "rte_intr_enable failed");
        }
 
@@ -203,8 +203,6 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
        /* Print important adapter info for the user. */
        bnx2x_print_adapter_info(sc);
 
-       DELAY_MS(2500);
-
        return ret;
 }
 
@@ -217,8 +215,8 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)
        PMD_INIT_FUNC_TRACE();
 
        if (IS_PF(sc)) {
-               rte_intr_disable(&(dev->pci_dev->intr_handle));
-               rte_intr_callback_unregister(&(dev->pci_dev->intr_handle),
+               rte_intr_disable(&sc->pci_dev->intr_handle);
+               rte_intr_callback_unregister(&sc->pci_dev->intr_handle,
                                bnx2x_interrupt_handler, (void *)dev);
        }
 
@@ -433,6 +431,7 @@ static void
 bnx2x_dev_infos_get(struct rte_eth_dev *dev, __rte_unused struct rte_eth_dev_info *dev_info)
 {
        struct bnx2x_softc *sc = dev->data->dev_private;
+       dev_info->pci_dev = dev->pci_dev;
        dev_info->max_rx_queues  = sc->max_rx_queues;
        dev_info->max_tx_queues  = sc->max_tx_queues;
        dev_info->min_rx_bufsize = BNX2X_MIN_RX_BUF_SIZE;
@@ -577,6 +576,8 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
                        eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id);
 
        if (IS_VF(sc)) {
+               rte_spinlock_init(&sc->vf2pf_lock);
+
                if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg),
                                    &sc->vf2pf_mbox_mapping, "vf2pf_mbox",
                                    RTE_CACHE_LINE_SIZE) != 0)
@@ -641,7 +642,9 @@ static struct eth_driver rte_bnx2xvf_pmd = {
        .dev_private_size = sizeof(struct bnx2x_softc),
 };
 
-DRIVER_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd.pci_drv);
-DRIVER_REGISTER_PCI_TABLE(net_bnx2x, pci_id_bnx2x_map);
-DRIVER_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
-DRIVER_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map);
+RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI_TABLE(net_bnx2x, pci_id_bnx2x_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_bnx2x, "* igb_uio | uio_pci_generic | vfio");
+RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
+RTE_PMD_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio");