]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: move info filling of PCI into drivers
authorJan Blunck <jblunck@infradead.org>
Fri, 23 Dec 2016 15:58:10 +0000 (16:58 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 25 Dec 2016 22:25:42 +0000 (23:25 +0100)
Only the drivers itself can decide if it could fill PCI information fields
of dev_info.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
20 files changed:
drivers/net/bnx2x/bnx2x_ethdev.c
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/cxgbe/cxgbe_ethdev.c
drivers/net/e1000/em_ethdev.c
drivers/net/e1000/igb_ethdev.c
drivers/net/ena/ena_ethdev.c
drivers/net/enic/enic_ethdev.c
drivers/net/fm10k/fm10k_ethdev.c
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev_vf.c
drivers/net/ixgbe/ixgbe_ethdev.c
drivers/net/mlx4/mlx4.c
drivers/net/mlx5/mlx5_ethdev.c
drivers/net/nfp/nfp_net.c
drivers/net/qede/qede_ethdev.c
drivers/net/szedata2/rte_eth_szedata2.c
drivers/net/thunderx/nicvf_ethdev.c
drivers/net/virtio/virtio_ethdev.c
drivers/net/vmxnet3/vmxnet3_ethdev.c
lib/librte_ether/rte_ethdev.c

index fd9513664b37c3cc09b95dc56bc88c7b4118fbce..7237bcca42dc3d1d987a21bd3c0018955b132d38 100644 (file)
@@ -431,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;
index 97f5a79e4d98db03f180c8ecfb4753634bfaeb85..778323b441cc42fd653d4d0c2fd238c506773c56 100644 (file)
@@ -303,6 +303,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
        struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
        uint16_t max_vnics, i, j, vpool, vrxq;
 
+       dev_info->pci_dev = eth_dev->pci_dev;
+
        /* MAC Specifics */
        dev_info->max_mac_addrs = MAX_NUM_MAC_ADDR;
        dev_info->max_hash_mac_addrs = 0;
index 317598db78f1719287c19ad4c803133a0993a18b..70b66b0180ef54306bdf804eaa7cb4e3636c90bc 100644 (file)
@@ -147,6 +147,8 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
                .nb_align = 1,
        };
 
+       device_info->pci_dev = eth_dev->pci_dev;
+
        device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
        device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
        device_info->max_rx_queues = max_queues;
index 7a70bdebfe1e7d83c17c3230512d87c34c7fa486..6d071d99b0b12123a015268699c11999321734be 100644 (file)
@@ -1049,6 +1049,7 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
+       dev_info->pci_dev = dev->pci_dev;
        dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */
        dev_info->max_rx_pktlen = em_get_max_pktlen(hw);
        dev_info->max_mac_addrs = hw->mac.rar_entry_count;
index 352ef946f5be561d57ff931afda1120a548bb0f4..59a8bfd26c8fbf8df3aa46b22d38cdcded01c62e 100644 (file)
@@ -1985,6 +1985,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
+       dev_info->pci_dev = dev->pci_dev;
        dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */
        dev_info->max_rx_pktlen  = 0x3FFF; /* See RLPML register. */
        dev_info->max_mac_addrs = hw->mac.rar_entry_count;
@@ -2113,6 +2114,7 @@ eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
+       dev_info->pci_dev = dev->pci_dev;
        dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */
        dev_info->max_rx_pktlen  = 0x3FFF; /* See RLPML register. */
        dev_info->max_mac_addrs = hw->mac.rar_entry_count;
index 555fb31c6e47918affaad599a7f7b2c8650e95e6..020c02a2d8d1a5a42a8f3b744af930747f32d481 100644 (file)
@@ -1436,6 +1436,8 @@ static void ena_infos_get(struct rte_eth_dev *dev,
        ena_dev = &adapter->ena_dev;
        ena_assert_msg(ena_dev != NULL, "Uninitialized device");
 
+       dev_info->pci_dev = dev->pci_dev;
+
        dev_info->speed_capa =
                        ETH_LINK_SPEED_1G   |
                        ETH_LINK_SPEED_2_5G |
index f99730259c088fa20e3dd7d825dda167fc72be3d..ae6f39402e10bee5b047fef1d029ddaebbde5464 100644 (file)
@@ -459,6 +459,7 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
        struct enic *enic = pmd_priv(eth_dev);
 
        ENICPMD_FUNC_TRACE();
+       device_info->pci_dev = eth_dev->pci_dev;
        /* Scattered Rx uses two receive queues per rx queue exposed to dpdk */
        device_info->max_rx_queues = enic->conf_rq_count / 2;
        device_info->max_tx_queues = enic->conf_wq_count;
index 95ee9d26927d1972c9f0b871a76a4ac98548eeb2..a97a4836574ca003cd73e6a1319e1923b769204e 100644 (file)
@@ -1393,6 +1393,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
 
        PMD_INIT_FUNC_TRACE();
 
+       dev_info->pci_dev            = pdev;
        dev_info->min_rx_bufsize     = FM10K_MIN_RX_BUF_SIZE;
        dev_info->max_rx_pktlen      = FM10K_MAX_PKT_SIZE;
        dev_info->max_rx_queues      = hw->mac.max_queues;
index 0341e3364a0bb71786c49f176932173afffefb68..8f63044ba4be725388273a56ef94a6471a44be59 100644 (file)
@@ -2597,6 +2597,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        struct i40e_vsi *vsi = pf->main_vsi;
        struct rte_pci_device *pci_dev = I40E_DEV_TO_PCI(dev);
 
+       dev_info->pci_dev = pci_dev;
        dev_info->max_rx_queues = vsi->nb_qps;
        dev_info->max_tx_queues = vsi->nb_qps;
        dev_info->min_rx_bufsize = I40E_BUF_SIZE_MIN;
index 29b31b54f416a0578f5a64246bef1fec394a7323..5b8c376df41d2413cd2f0961c1ce9b02dbb20c0a 100644 (file)
@@ -2225,6 +2225,7 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
        memset(dev_info, 0, sizeof(*dev_info));
+       dev_info->pci_dev = dev->pci_dev;
        dev_info->max_rx_queues = vf->vsi_res->num_queue_pairs;
        dev_info->max_tx_queues = vf->vsi_res->num_queue_pairs;
        dev_info->min_rx_bufsize = I40E_BUF_SIZE_MIN;
index b009fb0afd4a886822746dc25e709dbbdcb4dc2a..ec2edade2ad8f951665d860cd87ee55d2b46a961 100644 (file)
@@ -3035,6 +3035,7 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 
+       dev_info->pci_dev = pci_dev;
        dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
        dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
        if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
@@ -3167,6 +3168,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
        struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
+       dev_info->pci_dev = pci_dev;
        dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
        dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
        dev_info->min_rx_bufsize = 1024; /* cf BSIZEPACKET in SRRCTL reg */
index 82b51a72b16a4b4bf6d6fd0e394f5f6364b6fb3f..ebcc9cbbf9c4c44ff4b59a79525c9f92b501148e 100644 (file)
@@ -4421,6 +4421,8 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
        unsigned int max;
        char ifname[IF_NAMESIZE];
 
+       info->pci_dev = dev->pci_dev;
+
        if (priv == NULL)
                return;
        priv_lock(priv);
index c0f73e9392d428cabfa622e29af589619b10ae48..da1a3ca8150031267ef43dd39476815e8e649545 100644 (file)
@@ -562,6 +562,8 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
        unsigned int max;
        char ifname[IF_NAMESIZE];
 
+       info->pci_dev = dev->pci_dev;
+
        priv_lock(priv);
        /* FIXME: we should ask the device for these values. */
        info->min_rx_bufsize = 32;
index c9b3ef9276fa415736266037cc630ea37e44bc4a..590ecb2c78e27992997ec8d2ffeaed75e7957367 100644 (file)
@@ -1008,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;
index aefc6f11d45cc61089e5950411cea3718941b825..9133fca0c521a81915295efc21ee7a164e6b7c05 100644 (file)
@@ -651,6 +651,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
 
        PMD_INIT_FUNC_TRACE(edev);
 
+       dev_info->pci_dev = eth_dev->pci_dev;
        dev_info->min_rx_bufsize = (uint32_t)(ETHER_MIN_MTU +
                                              QEDE_ETH_OVERHEAD);
        dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
index c4f6134cc7fa2cfc5813f27b88fb960a3bcc0db4..a6c2e3b69f4e4e67db7785d44aa5236d8516b707 100644 (file)
@@ -1031,6 +1031,7 @@ eth_dev_info(struct rte_eth_dev *dev,
                struct rte_eth_dev_info *dev_info)
 {
        struct pmd_internals *internals = dev->data->dev_private;
+       dev_info->pci_dev = dev->pci_dev;
        dev_info->if_index = 0;
        dev_info->max_mac_addrs = 1;
        dev_info->max_rx_pktlen = (uint32_t)-1;
index db03fa8f79b79dedb1966e99331aac83796b55ef..df91289e5114d6134e8db03409924dcb54d3e97b 100644 (file)
@@ -1338,6 +1338,8 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
        PMD_INIT_FUNC_TRACE();
 
+       dev_info->pci_dev = dev->pci_dev;
+
        dev_info->min_rx_bufsize = ETHER_MIN_MTU;
        dev_info->max_rx_pktlen = NIC_HW_MAX_FRS;
        dev_info->max_rx_queues =
index 26848e471d472f317be394fccc90b4eb078574da..6949b3996c76a6f6536d6f1b1dedf113943fa721 100644 (file)
@@ -1626,6 +1626,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        uint64_t tso_mask;
        struct virtio_hw *hw = dev->data->dev_private;
 
+       dev_info->pci_dev = hw->dev;
        dev_info->max_rx_queues =
                RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
        dev_info->max_tx_queues =
index 9c8b65f9dd0c6c636e643146ef0de59de9e33a8b..5fe1d3f2d5c8b8a9fd292ac4d3f48f2f61f21078 100644 (file)
@@ -706,9 +706,11 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 }
 
 static void
-vmxnet3_dev_info_get(__rte_unused struct rte_eth_dev *dev,
+vmxnet3_dev_info_get(struct rte_eth_dev *dev,
                     struct rte_eth_dev_info *dev_info)
 {
+       dev_info->pci_dev = dev->pci_dev;
+
        dev_info->max_rx_queues = VMXNET3_MAX_RX_QUEUES;
        dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES;
        dev_info->min_rx_bufsize = 1518 + RTE_PKTMBUF_HEADROOM;
index b455850713440b946f9ee78f5782e3d2c8c28973..8e02d2e01fd905dfe066762f70028fee2b641614 100644 (file)
@@ -1604,7 +1604,6 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 
        RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
        (*dev->dev_ops->dev_infos_get)(dev, dev_info);
-       dev_info->pci_dev = dev->pci_dev;
        dev_info->driver_name = dev->data->drv_name;
        dev_info->nb_rx_queues = dev->data->nb_rx_queues;
        dev_info->nb_tx_queues = dev->data->nb_tx_queues;