* [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev
@ 2018-03-27 17:40 Ferruh Yigit
2018-03-28 7:04 ` Shreyansh Jain
` (4 more replies)
0 siblings, 5 replies; 22+ messages in thread
From: Ferruh Yigit @ 2018-03-27 17:40 UTC (permalink / raw)
To: Wenzhuo Lu, Jingjing Wu, John W. Linville, Shepard Siegel,
Ed Czeck, John Miller, Allain Legacy, Matt Peters, Harish Patil,
Rasesh Mody, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
Hemant Agrawal, Shreyansh Jain, Marcin Wojtas, Michal Krawczyk,
Guy Tzalik, Evgeny Schemeilin, John Daley, Hyong Youb Kim,
Qi Zhang, Xiao Wang, Beilei Xing, Konstantin Ananyev,
Shijith Thotton, Srisivasubramanian Srinivasan, Adrien Mazarguil,
Nelio Laranjeiro, Yongseok Koh, Jacek Siuda, Tomasz Duszynski,
Dmitri Epshtein, Natalie Samsonov, Jianbo Liu, Alejandro Lucero,
Tetsuya Mukawa, Santosh Shukla, Jerin Jacob, Shahed Shaikh,
Bruce Richardson, Andrew Rybchenko, Matej Vido, Pascal Mazon,
Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Shrikrishna Khare,
Remy Horton, Ori Kam, Pablo de Lara, Radu Nicolau, Akhil Goyal,
Tomasz Kantecki, Cristian Dumitrescu, Thomas Monjalon
Cc: dev, Ferruh Yigit
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.
Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>
There is no deprecation notice sent for this update but in this release
ethdev info already updated and ABI already broken, it can be good
opportunity for this update.
---
app/test-pmd/config.c | 11 ++++++++++-
app/test-pmd/testpmd.h | 24 ++++++++++++++++++------
drivers/net/af_packet/rte_eth_af_packet.c | 1 +
drivers/net/ark/ark_ethdev.c | 4 +++-
drivers/net/avf/avf_ethdev.c | 2 +-
drivers/net/avp/avp_ethdev.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
drivers/net/dpaa/dpaa_ethdev.c | 1 +
drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
drivers/net/e1000/em_ethdev.c | 2 +-
drivers/net/e1000/igb_ethdev.c | 4 ++--
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/enic/enic_ethdev.c | 2 +-
drivers/net/fm10k/fm10k_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/kni/rte_eth_kni.c | 2 +-
drivers/net/liquidio/lio_ethdev.c | 2 +-
drivers/net/mlx4/mlx4_ethdev.c | 2 +-
drivers/net/mlx5/mlx5_ethdev.c | 2 +-
drivers/net/mrvl/mrvl_ethdev.c | 2 ++
drivers/net/nfp/nfp_net.c | 2 +-
drivers/net/null/rte_eth_null.c | 1 +
drivers/net/octeontx/octeontx_ethdev.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 1 +
drivers/net/qede/qede_ethdev.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 1 +
drivers/net/sfc/sfc_ethdev.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
drivers/net/tap/rte_eth_tap.c | 2 +-
drivers/net/thunderx/nicvf_ethdev.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
examples/ethtool/lib/rte_ethtool.c | 15 +++++++++------
examples/ip_pipeline/init.c | 10 ++++++++--
examples/kni/main.c | 10 +++++++---
lib/librte_ether/rte_ethdev.h | 2 +-
test/test/test_kni.c | 28 ++++++++++++++++++++++------
41 files changed, 114 insertions(+), 54 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 51f725865..e5578a472 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -754,6 +754,8 @@ vlan_id_is_invalid(uint16_t vlan_id)
static int
port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
uint64_t pci_len;
if (reg_off & 0x3) {
@@ -762,7 +764,14 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
(unsigned)reg_off);
return 1;
}
- pci_len = ports[port_id].dev_info.pci_dev->mem_resource[0].len;
+
+ bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
+ if (bus && !strcmp(bus->name, "pci"))
+ pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
+ else
+ return 1;
+
+ pci_len = pci_dev->mem_resource[0].len;
if (reg_off >= pci_len) {
printf("Port %d: register offset %u (0x%X) out of port PCI "
"resource (length=%"PRIu64")\n",
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 153abea05..a58fb4e70 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -500,12 +500,18 @@ mbuf_pool_find(unsigned int sock_id)
static inline uint32_t
port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
uint32_t reg_v;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci"))
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ else
+ return 0;
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
reg_v = *((volatile uint32_t *)reg_addr);
return rte_le_to_cpu_32(reg_v);
}
@@ -516,11 +522,17 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
static inline void
port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci"))
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ else
+ return;
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
}
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 57eccfd04..2dc5cf527 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -293,6 +293,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->device = dev->device;
dev_info->if_index = internals->if_index;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ff87c20e2..3d5412879 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -748,6 +748,8 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
struct ark_mpu_t *rx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_RX_BASE);
uint16_t ports = ark->num_ports;
+ dev_info->device = dev->device;
+
dev_info->max_rx_pktlen = ARK_RX_MAX_PKT_LEN;
dev_info->min_rx_bufsize = ARK_RX_MIN_BUFSIZE;
@@ -771,7 +773,7 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
}
static int
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 4442c3cd8..81743c879 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -507,7 +507,7 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
memset(dev_info, 0, sizeof(*dev_info));
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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 = AVF_BUF_SIZE_MIN;
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index dba99120f..0c1d8ae5d 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -2206,7 +2206,7 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
dev_info->max_rx_queues = avp->max_rx_queues;
dev_info->max_tx_queues = avp->max_tx_queues;
dev_info->min_rx_bufsize = AVP_MIN_RX_BUFSIZE;
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 483d5a17c..29636522e 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -447,7 +447,7 @@ static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct bnx2x_softc *sc = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 21c46f833..a1f8a7d63 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -407,7 +407,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
/* MAC Specifics */
dev_info->max_mac_addrs = bp->max_l2_ctx;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 781d75cc2..ec3a024c6 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -148,7 +148,7 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
.nb_align = 1,
};
- device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ device_info->device = eth_dev->device;
device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index db493648a..29513158f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -245,6 +245,7 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
+ dev_info->device = dev->device;
dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
dev_info->min_rx_bufsize = DPAA_MIN_RX_BUF_SIZE;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 2fb7b2da7..7802067e8 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -163,6 +163,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->if_index = priv->hw_id;
+ dev_info->device = dev->device;
dev_info->max_mac_addrs = priv->max_mac_filters;
dev_info->max_rx_pktlen = DPAA2_MAX_RX_PKT_LEN;
dev_info->min_rx_bufsize = DPAA2_MIN_RX_BUF_SIZE;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 0358cbfa4..8ab6361a2 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1048,7 +1048,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index d7eef9a6c..5504fc16c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2144,7 +2144,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
@@ -2273,7 +2273,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ad4e03dba..4806f2601 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1527,7 +1527,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->speed_capa =
ETH_LINK_SPEED_1G |
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 03f0c2547..c4250db28 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -471,7 +471,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 = RTE_ETH_DEV_TO_PCI(eth_dev);
+ device_info->device = eth_dev->device;
/* 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;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index cc1a773a7..116be6f13 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1375,7 +1375,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = pdev;
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f9408b0e7..54c577170 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3200,7 +3200,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 = RTE_ETH_DEV_TO_PCI(dev);
- dev_info->pci_dev = pci_dev;
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c30a0e9c3..ce468c7b3 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2165,7 +2165,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b65fab736..f66c6c515 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3572,7 +3572,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->device = dev->device;
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) {
@@ -3731,7 +3731,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_pci_device *pci_dev = RTE_ETH_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->device = dev->device;
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 */
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index dc4e65f5d..d35e2beb9 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -201,7 +201,7 @@ eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused,
dev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = NULL;
}
static int
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index eeb8350e4..a135645bc 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -373,7 +373,7 @@ 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;
+ devinfo->device = eth_dev->device;
switch (pci_dev->id.subsystem_device_id) {
/* CN23xx 10G cards */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index beecc53ba..577aab3d3 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -555,7 +555,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ info->device = dev->device;
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index aa4118026..693755a74 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -403,7 +403,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ info->device = dev->device;
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index c0483b912..d46c65255 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -1314,6 +1314,8 @@ static void
mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
struct rte_eth_dev_info *info)
{
+ info->device = dev->device;
+
info->speed_capa = ETH_LINK_SPEED_10M |
ETH_LINK_SPEED_100M |
ETH_LINK_SPEED_1G |
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8591c7de0..add00baf9 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1159,7 +1159,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 73fe8b04a..7506f77f6 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -292,6 +292,7 @@ eth_dev_info(struct rte_eth_dev *dev,
return;
internals = dev->data->dev_private;
+ dev_info->device = dev->device;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 90dd249a6..edd4dd3ff 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -611,7 +611,7 @@ octeontx_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = PKO_MAX_NUM_DQ;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = NULL;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = 0,
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index c1571e1fe..2e739a24e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -526,6 +526,7 @@ eth_dev_info(struct rte_eth_dev *dev,
{
struct pmd_internals *internals = dev->data->dev_private;
+ dev_info->device = dev->device;
dev_info->if_index = internals->if_index;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t) -1;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a91f43683..59d604b78 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1515,7 +1515,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
PMD_INIT_FUNC_TRACE(edev);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE;
dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
dev_info->rx_desc_lim = qede_rx_desc_lim;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index df13c44be..14274fa36 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -153,6 +153,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->device = dev->device;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index f16d52081..2c0ad7ecf 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -89,7 +89,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
sfc_log_init(sa, "entry");
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
/* Autonegotiation may be disabled */
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 1d02aee6f..4157cc88f 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1031,7 +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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->if_index = 0;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 67ed9d466..23843e32e 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -688,7 +688,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = NULL;
dev_info->speed_capa = tap_dev_speed_capa();
dev_info->rx_offload_capa = tap_rx_offload_get_port_capa();
dev_info->tx_offload_capa = tap_tx_offload_get_port_capa();
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 067f2243b..f9e4a5810 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1400,7 +1400,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
/* Autonegotiation may be disabled */
dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4dddb1c80..c623ce186 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2057,7 +2057,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
- dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
+ dev_info->device = dev->device;
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 426008722..220668e19 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1025,7 +1025,7 @@ static void
vmxnet3_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_queues = VMXNET3_MAX_RX_QUEUES;
dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 90dfbb739..4c770ec6a 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
{
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
int n;
int ret;
@@ -46,15 +48,16 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
rte_version());
/* TODO: replace bus_info by rte_devargs.name */
- if (dev_info.pci_dev)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
"%04x:%02x:%02x.%x",
- dev_info.pci_dev->addr.domain,
- dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
- else
+ pci_dev->addr.domain, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
+ } else {
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
+ }
memset(®_info, 0, sizeof(reg_info));
rte_eth_dev_get_reg_info(port_id, ®_info);
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index bb07efa13..f57236b7a 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -1266,6 +1266,8 @@ app_init_kni(struct app_params *app) {
struct rte_eth_dev_info dev_info;
struct app_mempool_params *mempool_params;
struct rte_mempool *mempool;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
struct rte_kni_conf conf;
struct rte_kni_ops ops;
@@ -1297,8 +1299,12 @@ app_init_kni(struct app_params *app) {
}
conf.group_id = p_link->pmd_id;
conf.mbuf_size = mempool_params->buffer_size;
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
memset(&ops, 0, sizeof(ops));
ops.port_id = (uint8_t) p_link->pmd_id;
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 0d9980ee1..06eb74f6f 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -834,13 +834,17 @@ kni_alloc(uint16_t port_id)
if (i == 0) {
struct rte_kni_ops ops;
struct rte_eth_dev_info dev_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
- if (dev_info.pci_dev) {
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
}
/* Get the interface default mac address */
rte_eth_macaddr_get(port_id,
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ab1030d42..0ed903966 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -995,7 +995,7 @@ struct rte_pci_device;
* Ethernet device information
*/
struct rte_eth_dev_info {
- struct rte_pci_device *pci_dev; /**< Device PCI information. */
+ struct rte_device *device; /** Generic device information */
const char *driver_name; /**< Device Driver name. */
unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */
diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index e4839cdb7..e23eb0837 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -357,6 +357,8 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
if (!mp)
return -1;
@@ -366,8 +368,12 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
/* core id 1 configured for kernel thread */
@@ -465,6 +471,8 @@ test_kni(void)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
/* Initialize KNI subsytem */
rte_kni_init(KNI_TEST_MAX_PORTS);
@@ -523,8 +531,12 @@ test_kni(void)
memset(&conf, 0, sizeof(conf));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
@@ -552,8 +564,12 @@ test_kni(void)
memset(&info, 0, sizeof(info));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
--
2.14.3
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev
2018-03-27 17:40 [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev Ferruh Yigit
@ 2018-03-28 7:04 ` Shreyansh Jain
2018-03-28 13:11 ` Legacy, Allain
` (3 subsequent siblings)
4 siblings, 0 replies; 22+ messages in thread
From: Shreyansh Jain @ 2018-03-28 7:04 UTC (permalink / raw)
To: Ferruh Yigit
Cc: Wenzhuo Lu, Jingjing Wu, John W. Linville, Shepard Siegel,
Ed Czeck, John Miller, Allain Legacy, Matt Peters, Harish Patil,
Rasesh Mody, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
Hemant Agrawal, Shreyansh Jain, Marcin Wojtas, Michal Krawczyk,
Guy Tzalik, Evgeny Schemeilin, John Daley, Hyong Youb Kim,
Qi Zhang, Xiao Wang, Beilei Xing, Konstantin Ananyev,
Shijith Thotton, Srisivasubramanian Srinivasan, Adrien Mazarguil,
Nelio Laranjeiro, Yongseok Koh, Jacek Siuda, Tomasz Duszynski,
Dmitri Epshtein, Natalie Samsonov, Jianbo Liu, Alejandro Lucero,
Tetsuya Mukawa, Santosh Shukla, Jerin Jacob, Shahed Shaikh,
Bruce Richardson, Andrew Rybchenko, Matej Vido, Pascal Mazon,
Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Shrikrishna Khare,
Remy Horton, Ori Kam, Pablo de Lara, Radu Nicolau, Akhil Goyal,
Tomasz Kantecki, Cristian Dumitrescu, Thomas Monjalon, dev
On 3/27/2018 11:10 PM, Ferruh Yigit wrote:
> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
> although it is common for all ethdev in all buses.
>
> Replacing pci specific struct with generic device struct and updating
> places that are using pci device in a way to get this information from
> generic device.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> There is no deprecation notice sent for this update but in this release
> ethdev info already updated and ABI already broken, it can be good
> opportunity for this update.
> ---
> app/test-pmd/config.c | 11 ++++++++++-
> app/test-pmd/testpmd.h | 24 ++++++++++++++++++------
> drivers/net/af_packet/rte_eth_af_packet.c | 1 +
> drivers/net/ark/ark_ethdev.c | 4 +++-
> drivers/net/avf/avf_ethdev.c | 2 +-
> drivers/net/avp/avp_ethdev.c | 2 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
> drivers/net/bnxt/bnxt_ethdev.c | 2 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
> drivers/net/dpaa/dpaa_ethdev.c | 1 +
> drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
> drivers/net/e1000/em_ethdev.c | 2 +-
> drivers/net/e1000/igb_ethdev.c | 4 ++--
> drivers/net/ena/ena_ethdev.c | 2 +-
> drivers/net/enic/enic_ethdev.c | 2 +-
> drivers/net/fm10k/fm10k_ethdev.c | 2 +-
> drivers/net/i40e/i40e_ethdev.c | 2 +-
> drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
> drivers/net/kni/rte_eth_kni.c | 2 +-
> drivers/net/liquidio/lio_ethdev.c | 2 +-
> drivers/net/mlx4/mlx4_ethdev.c | 2 +-
> drivers/net/mlx5/mlx5_ethdev.c | 2 +-
> drivers/net/mrvl/mrvl_ethdev.c | 2 ++
> drivers/net/nfp/nfp_net.c | 2 +-
> drivers/net/null/rte_eth_null.c | 1 +
> drivers/net/octeontx/octeontx_ethdev.c | 2 +-
> drivers/net/pcap/rte_eth_pcap.c | 1 +
> drivers/net/qede/qede_ethdev.c | 2 +-
> drivers/net/ring/rte_eth_ring.c | 1 +
> drivers/net/sfc/sfc_ethdev.c | 2 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
> drivers/net/tap/rte_eth_tap.c | 2 +-
> drivers/net/thunderx/nicvf_ethdev.c | 2 +-
> drivers/net/virtio/virtio_ethdev.c | 2 +-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
> examples/ethtool/lib/rte_ethtool.c | 15 +++++++++------
> examples/ip_pipeline/init.c | 10 ++++++++--
> examples/kni/main.c | 10 +++++++---
> lib/librte_ether/rte_ethdev.h | 2 +-
> test/test/test_kni.c | 28 ++++++++++++++++++++++------
> 41 files changed, 114 insertions(+), 54 deletions(-)
>
[...]
> diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
> index 781d75cc2..ec3a024c6 100644
> --- a/drivers/net/cxgbe/cxgbe_ethdev.c
> +++ b/drivers/net/cxgbe/cxgbe_ethdev.c
> @@ -148,7 +148,7 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
> .nb_align = 1,
> };
>
> - device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
> + device_info->device = eth_dev->device;
>
> device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
> device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
> diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
> index db493648a..29513158f 100644
> --- a/drivers/net/dpaa/dpaa_ethdev.c
> +++ b/drivers/net/dpaa/dpaa_ethdev.c
> @@ -245,6 +245,7 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev,
>
> PMD_INIT_FUNC_TRACE();
>
> + dev_info->device = dev->device;
> dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
> dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
> dev_info->min_rx_bufsize = DPAA_MIN_RX_BUF_SIZE;
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
> index 2fb7b2da7..7802067e8 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -163,6 +163,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>
> dev_info->if_index = priv->hw_id;
>
> + dev_info->device = dev->device;
> dev_info->max_mac_addrs = priv->max_mac_filters;
> dev_info->max_rx_pktlen = DPAA2_MAX_RX_PKT_LEN;
> dev_info->min_rx_bufsize = DPAA2_MIN_RX_BUF_SIZE;
[...]
For dpaa and dpaa2 specific change...
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index ab1030d42..0ed903966 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -995,7 +995,7 @@ struct rte_pci_device;
> * Ethernet device information
> */
> struct rte_eth_dev_info {
> - struct rte_pci_device *pci_dev; /**< Device PCI information. */
> + struct rte_device *device; /** Generic device information */
> const char *driver_name; /**< Device Driver name. */
> unsigned int if_index; /**< Index to bound host interface, or 0 if none.
> Use if_indextoname() to translate into an interface name. */
[...]
And for the above change:
Acked-By: Shreyansh Jain <shreyansh.jain@nxp.com>
_
Shreyansh
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev
2018-03-27 17:40 [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev Ferruh Yigit
2018-03-28 7:04 ` Shreyansh Jain
@ 2018-03-28 13:11 ` Legacy, Allain
2018-03-29 6:17 ` Tomasz Duszynski
` (2 subsequent siblings)
4 siblings, 0 replies; 22+ messages in thread
From: Legacy, Allain @ 2018-03-28 13:11 UTC (permalink / raw)
To: YIGIT, FERRUH, LU, WENZHUO, WU, JINGJING, John W. Linville,
Shepard Siegel, Ed Czeck, John Miller, Peters, Matt,
Harish Patil, Rasesh Mody, Ajit Khaparde, Somnath Kotur,
Rahul Lakkireddy, Hemant Agrawal, Shreyansh Jain, Marcin Wojtas,
Michal Krawczyk, Guy Tzalik, Evgeny Schemeilin, John Daley,
Hyong Youb Kim, ZHANG, QI, WANG, XIAO, XING, BEILEI, ANANYEV,
KONSTANTIN, Shijith Thotton, Srisivasubramanian Srinivasan,
Adrien Mazarguil, Nelio Laranjeiro, Yongseok Koh, Jacek Siuda,
Tomasz Duszynski, Dmitri Epshtein, Natalie Samsonov, Jianbo Liu,
Alejandro Lucero, Tetsuya Mukawa, Santosh Shukla, Jerin Jacob,
Shahed Shaikh, RICHARDSON, BRUCE, Andrew Rybchenko, Matej Vido,
Pascal Mazon, Maciej Czekaj, Maxime Coquelin, BIE, TIWEI,
Shrikrishna Khare, HORTON, REMY, Ori Kam, DE LARA GUARCH, PABLO,
NICOLAU, RADU, Akhil Goyal, KANTECKI, TOMASZ, DUMITRESCU,
CRISTIAN FLORIN, Thomas Monjalon
Cc: dev, YIGIT, FERRUH
> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Tuesday, March 27, 2018 1:41 PM
<...>
> Subject: [PATCH] ethdev: replace bus specific struct with generic dev
>
> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
> although it is common for all ethdev in all buses.
>
> Replacing pci specific struct with generic device struct and updating places
> that are using pci device in a way to get this information from generic device.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> There is no deprecation notice sent for this update but in this release ethdev
> info already updated and ABI already broken, it can be good opportunity for
> this update.
> ---
> app/test-pmd/config.c | 11 ++++++++++-
> app/test-pmd/testpmd.h | 24 ++++++++++++++++++------
> drivers/net/af_packet/rte_eth_af_packet.c | 1 +
> drivers/net/ark/ark_ethdev.c | 4 +++-
> drivers/net/avf/avf_ethdev.c | 2 +-
> drivers/net/avp/avp_ethdev.c | 2 +-
Acked-by: Allain Legacy <allain.legacy@windriver.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev
2018-03-27 17:40 [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev Ferruh Yigit
2018-03-28 7:04 ` Shreyansh Jain
2018-03-28 13:11 ` Legacy, Allain
@ 2018-03-29 6:17 ` Tomasz Duszynski
2018-03-29 9:20 ` Ferruh Yigit
2018-03-29 8:01 ` santosh
2018-03-29 14:50 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
4 siblings, 1 reply; 22+ messages in thread
From: Tomasz Duszynski @ 2018-03-29 6:17 UTC (permalink / raw)
To: Ferruh Yigit
Cc: Wenzhuo Lu, Jingjing Wu, John W. Linville, Shepard Siegel,
Ed Czeck, John Miller, Allain Legacy, Matt Peters, Harish Patil,
Rasesh Mody, Ajit Khaparde, Somnath Kotur, Rahul Lakkireddy,
Hemant Agrawal, Shreyansh Jain, Marcin Wojtas, Michal Krawczyk,
Guy Tzalik, Evgeny Schemeilin, John Daley, Hyong Youb Kim,
Qi Zhang, Xiao Wang, Beilei Xing, Konstantin Ananyev,
Shijith Thotton, Srisivasubramanian Srinivasan, Adrien Mazarguil,
Nelio Laranjeiro, Yongseok Koh, Jacek Siuda, Tomasz Duszynski,
Dmitri Epshtein, Natalie Samsonov, Jianbo Liu, Alejandro Lucero,
Tetsuya Mukawa, Santosh Shukla, Jerin Jacob, Shahed Shaikh,
Bruce Richardson, Andrew Rybchenko, Matej Vido, Pascal Mazon,
Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Shrikrishna Khare,
Remy Horton, Ori Kam, Pablo de Lara, Radu Nicolau, Akhil Goyal,
Tomasz Kantecki, Cristian Dumitrescu, Thomas Monjalon, dev
On Tue, Mar 27, 2018 at 06:40:52PM +0100, Ferruh Yigit wrote:
> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
> although it is common for all ethdev in all buses.
>
> Replacing pci specific struct with generic device struct and updating
> places that are using pci device in a way to get this information from
> generic device.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> There is no deprecation notice sent for this update but in this release
> ethdev info already updated and ABI already broken, it can be good
> opportunity for this update.
> ---
> app/test-pmd/config.c | 11 ++++++++++-
> app/test-pmd/testpmd.h | 24 ++++++++++++++++++------
> drivers/net/af_packet/rte_eth_af_packet.c | 1 +
> drivers/net/ark/ark_ethdev.c | 4 +++-
> drivers/net/avf/avf_ethdev.c | 2 +-
> drivers/net/avp/avp_ethdev.c | 2 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
> drivers/net/bnxt/bnxt_ethdev.c | 2 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
> drivers/net/dpaa/dpaa_ethdev.c | 1 +
> drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
> drivers/net/e1000/em_ethdev.c | 2 +-
> drivers/net/e1000/igb_ethdev.c | 4 ++--
> drivers/net/ena/ena_ethdev.c | 2 +-
> drivers/net/enic/enic_ethdev.c | 2 +-
> drivers/net/fm10k/fm10k_ethdev.c | 2 +-
> drivers/net/i40e/i40e_ethdev.c | 2 +-
> drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
> drivers/net/kni/rte_eth_kni.c | 2 +-
> drivers/net/liquidio/lio_ethdev.c | 2 +-
> drivers/net/mlx4/mlx4_ethdev.c | 2 +-
> drivers/net/mlx5/mlx5_ethdev.c | 2 +-
> drivers/net/mrvl/mrvl_ethdev.c | 2 ++
> drivers/net/nfp/nfp_net.c | 2 +-
> drivers/net/null/rte_eth_null.c | 1 +
> drivers/net/octeontx/octeontx_ethdev.c | 2 +-
> drivers/net/pcap/rte_eth_pcap.c | 1 +
> drivers/net/qede/qede_ethdev.c | 2 +-
> drivers/net/ring/rte_eth_ring.c | 1 +
> drivers/net/sfc/sfc_ethdev.c | 2 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
> drivers/net/tap/rte_eth_tap.c | 2 +-
> drivers/net/thunderx/nicvf_ethdev.c | 2 +-
> drivers/net/virtio/virtio_ethdev.c | 2 +-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
> examples/ethtool/lib/rte_ethtool.c | 15 +++++++++------
> examples/ip_pipeline/init.c | 10 ++++++++--
> examples/kni/main.c | 10 +++++++---
> lib/librte_ether/rte_ethdev.h | 2 +-
> test/test/test_kni.c | 28 ++++++++++++++++++++++------
> 41 files changed, 114 insertions(+), 54 deletions(-)
>
[...]
> diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
> index c0483b912..d46c65255 100644
> --- a/drivers/net/mrvl/mrvl_ethdev.c
> +++ b/drivers/net/mrvl/mrvl_ethdev.c
> @@ -1314,6 +1314,8 @@ static void
> mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
> struct rte_eth_dev_info *info)
> {
> + info->device = dev->device;
Since dev is used perhaps __rte_unused can be dropped.
Besides that,
Acked-by: Tomasz Duszynski <tdu@semihalf.com>
> +
> info->speed_capa = ETH_LINK_SPEED_10M |
> ETH_LINK_SPEED_100M |
> ETH_LINK_SPEED_1G |
> diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
> index 8591c7de0..add00baf9 100644
> --- a/drivers/net/nfp/nfp_net.c
> +++ b/drivers/net/nfp/nfp_net.c
> @@ -1159,7 +1159,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 = RTE_ETH_DEV_TO_PCI(dev);
> + dev_info->device = dev->device;
> dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
> dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
> dev_info->min_rx_bufsize = ETHER_MIN_MTU;
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index 73fe8b04a..7506f77f6 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> @@ -292,6 +292,7 @@ eth_dev_info(struct rte_eth_dev *dev,
> return;
>
> internals = dev->data->dev_private;
> + dev_info->device = dev->device;
> dev_info->max_mac_addrs = 1;
> dev_info->max_rx_pktlen = (uint32_t)-1;
> dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
> index 90dd249a6..edd4dd3ff 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -611,7 +611,7 @@ octeontx_dev_info(struct rte_eth_dev *dev,
> dev_info->max_rx_queues = 1;
> dev_info->max_tx_queues = PKO_MAX_NUM_DQ;
> dev_info->min_rx_bufsize = 0;
> - dev_info->pci_dev = NULL;
> + dev_info->device = NULL;
>
> dev_info->default_rxconf = (struct rte_eth_rxconf) {
> .rx_free_thresh = 0,
> diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
> index c1571e1fe..2e739a24e 100644
> --- a/drivers/net/pcap/rte_eth_pcap.c
> +++ b/drivers/net/pcap/rte_eth_pcap.c
> @@ -526,6 +526,7 @@ eth_dev_info(struct rte_eth_dev *dev,
> {
> struct pmd_internals *internals = dev->data->dev_private;
>
> + dev_info->device = dev->device;
> dev_info->if_index = internals->if_index;
> dev_info->max_mac_addrs = 1;
> dev_info->max_rx_pktlen = (uint32_t) -1;
> diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
> index a91f43683..59d604b78 100644
> --- a/drivers/net/qede/qede_ethdev.c
> +++ b/drivers/net/qede/qede_ethdev.c
> @@ -1515,7 +1515,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
>
> PMD_INIT_FUNC_TRACE(edev);
>
> - dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
> + dev_info->device = eth_dev->device;
> dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE;
> dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
> dev_info->rx_desc_lim = qede_rx_desc_lim;
> diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
> index df13c44be..14274fa36 100644
> --- a/drivers/net/ring/rte_eth_ring.c
> +++ b/drivers/net/ring/rte_eth_ring.c
> @@ -153,6 +153,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->device = dev->device;
> dev_info->max_mac_addrs = 1;
> dev_info->max_rx_pktlen = (uint32_t)-1;
> dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
> diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
> index f16d52081..2c0ad7ecf 100644
> --- a/drivers/net/sfc/sfc_ethdev.c
> +++ b/drivers/net/sfc/sfc_ethdev.c
> @@ -89,7 +89,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>
> sfc_log_init(sa, "entry");
>
> - dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> + dev_info->device = dev->device;
> dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
>
> /* Autonegotiation may be disabled */
> diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
> index 1d02aee6f..4157cc88f 100644
> --- a/drivers/net/szedata2/rte_eth_szedata2.c
> +++ b/drivers/net/szedata2/rte_eth_szedata2.c
> @@ -1031,7 +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 = RTE_ETH_DEV_TO_PCI(dev);
> + dev_info->device = dev->device;
> dev_info->if_index = 0;
> dev_info->max_mac_addrs = 1;
> dev_info->max_rx_pktlen = (uint32_t)-1;
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 67ed9d466..23843e32e 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -688,7 +688,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
> dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES;
> dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
> dev_info->min_rx_bufsize = 0;
> - dev_info->pci_dev = NULL;
> + dev_info->device = NULL;
> dev_info->speed_capa = tap_dev_speed_capa();
> dev_info->rx_offload_capa = tap_rx_offload_get_port_capa();
> dev_info->tx_offload_capa = tap_tx_offload_get_port_capa();
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
> index 067f2243b..f9e4a5810 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -1400,7 +1400,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>
> PMD_INIT_FUNC_TRACE();
>
> - dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> + dev_info->device = dev->device;
>
> /* Autonegotiation may be disabled */
> dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 4dddb1c80..c623ce186 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2057,7 +2057,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
>
> dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
>
> - dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
> + dev_info->device = dev->device;
> dev_info->max_rx_queues =
> RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
> dev_info->max_tx_queues =
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> index 426008722..220668e19 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> @@ -1025,7 +1025,7 @@ static void
> vmxnet3_dev_info_get(struct rte_eth_dev *dev,
> struct rte_eth_dev_info *dev_info)
> {
> - dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> + dev_info->device = dev->device;
>
> dev_info->max_rx_queues = VMXNET3_MAX_RX_QUEUES;
> dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES;
> diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
> index 90dfbb739..4c770ec6a 100644
> --- a/examples/ethtool/lib/rte_ethtool.c
> +++ b/examples/ethtool/lib/rte_ethtool.c
> @@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
> {
> struct rte_eth_dev_info dev_info;
> struct rte_dev_reg_info reg_info;
> + const struct rte_pci_device *pci_dev;
> + const struct rte_bus *bus;
> int n;
> int ret;
>
> @@ -46,15 +48,16 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
> snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
> rte_version());
> /* TODO: replace bus_info by rte_devargs.name */
> - if (dev_info.pci_dev)
> + bus = rte_bus_find_by_device(dev_info.device);
> + if (bus && !strcmp(bus->name, "pci")) {
> + pci_dev = RTE_DEV_TO_PCI(dev_info.device);
> snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
> "%04x:%02x:%02x.%x",
> - dev_info.pci_dev->addr.domain,
> - dev_info.pci_dev->addr.bus,
> - dev_info.pci_dev->addr.devid,
> - dev_info.pci_dev->addr.function);
> - else
> + pci_dev->addr.domain, pci_dev->addr.bus,
> + pci_dev->addr.devid, pci_dev->addr.function);
> + } else {
> snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
> + }
>
> memset(®_info, 0, sizeof(reg_info));
> rte_eth_dev_get_reg_info(port_id, ®_info);
> diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
> index bb07efa13..f57236b7a 100644
> --- a/examples/ip_pipeline/init.c
> +++ b/examples/ip_pipeline/init.c
> @@ -1266,6 +1266,8 @@ app_init_kni(struct app_params *app) {
> struct rte_eth_dev_info dev_info;
> struct app_mempool_params *mempool_params;
> struct rte_mempool *mempool;
> + const struct rte_pci_device *pci_dev;
> + const struct rte_bus *bus;
> struct rte_kni_conf conf;
> struct rte_kni_ops ops;
>
> @@ -1297,8 +1299,12 @@ app_init_kni(struct app_params *app) {
> }
> conf.group_id = p_link->pmd_id;
> conf.mbuf_size = mempool_params->buffer_size;
> - conf.addr = dev_info.pci_dev->addr;
> - conf.id = dev_info.pci_dev->id;
> + bus = rte_bus_find_by_device(dev_info.device);
> + if (bus && !strcmp(bus->name, "pci")) {
> + pci_dev = RTE_DEV_TO_PCI(dev_info.device);
> + conf.addr = pci_dev->addr;
> + conf.id = pci_dev->id;
> + }
>
> memset(&ops, 0, sizeof(ops));
> ops.port_id = (uint8_t) p_link->pmd_id;
> diff --git a/examples/kni/main.c b/examples/kni/main.c
> index 0d9980ee1..06eb74f6f 100644
> --- a/examples/kni/main.c
> +++ b/examples/kni/main.c
> @@ -834,13 +834,17 @@ kni_alloc(uint16_t port_id)
> if (i == 0) {
> struct rte_kni_ops ops;
> struct rte_eth_dev_info dev_info;
> + const struct rte_pci_device *pci_dev;
> + const struct rte_bus *bus;
>
> memset(&dev_info, 0, sizeof(dev_info));
> rte_eth_dev_info_get(port_id, &dev_info);
>
> - if (dev_info.pci_dev) {
> - conf.addr = dev_info.pci_dev->addr;
> - conf.id = dev_info.pci_dev->id;
> + bus = rte_bus_find_by_device(dev_info.device);
> + if (bus && !strcmp(bus->name, "pci")) {
> + pci_dev = RTE_DEV_TO_PCI(dev_info.device);
> + conf.addr = pci_dev->addr;
> + conf.id = pci_dev->id;
> }
> /* Get the interface default mac address */
> rte_eth_macaddr_get(port_id,
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index ab1030d42..0ed903966 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -995,7 +995,7 @@ struct rte_pci_device;
> * Ethernet device information
> */
> struct rte_eth_dev_info {
> - struct rte_pci_device *pci_dev; /**< Device PCI information. */
> + struct rte_device *device; /** Generic device information */
> const char *driver_name; /**< Device Driver name. */
> unsigned int if_index; /**< Index to bound host interface, or 0 if none.
> Use if_indextoname() to translate into an interface name. */
> diff --git a/test/test/test_kni.c b/test/test/test_kni.c
> index e4839cdb7..e23eb0837 100644
> --- a/test/test/test_kni.c
> +++ b/test/test/test_kni.c
> @@ -357,6 +357,8 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
> struct rte_kni_conf conf;
> struct rte_eth_dev_info info;
> struct rte_kni_ops ops;
> + const struct rte_pci_device *pci_dev;
> + const struct rte_bus *bus;
>
> if (!mp)
> return -1;
> @@ -366,8 +368,12 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
> memset(&ops, 0, sizeof(ops));
>
> rte_eth_dev_info_get(port_id, &info);
> - conf.addr = info.pci_dev->addr;
> - conf.id = info.pci_dev->id;
> + bus = rte_bus_find_by_device(info.device);
> + if (bus && !strcmp(bus->name, "pci")) {
> + pci_dev = RTE_DEV_TO_PCI(info.device);
> + conf.addr = pci_dev->addr;
> + conf.id = pci_dev->id;
> + }
> snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
>
> /* core id 1 configured for kernel thread */
> @@ -465,6 +471,8 @@ test_kni(void)
> struct rte_kni_conf conf;
> struct rte_eth_dev_info info;
> struct rte_kni_ops ops;
> + const struct rte_pci_device *pci_dev;
> + const struct rte_bus *bus;
>
> /* Initialize KNI subsytem */
> rte_kni_init(KNI_TEST_MAX_PORTS);
> @@ -523,8 +531,12 @@ test_kni(void)
> memset(&conf, 0, sizeof(conf));
> memset(&ops, 0, sizeof(ops));
> rte_eth_dev_info_get(port_id, &info);
> - conf.addr = info.pci_dev->addr;
> - conf.id = info.pci_dev->id;
> + bus = rte_bus_find_by_device(info.device);
> + if (bus && !strcmp(bus->name, "pci")) {
> + pci_dev = RTE_DEV_TO_PCI(info.device);
> + conf.addr = pci_dev->addr;
> + conf.id = pci_dev->id;
> + }
> conf.group_id = port_id;
> conf.mbuf_size = MAX_PACKET_SZ;
>
> @@ -552,8 +564,12 @@ test_kni(void)
> memset(&info, 0, sizeof(info));
> memset(&ops, 0, sizeof(ops));
> rte_eth_dev_info_get(port_id, &info);
> - conf.addr = info.pci_dev->addr;
> - conf.id = info.pci_dev->id;
> + bus = rte_bus_find_by_device(info.device);
> + if (bus && !strcmp(bus->name, "pci")) {
> + pci_dev = RTE_DEV_TO_PCI(info.device);
> + conf.addr = pci_dev->addr;
> + conf.id = pci_dev->id;
> + }
> conf.group_id = port_id;
> conf.mbuf_size = MAX_PACKET_SZ;
>
> --
> 2.14.3
>
--
- Tomasz Duszyński
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev
2018-03-29 6:17 ` Tomasz Duszynski
@ 2018-03-29 9:20 ` Ferruh Yigit
0 siblings, 0 replies; 22+ messages in thread
From: Ferruh Yigit @ 2018-03-29 9:20 UTC (permalink / raw)
To: Tomasz Duszynski, dpdk-dev
On 3/29/2018 7:17 AM, Tomasz Duszynski wrote:
> On Tue, Mar 27, 2018 at 06:40:52PM +0100, Ferruh Yigit wrote:
>> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
>> although it is common for all ethdev in all buses.
>>
>> Replacing pci specific struct with generic device struct and updating
>> places that are using pci device in a way to get this information from
>> generic device.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>>
>> There is no deprecation notice sent for this update but in this release
>> ethdev info already updated and ABI already broken, it can be good
>> opportunity for this update.
>> ---
>> app/test-pmd/config.c | 11 ++++++++++-
>> app/test-pmd/testpmd.h | 24 ++++++++++++++++++------
>> drivers/net/af_packet/rte_eth_af_packet.c | 1 +
>> drivers/net/ark/ark_ethdev.c | 4 +++-
>> drivers/net/avf/avf_ethdev.c | 2 +-
>> drivers/net/avp/avp_ethdev.c | 2 +-
>> drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
>> drivers/net/bnxt/bnxt_ethdev.c | 2 +-
>> drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
>> drivers/net/dpaa/dpaa_ethdev.c | 1 +
>> drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
>> drivers/net/e1000/em_ethdev.c | 2 +-
>> drivers/net/e1000/igb_ethdev.c | 4 ++--
>> drivers/net/ena/ena_ethdev.c | 2 +-
>> drivers/net/enic/enic_ethdev.c | 2 +-
>> drivers/net/fm10k/fm10k_ethdev.c | 2 +-
>> drivers/net/i40e/i40e_ethdev.c | 2 +-
>> drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
>> drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
>> drivers/net/kni/rte_eth_kni.c | 2 +-
>> drivers/net/liquidio/lio_ethdev.c | 2 +-
>> drivers/net/mlx4/mlx4_ethdev.c | 2 +-
>> drivers/net/mlx5/mlx5_ethdev.c | 2 +-
>> drivers/net/mrvl/mrvl_ethdev.c | 2 ++
>> drivers/net/nfp/nfp_net.c | 2 +-
>> drivers/net/null/rte_eth_null.c | 1 +
>> drivers/net/octeontx/octeontx_ethdev.c | 2 +-
>> drivers/net/pcap/rte_eth_pcap.c | 1 +
>> drivers/net/qede/qede_ethdev.c | 2 +-
>> drivers/net/ring/rte_eth_ring.c | 1 +
>> drivers/net/sfc/sfc_ethdev.c | 2 +-
>> drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
>> drivers/net/tap/rte_eth_tap.c | 2 +-
>> drivers/net/thunderx/nicvf_ethdev.c | 2 +-
>> drivers/net/virtio/virtio_ethdev.c | 2 +-
>> drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
>> examples/ethtool/lib/rte_ethtool.c | 15 +++++++++------
>> examples/ip_pipeline/init.c | 10 ++++++++--
>> examples/kni/main.c | 10 +++++++---
>> lib/librte_ether/rte_ethdev.h | 2 +-
>> test/test/test_kni.c | 28 ++++++++++++++++++++++------
>> 41 files changed, 114 insertions(+), 54 deletions(-)
>>
>
> [...]
>
>> diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
>> index c0483b912..d46c65255 100644
>> --- a/drivers/net/mrvl/mrvl_ethdev.c
>> +++ b/drivers/net/mrvl/mrvl_ethdev.c
>> @@ -1314,6 +1314,8 @@ static void
>> mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
>> struct rte_eth_dev_info *info)
>> {
>> + info->device = dev->device;
>
> Since dev is used perhaps __rte_unused can be dropped.
> Besides that,
OK, I will send new version.
(reduced cc list)
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev
2018-03-27 17:40 [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev Ferruh Yigit
` (2 preceding siblings ...)
2018-03-29 6:17 ` Tomasz Duszynski
@ 2018-03-29 8:01 ` santosh
2018-03-29 14:50 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
4 siblings, 0 replies; 22+ messages in thread
From: santosh @ 2018-03-29 8:01 UTC (permalink / raw)
To: Ferruh Yigit, Jerin Jacob, Thomas Monjalon; +Cc: dev
On Tuesday 27 March 2018 11:10 PM, Ferruh Yigit wrote:
> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
> although it is common for all ethdev in all buses.
>
> Replacing pci specific struct with generic device struct and updating
> places that are using pci device in a way to get this information from
> generic device.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> There is no deprecation notice sent for this update but in this release
> ethdev info already updated and ABI already broken, it can be good
> opportunity for this update.
> ---
> app/test-pmd/config.c | 11 ++++++++++-
> app/test-pmd/testpmd.h | 24 ++++++++++++++++++------
> drivers/net/af_packet/rte_eth_af_packet.c | 1 +
> drivers/net/ark/ark_ethdev.c | 4 +++-
> drivers/net/avf/avf_ethdev.c | 2 +-
> drivers/net/avp/avp_ethdev.c | 2 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
> drivers/net/bnxt/bnxt_ethdev.c | 2 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
> drivers/net/dpaa/dpaa_ethdev.c | 1 +
> drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
> drivers/net/e1000/em_ethdev.c | 2 +-
> drivers/net/e1000/igb_ethdev.c | 4 ++--
> drivers/net/ena/ena_ethdev.c | 2 +-
> drivers/net/enic/enic_ethdev.c | 2 +-
> drivers/net/fm10k/fm10k_ethdev.c | 2 +-
> drivers/net/i40e/i40e_ethdev.c | 2 +-
> drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
> drivers/net/kni/rte_eth_kni.c | 2 +-
> drivers/net/liquidio/lio_ethdev.c | 2 +-
> drivers/net/mlx4/mlx4_ethdev.c | 2 +-
> drivers/net/mlx5/mlx5_ethdev.c | 2 +-
> drivers/net/mrvl/mrvl_ethdev.c | 2 ++
> drivers/net/nfp/nfp_net.c | 2 +-
> drivers/net/null/rte_eth_null.c | 1 +
> drivers/net/octeontx/octeontx_ethdev.c | 2 +-
Resending, as mailman had issues sending to too many recipient.
nits: patch apply failed on tip 20526313, applied manually.
with that:
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
[..]
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v2] ethdev: replace bus specific struct with generic dev
2018-03-27 17:40 [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev Ferruh Yigit
` (3 preceding siblings ...)
2018-03-29 8:01 ` santosh
@ 2018-03-29 14:50 ` Ferruh Yigit
2018-03-29 17:52 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
4 siblings, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2018-03-29 14:50 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.
Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
v2:
- prevent possible crash while getting bus (Pablo)
- Remove unnecessary __rte_unused
- Some PMD info_dev->device was assinged to NULL, fixed them
---
app/test-pmd/config.c | 18 ++++++++++++++-
app/test-pmd/testpmd.h | 38 ++++++++++++++++++++++++++-----
drivers/net/af_packet/rte_eth_af_packet.c | 1 +
drivers/net/ark/ark_ethdev.c | 2 +-
drivers/net/avf/avf_ethdev.c | 2 +-
drivers/net/avp/avp_ethdev.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
drivers/net/dpaa/dpaa_ethdev.c | 1 +
drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
drivers/net/e1000/em_ethdev.c | 2 +-
drivers/net/e1000/igb_ethdev.c | 4 ++--
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/enic/enic_ethdev.c | 2 +-
drivers/net/fm10k/fm10k_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/kni/rte_eth_kni.c | 5 ++--
drivers/net/liquidio/lio_ethdev.c | 2 +-
drivers/net/mlx4/mlx4_ethdev.c | 2 +-
drivers/net/mlx5/mlx5_ethdev.c | 2 +-
drivers/net/mrvl/mrvl_ethdev.c | 5 ++--
drivers/net/nfp/nfp_net.c | 2 +-
drivers/net/null/rte_eth_null.c | 1 +
drivers/net/octeontx/octeontx_ethdev.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 4 ++--
drivers/net/qede/qede_ethdev.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 5 ++--
drivers/net/sfc/sfc_ethdev.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
drivers/net/tap/rte_eth_tap.c | 2 +-
drivers/net/thunderx/nicvf_ethdev.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
examples/ethtool/lib/rte_ethtool.c | 16 ++++++++-----
examples/ip_pipeline/init.c | 11 +++++++--
examples/kni/main.c | 11 ++++++---
lib/librte_ether/rte_ethdev.h | 2 +-
test/test/test_kni.c | 35 +++++++++++++++++++++++-----
41 files changed, 148 insertions(+), 62 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 51f725865..ca14bb25d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -754,6 +754,8 @@ vlan_id_is_invalid(uint16_t vlan_id)
static int
port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
uint64_t pci_len;
if (reg_off & 0x3) {
@@ -762,7 +764,21 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
(unsigned)reg_off);
return 1;
}
- pci_len = ports[port_id].dev_info.pci_dev->mem_resource[0].len;
+
+ if (!ports[port_id].dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 1;
+ }
+
+ pci_len = pci_dev->mem_resource[0].len;
if (reg_off >= pci_len) {
printf("Port %d: register offset %u (0x%X) out of port PCI "
"resource (length=%"PRIu64")\n",
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 153abea05..4d84e7b00 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -500,12 +500,25 @@ mbuf_pool_find(unsigned int sock_id)
static inline uint32_t
port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
uint32_t reg_v;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 0;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
reg_v = *((volatile uint32_t *)reg_addr);
return rte_le_to_cpu_32(reg_v);
}
@@ -516,11 +529,24 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
static inline void
port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
}
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 57eccfd04..2dc5cf527 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -293,6 +293,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->device = dev->device;
dev_info->if_index = internals->if_index;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ff87c20e2..b4cd6b630 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -771,7 +771,7 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
}
static int
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 4442c3cd8..81743c879 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -507,7 +507,7 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
memset(dev_info, 0, sizeof(*dev_info));
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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 = AVF_BUF_SIZE_MIN;
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index a07a288ed..35e91f7c8 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -2172,7 +2172,7 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
dev_info->max_rx_queues = avp->max_rx_queues;
dev_info->max_tx_queues = avp->max_tx_queues;
dev_info->min_rx_bufsize = AVP_MIN_RX_BUFSIZE;
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 483d5a17c..29636522e 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -447,7 +447,7 @@ static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct bnx2x_softc *sc = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0b2165326..1598e6088 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -407,7 +407,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
/* MAC Specifics */
dev_info->max_mac_addrs = bp->max_l2_ctx;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index feae01d6a..e196a3433 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -121,7 +121,7 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
.nb_align = 1,
};
- device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ device_info->device = eth_dev->device;
device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index db493648a..29513158f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -245,6 +245,7 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
+ dev_info->device = dev->device;
dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
dev_info->min_rx_bufsize = DPAA_MIN_RX_BUF_SIZE;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 2fb7b2da7..7802067e8 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -163,6 +163,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->if_index = priv->hw_id;
+ dev_info->device = dev->device;
dev_info->max_mac_addrs = priv->max_mac_filters;
dev_info->max_rx_pktlen = DPAA2_MAX_RX_PKT_LEN;
dev_info->min_rx_bufsize = DPAA2_MIN_RX_BUF_SIZE;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 0358cbfa4..8ab6361a2 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1048,7 +1048,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index d7eef9a6c..5504fc16c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2144,7 +2144,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
@@ -2273,7 +2273,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ad4e03dba..4806f2601 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1527,7 +1527,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->speed_capa =
ETH_LINK_SPEED_1G |
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 03f0c2547..c4250db28 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -471,7 +471,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 = RTE_ETH_DEV_TO_PCI(eth_dev);
+ device_info->device = eth_dev->device;
/* 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;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index cc1a773a7..116be6f13 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1375,7 +1375,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = pdev;
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0bf4e349..58877c60c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3212,7 +3212,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 = RTE_ETH_DEV_TO_PCI(dev);
- dev_info->pci_dev = pci_dev;
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 26e71f9db..f6c63848b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2183,7 +2183,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b65fab736..f66c6c515 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3572,7 +3572,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->device = dev->device;
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) {
@@ -3731,7 +3731,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_pci_device *pci_dev = RTE_ETH_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->device = dev->device;
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 */
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index dc4e65f5d..fab74d0f5 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -193,15 +193,14 @@ eth_kni_dev_configure(struct rte_eth_dev *dev __rte_unused)
}
static void
-eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused,
- struct rte_eth_dev_info *dev_info)
+eth_kni_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = UINT32_MAX;
dev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = dev->device;
}
static int
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index eeb8350e4..a135645bc 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -373,7 +373,7 @@ 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;
+ devinfo->device = eth_dev->device;
switch (pci_dev->id.subsystem_device_id) {
/* CN23xx 10G cards */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index beecc53ba..577aab3d3 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -555,7 +555,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ info->device = dev->device;
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 8ece4987e..944972cdc 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -404,7 +404,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ info->device = dev->device;
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index c0483b912..b98a65b9a 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -1311,9 +1311,10 @@ mrvl_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
* Info structure output buffer.
*/
static void
-mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
- struct rte_eth_dev_info *info)
+mrvl_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
{
+ info->device = dev->device;
+
info->speed_capa = ETH_LINK_SPEED_10M |
ETH_LINK_SPEED_100M |
ETH_LINK_SPEED_1G |
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8591c7de0..add00baf9 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1159,7 +1159,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 73fe8b04a..7506f77f6 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -292,6 +292,7 @@ eth_dev_info(struct rte_eth_dev *dev,
return;
internals = dev->data->dev_private;
+ dev_info->device = dev->device;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 90dd249a6..75765381f 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -611,7 +611,7 @@ octeontx_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = PKO_MAX_NUM_DQ;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = dev->device;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = 0,
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index c1571e1fe..2cf866b47 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -521,11 +521,11 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
}
static void
-eth_dev_info(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info)
+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->device = dev->device;
dev_info->if_index = internals->if_index;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t) -1;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a91f43683..59d604b78 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1515,7 +1515,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
PMD_INIT_FUNC_TRACE(edev);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE;
dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
dev_info->rx_desc_lim = qede_rx_desc_lim;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index df13c44be..e54a0a8ae 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -149,10 +149,11 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
static void
-eth_dev_info(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info)
+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->device = dev->device;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index e140f8f76..6b9f42af9 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -89,7 +89,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
sfc_log_init(sa, "entry");
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
/* Autonegotiation may be disabled */
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 1d02aee6f..4157cc88f 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1031,7 +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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->if_index = 0;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 67ed9d466..0dc5103ef 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -688,7 +688,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = dev->device;
dev_info->speed_capa = tap_dev_speed_capa();
dev_info->rx_offload_capa = tap_rx_offload_get_port_capa();
dev_info->tx_offload_capa = tap_tx_offload_get_port_capa();
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 067f2243b..f9e4a5810 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1400,7 +1400,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
/* Autonegotiation may be disabled */
dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4dddb1c80..c623ce186 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2057,7 +2057,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
- dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
+ dev_info->device = dev->device;
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 426008722..220668e19 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1025,7 +1025,7 @@ static void
vmxnet3_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_queues = VMXNET3_MAX_RX_QUEUES;
dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 90dfbb739..d519a50db 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
{
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
int n;
int ret;
@@ -46,15 +48,17 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
rte_version());
/* TODO: replace bus_info by rte_devargs.name */
- if (dev_info.pci_dev)
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
"%04x:%02x:%02x.%x",
- dev_info.pci_dev->addr.domain,
- dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
- else
+ pci_dev->addr.domain, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
+ } else {
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
+ }
memset(®_info, 0, sizeof(reg_info));
rte_eth_dev_get_reg_info(port_id, ®_info);
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index bb07efa13..87e998828 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -1266,6 +1266,8 @@ app_init_kni(struct app_params *app) {
struct rte_eth_dev_info dev_info;
struct app_mempool_params *mempool_params;
struct rte_mempool *mempool;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
struct rte_kni_conf conf;
struct rte_kni_ops ops;
@@ -1297,8 +1299,13 @@ app_init_kni(struct app_params *app) {
}
conf.group_id = p_link->pmd_id;
conf.mbuf_size = mempool_params->buffer_size;
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
memset(&ops, 0, sizeof(ops));
ops.port_id = (uint8_t) p_link->pmd_id;
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 0d9980ee1..aebfedd59 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -834,13 +834,18 @@ kni_alloc(uint16_t port_id)
if (i == 0) {
struct rte_kni_ops ops;
struct rte_eth_dev_info dev_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
- if (dev_info.pci_dev) {
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
}
/* Get the interface default mac address */
rte_eth_macaddr_get(port_id,
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ab1030d42..0ed903966 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -995,7 +995,7 @@ struct rte_pci_device;
* Ethernet device information
*/
struct rte_eth_dev_info {
- struct rte_pci_device *pci_dev; /**< Device PCI information. */
+ struct rte_device *device; /** Generic device information */
const char *driver_name; /**< Device Driver name. */
unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */
diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index e4839cdb7..3d1be56a9 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -357,6 +357,8 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
if (!mp)
return -1;
@@ -366,8 +368,13 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
/* core id 1 configured for kernel thread */
@@ -465,6 +472,8 @@ test_kni(void)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
/* Initialize KNI subsytem */
rte_kni_init(KNI_TEST_MAX_PORTS);
@@ -523,8 +532,15 @@ test_kni(void)
memset(&conf, 0, sizeof(conf));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
@@ -552,8 +568,15 @@ test_kni(void)
memset(&info, 0, sizeof(info));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
--
2.14.3
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v3] ethdev: replace bus specific struct with generic dev
2018-03-29 14:50 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
@ 2018-03-29 17:52 ` Ferruh Yigit
2018-03-30 6:44 ` David Marchand
2018-03-30 15:17 ` [dpdk-dev] [PATCH v4] " Ferruh Yigit
0 siblings, 2 replies; 22+ messages in thread
From: Ferruh Yigit @ 2018-03-29 17:52 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.
Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
v2:
- prevent possible crash while getting bus (Pablo)
- Remove unnecessary __rte_unused
- Some PMD info_dev->device was assigned to NULL, fixed them
v3:
- rebased on latest next-net
---
app/test-pmd/config.c | 18 ++++++++++++++-
app/test-pmd/testpmd.h | 38 ++++++++++++++++++++++++++-----
drivers/net/af_packet/rte_eth_af_packet.c | 1 +
drivers/net/ark/ark_ethdev.c | 2 +-
drivers/net/avf/avf_ethdev.c | 2 +-
drivers/net/avp/avp_ethdev.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
drivers/net/dpaa/dpaa_ethdev.c | 1 +
drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
drivers/net/e1000/em_ethdev.c | 2 +-
drivers/net/e1000/igb_ethdev.c | 4 ++--
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/enic/enic_ethdev.c | 2 +-
drivers/net/fm10k/fm10k_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev.c | 2 +-
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++--
drivers/net/kni/rte_eth_kni.c | 5 ++--
drivers/net/liquidio/lio_ethdev.c | 2 +-
drivers/net/mlx4/mlx4_ethdev.c | 2 +-
drivers/net/mlx5/mlx5_ethdev.c | 2 +-
drivers/net/mrvl/mrvl_ethdev.c | 5 ++--
drivers/net/nfp/nfp_net.c | 2 +-
drivers/net/null/rte_eth_null.c | 1 +
drivers/net/octeontx/octeontx_ethdev.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 4 ++--
drivers/net/qede/qede_ethdev.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 5 ++--
drivers/net/sfc/sfc_ethdev.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
drivers/net/tap/rte_eth_tap.c | 2 +-
drivers/net/thunderx/nicvf_ethdev.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +-
examples/ethtool/lib/rte_ethtool.c | 16 ++++++++-----
examples/ip_pipeline/init.c | 11 +++++++--
examples/kni/main.c | 11 ++++++---
lib/librte_ether/rte_ethdev.h | 2 +-
test/test/test_kni.c | 35 +++++++++++++++++++++++-----
41 files changed, 148 insertions(+), 62 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 4bb255c62..dd051f5ca 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -754,6 +754,8 @@ vlan_id_is_invalid(uint16_t vlan_id)
static int
port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
uint64_t pci_len;
if (reg_off & 0x3) {
@@ -762,7 +764,21 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
(unsigned)reg_off);
return 1;
}
- pci_len = ports[port_id].dev_info.pci_dev->mem_resource[0].len;
+
+ if (!ports[port_id].dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 1;
+ }
+
+ pci_len = pci_dev->mem_resource[0].len;
if (reg_off >= pci_len) {
printf("Port %d: register offset %u (0x%X) out of port PCI "
"resource (length=%"PRIu64")\n",
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 153abea05..4d84e7b00 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -500,12 +500,25 @@ mbuf_pool_find(unsigned int sock_id)
static inline uint32_t
port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
uint32_t reg_v;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 0;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
reg_v = *((volatile uint32_t *)reg_addr);
return rte_le_to_cpu_32(reg_v);
}
@@ -516,11 +529,24 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
static inline void
port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
}
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 57eccfd04..2dc5cf527 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -293,6 +293,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->device = dev->device;
dev_info->if_index = internals->if_index;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ff87c20e2..b4cd6b630 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -771,7 +771,7 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
}
static int
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 4df661705..a2c25ba49 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -507,7 +507,7 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
memset(dev_info, 0, sizeof(*dev_info));
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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 = AVF_BUF_SIZE_MIN;
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index a07a288ed..35e91f7c8 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -2172,7 +2172,7 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
dev_info->max_rx_queues = avp->max_rx_queues;
dev_info->max_tx_queues = avp->max_tx_queues;
dev_info->min_rx_bufsize = AVP_MIN_RX_BUFSIZE;
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 483d5a17c..29636522e 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -447,7 +447,7 @@ static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct bnx2x_softc *sc = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0b2165326..1598e6088 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -407,7 +407,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
/* MAC Specifics */
dev_info->max_mac_addrs = bp->max_l2_ctx;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index feae01d6a..e196a3433 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -121,7 +121,7 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
.nb_align = 1,
};
- device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ device_info->device = eth_dev->device;
device_info->min_rx_bufsize = CXGBE_MIN_RX_BUFSIZE;
device_info->max_rx_pktlen = CXGBE_MAX_RX_PKTLEN;
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index db493648a..29513158f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -245,6 +245,7 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
+ dev_info->device = dev->device;
dev_info->max_rx_queues = dpaa_intf->nb_rx_queues;
dev_info->max_tx_queues = dpaa_intf->nb_tx_queues;
dev_info->min_rx_bufsize = DPAA_MIN_RX_BUF_SIZE;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 2fb7b2da7..7802067e8 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -163,6 +163,7 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->if_index = priv->hw_id;
+ dev_info->device = dev->device;
dev_info->max_mac_addrs = priv->max_mac_filters;
dev_info->max_rx_pktlen = DPAA2_MAX_RX_PKT_LEN;
dev_info->min_rx_bufsize = DPAA2_MIN_RX_BUF_SIZE;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index f72738290..19bfeca51 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1048,7 +1048,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index d7eef9a6c..5504fc16c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2144,7 +2144,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
@@ -2273,7 +2273,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 34b2a8d78..2e8f74edf 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1527,7 +1527,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->speed_capa =
ETH_LINK_SPEED_1G |
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 03f0c2547..c4250db28 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -471,7 +471,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 = RTE_ETH_DEV_TO_PCI(eth_dev);
+ device_info->device = eth_dev->device;
/* 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;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 94237610c..b8bdc6803 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1377,7 +1377,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = pdev;
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0bf4e349..58877c60c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3212,7 +3212,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 = RTE_ETH_DEV_TO_PCI(dev);
- dev_info->pci_dev = pci_dev;
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 750d84972..b020f5c8d 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2183,7 +2183,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
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;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 1cb85b367..ba0ff606f 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3572,7 +3572,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->device = dev->device;
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) {
@@ -3731,7 +3731,7 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_pci_device *pci_dev = RTE_ETH_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->device = dev->device;
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 */
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index dc4e65f5d..fab74d0f5 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -193,15 +193,14 @@ eth_kni_dev_configure(struct rte_eth_dev *dev __rte_unused)
}
static void
-eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused,
- struct rte_eth_dev_info *dev_info)
+eth_kni_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = UINT32_MAX;
dev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = dev->device;
}
static int
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index eeb8350e4..a135645bc 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -373,7 +373,7 @@ 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;
+ devinfo->device = eth_dev->device;
switch (pci_dev->id.subsystem_device_id) {
/* CN23xx 10G cards */
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index fbeef16c8..8aab184f1 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -555,7 +555,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ info->device = dev->device;
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index b6f5101cf..d3381d02f 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -404,7 +404,7 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
+ info->device = dev->device;
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index c0483b912..b98a65b9a 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -1311,9 +1311,10 @@ mrvl_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
* Info structure output buffer.
*/
static void
-mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
- struct rte_eth_dev_info *info)
+mrvl_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
{
+ info->device = dev->device;
+
info->speed_capa = ETH_LINK_SPEED_10M |
ETH_LINK_SPEED_100M |
ETH_LINK_SPEED_1G |
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8591c7de0..add00baf9 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1159,7 +1159,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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 73fe8b04a..7506f77f6 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -292,6 +292,7 @@ eth_dev_info(struct rte_eth_dev *dev,
return;
internals = dev->data->dev_private;
+ dev_info->device = dev->device;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 90dd249a6..75765381f 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -611,7 +611,7 @@ octeontx_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = PKO_MAX_NUM_DQ;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = dev->device;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = 0,
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index c1571e1fe..2cf866b47 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -521,11 +521,11 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
}
static void
-eth_dev_info(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info)
+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->device = dev->device;
dev_info->if_index = internals->if_index;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t) -1;
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a91f43683..59d604b78 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1515,7 +1515,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
PMD_INIT_FUNC_TRACE(edev);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ dev_info->device = eth_dev->device;
dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE;
dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
dev_info->rx_desc_lim = qede_rx_desc_lim;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index df13c44be..e54a0a8ae 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -149,10 +149,11 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
static void
-eth_dev_info(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info)
+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->device = dev->device;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index e140f8f76..6b9f42af9 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -89,7 +89,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
sfc_log_init(sa, "entry");
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
/* Autonegotiation may be disabled */
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 1d02aee6f..4157cc88f 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1031,7 +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 = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->if_index = 0;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 3e4f7a8e8..cfaf64ae0 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -736,7 +736,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
+ dev_info->device = dev->device;
dev_info->speed_capa = tap_dev_speed_capa();
dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() |
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 067f2243b..f9e4a5810 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1400,7 +1400,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
/* Autonegotiation may be disabled */
dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4dddb1c80..c623ce186 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2057,7 +2057,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
- dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
+ dev_info->device = dev->device;
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 426008722..220668e19 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1025,7 +1025,7 @@ static void
vmxnet3_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ dev_info->device = dev->device;
dev_info->max_rx_queues = VMXNET3_MAX_RX_QUEUES;
dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 90dfbb739..d519a50db 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
{
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
int n;
int ret;
@@ -46,15 +48,17 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
rte_version());
/* TODO: replace bus_info by rte_devargs.name */
- if (dev_info.pci_dev)
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
"%04x:%02x:%02x.%x",
- dev_info.pci_dev->addr.domain,
- dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
- else
+ pci_dev->addr.domain, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
+ } else {
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
+ }
memset(®_info, 0, sizeof(reg_info));
rte_eth_dev_get_reg_info(port_id, ®_info);
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index bb07efa13..87e998828 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -1266,6 +1266,8 @@ app_init_kni(struct app_params *app) {
struct rte_eth_dev_info dev_info;
struct app_mempool_params *mempool_params;
struct rte_mempool *mempool;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
struct rte_kni_conf conf;
struct rte_kni_ops ops;
@@ -1297,8 +1299,13 @@ app_init_kni(struct app_params *app) {
}
conf.group_id = p_link->pmd_id;
conf.mbuf_size = mempool_params->buffer_size;
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
memset(&ops, 0, sizeof(ops));
ops.port_id = (uint8_t) p_link->pmd_id;
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 0d9980ee1..aebfedd59 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -834,13 +834,18 @@ kni_alloc(uint16_t port_id)
if (i == 0) {
struct rte_kni_ops ops;
struct rte_eth_dev_info dev_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
- if (dev_info.pci_dev) {
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
}
/* Get the interface default mac address */
rte_eth_macaddr_get(port_id,
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 5e13dca6a..784c6faa4 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -992,7 +992,7 @@ struct rte_pci_device;
* Ethernet device information
*/
struct rte_eth_dev_info {
- struct rte_pci_device *pci_dev; /**< Device PCI information. */
+ struct rte_device *device; /** Generic device information */
const char *driver_name; /**< Device Driver name. */
unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */
diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index e4839cdb7..3d1be56a9 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -357,6 +357,8 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
if (!mp)
return -1;
@@ -366,8 +368,13 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
/* core id 1 configured for kernel thread */
@@ -465,6 +472,8 @@ test_kni(void)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
/* Initialize KNI subsytem */
rte_kni_init(KNI_TEST_MAX_PORTS);
@@ -523,8 +532,15 @@ test_kni(void)
memset(&conf, 0, sizeof(conf));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
@@ -552,8 +568,15 @@ test_kni(void)
memset(&info, 0, sizeof(info));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
--
2.14.3
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v3] ethdev: replace bus specific struct with generic dev
2018-03-29 17:52 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
@ 2018-03-30 6:44 ` David Marchand
2018-03-30 10:27 ` Ferruh Yigit
2018-03-30 15:17 ` [dpdk-dev] [PATCH v4] " Ferruh Yigit
1 sibling, 1 reply; 22+ messages in thread
From: David Marchand @ 2018-03-30 6:44 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev
Hello Ferruh,
On Thu, Mar 29, 2018 at 7:52 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
> although it is common for all ethdev in all buses.
>
> Replacing pci specific struct with generic device struct and updating
> places that are using pci device in a way to get this information from
> generic device.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> Acked-by: Allain Legacy <allain.legacy@windriver.com>
> Acked-by: Tomasz Duszynski <tdu@semihalf.com>
> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
The ethdev device already points to the backing device.
So, can't this be done in the ethdev layer itself ?
--
David Marchand
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v3] ethdev: replace bus specific struct with generic dev
2018-03-30 6:44 ` David Marchand
@ 2018-03-30 10:27 ` Ferruh Yigit
0 siblings, 0 replies; 22+ messages in thread
From: Ferruh Yigit @ 2018-03-30 10:27 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On 3/30/2018 7:44 AM, David Marchand wrote:
> Hello Ferruh,
>
> On Thu, Mar 29, 2018 at 7:52 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
>> although it is common for all ethdev in all buses.
>>
>> Replacing pci specific struct with generic device struct and updating
>> places that are using pci device in a way to get this information from
>> generic device.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> Acked-by: Allain Legacy <allain.legacy@windriver.com>
>> Acked-by: Tomasz Duszynski <tdu@semihalf.com>
>> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>
> The ethdev device already points to the backing device.
> So, can't this be done in the ethdev layer itself ?
Thanks Dave, yes, I think can be done. I will update according.
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-03-29 17:52 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2018-03-30 6:44 ` David Marchand
@ 2018-03-30 15:17 ` Ferruh Yigit
2018-03-30 15:29 ` David Marchand
2018-04-05 16:40 ` [dpdk-dev] [PATCH v5] " Ferruh Yigit
1 sibling, 2 replies; 22+ messages in thread
From: Ferruh Yigit @ 2018-03-30 15:17 UTC (permalink / raw)
To: dev
Cc: Ferruh Yigit, Shreyansh Jain, Allain Legacy, Tomasz Duszynski,
Santosh Shukla, David Marchand
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.
Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Shreyansh Jain <shreyansh.jain@nxp.com>
Cc: Allain Legacy <allain.legacy@windriver.com>
Cc: Tomasz Duszynski <tdu@semihalf.com>
Cc: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Cc: David Marchand <david.marchand@6wind.com>
v2:
- prevent possible crash while getting bus (Pablo)
- Remove unnecessary __rte_unused
- Some PMD info_dev->device was assigned to NULL, fixed them
v3:
- rebased on latest next-net
v4:
- Move dev_info->device assignment to ethdev layer
---
app/test-pmd/config.c | 18 +++++++++++++++-
app/test-pmd/testpmd.h | 38 +++++++++++++++++++++++++++------
drivers/net/ark/ark_ethdev.c | 1 -
drivers/net/avf/avf_ethdev.c | 1 -
drivers/net/avp/avp_ethdev.c | 1 -
drivers/net/bnx2x/bnx2x_ethdev.c | 1 -
drivers/net/bnxt/bnxt_ethdev.c | 2 --
drivers/net/cxgbe/cxgbe_ethdev.c | 2 --
drivers/net/e1000/em_ethdev.c | 1 -
drivers/net/e1000/igb_ethdev.c | 2 --
drivers/net/ena/ena_ethdev.c | 2 --
drivers/net/enic/enic_ethdev.c | 1 -
drivers/net/fm10k/fm10k_ethdev.c | 1 -
drivers/net/i40e/i40e_ethdev.c | 1 -
drivers/net/i40e/i40e_ethdev_vf.c | 1 -
drivers/net/ixgbe/ixgbe_ethdev.c | 2 --
drivers/net/kni/rte_eth_kni.c | 1 -
drivers/net/liquidio/lio_ethdev.c | 2 --
drivers/net/mlx4/mlx4_ethdev.c | 1 -
drivers/net/mlx5/mlx5_ethdev.c | 1 -
drivers/net/nfp/nfp_net.c | 1 -
drivers/net/octeontx/octeontx_ethdev.c | 1 -
drivers/net/qede/qede_ethdev.c | 1 -
drivers/net/sfc/sfc_ethdev.c | 1 -
drivers/net/szedata2/rte_eth_szedata2.c | 1 -
drivers/net/tap/rte_eth_tap.c | 1 -
drivers/net/thunderx/nicvf_ethdev.c | 2 --
drivers/net/virtio/virtio_ethdev.c | 1 -
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +---
examples/ethtool/lib/rte_ethtool.c | 16 ++++++++------
examples/ip_pipeline/init.c | 11 ++++++++--
examples/kni/main.c | 11 +++++++---
lib/librte_ether/rte_ethdev.c | 1 +
lib/librte_ether/rte_ethdev.h | 2 +-
test/test/test_kni.c | 35 ++++++++++++++++++++++++------
35 files changed, 108 insertions(+), 61 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 4bb255c62..dd051f5ca 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -754,6 +754,8 @@ vlan_id_is_invalid(uint16_t vlan_id)
static int
port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
uint64_t pci_len;
if (reg_off & 0x3) {
@@ -762,7 +764,21 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
(unsigned)reg_off);
return 1;
}
- pci_len = ports[port_id].dev_info.pci_dev->mem_resource[0].len;
+
+ if (!ports[port_id].dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 1;
+ }
+
+ pci_len = pci_dev->mem_resource[0].len;
if (reg_off >= pci_len) {
printf("Port %d: register offset %u (0x%X) out of port PCI "
"resource (length=%"PRIu64")\n",
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 153abea05..4d84e7b00 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -500,12 +500,25 @@ mbuf_pool_find(unsigned int sock_id)
static inline uint32_t
port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
uint32_t reg_v;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 0;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
reg_v = *((volatile uint32_t *)reg_addr);
return rte_le_to_cpu_32(reg_v);
}
@@ -516,11 +529,24 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
static inline void
port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
}
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ff87c20e2..c9d541921 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -771,7 +771,6 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
}
static int
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 4442c3cd8..06f4e4d6e 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -507,7 +507,6 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
memset(dev_info, 0, sizeof(*dev_info));
- dev_info->pci_dev = RTE_ETH_DEV_TO_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 = AVF_BUF_SIZE_MIN;
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index a07a288ed..5b3c4cebf 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -2172,7 +2172,6 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
dev_info->max_rx_queues = avp->max_rx_queues;
dev_info->max_tx_queues = avp->max_tx_queues;
dev_info->min_rx_bufsize = AVP_MIN_RX_BUFSIZE;
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 483d5a17c..8726b357a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -447,7 +447,6 @@ static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct bnx2x_softc *sc = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0b2165326..57f0c9ec6 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -407,8 +407,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
/* MAC Specifics */
dev_info->max_mac_addrs = bp->max_l2_ctx;
dev_info->max_hash_mac_addrs = 0;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index feae01d6a..50e1fcece 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -121,8 +121,6 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
.nb_align = 1,
};
- device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_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;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 2035ea85c..808ee47bd 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1048,7 +1048,6 @@ 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 = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index d7eef9a6c..2a1ee90bc 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2144,7 +2144,6 @@ 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 = RTE_ETH_DEV_TO_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;
@@ -2273,7 +2272,6 @@ 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 = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 34b2a8d78..a15436c99 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1527,8 +1527,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
-
dev_info->speed_capa =
ETH_LINK_SPEED_1G |
ETH_LINK_SPEED_2_5G |
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 03f0c2547..801f4704c 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -471,7 +471,6 @@ 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 = RTE_ETH_DEV_TO_PCI(eth_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;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 94237610c..d3ec76182 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1377,7 +1377,6 @@ 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;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index acf1f993c..03998c036 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3212,7 +3212,6 @@ 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 = RTE_ETH_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;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 750d84972..5a1b3ab51 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2183,7 +2183,6 @@ 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 = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4df5c75c3..eb8ff1239 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3586,7 +3586,6 @@ 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) {
@@ -3745,7 +3744,6 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_pci_device *pci_dev = RTE_ETH_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 */
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index dc4e65f5d..c10e970c2 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -201,7 +201,6 @@ eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused,
dev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
}
static int
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index eeb8350e4..a13a566f9 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -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:
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index fbeef16c8..237d98628 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -555,7 +555,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index b6f5101cf..208ed1f94 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -404,7 +404,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8591c7de0..d922b0259 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1159,7 +1159,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 90dd249a6..6dd7c60a6 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -611,7 +611,6 @@ octeontx_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = PKO_MAX_NUM_DQ;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = 0,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a4e9e753e..13c2a3b87 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1549,7 +1549,6 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
PMD_INIT_FUNC_TRACE(edev);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE;
dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
dev_info->rx_desc_lim = qede_rx_desc_lim;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 2af898e08..6631c5a7e 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -89,7 +89,6 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
sfc_log_init(sa, "entry");
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
/* Autonegotiation may be disabled */
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 1d02aee6f..58c177398 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1031,7 +1031,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
dev_info->if_index = 0;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 3e4f7a8e8..9828e84b1 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -736,7 +736,6 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
dev_info->speed_capa = tap_dev_speed_capa();
dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() |
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 067f2243b..75e9d16c5 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1400,8 +1400,6 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-
/* Autonegotiation may be disabled */
dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
dev_info->speed_capa |= ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M |
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 2ef213d1a..488b19917 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2062,7 +2062,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
- dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 426008722..01b4802e0 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1022,11 +1022,9 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
}
static void
-vmxnet3_dev_info_get(struct rte_eth_dev *dev,
+vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused,
struct rte_eth_dev_info *dev_info)
{
- dev_info->pci_dev = RTE_ETH_DEV_TO_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;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 90dfbb739..d519a50db 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
{
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
int n;
int ret;
@@ -46,15 +48,17 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
rte_version());
/* TODO: replace bus_info by rte_devargs.name */
- if (dev_info.pci_dev)
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
"%04x:%02x:%02x.%x",
- dev_info.pci_dev->addr.domain,
- dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
- else
+ pci_dev->addr.domain, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
+ } else {
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
+ }
memset(®_info, 0, sizeof(reg_info));
rte_eth_dev_get_reg_info(port_id, ®_info);
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index bb07efa13..87e998828 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -1266,6 +1266,8 @@ app_init_kni(struct app_params *app) {
struct rte_eth_dev_info dev_info;
struct app_mempool_params *mempool_params;
struct rte_mempool *mempool;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
struct rte_kni_conf conf;
struct rte_kni_ops ops;
@@ -1297,8 +1299,13 @@ app_init_kni(struct app_params *app) {
}
conf.group_id = p_link->pmd_id;
conf.mbuf_size = mempool_params->buffer_size;
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
memset(&ops, 0, sizeof(ops));
ops.port_id = (uint8_t) p_link->pmd_id;
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 0d9980ee1..aebfedd59 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -834,13 +834,18 @@ kni_alloc(uint16_t port_id)
if (i == 0) {
struct rte_kni_ops ops;
struct rte_eth_dev_info dev_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
- if (dev_info.pci_dev) {
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
}
/* Get the interface default mac address */
rte_eth_macaddr_get(port_id,
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 209796d46..68bdc3103 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2421,6 +2421,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
dev_info->rx_desc_lim = lim;
dev_info->tx_desc_lim = lim;
+ dev_info->device = dev->device;
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 5c8af16f5..cf9105bae 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1011,7 +1011,7 @@ struct rte_eth_dev_portconf {
* Ethernet device information
*/
struct rte_eth_dev_info {
- struct rte_pci_device *pci_dev; /**< Device PCI information. */
+ struct rte_device *device; /** Generic device information */
const char *driver_name; /**< Device Driver name. */
unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */
diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index e4839cdb7..3d1be56a9 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -357,6 +357,8 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
if (!mp)
return -1;
@@ -366,8 +368,13 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
/* core id 1 configured for kernel thread */
@@ -465,6 +472,8 @@ test_kni(void)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
/* Initialize KNI subsytem */
rte_kni_init(KNI_TEST_MAX_PORTS);
@@ -523,8 +532,15 @@ test_kni(void)
memset(&conf, 0, sizeof(conf));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
@@ -552,8 +568,15 @@ test_kni(void)
memset(&info, 0, sizeof(info));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
--
2.14.3
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-03-30 15:17 ` [dpdk-dev] [PATCH v4] " Ferruh Yigit
@ 2018-03-30 15:29 ` David Marchand
2018-04-02 9:40 ` David Marchand
2018-04-02 16:13 ` santosh
2018-04-05 16:40 ` [dpdk-dev] [PATCH v5] " Ferruh Yigit
1 sibling, 2 replies; 22+ messages in thread
From: David Marchand @ 2018-03-30 15:29 UTC (permalink / raw)
To: Ferruh Yigit
Cc: dev, Shreyansh Jain, Allain Legacy, Tomasz Duszynski, Santosh Shukla
On Fri, Mar 30, 2018 at 5:17 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
> although it is common for all ethdev in all buses.
>
> Replacing pci specific struct with generic device struct and updating
> places that are using pci device in a way to get this information from
> generic device.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
[snip]
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 209796d46..68bdc3103 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -2421,6 +2421,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
> memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
> dev_info->rx_desc_lim = lim;
> dev_info->tx_desc_lim = lim;
> + dev_info->device = dev->device;
>
> RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
> (*dev->dev_ops->dev_infos_get)(dev, dev_info);
Reviewed-by: David Marchand <david.marchand@6wind.com>
Just a little comment, do we want the pmd to be able to override this ?
I can see we enforce the driver name by putting it after the call to
.dev_infos_get.
http://dpdk.org/browse/dpdk/tree/lib/librte_ether/rte_ethdev.c#n2399
octeontx pmd seems to try to do something about it:
http://dpdk.org/browse/dpdk/tree/drivers/net/octeontx/octeontx_ethdev.c#n622
Not sure it does something, might be a thing to cleanup.
--
David Marchand
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-03-30 15:29 ` David Marchand
@ 2018-04-02 9:40 ` David Marchand
2018-04-02 16:13 ` santosh
1 sibling, 0 replies; 22+ messages in thread
From: David Marchand @ 2018-04-02 9:40 UTC (permalink / raw)
To: Ferruh Yigit
Cc: dev, Shreyansh Jain, Allain Legacy, Tomasz Duszynski,
Santosh Shukla, Thomas Monjalon
Hello Ferruh,
On Fri, Mar 30, 2018 at 5:29 PM, David Marchand
<david.marchand@6wind.com> wrote:
> On Fri, Mar 30, 2018 at 5:17 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index 209796d46..68bdc3103 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -2421,6 +2421,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
>> memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
>> dev_info->rx_desc_lim = lim;
>> dev_info->tx_desc_lim = lim;
>> + dev_info->device = dev->device;
>>
>> RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
>> (*dev->dev_ops->dev_infos_get)(dev, dev_info);
>
> Just a little comment, do we want the pmd to be able to override this ?
I still don't see when the pmd would need to override the dev_info->device.
The pmd is the one that populated dev->device in the first place.
Why would it want to report something different in dev_infos ?
Some comments from pmd maintainers, maybe ?
--
David Marchand
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-03-30 15:29 ` David Marchand
2018-04-02 9:40 ` David Marchand
@ 2018-04-02 16:13 ` santosh
2018-04-03 9:06 ` David Marchand
1 sibling, 1 reply; 22+ messages in thread
From: santosh @ 2018-04-02 16:13 UTC (permalink / raw)
To: David Marchand, Ferruh Yigit
Cc: dev, Shreyansh Jain, Allain Legacy, Tomasz Duszynski
Hello David,
On Friday 30 March 2018 08:59 PM, David Marchand wrote:
> On Fri, Mar 30, 2018 at 5:17 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
>> although it is common for all ethdev in all buses.
>>
>> Replacing pci specific struct with generic device struct and updating
>> places that are using pci device in a way to get this information from
>> generic device.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> [snip]
>
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index 209796d46..68bdc3103 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -2421,6 +2421,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
>> memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
>> dev_info->rx_desc_lim = lim;
>> dev_info->tx_desc_lim = lim;
>> + dev_info->device = dev->device;
>>
>> RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
>> (*dev->dev_ops->dev_infos_get)(dev, dev_info);
> Reviewed-by: David Marchand <david.marchand@6wind.com>
>
> Just a little comment, do we want the pmd to be able to override this ?
>
> I can see we enforce the driver name by putting it after the call to
> .dev_infos_get.
> http://dpdk.org/browse/dpdk/tree/lib/librte_ether/rte_ethdev.c#n2399
>
> octeontx pmd seems to try to do something about it:
> http://dpdk.org/browse/dpdk/tree/drivers/net/octeontx/octeontx_ethdev.c#n622
>
> Not sure it does something, might be a thing to cleanup.
>
>
In case, if your referring to driver_name update then
indeed its a cleanup [1].
Otherwise, I don't see any issue with v4 Or
may be /I /misunderstood your comment.
Thanks.
[1] http://dpdk.org/dev/patchwork/patch/36880/
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-04-02 16:13 ` santosh
@ 2018-04-03 9:06 ` David Marchand
2018-04-03 9:50 ` Ferruh Yigit
0 siblings, 1 reply; 22+ messages in thread
From: David Marchand @ 2018-04-03 9:06 UTC (permalink / raw)
To: santosh
Cc: Ferruh Yigit, dev, Shreyansh Jain, Allain Legacy,
Tomasz Duszynski, Thomas Monjalon
On Mon, Apr 2, 2018 at 6:13 PM, santosh
<santosh.shukla@caviumnetworks.com> wrote:
> On Friday 30 March 2018 08:59 PM, David Marchand wrote:
>> I can see we enforce the driver name by putting it after the call to
>> .dev_infos_get.
>> http://dpdk.org/browse/dpdk/tree/lib/librte_ether/rte_ethdev.c#n2399
>>
>> octeontx pmd seems to try to do something about it:
>> http://dpdk.org/browse/dpdk/tree/drivers/net/octeontx/octeontx_ethdev.c#n622
>>
>> Not sure it does something, might be a thing to cleanup.
>>
>>
> In case, if your referring to driver_name update then
> indeed its a cleanup [1].
>
> Otherwise, I don't see any issue with v4 Or
> may be /I /misunderstood your comment.
I agree there is no fundamental issue.
dev_info->device = dev->device;
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->driver_name = dev->device->driver->name;
If somebody (I mean some pmd out there) has a usecase with
dev_info->device != dev->device, why not.
Thomas ?
--
David Marchand
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-04-03 9:06 ` David Marchand
@ 2018-04-03 9:50 ` Ferruh Yigit
2018-04-04 17:57 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2018-04-03 9:50 UTC (permalink / raw)
To: David Marchand, santosh
Cc: dev, Shreyansh Jain, Allain Legacy, Tomasz Duszynski, Thomas Monjalon
On 4/3/2018 10:06 AM, David Marchand wrote:
> On Mon, Apr 2, 2018 at 6:13 PM, santosh
> <santosh.shukla@caviumnetworks.com> wrote:
>> On Friday 30 March 2018 08:59 PM, David Marchand wrote:
>>> I can see we enforce the driver name by putting it after the call to
>>> .dev_infos_get.
>>> http://dpdk.org/browse/dpdk/tree/lib/librte_ether/rte_ethdev.c#n2399
>>>
>>> octeontx pmd seems to try to do something about it:
>>> http://dpdk.org/browse/dpdk/tree/drivers/net/octeontx/octeontx_ethdev.c#n622
>>>
>>> Not sure it does something, might be a thing to cleanup.
>>>
>>>
>> In case, if your referring to driver_name update then
>> indeed its a cleanup [1].
>>
>> Otherwise, I don't see any issue with v4 Or
>> may be /I /misunderstood your comment.
>
> I agree there is no fundamental issue.
>
> dev_info->device = dev->device;
>
> RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
> (*dev->dev_ops->dev_infos_get)(dev, dev_info);
> dev_info->driver_name = dev->device->driver->name;
>
> If somebody (I mean some pmd out there) has a usecase with
> dev_info->device != dev->device, why not.
Intentional let drivers update this variable although I don't also see any use
case of it.
This variable was set by PMDs before this patch, so I don't see any reason to be
so strict here.
If driver does anything ethdev will set dev_info->device for it, if it want to
overwrite, for any reason, it will have the capability.
>
> Thomas ?
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-04-03 9:50 ` Ferruh Yigit
@ 2018-04-04 17:57 ` De Lara Guarch, Pablo
2018-04-05 9:19 ` Ferruh Yigit
0 siblings, 1 reply; 22+ messages in thread
From: De Lara Guarch, Pablo @ 2018-04-04 17:57 UTC (permalink / raw)
To: Yigit, Ferruh, David Marchand, santosh
Cc: dev, Shreyansh Jain, Legacy, Allain (Wind River),
Tomasz Duszynski, Thomas Monjalon
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Tuesday, April 3, 2018 10:50 AM
> To: David Marchand <david.marchand@6wind.com>; santosh
> <santosh.shukla@caviumnetworks.com>
> Cc: dev@dpdk.org; Shreyansh Jain <shreyansh.jain@nxp.com>; Legacy, Allain
> (Wind River) <allain.legacy@windriver.com>; Tomasz Duszynski
> <tdu@semihalf.com>; Thomas Monjalon <thomas@monjalon.net>
> Subject: Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with
> generic dev
>
> On 4/3/2018 10:06 AM, David Marchand wrote:
> > On Mon, Apr 2, 2018 at 6:13 PM, santosh
> > <santosh.shukla@caviumnetworks.com> wrote:
> >> On Friday 30 March 2018 08:59 PM, David Marchand wrote:
> >>> I can see we enforce the driver name by putting it after the call to
> >>> .dev_infos_get.
> >>> http://dpdk.org/browse/dpdk/tree/lib/librte_ether/rte_ethdev.c#n2399
> >>>
> >>> octeontx pmd seems to try to do something about it:
> >>> http://dpdk.org/browse/dpdk/tree/drivers/net/octeontx/octeontx_ethde
> >>> v.c#n622
> >>>
> >>> Not sure it does something, might be a thing to cleanup.
> >>>
> >>>
> >> In case, if your referring to driver_name update then indeed its a
> >> cleanup [1].
> >>
> >> Otherwise, I don't see any issue with v4 Or may be /I /misunderstood
> >> your comment.
> >
> > I agree there is no fundamental issue.
> >
> > dev_info->device = dev->device;
> >
> > RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
> > (*dev->dev_ops->dev_infos_get)(dev, dev_info);
> > dev_info->driver_name = dev->device->driver->name;
> >
> > If somebody (I mean some pmd out there) has a usecase with
> > dev_info->device != dev->device, why not.
>
> Intentional let drivers update this variable although I don't also see any use case
> of it.
>
> This variable was set by PMDs before this patch, so I don't see any reason to be
> so strict here.
>
> If driver does anything ethdev will set dev_info->device for it, if it want to
> overwrite, for any reason, it will have the capability.
Looks good to me. Will do the same for cryptodev and bbdev.
The only thing that I am missing here is an update in documentation,
adding the ABI Change in release notes.
Apart from it:
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> >
> > Thomas ?
> >
> >
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with generic dev
2018-04-04 17:57 ` De Lara Guarch, Pablo
@ 2018-04-05 9:19 ` Ferruh Yigit
0 siblings, 0 replies; 22+ messages in thread
From: Ferruh Yigit @ 2018-04-05 9:19 UTC (permalink / raw)
To: De Lara Guarch, Pablo, David Marchand, santosh
Cc: dev, Shreyansh Jain, Legacy, Allain (Wind River),
Tomasz Duszynski, Thomas Monjalon
On 4/4/2018 6:57 PM, De Lara Guarch, Pablo wrote:
>
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
>> Sent: Tuesday, April 3, 2018 10:50 AM
>> To: David Marchand <david.marchand@6wind.com>; santosh
>> <santosh.shukla@caviumnetworks.com>
>> Cc: dev@dpdk.org; Shreyansh Jain <shreyansh.jain@nxp.com>; Legacy, Allain
>> (Wind River) <allain.legacy@windriver.com>; Tomasz Duszynski
>> <tdu@semihalf.com>; Thomas Monjalon <thomas@monjalon.net>
>> Subject: Re: [dpdk-dev] [PATCH v4] ethdev: replace bus specific struct with
>> generic dev
>>
>> On 4/3/2018 10:06 AM, David Marchand wrote:
>>> On Mon, Apr 2, 2018 at 6:13 PM, santosh
>>> <santosh.shukla@caviumnetworks.com> wrote:
>>>> On Friday 30 March 2018 08:59 PM, David Marchand wrote:
>>>>> I can see we enforce the driver name by putting it after the call to
>>>>> .dev_infos_get.
>>>>> http://dpdk.org/browse/dpdk/tree/lib/librte_ether/rte_ethdev.c#n2399
>>>>>
>>>>> octeontx pmd seems to try to do something about it:
>>>>> http://dpdk.org/browse/dpdk/tree/drivers/net/octeontx/octeontx_ethde
>>>>> v.c#n622
>>>>>
>>>>> Not sure it does something, might be a thing to cleanup.
>>>>>
>>>>>
>>>> In case, if your referring to driver_name update then indeed its a
>>>> cleanup [1].
>>>>
>>>> Otherwise, I don't see any issue with v4 Or may be /I /misunderstood
>>>> your comment.
>>>
>>> I agree there is no fundamental issue.
>>>
>>> dev_info->device = dev->device;
>>>
>>> RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
>>> (*dev->dev_ops->dev_infos_get)(dev, dev_info);
>>> dev_info->driver_name = dev->device->driver->name;
>>>
>>> If somebody (I mean some pmd out there) has a usecase with
>>> dev_info->device != dev->device, why not.
>>
>> Intentional let drivers update this variable although I don't also see any use case
>> of it.
>>
>> This variable was set by PMDs before this patch, so I don't see any reason to be
>> so strict here.
>>
>> If driver does anything ethdev will set dev_info->device for it, if it want to
>> overwrite, for any reason, it will have the capability.
>
> Looks good to me. Will do the same for cryptodev and bbdev.
> The only thing that I am missing here is an update in documentation,
> adding the ABI Change in release notes.
Right, I forget about it, will send a new version.
Thanks,
ferruh
>
> Apart from it:
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
>>
>>>
>>> Thomas ?
>>>
>>>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v5] ethdev: replace bus specific struct with generic dev
2018-03-30 15:17 ` [dpdk-dev] [PATCH v4] " Ferruh Yigit
2018-03-30 15:29 ` David Marchand
@ 2018-04-05 16:40 ` Ferruh Yigit
2018-04-09 12:09 ` [dpdk-dev] [PATCH v6] " Ferruh Yigit
1 sibling, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2018-04-05 16:40 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Ferruh Yigit, Shreyansh Jain, Allain Legacy,
Tomasz Duszynski, Santosh Shukla, David Marchand
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.
Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
Cc: Shreyansh Jain <shreyansh.jain@nxp.com>
Cc: Allain Legacy <allain.legacy@windriver.com>
Cc: Tomasz Duszynski <tdu@semihalf.com>
Cc: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Cc: David Marchand <david.marchand@6wind.com>
v2:
- prevent possible crash while getting bus (Pablo)
- Remove unnecessary __rte_unused
- Some PMD info_dev->device was assigned to NULL, fixed them
v3:
- rebased on latest next-net
v4:
- Move dev_info->device assignment to ethdev layer
v5:
- Document API change in related section in release notes
---
app/test-pmd/config.c | 18 +++++++++++++++-
app/test-pmd/testpmd.h | 38 +++++++++++++++++++++++++++------
doc/guides/rel_notes/release_18_05.rst | 3 +++
drivers/net/ark/ark_ethdev.c | 1 -
drivers/net/avf/avf_ethdev.c | 1 -
drivers/net/avp/avp_ethdev.c | 1 -
drivers/net/bnx2x/bnx2x_ethdev.c | 1 -
drivers/net/bnxt/bnxt_ethdev.c | 2 --
drivers/net/cxgbe/cxgbe_ethdev.c | 2 --
drivers/net/e1000/em_ethdev.c | 1 -
drivers/net/e1000/igb_ethdev.c | 2 --
drivers/net/ena/ena_ethdev.c | 2 --
drivers/net/enic/enic_ethdev.c | 1 -
drivers/net/fm10k/fm10k_ethdev.c | 1 -
drivers/net/i40e/i40e_ethdev.c | 1 -
drivers/net/i40e/i40e_ethdev_vf.c | 1 -
drivers/net/ixgbe/ixgbe_ethdev.c | 2 --
drivers/net/kni/rte_eth_kni.c | 1 -
drivers/net/liquidio/lio_ethdev.c | 2 --
drivers/net/mlx4/mlx4_ethdev.c | 1 -
drivers/net/mlx5/mlx5_ethdev.c | 1 -
drivers/net/nfp/nfp_net.c | 1 -
drivers/net/octeontx/octeontx_ethdev.c | 1 -
drivers/net/qede/qede_ethdev.c | 1 -
drivers/net/sfc/sfc_ethdev.c | 1 -
drivers/net/szedata2/rte_eth_szedata2.c | 1 -
drivers/net/tap/rte_eth_tap.c | 1 -
drivers/net/thunderx/nicvf_ethdev.c | 2 --
drivers/net/virtio/virtio_ethdev.c | 1 -
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +---
examples/ethtool/lib/rte_ethtool.c | 16 ++++++++------
examples/ip_pipeline/init.c | 11 ++++++++--
examples/kni/main.c | 11 +++++++---
lib/librte_ether/rte_ethdev.c | 1 +
lib/librte_ether/rte_ethdev.h | 2 +-
test/test/test_kni.c | 35 ++++++++++++++++++++++++------
36 files changed, 111 insertions(+), 61 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 4bb255c62..dd051f5ca 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -754,6 +754,8 @@ vlan_id_is_invalid(uint16_t vlan_id)
static int
port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
uint64_t pci_len;
if (reg_off & 0x3) {
@@ -762,7 +764,21 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
(unsigned)reg_off);
return 1;
}
- pci_len = ports[port_id].dev_info.pci_dev->mem_resource[0].len;
+
+ if (!ports[port_id].dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 1;
+ }
+
+ pci_len = pci_dev->mem_resource[0].len;
if (reg_off >= pci_len) {
printf("Port %d: register offset %u (0x%X) out of port PCI "
"resource (length=%"PRIu64")\n",
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 153abea05..4d84e7b00 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -500,12 +500,25 @@ mbuf_pool_find(unsigned int sock_id)
static inline uint32_t
port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
uint32_t reg_v;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 0;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
reg_v = *((volatile uint32_t *)reg_addr);
return rte_le_to_cpu_32(reg_v);
}
@@ -516,11 +529,24 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
static inline void
port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
}
diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst
index e5fac1cd1..ffa5cae39 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -72,6 +72,9 @@ API Changes
Also, make sure to start the actual text at the margin.
=========================================================
+* ethdev, in struct ``struct rte_eth_dev_info``, field ``rte_pci_device *pci_dev``
+ replaced with field ``struct rte_device *device``.
+
ABI Changes
-----------
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ff87c20e2..c9d541921 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -771,7 +771,6 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
}
static int
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index b59e3cf79..8e2a1b066 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -507,7 +507,6 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
memset(dev_info, 0, sizeof(*dev_info));
- dev_info->pci_dev = RTE_ETH_DEV_TO_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 = AVF_BUF_SIZE_MIN;
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index a07a288ed..5b3c4cebf 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -2172,7 +2172,6 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
dev_info->max_rx_queues = avp->max_rx_queues;
dev_info->max_tx_queues = avp->max_tx_queues;
dev_info->min_rx_bufsize = AVP_MIN_RX_BUFSIZE;
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 483d5a17c..8726b357a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -447,7 +447,6 @@ static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct bnx2x_softc *sc = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7c007c8f9..c447cd727 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -379,8 +379,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
/* MAC Specifics */
dev_info->max_mac_addrs = bp->max_l2_ctx;
dev_info->max_hash_mac_addrs = 0;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index feae01d6a..50e1fcece 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -121,8 +121,6 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
.nb_align = 1,
};
- device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_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;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 087c192d5..c6062468c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1070,7 +1070,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */
dev_info->max_rx_pktlen = em_get_max_pktlen(dev);
dev_info->max_mac_addrs = hw->mac.rar_entry_count;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 8d4226676..872357146 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2144,7 +2144,6 @@ 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 = RTE_ETH_DEV_TO_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;
@@ -2269,7 +2268,6 @@ 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 = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 34b2a8d78..a15436c99 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1527,8 +1527,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
-
dev_info->speed_capa =
ETH_LINK_SPEED_1G |
ETH_LINK_SPEED_2_5G |
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 03f0c2547..801f4704c 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -471,7 +471,6 @@ 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 = RTE_ETH_DEV_TO_PCI(eth_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;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 61de4d772..34affd1cc 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1404,7 +1404,6 @@ 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;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6e06f8a2b..6a8a2cd2a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3212,7 +3212,6 @@ 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 = RTE_ETH_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;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 2908c87e0..f6d7f40b1 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2183,7 +2183,6 @@ 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 = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fbc048f7d..bd1773978 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3593,7 +3593,6 @@ 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) {
@@ -3712,7 +3711,6 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_pci_device *pci_dev = RTE_ETH_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 */
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index dc4e65f5d..c10e970c2 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -201,7 +201,6 @@ eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused,
dev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
}
static int
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index eeb8350e4..a13a566f9 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -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:
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 5f731e023..636100b23 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -556,7 +556,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index cc85f76c0..44cdbb622 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -405,7 +405,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8591c7de0..d922b0259 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1159,7 +1159,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 4d7d1d7f4..1148652ea 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -617,7 +617,6 @@ octeontx_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = PKO_MAX_NUM_DQ;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = 0,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a4e9e753e..13c2a3b87 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1549,7 +1549,6 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
PMD_INIT_FUNC_TRACE(edev);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE;
dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
dev_info->rx_desc_lim = qede_rx_desc_lim;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 2af898e08..6631c5a7e 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -89,7 +89,6 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
sfc_log_init(sa, "entry");
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
/* Autonegotiation may be disabled */
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 1d02aee6f..58c177398 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1031,7 +1031,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
dev_info->if_index = 0;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index ed6d7380e..6a39398b8 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -737,7 +737,6 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
dev_info->speed_capa = tap_dev_speed_capa();
dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() |
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 067f2243b..75e9d16c5 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1400,8 +1400,6 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-
/* Autonegotiation may be disabled */
dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
dev_info->speed_capa |= ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M |
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 11f758929..d7c81747e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2064,7 +2064,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
- dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 426008722..01b4802e0 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1022,11 +1022,9 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
}
static void
-vmxnet3_dev_info_get(struct rte_eth_dev *dev,
+vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused,
struct rte_eth_dev_info *dev_info)
{
- dev_info->pci_dev = RTE_ETH_DEV_TO_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;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 90dfbb739..d519a50db 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
{
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
int n;
int ret;
@@ -46,15 +48,17 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
rte_version());
/* TODO: replace bus_info by rte_devargs.name */
- if (dev_info.pci_dev)
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
"%04x:%02x:%02x.%x",
- dev_info.pci_dev->addr.domain,
- dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
- else
+ pci_dev->addr.domain, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
+ } else {
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
+ }
memset(®_info, 0, sizeof(reg_info));
rte_eth_dev_get_reg_info(port_id, ®_info);
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index bb07efa13..87e998828 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -1266,6 +1266,8 @@ app_init_kni(struct app_params *app) {
struct rte_eth_dev_info dev_info;
struct app_mempool_params *mempool_params;
struct rte_mempool *mempool;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
struct rte_kni_conf conf;
struct rte_kni_ops ops;
@@ -1297,8 +1299,13 @@ app_init_kni(struct app_params *app) {
}
conf.group_id = p_link->pmd_id;
conf.mbuf_size = mempool_params->buffer_size;
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
memset(&ops, 0, sizeof(ops));
ops.port_id = (uint8_t) p_link->pmd_id;
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 0d9980ee1..aebfedd59 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -834,13 +834,18 @@ kni_alloc(uint16_t port_id)
if (i == 0) {
struct rte_kni_ops ops;
struct rte_eth_dev_info dev_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
- if (dev_info.pci_dev) {
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
}
/* Get the interface default mac address */
rte_eth_macaddr_get(port_id,
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 2c74f7e04..90c47ad12 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2395,6 +2395,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
dev_info->rx_desc_lim = lim;
dev_info->tx_desc_lim = lim;
+ dev_info->device = dev->device;
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 5e13dca6a..784c6faa4 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -992,7 +992,7 @@ struct rte_pci_device;
* Ethernet device information
*/
struct rte_eth_dev_info {
- struct rte_pci_device *pci_dev; /**< Device PCI information. */
+ struct rte_device *device; /** Generic device information */
const char *driver_name; /**< Device Driver name. */
unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */
diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index e4839cdb7..3d1be56a9 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -357,6 +357,8 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
if (!mp)
return -1;
@@ -366,8 +368,13 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
/* core id 1 configured for kernel thread */
@@ -465,6 +472,8 @@ test_kni(void)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
/* Initialize KNI subsytem */
rte_kni_init(KNI_TEST_MAX_PORTS);
@@ -523,8 +532,15 @@ test_kni(void)
memset(&conf, 0, sizeof(conf));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
@@ -552,8 +568,15 @@ test_kni(void)
memset(&info, 0, sizeof(info));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
--
2.14.3
^ permalink raw reply [flat|nested] 22+ messages in thread
* [dpdk-dev] [PATCH v6] ethdev: replace bus specific struct with generic dev
2018-04-05 16:40 ` [dpdk-dev] [PATCH v5] " Ferruh Yigit
@ 2018-04-09 12:09 ` Ferruh Yigit
2018-04-10 13:34 ` Thomas Monjalon
0 siblings, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2018-04-09 12:09 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Ferruh Yigit, Shreyansh Jain, Allain Legacy,
Tomasz Duszynski, Santosh Shukla, David Marchand
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.
Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
Cc: Shreyansh Jain <shreyansh.jain@nxp.com>
Cc: Allain Legacy <allain.legacy@windriver.com>
Cc: Tomasz Duszynski <tdu@semihalf.com>
Cc: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Cc: David Marchand <david.marchand@6wind.com>
v2:
- prevent possible crash while getting bus (Pablo)
- Remove unnecessary __rte_unused
- Some PMD info_dev->device was assigned to NULL, fixed them
v3:
- rebased on latest next-net
v4:
- Move dev_info->device assignment to ethdev layer
v5:
- Document API change in related section in release notes
v6:
- Rebase on latest next-net, ip_pipeline updated
- Update axgbe too
---
app/test-pmd/config.c | 18 +++++++++++++++-
app/test-pmd/testpmd.h | 38 +++++++++++++++++++++++++++------
doc/guides/rel_notes/release_18_05.rst | 3 +++
drivers/net/ark/ark_ethdev.c | 1 -
drivers/net/avf/avf_ethdev.c | 1 -
drivers/net/avp/avp_ethdev.c | 1 -
drivers/net/axgbe/axgbe_ethdev.c | 4 +---
drivers/net/bnx2x/bnx2x_ethdev.c | 1 -
drivers/net/bnxt/bnxt_ethdev.c | 2 --
drivers/net/cxgbe/cxgbe_ethdev.c | 2 --
drivers/net/e1000/em_ethdev.c | 1 -
drivers/net/e1000/igb_ethdev.c | 2 --
drivers/net/ena/ena_ethdev.c | 2 --
drivers/net/enic/enic_ethdev.c | 1 -
drivers/net/fm10k/fm10k_ethdev.c | 1 -
drivers/net/i40e/i40e_ethdev.c | 1 -
drivers/net/i40e/i40e_ethdev_vf.c | 1 -
drivers/net/ixgbe/ixgbe_ethdev.c | 2 --
drivers/net/kni/rte_eth_kni.c | 1 -
drivers/net/liquidio/lio_ethdev.c | 2 --
drivers/net/mlx4/mlx4_ethdev.c | 1 -
drivers/net/mlx5/mlx5_ethdev.c | 1 -
drivers/net/nfp/nfp_net.c | 1 -
drivers/net/octeontx/octeontx_ethdev.c | 1 -
drivers/net/qede/qede_ethdev.c | 1 -
drivers/net/sfc/sfc_ethdev.c | 1 -
drivers/net/szedata2/rte_eth_szedata2.c | 1 -
drivers/net/tap/rte_eth_tap.c | 1 -
drivers/net/thunderx/nicvf_ethdev.c | 2 --
drivers/net/virtio/virtio_ethdev.c | 1 -
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +---
examples/ethtool/lib/rte_ethtool.c | 16 ++++++++------
examples/ip_pipeline/kni.c | 11 ++++++++--
examples/kni/main.c | 11 +++++++---
lib/librte_ether/rte_ethdev.c | 1 +
lib/librte_ether/rte_ethdev.h | 2 +-
test/test/test_kni.c | 35 ++++++++++++++++++++++++------
37 files changed, 112 insertions(+), 64 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 4bb255c62..dd051f5ca 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -754,6 +754,8 @@ vlan_id_is_invalid(uint16_t vlan_id)
static int
port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
uint64_t pci_len;
if (reg_off & 0x3) {
@@ -762,7 +764,21 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
(unsigned)reg_off);
return 1;
}
- pci_len = ports[port_id].dev_info.pci_dev->mem_resource[0].len;
+
+ if (!ports[port_id].dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 1;
+ }
+
+ pci_len = pci_dev->mem_resource[0].len;
if (reg_off >= pci_len) {
printf("Port %d: register offset %u (0x%X) out of port PCI "
"resource (length=%"PRIu64")\n",
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 153abea05..4d84e7b00 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -500,12 +500,25 @@ mbuf_pool_find(unsigned int sock_id)
static inline uint32_t
port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
uint32_t reg_v;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return 0;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return 0;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
reg_v = *((volatile uint32_t *)reg_addr);
return rte_le_to_cpu_32(reg_v);
}
@@ -516,11 +529,24 @@ port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
static inline void
port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
{
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
void *reg_addr;
- reg_addr = (void *)
- ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
- reg_off);
+ if (!port->dev_info.device) {
+ printf("Invalid device\n");
+ return;
+ }
+
+ bus = rte_bus_find_by_device(port->dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(port->dev_info.device);
+ } else {
+ printf("Not a PCI device\n");
+ return;
+ }
+
+ reg_addr = ((char *)pci_dev->mem_resource[0].addr + reg_off);
*((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
}
diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst
index 0f3d00972..4b6bc9bf5 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -88,6 +88,9 @@ API Changes
memory footprint which helps in better cache utilization when large number
of meter objects are used.
+* ethdev, in struct ``struct rte_eth_dev_info``, field ``rte_pci_device *pci_dev``
+ replaced with field ``struct rte_device *device``.
+
ABI Changes
-----------
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ff87c20e2..c9d541921 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -771,7 +771,6 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_40G |
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
}
static int
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index b59e3cf79..8e2a1b066 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -507,7 +507,6 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
memset(dev_info, 0, sizeof(*dev_info));
- dev_info->pci_dev = RTE_ETH_DEV_TO_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 = AVF_BUF_SIZE_MIN;
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index a07a288ed..5b3c4cebf 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -2172,7 +2172,6 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
dev_info->max_rx_queues = avp->max_rx_queues;
dev_info->max_tx_queues = avp->max_tx_queues;
dev_info->min_rx_bufsize = AVP_MIN_RX_BUFSIZE;
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 07c1337ac..2a68ccbf5 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -349,12 +349,10 @@ axgbe_dev_stats_reset(struct rte_eth_dev *dev)
}
static void
-axgbe_dev_info_get(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info)
+axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct axgbe_port *pdata = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
dev_info->max_rx_queues = pdata->tx_ring_count;
dev_info->max_tx_queues = pdata->rx_ring_count;
dev_info->min_rx_bufsize = AXGBE_RX_MIN_BUF_SIZE;
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 483d5a17c..8726b357a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -447,7 +447,6 @@ static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
struct bnx2x_softc *sc = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7c007c8f9..c447cd727 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -379,8 +379,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
/* MAC Specifics */
dev_info->max_mac_addrs = bp->max_l2_ctx;
dev_info->max_hash_mac_addrs = 0;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 581a1f33a..24c9a9323 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -134,8 +134,6 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
.nb_align = 1,
};
- device_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_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;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 087c192d5..c6062468c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1070,7 +1070,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */
dev_info->max_rx_pktlen = em_get_max_pktlen(dev);
dev_info->max_mac_addrs = hw->mac.rar_entry_count;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 8d4226676..872357146 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2144,7 +2144,6 @@ 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 = RTE_ETH_DEV_TO_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;
@@ -2269,7 +2268,6 @@ 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 = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 34b2a8d78..a15436c99 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1527,8 +1527,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
-
dev_info->speed_capa =
ETH_LINK_SPEED_1G |
ETH_LINK_SPEED_2_5G |
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 03f0c2547..801f4704c 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -471,7 +471,6 @@ 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 = RTE_ETH_DEV_TO_PCI(eth_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;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 61de4d772..34affd1cc 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1404,7 +1404,6 @@ 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;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6e06f8a2b..6a8a2cd2a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3212,7 +3212,6 @@ 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 = RTE_ETH_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;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 2908c87e0..f6d7f40b1 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2183,7 +2183,6 @@ 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 = RTE_ETH_DEV_TO_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;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fbc048f7d..bd1773978 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3593,7 +3593,6 @@ 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) {
@@ -3712,7 +3711,6 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
struct rte_pci_device *pci_dev = RTE_ETH_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 */
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index dc4e65f5d..c10e970c2 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -201,7 +201,6 @@ eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused,
dev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
}
static int
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index eeb8350e4..a13a566f9 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -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:
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 5f731e023..636100b23 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -556,7 +556,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index cc85f76c0..44cdbb622 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -405,7 +405,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
/* FIXME: we should ask the device for these values. */
info->min_rx_bufsize = 32;
info->max_rx_pktlen = 65536;
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 606cd3dc2..e030bbf9f 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1253,7 +1253,6 @@ 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 = RTE_ETH_DEV_TO_PCI(dev);
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 1406e4e19..f829e0ca9 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -616,7 +616,6 @@ octeontx_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = PKO_MAX_NUM_DQ;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = 0,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a4e9e753e..13c2a3b87 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1549,7 +1549,6 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
PMD_INIT_FUNC_TRACE(edev);
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
dev_info->min_rx_bufsize = (uint32_t)QEDE_MIN_RX_BUFF_SIZE;
dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN;
dev_info->rx_desc_lim = qede_rx_desc_lim;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 2af898e08..6631c5a7e 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -89,7 +89,6 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
sfc_log_init(sa, "entry");
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
/* Autonegotiation may be disabled */
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index fb9aac04b..41a6fb427 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1015,7 +1015,6 @@ eth_dev_info(struct rte_eth_dev *dev,
{
struct pmd_internals *internals = dev->data->dev_private;
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
dev_info->if_index = 0;
dev_info->max_mac_addrs = 1;
dev_info->max_rx_pktlen = (uint32_t)-1;
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 61d646558..54c7c2b0f 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -760,7 +760,6 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
dev_info->min_rx_bufsize = 0;
- dev_info->pci_dev = NULL;
dev_info->speed_capa = tap_dev_speed_capa();
dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() |
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 067f2243b..75e9d16c5 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1400,8 +1400,6 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
PMD_INIT_FUNC_TRACE();
- dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-
/* Autonegotiation may be disabled */
dev_info->speed_capa = ETH_LINK_SPEED_FIXED;
dev_info->speed_capa |= ETH_LINK_SPEED_10M | ETH_LINK_SPEED_100M |
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 11f758929..d7c81747e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2064,7 +2064,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
- dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 426008722..01b4802e0 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1022,11 +1022,9 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
}
static void
-vmxnet3_dev_info_get(struct rte_eth_dev *dev,
+vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused,
struct rte_eth_dev_info *dev_info)
{
- dev_info->pci_dev = RTE_ETH_DEV_TO_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;
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 90dfbb739..d519a50db 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
{
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
int n;
int ret;
@@ -46,15 +48,17 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
rte_version());
/* TODO: replace bus_info by rte_devargs.name */
- if (dev_info.pci_dev)
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
"%04x:%02x:%02x.%x",
- dev_info.pci_dev->addr.domain,
- dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
- else
+ pci_dev->addr.domain, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
+ } else {
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
+ }
memset(®_info, 0, sizeof(reg_info));
rte_eth_dev_get_reg_info(port_id, ®_info);
diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index ebc8c7904..712775338 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -106,6 +106,8 @@ kni_create(const char *name, struct kni_params *params)
struct mempool *mempool;
struct link *link;
struct rte_kni *k;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
/* Check input params */
if ((name == NULL) ||
@@ -128,8 +130,13 @@ kni_create(const char *name, struct kni_params *params)
kni_conf.core_id = params->thread_id;
kni_conf.group_id = link->port_id;
kni_conf.mbuf_size = mempool->buffer_size;
- kni_conf.addr = dev_info.pci_dev->addr;
- kni_conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ kni_conf.addr = pci_dev->addr;
+ kni_conf.id = pci_dev->id;
+ }
memset(&kni_ops, 0, sizeof(kni_ops));
kni_ops.port_id = link->port_id;
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 0d9980ee1..aebfedd59 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -834,13 +834,18 @@ kni_alloc(uint16_t port_id)
if (i == 0) {
struct rte_kni_ops ops;
struct rte_eth_dev_info dev_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
- if (dev_info.pci_dev) {
- conf.addr = dev_info.pci_dev->addr;
- conf.id = dev_info.pci_dev->id;
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
}
/* Get the interface default mac address */
rte_eth_macaddr_get(port_id,
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 2c74f7e04..90c47ad12 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2395,6 +2395,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
dev_info->rx_desc_lim = lim;
dev_info->tx_desc_lim = lim;
+ dev_info->device = dev->device;
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 5e13dca6a..784c6faa4 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -992,7 +992,7 @@ struct rte_pci_device;
* Ethernet device information
*/
struct rte_eth_dev_info {
- struct rte_pci_device *pci_dev; /**< Device PCI information. */
+ struct rte_device *device; /** Generic device information */
const char *driver_name; /**< Device Driver name. */
unsigned int if_index; /**< Index to bound host interface, or 0 if none.
Use if_indextoname() to translate into an interface name. */
diff --git a/test/test/test_kni.c b/test/test/test_kni.c
index e4839cdb7..3d1be56a9 100644
--- a/test/test/test_kni.c
+++ b/test/test/test_kni.c
@@ -357,6 +357,8 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
if (!mp)
return -1;
@@ -366,8 +368,13 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
/* core id 1 configured for kernel thread */
@@ -465,6 +472,8 @@ test_kni(void)
struct rte_kni_conf conf;
struct rte_eth_dev_info info;
struct rte_kni_ops ops;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus;
/* Initialize KNI subsytem */
rte_kni_init(KNI_TEST_MAX_PORTS);
@@ -523,8 +532,15 @@ test_kni(void)
memset(&conf, 0, sizeof(conf));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
@@ -552,8 +568,15 @@ test_kni(void)
memset(&info, 0, sizeof(info));
memset(&ops, 0, sizeof(ops));
rte_eth_dev_info_get(port_id, &info);
- conf.addr = info.pci_dev->addr;
- conf.id = info.pci_dev->id;
+ if (info.device)
+ bus = rte_bus_find_by_device(info.device);
+ else
+ bus = NULL;
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(info.device);
+ conf.addr = pci_dev->addr;
+ conf.id = pci_dev->id;
+ }
conf.group_id = port_id;
conf.mbuf_size = MAX_PACKET_SZ;
--
2.14.3
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v6] ethdev: replace bus specific struct with generic dev
2018-04-09 12:09 ` [dpdk-dev] [PATCH v6] " Ferruh Yigit
@ 2018-04-10 13:34 ` Thomas Monjalon
2018-04-10 18:19 ` Ferruh Yigit
0 siblings, 1 reply; 22+ messages in thread
From: Thomas Monjalon @ 2018-04-10 13:34 UTC (permalink / raw)
To: Ferruh Yigit
Cc: dev, Shreyansh Jain, Allain Legacy, Tomasz Duszynski,
Santosh Shukla, David Marchand
09/04/2018 14:09, Ferruh Yigit:
> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
> although it is common for all ethdev in all buses.
>
> Replacing pci specific struct with generic device struct and updating
> places that are using pci device in a way to get this information from
> generic device.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Reviewed-by: David Marchand <david.marchand@6wind.com>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Good progress, thanks!
Acked-by: Thomas Monjalon <thomas@monjalon.net>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [dpdk-dev] [PATCH v6] ethdev: replace bus specific struct with generic dev
2018-04-10 13:34 ` Thomas Monjalon
@ 2018-04-10 18:19 ` Ferruh Yigit
0 siblings, 0 replies; 22+ messages in thread
From: Ferruh Yigit @ 2018-04-10 18:19 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Shreyansh Jain, Allain Legacy, Tomasz Duszynski,
Santosh Shukla, David Marchand
On 4/10/2018 2:34 PM, Thomas Monjalon wrote:
> 09/04/2018 14:09, Ferruh Yigit:
>> Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
>> although it is common for all ethdev in all buses.
>>
>> Replacing pci specific struct with generic device struct and updating
>> places that are using pci device in a way to get this information from
>> generic device.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> Reviewed-by: David Marchand <david.marchand@6wind.com>
>> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> Good progress, thanks!
>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2018-04-10 18:19 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 17:40 [dpdk-dev] [PATCH] ethdev: replace bus specific struct with generic dev Ferruh Yigit
2018-03-28 7:04 ` Shreyansh Jain
2018-03-28 13:11 ` Legacy, Allain
2018-03-29 6:17 ` Tomasz Duszynski
2018-03-29 9:20 ` Ferruh Yigit
2018-03-29 8:01 ` santosh
2018-03-29 14:50 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2018-03-29 17:52 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2018-03-30 6:44 ` David Marchand
2018-03-30 10:27 ` Ferruh Yigit
2018-03-30 15:17 ` [dpdk-dev] [PATCH v4] " Ferruh Yigit
2018-03-30 15:29 ` David Marchand
2018-04-02 9:40 ` David Marchand
2018-04-02 16:13 ` santosh
2018-04-03 9:06 ` David Marchand
2018-04-03 9:50 ` Ferruh Yigit
2018-04-04 17:57 ` De Lara Guarch, Pablo
2018-04-05 9:19 ` Ferruh Yigit
2018-04-05 16:40 ` [dpdk-dev] [PATCH v5] " Ferruh Yigit
2018-04-09 12:09 ` [dpdk-dev] [PATCH v6] " Ferruh Yigit
2018-04-10 13:34 ` Thomas Monjalon
2018-04-10 18:19 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).