ethdev: move info filling of PCI into drivers
[dpdk.git] / drivers / net / nfp / nfp_net.c
index faf725c..590ecb2 100644 (file)
@@ -718,10 +718,12 @@ static void
 nfp_net_close(struct rte_eth_dev *dev)
 {
        struct nfp_net_hw *hw;
+       struct rte_pci_device *pci_dev;
 
        PMD_INIT_LOG(DEBUG, "Close\n");
 
        hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       pci_dev = dev->pci_dev;
 
        /*
         * We assume that the DPDK application is stopping all the
@@ -730,11 +732,11 @@ nfp_net_close(struct rte_eth_dev *dev)
 
        nfp_net_stop(dev);
 
-       rte_intr_disable(&dev->pci_dev->intr_handle);
+       rte_intr_disable(&pci_dev->intr_handle);
        nn_cfg_writeb(hw, NFP_NET_CFG_LSC, 0xff);
 
        /* unregister callback func from eal lib */
-       rte_intr_callback_unregister(&dev->pci_dev->intr_handle,
+       rte_intr_callback_unregister(&pci_dev->intr_handle,
                                     nfp_net_dev_interrupt_handler,
                                     (void *)dev);
 
@@ -1006,6 +1008,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
        hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
+       dev_info->pci_dev = dev->pci_dev;
        dev_info->driver_name = dev->driver->pci_drv.driver.name;
        dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
        dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
@@ -1122,6 +1125,7 @@ nfp_net_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx)
 static void
 nfp_net_dev_link_status_print(struct rte_eth_dev *dev)
 {
+       struct rte_pci_device *pci_dev = dev->pci_dev;
        struct rte_eth_link link;
 
        memset(&link, 0, sizeof(link));
@@ -1136,8 +1140,8 @@ nfp_net_dev_link_status_print(struct rte_eth_dev *dev)
                        (int)(dev->data->port_id));
 
        RTE_LOG(INFO, PMD, "PCI Address: %04d:%02d:%02d:%d\n",
-               dev->pci_dev->addr.domain, dev->pci_dev->addr.bus,
-               dev->pci_dev->addr.devid, dev->pci_dev->addr.function);
+               pci_dev->addr.domain, pci_dev->addr.bus,
+               pci_dev->addr.devid, pci_dev->addr.function);
 }
 
 /* Interrupt configuration and handling */
@@ -1152,13 +1156,15 @@ static void
 nfp_net_irq_unmask(struct rte_eth_dev *dev)
 {
        struct nfp_net_hw *hw;
+       struct rte_pci_device *pci_dev;
 
        hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       pci_dev = dev->pci_dev;
 
        if (hw->ctrl & NFP_NET_CFG_CTRL_MSIXAUTO) {
                /* If MSI-X auto-masking is used, clear the entry */
                rte_wmb();
-               rte_intr_enable(&dev->pci_dev->intr_handle);
+               rte_intr_enable(&pci_dev->intr_handle);
        } else {
                /* Make sure all updates are written before un-masking */
                rte_wmb();
@@ -1219,7 +1225,7 @@ nfp_net_dev_interrupt_delayed_handler(void *param)
        struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
        nfp_net_link_update(dev, 0);
-       _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+       _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
        nfp_net_dev_link_status_print(dev);
 
@@ -1707,7 +1713,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                 * DPDK just checks the queue is lower than max queues
                 * enabled. But the queue needs to be configured
                 */
-               RTE_LOG(ERR, PMD, "RX Bad queue\n");
+               RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
                return -EINVAL;
        }
 
@@ -1720,7 +1726,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
                rxb = &rxq->rxbufs[idx];
                if (unlikely(rxb == NULL)) {
-                       RTE_LOG(ERR, PMD, "rxb does not exist!\n");
+                       RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
                        break;
                }
 
@@ -1740,7 +1746,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                 */
                new_mb = rte_pktmbuf_alloc(rxq->mem_pool);
                if (unlikely(new_mb == NULL)) {
-                       RTE_LOG(DEBUG, PMD, "RX mbuf alloc failed port_id=%u "
+                       RTE_LOG_DP(DEBUG, PMD, "RX mbuf alloc failed port_id=%u "
                                "queue_id=%u\n", (unsigned)rxq->port_id,
                                (unsigned)rxq->qidx);
                        nfp_net_mbuf_alloc_failed(rxq);
@@ -1771,7 +1777,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                         * responsibility of avoiding it. But we have
                         * to give some info about the error
                         */
-                       RTE_LOG(ERR, PMD,
+                       RTE_LOG_DP(ERR, PMD,
                                "mbuf overflow likely due to the RX offset.\n"
                                "\t\tYour mbuf size should have extra space for"
                                " RX offset=%u bytes.\n"
@@ -2400,7 +2406,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
                     hw->cap & NFP_NET_CFG_CTRL_LSO     ? "TSO "     : "",
                     hw->cap & NFP_NET_CFG_CTRL_RSS     ? "RSS "     : "");
 
-       pci_dev = eth_dev->pci_dev;
        hw->ctrl = 0;
 
        hw->stride_rx = stride;
@@ -2481,6 +2486,7 @@ static struct eth_driver rte_nfp_net_pmd = {
 
 RTE_PMD_REGISTER_PCI(net_nfp, rte_nfp_net_pmd.pci_drv);
 RTE_PMD_REGISTER_PCI_TABLE(net_nfp, pci_id_nfp_net_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_nfp, "* igb_uio | uio_pci_generic | vfio");
 
 /*
  * Local variables: