* [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver
@ 2016-01-29 14:08 David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 1/9] pci: no need for dynamic tailq init David Marchand
` (11 more replies)
0 siblings, 12 replies; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
Following discussions with Jan [1] and some cleanup I started on pci code,
here is a patchset that reworks pdev drivers registration and hotplug api.
The structures changes mentioned in [1] are still to be done, but at least,
I think we are one step closer to it.
Before this patchset, rte_driver .init semantics differed whether it
concerned a pdev or a vdev driver:
- for vdev, it actually meant that a devargs is given to the driver so
that it creates ethdev / crypto objects, so it was a probing action
- for pdev, it only registered the driver triggering no ethdev / crypto
objects
Patches 1 to 3 convert all existing pdev drivers into pci drivers and move
their registration in constructors.
Patch 4 might be of interest to Chelsio guys, following a regression they
reported [2].
Patches 5 and 6 align pci drivers and vdev drivers init.
Patches 7 to 9 move hotplug where it belongs.
I did not test patch 8 on FreeBSD (did not even compile it, for now).
[1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
[2] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Regards,
--
David Marchand
David Marchand (9):
pci: no need for dynamic tailq init
pci: register all pdev as pci drivers
drivers: no more pdev drivers
eal/linux: move back interrupt thread init before setting affinity
eal: get rid of pmd type
eal: initialize vdevs right next to pci devices
pci: add a helper for device name
pci: add a helper to refresh a device
eal: relocate hotplug code from ethdev
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 +
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +--
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +-
drivers/net/e1000/em_ethdev.c | 17 +-
drivers/net/e1000/igb_ethdev.c | 40 +---
drivers/net/enic/enic_ethdev.c | 23 +-
drivers/net/fm10k/fm10k_ethdev.c | 23 +-
drivers/net/i40e/i40e_ethdev.c | 24 +-
drivers/net/i40e/i40e_ethdev_vf.c | 25 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +---
drivers/net/mlx4/mlx4.c | 19 +-
drivers/net/mlx5/mlx5.c | 19 +-
drivers/net/mpipe/mpipe_tilegx.c | 4 +
drivers/net/nfp/nfp_net.c | 21 +-
drivers/net/null/rte_eth_null.c | 2 +
drivers/net/pcap/rte_eth_pcap.c | 2 +
drivers/net/ring/rte_eth_ring.c | 2 +
drivers/net/szedata2/rte_eth_szedata2.c | 2 +
drivers/net/virtio/virtio_ethdev.c | 26 +--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +
lib/librte_cryptodev/rte_cryptodev.c | 32 ++-
lib/librte_cryptodev/rte_cryptodev.h | 2 +
lib/librte_cryptodev/rte_cryptodev_pmd.h | 18 ++
lib/librte_cryptodev/rte_cryptodev_version.map | 10 +-
lib/librte_eal/bsdapp/eal/eal.c | 7 +
lib/librte_eal/bsdapp/eal/eal_pci.c | 52 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +
lib/librte_eal/common/eal_common_dev.c | 50 +++-
lib/librte_eal/common/eal_common_pci.c | 17 +-
lib/librte_eal/common/eal_private.h | 13 ++
lib/librte_eal/common/include/rte_dev.h | 31 ++-
lib/librte_eal/common/include/rte_pci.h | 28 +++
lib/librte_eal/linuxapp/eal/eal.c | 13 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +
lib/librte_ether/rte_ethdev.c | 296 ++++--------------------
lib/librte_ether/rte_ethdev.h | 15 ++
lib/librte_ether/rte_ether_version.map | 8 +
42 files changed, 465 insertions(+), 561 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 1/9] pci: no need for dynamic tailq init
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-08 10:32 ` viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 2/9] pci: register all pdev as pci drivers David Marchand
` (10 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 6c21fbd..4584522 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -483,9 +483,6 @@ int rte_eal_pci_write_config(const struct rte_pci_device *dev,
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index dcfe947..1e12776 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
{
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bc5b5be..a354f76 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -625,9 +625,6 @@ int rte_eal_pci_write_config(const struct rte_pci_device *device,
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 2/9] pci: register all pdev as pci drivers
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 1/9] pci: no need for dynamic tailq init David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-08 11:03 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers David Marchand
` (9 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
pdev drivers are actually pci drivers.
Wrappers for ethdev and crypto pci drivers, that assume a 1 to 1
association between pci device and upper device, have been added so that
current drivers are not impacted.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 7 +++++--
drivers/net/bnx2x/bnx2x_ethdev.c | 16 ++++++++++------
drivers/net/cxgbe/cxgbe_ethdev.c | 5 +++--
drivers/net/e1000/em_ethdev.c | 4 +++-
drivers/net/e1000/igb_ethdev.c | 14 +++++++++-----
drivers/net/enic/enic_ethdev.c | 5 +++--
drivers/net/fm10k/fm10k_ethdev.c | 4 +++-
drivers/net/i40e/i40e_ethdev.c | 5 +++--
drivers/net/i40e/i40e_ethdev_vf.c | 6 +++---
drivers/net/ixgbe/ixgbe_ethdev.c | 10 ++++++----
drivers/net/nfp/nfp_net.c | 7 ++++---
drivers/net/virtio/virtio_ethdev.c | 4 +++-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 5 +++--
lib/librte_cryptodev/rte_cryptodev.c | 18 ++++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 14 ++++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 10 +++++++++-
lib/librte_ether/rte_ethdev.c | 16 +++++++++-------
lib/librte_ether/rte_ethdev.h | 15 +++++++++++++++
lib/librte_ether/rte_ether_version.map | 8 ++++++++
19 files changed, 123 insertions(+), 50 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index e500c1e..6853aee 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,10 +113,12 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
@@ -126,7 +128,8 @@ static int
rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
+ rte_eal_pci_register(&rte_qat_pmd.pci_drv);
+ return 0;
}
static struct rte_driver pmd_qat_drv = {
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 69df02e..916b9da 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -501,6 +501,8 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
@@ -514,24 +516,26 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
+static int rte_bnx2x_pmd_init(const char *name __rte_unused,
+ const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
+ rte_eal_pci_register(&rte_bnx2x_pmd.pci_drv);
return 0;
}
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
+static int rte_bnx2xvf_pmd_init(const char *name __rte_unused,
+ const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
+ rte_eal_pci_register(&rte_bnx2xvf_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 97ef152..e425ef2 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -851,6 +851,8 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
@@ -865,8 +867,7 @@ static int rte_cxgbe_pmd_init(const char *name __rte_unused,
const char *params __rte_unused)
{
CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
+ rte_eal_pci_register(&rte_cxgbe_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 66e8993..973ec97 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -340,6 +340,8 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
@@ -349,7 +351,7 @@ static struct eth_driver rte_em_pmd = {
static int
rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
- rte_eth_driver_register(&rte_em_pmd);
+ rte_eal_pci_register(&rte_em_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index d1bbcda..a8d94a4 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -961,6 +961,8 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
@@ -975,6 +977,8 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
@@ -984,7 +988,7 @@ static struct eth_driver rte_igbvf_pmd = {
static int
rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
- rte_eth_driver_register(&rte_igb_pmd);
+ rte_eal_pci_register(&rte_igb_pmd.pci_drv);
return 0;
}
@@ -1005,12 +1009,12 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
* Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
*/
static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
+rte_igbvf_pmd_init(const char *name __rte_unused,
+ const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return (0);
+ rte_eal_pci_register(&rte_igbvf_pmd.pci_drv);
+ return 0;
}
static int
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 2a88043..7678c0a 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -625,6 +625,8 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
@@ -639,8 +641,7 @@ rte_enic_pmd_init(const char *name __rte_unused,
const char *params __rte_unused)
{
ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
+ rte_eal_pci_register(&rte_enic_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index e4aed94..75537e0 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2752,6 +2752,8 @@ static struct eth_driver rte_pmd_fm10k = {
.name = "rte_pmd_fm10k",
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
@@ -2768,7 +2770,7 @@ rte_pmd_fm10k_init(__rte_unused const char *name,
__rte_unused const char *params)
{
PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
+ rte_eal_pci_register(&rte_pmd_fm10k.pci_drv);
return 0;
}
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bf6220d..ab24115 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -603,6 +603,8 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
@@ -647,8 +649,7 @@ rte_i40e_pmd_init(const char *name __rte_unused,
const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
+ rte_eal_pci_register(&rte_i40e_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 14d2a50..050d7ea 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1366,6 +1366,8 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
@@ -1382,9 +1384,7 @@ rte_i40evf_pmd_init(const char *name __rte_unused,
const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
+ rte_eal_pci_register(&rte_i40evf_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4c4c6df..970528e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1433,6 +1433,8 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1447,6 +1449,8 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
@@ -1462,8 +1466,7 @@ static int
rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
{
PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
+ rte_eal_pci_register(&rte_ixgbe_pmd.pci_drv);
return 0;
}
@@ -1476,8 +1479,7 @@ static int
rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
+ rte_eal_pci_register(&rte_ixgbevf_pmd.pci_drv);
return (0);
}
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index bc2089f..89ba703 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2463,10 +2463,12 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
@@ -2479,8 +2481,7 @@ nfp_net_pmd_init(const char *name __rte_unused,
PMD_INIT_FUNC_TRACE();
PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
+ rte_eal_pci_register(&rte_nfp_net_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index d928339..08f386a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1439,6 +1439,8 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
@@ -1460,7 +1462,7 @@ rte_virtio_pmd_init(const char *name __rte_unused,
return -1;
}
- rte_eth_driver_register(&rte_virtio_pmd);
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
return 0;
}
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index c363bf6..1a3bc66 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -325,6 +325,8 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
@@ -340,8 +342,7 @@ static int
rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
{
PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
+ rte_eal_pci_register(&rte_vmxnet3_pmd.pci_drv);
return 0;
}
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index f09f67e..1950020 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -313,9 +313,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -375,8 +375,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -418,26 +418,28 @@ rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
return 0;
}
+#ifndef RTE_NEXT_ABI
int
rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
enum pmd_type type)
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
return 0;
}
+#endif
uint16_t
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 8270afa..1c5ee14 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -499,6 +499,7 @@ extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
+#ifndef RTE_NEXT_ABI
/**
* Register a Crypto [Poll Mode] driver.
*
@@ -527,6 +528,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
extern int
rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
enum pmd_type type);
+#endif
/**
* Executes all the user application registered callbacks for the specific
@@ -541,6 +543,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index ff8e93d..3f838a4 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -29,4 +29,12 @@ DPDK_2.2 {
rte_cryptodev_queue_pair_stop;
local: *;
-};
\ No newline at end of file
+};
+
+DPDK_2.3 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+
+} DPDK_2.2;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 756b234..17e4f4d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -239,9 +239,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -293,8 +293,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -334,6 +334,7 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
return 0;
}
+#ifndef RTE_NEXT_ABI
/**
* Register an Ethernet [Poll Mode] driver.
*
@@ -351,10 +352,11 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
+#endif
int
rte_eth_dev_is_valid_port(uint8_t port_id)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8710dd7..af051d1 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1774,6 +1774,7 @@ struct eth_driver {
unsigned int dev_private_size; /**< Size of device private data. */
};
+#ifndef RTE_NEXT_ABI
/**
* @internal
* A function invoked by the initialization function of an Ethernet driver
@@ -1785,6 +1786,7 @@ struct eth_driver {
* the Ethernet driver.
*/
void rte_eth_driver_register(struct eth_driver *eth_drv);
+#endif
/**
* Configure an Ethernet device.
@@ -3880,6 +3882,19 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
uint16_t queue_id, size_t size,
unsigned align, int socket_id);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index d8db24d..07b2d8b 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -117,3 +117,11 @@ DPDK_2.2 {
local: *;
};
+
+DPDK_2.3 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_2.2;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 1/9] pci: no need for dynamic tailq init David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 2/9] pci: register all pdev as pci drivers David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-09 17:05 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity David Marchand
` (8 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
Now that pdev drivers have been converted to pci drivers, there is nothing
left in their init functions that can't go in a constructor.
pdev / vdev drivers init order is changed by this commit, but I can't see
why we would need to preserve it.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 13 +++---------
drivers/net/bnx2x/bnx2x_ethdev.c | 26 +++---------------------
drivers/net/cxgbe/cxgbe_ethdev.c | 19 +++---------------
drivers/net/e1000/em_ethdev.c | 13 +++---------
drivers/net/e1000/igb_ethdev.c | 34 ++++----------------------------
drivers/net/enic/enic_ethdev.c | 18 +++--------------
drivers/net/fm10k/fm10k_ethdev.c | 19 +++---------------
drivers/net/i40e/i40e_ethdev.c | 19 +++---------------
drivers/net/i40e/i40e_ethdev_vf.c | 19 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 36 +++-------------------------------
drivers/net/mlx4/mlx4.c | 19 +++---------------
drivers/net/mlx5/mlx5.c | 19 +++---------------
drivers/net/nfp/nfp_net.c | 14 +++----------
drivers/net/virtio/virtio_ethdev.c | 22 ++++-----------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 18 +++--------------
15 files changed, 47 insertions(+), 261 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 6853aee..ded5d60 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -124,17 +124,10 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_qat_pmd_init(void)
{
PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_qat_pmd.pci_drv);
- return 0;
}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 916b9da..a4b1599 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -523,31 +523,11 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_bnx2x_pmd_init(void)
{
PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_bnx2x_pmd.pci_drv);
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_bnx2xvf_pmd.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index e425ef2..9654ced 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -858,23 +858,10 @@ static struct eth_driver rte_cxgbe_pmd = {
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_cxgbe_pmd_init(void)
{
CXGBE_FUNC_TRACE();
rte_eal_pci_register(&rte_cxgbe_pmd.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_cxgbe_driver = {
- .name = "cxgbe_driver",
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 973ec97..19b2645 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -348,11 +348,11 @@ static struct eth_driver rte_em_pmd = {
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_em_pmd_init(void)
{
rte_eal_pci_register(&rte_em_pmd.pci_drv);
- return 0;
}
static int
@@ -1738,10 +1738,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr);
return 0;
}
-
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index a8d94a4..da63365 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -985,11 +985,12 @@ static struct eth_driver rte_igbvf_pmd = {
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_igb_pmd_init(void)
{
rte_eal_pci_register(&rte_igb_pmd.pci_drv);
- return 0;
+ rte_eal_pci_register(&rte_igbvf_pmd.pci_drv);
}
static void
@@ -1003,20 +1004,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eal_pci_register(&rte_igbvf_pmd.pci_drv);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -4696,16 +4683,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -4866,6 +4843,3 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-
-PMD_REGISTER_DRIVER(pmd_igb_drv);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 7678c0a..9f997b1 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -632,22 +632,10 @@ static struct eth_driver rte_enic_pmd = {
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_enic_pmd_init(void)
{
ENICPMD_FUNC_TRACE();
rte_eal_pci_register(&rte_enic_pmd.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 75537e0..b69fc22 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2760,23 +2760,10 @@ static struct eth_driver rte_pmd_fm10k = {
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_pmd_fm10k_init(void)
{
PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_pmd_fm10k.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ab24115..f47bb4b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -639,27 +639,14 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_i40e_pmd_init(void)
{
PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_i40e_pmd.pci_drv);
- return 0;
}
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver);
-
/*
* Initialize registers for flexible payload, which should be set by NVM.
* This should be removed from code once it is fixed in NVM.
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 050d7ea..2e11ff9 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1374,27 +1374,14 @@ static struct eth_driver rte_i40evf_pmd = {
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_i40evf_pmd_init(void)
{
PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_i40evf_pmd.pci_drv);
- return 0;
}
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver);
-
static int
i40evf_dev_configure(struct rte_eth_dev *dev)
{
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 970528e..9f29525 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1457,30 +1457,13 @@ static struct eth_driver rte_ixgbevf_pmd = {
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_ixgbe_pmd_init(void)
{
PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_ixgbe_pmd.pci_drv);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_ixgbevf_pmd.pci_drv);
- return (0);
}
static int
@@ -6192,16 +6175,3 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev,
}
return 0;
}
-
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 207bfe2..bd223c0 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5677,14 +5677,10 @@ static struct eth_driver mlx4_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -5694,13 +5690,4 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .name = MLX4_DRIVER_NAME,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 821ee0f..8d23068 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -542,14 +542,10 @@ static struct eth_driver mlx5_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -559,13 +555,4 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .name = MLX5_DRIVER_NAME,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 89ba703..6e4bc16 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2474,24 +2474,16 @@ static struct eth_driver rte_nfp_net_pmd = {
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+nfp_net_pmd_init(void)
{
PMD_INIT_FUNC_TRACE();
PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
NFP_NET_PMD_VERSION);
rte_eal_pci_register(&rte_nfp_net_pmd.pci_drv);
- return 0;
}
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver);
-
/*
* Local variables:
* c-file-style: "Linux"
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 08f386a..e44411e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1447,23 +1447,16 @@ static struct eth_driver rte_virtio_pmd = {
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
- return 0;
}
/*
@@ -1684,10 +1677,3 @@ __rte_unused uint8_t is_rx)
{
return 0;
}
-
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 1a3bc66..a065610 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -333,17 +333,12 @@ static struct eth_driver rte_vmxnet3_pmd = {
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
+/* Driver registration */
+static void __attribute__((constructor, used))
+rte_vmxnet3_pmd_init(void)
{
PMD_INIT_FUNC_TRACE();
rte_eal_pci_register(&rte_vmxnet3_pmd.pci_drv);
- return 0;
}
static int
@@ -922,10 +917,3 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (2 preceding siblings ...)
2016-01-29 14:08 ` [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-02 7:02 ` Rahul Lakkireddy
2016-01-29 14:08 ` [dpdk-dev] [PATCH 5/9] eal: get rid of pmd type David Marchand
` (7 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
Now that virtio pci driver is initialized in a constructor, we only need to
move the interrupt thread init after loading the plugins.
This way, chelsio driver should be happy again [1].
[1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 635ec36..62241ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -823,6 +823,9 @@ rte_eal_init(int argc, char **argv)
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");
+ if (rte_eal_intr_init() < 0)
+ rte_panic("Cannot init interrupt-handling thread\n");
+
eal_thread_init_master(rte_config.master_lcore);
ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
@@ -834,9 +837,6 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
- if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 5/9] eal: get rid of pmd type
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (3 preceding siblings ...)
2016-01-29 14:08 ` [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-09 17:15 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 6/9] eal: initialize vdevs right next to pci devices David Marchand
` (6 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
Now that we only have vdev drivers, there is no need for a pmd type in
rte_driver.
rte_driver is now purely a vdev thing, and could be renamed later
(then .init would become .probe, .uninit would become .remove).
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 ++
drivers/net/af_packet/rte_eth_af_packet.c | 2 ++
drivers/net/bonding/rte_eth_bond_pmd.c | 2 ++
drivers/net/mpipe/mpipe_tilegx.c | 4 ++++
drivers/net/null/rte_eth_null.c | 2 ++
drivers/net/pcap/rte_eth_pcap.c | 2 ++
drivers/net/ring/rte_eth_ring.c | 2 ++
drivers/net/szedata2/rte_eth_szedata2.c | 2 ++
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 ++
lib/librte_cryptodev/rte_cryptodev.c | 14 ++++++++++++++
lib/librte_cryptodev/rte_cryptodev.h | 2 ++
lib/librte_cryptodev/rte_cryptodev_pmd.h | 4 ++++
lib/librte_eal/common/eal_common_dev.c | 11 ++++++++---
lib/librte_eal/common/include/rte_dev.h | 4 ++++
14 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index d8ccf05..94752de 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -661,7 +661,9 @@ cryptodev_aesni_mb_uninit(const char *name)
static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
.name = CRYPTODEV_NAME_AESNI_MB_PMD,
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 767f36b..6603462 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -838,7 +838,9 @@ exit:
static struct rte_driver pmd_af_packet_drv = {
.name = "eth_af_packet",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_af_packet_devinit,
};
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b1373c6..d19d745 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2493,7 +2493,9 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
static struct rte_driver bond_drv = {
.name = "eth_bond",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = bond_init,
.uninit = bond_uninit,
};
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 35134ba..3eaf0db 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1608,13 +1608,17 @@ rte_pmd_mpipe_devinit(const char *ifname,
static struct rte_driver pmd_mpipe_xgbe_drv = {
.name = "xgbe",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_mpipe_devinit,
};
static struct rte_driver pmd_mpipe_gbe_drv = {
.name = "gbe",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_mpipe_devinit,
};
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 77fc988..f5700bb 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -695,7 +695,9 @@ rte_pmd_null_devuninit(const char *name)
static struct rte_driver pmd_null_drv = {
.name = "eth_null",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit,
};
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index f9230eb..9ab22be 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1092,7 +1092,9 @@ rte_pmd_pcap_devuninit(const char *name)
static struct rte_driver pmd_pcap_drv = {
.name = "eth_pcap",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit,
};
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index d92b088..9941a1c 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -596,7 +596,9 @@ rte_pmd_ring_devuninit(const char *name)
static struct rte_driver pmd_ring_drv = {
.name = "eth_ring",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit,
};
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 9f86c99..6bbb6b0 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1616,7 +1616,9 @@ rte_pmd_szedata2_devuninit(const char *name)
static struct rte_driver pmd_szedata2_drv = {
.name = "eth_szedata2",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_szedata2_devinit,
.uninit = rte_pmd_szedata2_devuninit,
};
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 3f31806..d5f3bbb 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -769,7 +769,9 @@ rte_pmd_xenvirt_devuninit(const char *name)
static struct rte_driver pmd_xenvirt_drv = {
.name = "eth_xenvirt",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit,
};
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 1950020..f499bc6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -202,7 +202,11 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
+#ifndef RTE_NEXT_ABI
rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+#else
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
+#endif
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -241,7 +245,9 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
+#ifndef RTE_NEXT_ABI
cryptodev->pmd_type = type;
+#endif
cryptodev_globals.nb_devs++;
}
@@ -290,7 +296,11 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
+#ifndef RTE_NEXT_ABI
cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+#else
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
+#endif
if (cryptodev == NULL)
return NULL;
@@ -332,8 +342,12 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
+#ifndef RTE_NEXT_ABI
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
rte_socket_id());
+#else
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
+#endif
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 892375d..4813ec1 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -471,9 +471,11 @@ struct rte_cryptodev {
/**< PCI info. supplied by probing */
enum rte_cryptodev_type dev_type;
+#ifndef RTE_NEXT_ABI
/**< Crypto device type */
enum pmd_type pmd_type;
/**< PMD type - PDEV / VDEV */
+#endif
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 1c5ee14..4a84757 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -466,7 +466,11 @@ struct rte_cryptodev_ops {
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
+#ifndef RTE_NEXT_ABI
rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+#else
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
+#endif
/**
* Creates a new virtual crypto device and returns the pointer
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..5137172 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -72,9 +72,10 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &dev_driver_list, next) {
+#ifndef RTE_NEXT_ABI
if (driver->type != PMD_VDEV)
continue;
-
+#endif
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -93,7 +94,9 @@ int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
+#ifndef RTE_NEXT_ABI
struct rte_driver *driver;
+#endif
/*
* Note that the dev_driver_list is populated here
@@ -114,7 +117,7 @@ rte_eal_dev_init(void)
return -1;
}
}
-
+#ifndef RTE_NEXT_ABI
/* Once the vdevs are initalized, start calling all the pdev drivers */
TAILQ_FOREACH(driver, &dev_driver_list, next) {
if (driver->type != PMD_PDEV)
@@ -122,6 +125,7 @@ rte_eal_dev_init(void)
/* PDEV drivers don't get passed any parameters */
driver->init(NULL, NULL);
}
+#endif
return 0;
}
@@ -134,9 +138,10 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &dev_driver_list, next) {
+#ifndef RTE_NEXT_ABI
if (driver->type != PMD_VDEV)
continue;
-
+#endif
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f1b5507..88c1a19 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -114,6 +114,7 @@ typedef int (rte_dev_init_t)(const char *name, const char *args);
*/
typedef int (rte_dev_uninit_t)(const char *name);
+#ifndef RTE_NEXT_ABI
/**
* Driver type enumeration
*/
@@ -121,13 +122,16 @@ enum pmd_type {
PMD_VDEV = 0,
PMD_PDEV = 1,
};
+#endif
/**
* A structure describing a device driver.
*/
struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+#ifndef RTE_NEXT_ABI
enum pmd_type type; /**< PMD Driver type */
+#endif
const char *name; /**< Driver name. */
rte_dev_init_t *init; /**< Device init. function. */
rte_dev_uninit_t *uninit; /**< Device uninit. function. */
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 6/9] eal: initialize vdevs right next to pci devices
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (4 preceding siblings ...)
2016-01-29 14:08 ` [dpdk-dev] [PATCH 5/9] eal: get rid of pmd type David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-10 11:05 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 7/9] pci: add a helper for device name David Marchand
` (5 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
This way, the resources probing happens in a common place.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal.c | 7 +++++++
lib/librte_eal/common/include/rte_dev.h | 2 +-
lib/librte_eal/linuxapp/eal/eal.c | 7 +++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index a34e61d..b557a9f 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -582,8 +582,10 @@ rte_eal_init(int argc, char **argv)
rte_config.master_lcore, thread_id, cpuset,
ret == 0 ? "" : "...");
+#ifndef RTE_NEXT_ABI
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
+#endif
RTE_LCORE_FOREACH_SLAVE(i) {
@@ -617,6 +619,11 @@ rte_eal_init(int argc, char **argv)
rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
rte_eal_mp_wait_lcore();
+#ifdef RTE_NEXT_ABI
+ if (rte_eal_dev_init() < 0)
+ rte_panic("Cannot probe vdev devices\n");
+#endif
+
/* Probe & Initialize PCI devices */
if (rte_eal_pci_probe())
rte_panic("Cannot probe PCI\n");
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 88c1a19..df69e28 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -156,7 +156,7 @@ void rte_eal_driver_register(struct rte_driver *driver);
void rte_eal_driver_unregister(struct rte_driver *driver);
/**
- * Initalize all the registered drivers in this process
+ * Scan all devargs and attach to drivers if available
*/
int rte_eal_dev_init(void);
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 62241ee..95313af 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -834,8 +834,10 @@ rte_eal_init(int argc, char **argv)
rte_config.master_lcore, (int)thread_id, cpuset,
ret == 0 ? "" : "...");
+#ifndef RTE_NEXT_ABI
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
+#endif
RTE_LCORE_FOREACH_SLAVE(i) {
@@ -873,6 +875,11 @@ rte_eal_init(int argc, char **argv)
rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
rte_eal_mp_wait_lcore();
+#ifdef RTE_NEXT_ABI
+ if (rte_eal_dev_init() < 0)
+ rte_panic("Cannot probe vdev devices\n");
+#endif
+
/* Probe & Initialize PCI devices */
if (rte_eal_pci_probe())
rte_panic("Cannot probe PCI\n");
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 7/9] pci: add a helper for device name
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (5 preceding siblings ...)
2016-01-29 14:08 ` [dpdk-dev] [PATCH 6/9] eal: initialize vdevs right next to pci devices David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-10 11:10 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device David Marchand
` (4 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
eal is a better place than ethdev for naming resources.
Add a helper here, and make use of it in ethdev hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/include/rte_pci.h | 28 ++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.c | 22 ++--------------------
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 334c12e..9edd5f5 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -309,6 +309,34 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using above functions.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline int
+eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, int size)
+{
+ int ret;
+
+ ret = snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function);
+ if (ret < 0 || ret >= size)
+ return -1;
+
+ return 0;
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 17e4f4d..5ba7479 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -214,20 +214,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -251,9 +237,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -304,9 +288,7 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (6 preceding siblings ...)
2016-01-29 14:08 ` [dpdk-dev] [PATCH 7/9] pci: add a helper for device name David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-02-10 11:23 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 9/9] eal: relocate hotplug code from ethdev David Marchand
` (3 subsequent siblings)
11 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
It will be used mainly for hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 13 ++++++++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 ++++++++++
3 files changed, 75 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 4584522..5dd89e3 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -396,6 +396,55 @@ error:
return -1;
}
+int
+pci_refresh_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = { &match },
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 072e672..ed1903f 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -155,6 +155,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Refresh a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_refresh_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index a354f76..4fe8b60 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -393,6 +393,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_refresh_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH 9/9] eal: relocate hotplug code from ethdev
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (7 preceding siblings ...)
2016-01-29 14:08 ` [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device David Marchand
@ 2016-01-29 14:08 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (2 subsequent siblings)
11 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-01-29 14:08 UTC (permalink / raw)
To: dev; +Cc: viktorin
hotplug which deals with resources should come from the layer that already
handles them, i.e. eal.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +
lib/librte_eal/common/eal_common_dev.c | 39 ++++
lib/librte_eal/common/eal_common_pci.c | 11 +-
lib/librte_eal/common/include/rte_dev.h | 25 +++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +
lib/librte_ether/rte_ethdev.c | 258 ++++--------------------
6 files changed, 125 insertions(+), 224 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 9d7adf1..9aad048 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -135,3 +135,11 @@ DPDK_2.2 {
rte_xen_dom0_supported;
} DPDK_2.1;
+
+DPDK_2.3 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+
+} DPDK_2.2;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 5137172..ec04b3a 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -155,3 +155,42 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+ int ret = -1;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ return ret;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
+ return -1;
+}
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 1e12776..d9aa66b 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -332,6 +332,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_refresh_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -344,9 +349,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index df69e28..6f026ff 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -182,6 +182,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a resource to a registered driver.
+ *
+ * @param name
+ * The resource name, that refers to a pci resource or some private
+ * way of designating a resource for vdev drivers. Based on this
+ * resource name, eal will identify a driver capable of handling
+ * this resource and pass this resource to the driver probing
+ * function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a resource from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define PMD_REGISTER_DRIVER(d)\
void devinitfn_ ##d(void);\
void __attribute__((constructor, used)) devinitfn_ ##d(void)\
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index cbe175f..ba0ff56 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -138,3 +138,11 @@ DPDK_2.2 {
rte_xen_dom0_supported;
} DPDK_2.1;
+
+DPDK_2.3 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+
+} DPDK_2.2;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 5ba7479..5a5d419 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -210,6 +211,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -364,100 +366,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- if (!rte_eth_dev_is_valid_port(port_id))
- return RTE_ETH_DEV_UNKNOWN;
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
-static int
-rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
-{
- char *tmp;
-
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (name == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- /* shouldn't check 'rte_eth_devices[i].data',
- * because it might be overwritten by VDEV PMD */
- tmp = rte_eth_dev_data[port_id].name;
- strcpy(name, tmp);
- return 0;
-}
-
-static int
-rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
-{
- int i;
-
- if (name == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- if (!strncmp(name,
- rte_eth_dev_data[i].name, strlen(name))) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
@@ -482,127 +390,50 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return !(dev_flags & RTE_ETH_DEV_DETACHABLE);
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL, *args;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ name = strdup(devargs);
+ if (!name)
+ goto err;
+
+ args = strchr(name, ',');
+ if (args) {
+ args[0] = '\0';
+ args++;
}
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ ret = -1;
+ goto err;
+ }
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
+ }
+ *port_id = eth_dev_last_created_port;
+
+ free(name);
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
return ret;
}
@@ -610,7 +441,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -618,33 +448,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity
2016-01-29 14:08 ` [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity David Marchand
@ 2016-02-02 7:02 ` Rahul Lakkireddy
2016-02-02 7:13 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: Rahul Lakkireddy @ 2016-02-02 7:02 UTC (permalink / raw)
To: David Marchand; +Cc: dev, kumaras, nirranjan, viktorin
Hi David,
On Friday, January 01/29/16, 2016 at 15:08:31 +0100, David Marchand wrote:
> Now that virtio pci driver is initialized in a constructor, we only need to
> move the interrupt thread init after loading the plugins.
> This way, chelsio driver should be happy again [1].
>
> [1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index 635ec36..62241ee 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -823,6 +823,9 @@ rte_eal_init(int argc, char **argv)
> if (eal_plugins_init() < 0)
> rte_panic("Cannot init plugins\n");
>
> + if (rte_eal_intr_init() < 0)
> + rte_panic("Cannot init interrupt-handling thread\n");
> +
> eal_thread_init_master(rte_config.master_lcore);
>
> ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
> @@ -834,9 +837,6 @@ rte_eal_init(int argc, char **argv)
> if (rte_eal_dev_init() < 0)
> rte_panic("Cannot init pmd devices\n");
>
> - if (rte_eal_intr_init() < 0)
> - rte_panic("Cannot init interrupt-handling thread\n");
> -
> RTE_LCORE_FOREACH_SLAVE(i) {
>
> /*
> --
> 1.9.1
>
Thank you for this patch. I've tested it and it does improve the perf.
back when there is a queue on master lcore in l3fwd app.
Thanks,
Rahul
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity
2016-02-02 7:02 ` Rahul Lakkireddy
@ 2016-02-02 7:13 ` David Marchand
2016-02-02 7:43 ` Rahul Lakkireddy
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-02-02 7:13 UTC (permalink / raw)
To: Rahul Lakkireddy; +Cc: dev, Nirranjan Kirubaharan, Kumar Sanghvi, Jan Viktorin
Hello Rahul,
On Tue, Feb 2, 2016 at 8:02 AM, Rahul Lakkireddy
<rahul.lakkireddy@chelsio.com> wrote:
> On Friday, January 01/29/16, 2016 at 15:08:31 +0100, David Marchand wrote:
>> Now that virtio pci driver is initialized in a constructor, we only need to
>> move the interrupt thread init after loading the plugins.
>> This way, chelsio driver should be happy again [1].
>
> Thank you for this patch. I've tested it and it does improve the perf.
> back when there is a queue on master lcore in l3fwd app.
Did you test the whole series ? or just this specific patch ?
Anyway, great, but this is still too fragile.
As discussed in the same thread as the problem you reported, there is
some work over there to be done so that interrupts are "distributed"
in a more flexible way.
Did someone look at this ?
Plans to work on this ? (post 2.3, I suppose)
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity
2016-02-02 7:13 ` David Marchand
@ 2016-02-02 7:43 ` Rahul Lakkireddy
0 siblings, 0 replies; 375+ messages in thread
From: Rahul Lakkireddy @ 2016-02-02 7:43 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Nirranjan Kirubaharan, Kumar A S, Jan Viktorin
Hi David,
On Monday, February 02/01/16, 2016 at 23:13:55 -0800, David Marchand wrote:
> Hello Rahul,
>
> On Tue, Feb 2, 2016 at 8:02 AM, Rahul Lakkireddy
> <rahul.lakkireddy@chelsio.com> wrote:
> > On Friday, January 01/29/16, 2016 at 15:08:31 +0100, David Marchand wrote:
> >> Now that virtio pci driver is initialized in a constructor, we only need to
> >> move the interrupt thread init after loading the plugins.
> >> This way, chelsio driver should be happy again [1].
> >
> > Thank you for this patch. I've tested it and it does improve the perf.
> > back when there is a queue on master lcore in l3fwd app.
>
> Did you test the whole series ? or just this specific patch ?
>
I've tested only this particular patch, not the whole series.
> Anyway, great, but this is still too fragile.
>
> As discussed in the same thread as the problem you reported, there is
> some work over there to be done so that interrupts are "distributed"
> in a more flexible way.
> Did someone look at this ?
> Plans to work on this ? (post 2.3, I suppose)
>
>
> --
> David Marchand
Thanks,
Rahul
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 1/9] pci: no need for dynamic tailq init
2016-01-29 14:08 ` [dpdk-dev] [PATCH 1/9] pci: no need for dynamic tailq init David Marchand
@ 2016-02-08 10:32 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-02-08 10:32 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Fri, 29 Jan 2016 15:08:28 +0100
David Marchand <david.marchand@6wind.com> wrote:
> These lists can be initialized once and for all at build time.
> With this, those lists are only manipulated in a common place
> (and we could even make them private).
>
> A nice side effect is that pci drivers can now register in constructors.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 2/9] pci: register all pdev as pci drivers
2016-01-29 14:08 ` [dpdk-dev] [PATCH 2/9] pci: register all pdev as pci drivers David Marchand
@ 2016-02-08 11:03 ` Jan Viktorin
2016-02-09 8:55 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-02-08 11:03 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Fri, 29 Jan 2016 15:08:29 +0100
David Marchand <david.marchand@6wind.com> wrote:
> pdev drivers are actually pci drivers.
> Wrappers for ethdev and crypto pci drivers, that assume a 1 to 1
> association between pci device and upper device, have been added so that
> current drivers are not impacted.
It took me a while to find out what's going on in this patch. I could
see several not-so-related changes down the e-mail. I'd suggest to split
it this way:
1) separate coding style fixes
2) rename init/uninit to probe/remove (preserve the 'static' there)
3) remove rte_eth_driver_register invocations
4) separate VDEV and PDEV for cryptodev
5) play with the NEXT_ABI (remove those 'static' keywords?)
A more detailed commit log would help too. But this would
be automatically solved by the separation, I think.
See comments below...
Regards
Jan
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> drivers/crypto/qat/rte_qat_cryptodev.c | 7 +++++--
> drivers/net/bnx2x/bnx2x_ethdev.c | 16 ++++++++++------
> drivers/net/cxgbe/cxgbe_ethdev.c | 5 +++--
> drivers/net/e1000/em_ethdev.c | 4 +++-
> drivers/net/e1000/igb_ethdev.c | 14 +++++++++-----
> drivers/net/enic/enic_ethdev.c | 5 +++--
> drivers/net/fm10k/fm10k_ethdev.c | 4 +++-
> drivers/net/i40e/i40e_ethdev.c | 5 +++--
> drivers/net/i40e/i40e_ethdev_vf.c | 6 +++---
> drivers/net/ixgbe/ixgbe_ethdev.c | 10 ++++++----
> drivers/net/nfp/nfp_net.c | 7 ++++---
> drivers/net/virtio/virtio_ethdev.c | 4 +++-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 5 +++--
> lib/librte_cryptodev/rte_cryptodev.c | 18 ++++++++++--------
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 14 ++++++++++++++
> lib/librte_cryptodev/rte_cryptodev_version.map | 10 +++++++++-
> lib/librte_ether/rte_ethdev.c | 16 +++++++++-------
> lib/librte_ether/rte_ethdev.h | 15 +++++++++++++++
> lib/librte_ether/rte_ether_version.map | 8 ++++++++
> 19 files changed, 123 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
> index e500c1e..6853aee 100644
> --- a/drivers/crypto/qat/rte_qat_cryptodev.c
> +++ b/drivers/crypto/qat/rte_qat_cryptodev.c
> @@ -113,10 +113,12 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
> }
>
> static struct rte_cryptodev_driver rte_qat_pmd = {
> - {
> + .pci_drv = {
I believe that you are making the driver independent on the exact
location of the pci_drv member in the rte_cryptodev_drivers struct. Is
it true? Why is that important?
> .name = "rte_qat_pmd",
> .id_table = pci_id_qat_map,
> .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + .devinit = rte_cryptodev_pci_probe,
> + .devuninit = rte_cryptodev_pci_remove,
> },
> .cryptodev_init = crypto_qat_dev_init,
> .dev_private_size = sizeof(struct qat_pmd_private),
> @@ -126,7 +128,8 @@ static int
> rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
> {
> PMD_INIT_FUNC_TRACE();
> - return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
> + rte_eal_pci_register(&rte_qat_pmd.pci_drv);
> + return 0;
So, I finally discovered that this change somehow separates the PCI
(PDEV) and VDEV initialization. Is that correct?
> }
>
> static struct rte_driver pmd_qat_drv = {
> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
> index 69df02e..916b9da 100644
> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
> @@ -501,6 +501,8 @@ static struct eth_driver rte_bnx2x_pmd = {
> .name = "rte_bnx2x_pmd",
> .id_table = pci_id_bnx2x_map,
> .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
> + .devinit = rte_eth_dev_pci_probe,
> + .devuninit = rte_eth_dev_pci_remove,
> },
> .eth_dev_init = eth_bnx2x_dev_init,
> .dev_private_size = sizeof(struct bnx2x_softc),
> @@ -514,24 +516,26 @@ static struct eth_driver rte_bnx2xvf_pmd = {
> .name = "rte_bnx2xvf_pmd",
> .id_table = pci_id_bnx2xvf_map,
> .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + .devinit = rte_eth_dev_pci_probe,
> + .devuninit = rte_eth_dev_pci_remove,
> },
> .eth_dev_init = eth_bnx2xvf_dev_init,
> .dev_private_size = sizeof(struct bnx2x_softc),
> };
>
> -static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
> +static int rte_bnx2x_pmd_init(const char *name __rte_unused,
> + const char *params __rte_unused)
> {
> PMD_INIT_FUNC_TRACE();
> - rte_eth_driver_register(&rte_bnx2x_pmd);
> -
> + rte_eal_pci_register(&rte_bnx2x_pmd.pci_drv);
Here, I think you are trying to remove calls to the
rte_eth_driver_register as it does not do anything important.
Similar below (snipped)...
> return 0;
> }
>
> -static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
> +static int rte_bnx2xvf_pmd_init(const char *name __rte_unused,
> + const char *params __rte_unused)
Coding style fixes should be in a separate patch. More occurences below
(snipped).
> {
> PMD_INIT_FUNC_TRACE();
> [snip]
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
> index f09f67e..1950020 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -313,9 +313,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
> return cryptodev;
> }
>
> -static int
> -rte_cryptodev_init(struct rte_pci_driver *pci_drv,
> - struct rte_pci_device *pci_dev)
> +int
> +rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
> + struct rte_pci_device *pci_dev)
> {
> struct rte_cryptodev_driver *cryptodrv;
> struct rte_cryptodev *cryptodev;
> @@ -375,8 +375,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
> return -ENXIO;
> }
>
> -static int
> -rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
> +int
> +rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
> {
> const struct rte_cryptodev_driver *cryptodrv;
> struct rte_cryptodev *cryptodev;
> @@ -418,26 +418,28 @@ rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
> return 0;
> }
>
> +#ifndef RTE_NEXT_ABI
> int
> rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
> enum pmd_type type)
> {
> /* Call crypto device initialization directly if device is virtual */
> if (type == PMD_VDEV)
> - return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
> + return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
> NULL);
>
> /*
> * Register PCI driver for physical device intialisation during
> * PCI probing
> */
> - cryptodrv->pci_drv.devinit = rte_cryptodev_init;
> - cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
> + cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
> + cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
>
> rte_eal_pci_register(&cryptodrv->pci_drv);
>
> return 0;
> }
> +#endif
>
>
> uint16_t
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> index 8270afa..1c5ee14 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> @@ -499,6 +499,7 @@ extern int
> rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
>
>
> +#ifndef RTE_NEXT_ABI
> /**
> * Register a Crypto [Poll Mode] driver.
> *
> @@ -527,6 +528,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
> extern int
> rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
> enum pmd_type type);
> +#endif
>
> /**
> * Executes all the user application registered callbacks for the specific
> @@ -541,6 +543,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
> void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
> enum rte_cryptodev_event_type event);
>
> +/**
> + * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
> + * interface.
> + */
> +int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
> + struct rte_pci_device *pci_dev);
> +
> +/**
> + * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
> + * interface.
> + */
> +int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
>
> #ifdef __cplusplus
> }
> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
> index ff8e93d..3f838a4 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -29,4 +29,12 @@ DPDK_2.2 {
> rte_cryptodev_queue_pair_stop;
>
> local: *;
> -};
> \ No newline at end of file
> +};
> +
> +DPDK_2.3 {
> + global:
> +
> + rte_cryptodev_pci_probe;
> + rte_cryptodev_pci_remove;
> +
> +} DPDK_2.2;
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 756b234..17e4f4d 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -239,9 +239,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
> return 0;
> }
>
> -static int
> -rte_eth_dev_init(struct rte_pci_driver *pci_drv,
> - struct rte_pci_device *pci_dev)
> +int
> +rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
> + struct rte_pci_device *pci_dev)
As I've suggested at the beginning, what about "first just rename then
make it public (non-static)"? I don't see the connection between the
rename and the NEXT_ABI conditional.
> {
> struct eth_driver *eth_drv;
> struct rte_eth_dev *eth_dev;
> @@ -293,8 +293,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
> return diag;
> }
>
> -static int
> -rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
> +int
> +rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
> {
> const struct eth_driver *eth_drv;
> struct rte_eth_dev *eth_dev;
> @@ -334,6 +334,7 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
> return 0;
> }
>
> +#ifndef RTE_NEXT_ABI
> /**
> * Register an Ethernet [Poll Mode] driver.
> *
> @@ -351,10 +352,11 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
> void
> rte_eth_driver_register(struct eth_driver *eth_drv)
> {
> - eth_drv->pci_drv.devinit = rte_eth_dev_init;
> - eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
> + eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
> + eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
> rte_eal_pci_register(ð_drv->pci_drv);
> }
> +#endif
>
> int
> rte_eth_dev_is_valid_port(uint8_t port_id)
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 8710dd7..af051d1 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1774,6 +1774,7 @@ struct eth_driver {
> unsigned int dev_private_size; /**< Size of device private data. */
> };
>
> +#ifndef RTE_NEXT_ABI
> /**
> * @internal
> * A function invoked by the initialization function of an Ethernet driver
> @@ -1785,6 +1786,7 @@ struct eth_driver {
> * the Ethernet driver.
> */
> void rte_eth_driver_register(struct eth_driver *eth_drv);
> +#endif
>
> /**
> * Configure an Ethernet device.
> @@ -3880,6 +3882,19 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
> uint16_t queue_id, size_t size,
> unsigned align, int socket_id);
>
> +/**
> + * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
> + * interface.
> + */
> +int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
> + struct rte_pci_device *pci_dev);
> +
> +/**
> + * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
> + * interface.
> + */
> +int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
> index d8db24d..07b2d8b 100644
> --- a/lib/librte_ether/rte_ether_version.map
> +++ b/lib/librte_ether/rte_ether_version.map
> @@ -117,3 +117,11 @@ DPDK_2.2 {
>
> local: *;
> };
> +
> +DPDK_2.3 {
> + global:
> +
> + rte_eth_dev_pci_probe;
> + rte_eth_dev_pci_remove;
> +
> +} DPDK_2.2;
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 2/9] pci: register all pdev as pci drivers
2016-02-08 11:03 ` Jan Viktorin
@ 2016-02-09 8:55 ` David Marchand
0 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-02-09 8:55 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev
On Mon, Feb 8, 2016 at 12:03 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> On Fri, 29 Jan 2016 15:08:29 +0100
> David Marchand <david.marchand@6wind.com> wrote:
>
>> pdev drivers are actually pci drivers.
>> Wrappers for ethdev and crypto pci drivers, that assume a 1 to 1
>> association between pci device and upper device, have been added so that
>> current drivers are not impacted.
>
> It took me a while to find out what's going on in this patch. I could
> see several not-so-related changes down the e-mail. I'd suggest to split
> it this way:
>
> 1) separate coding style fixes
> 2) rename init/uninit to probe/remove (preserve the 'static' there)
> 3) remove rte_eth_driver_register invocations
> 4) separate VDEV and PDEV for cryptodev
> 5) play with the NEXT_ABI (remove those 'static' keywords?)
>
> A more detailed commit log would help too. But this would
> be automatically solved by the separation, I think.
Yes, I rushed for this patchset to still be in the proposal window ...
Sorry, I will split for next version.
> See comments below...
Globally, all my answers are "Yes, will do and it will be easier with
smaller patches".
Just added some comments where appropriate.
>> diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
>> index e500c1e..6853aee 100644
>> --- a/drivers/crypto/qat/rte_qat_cryptodev.c
>> +++ b/drivers/crypto/qat/rte_qat_cryptodev.c
>> @@ -113,10 +113,12 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
>> }
>>
>> static struct rte_cryptodev_driver rte_qat_pmd = {
>> - {
>> + .pci_drv = {
>
> I believe that you are making the driver independent on the exact
> location of the pci_drv member in the rte_cryptodev_drivers struct. Is
> it true? Why is that important?
Yes, plus all other drivers are doing this, there were little
exception to this convention, so I just aligned here.
>> .name = "rte_qat_pmd",
>> .id_table = pci_id_qat_map,
>> .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
>> + .devinit = rte_cryptodev_pci_probe,
>> + .devuninit = rte_cryptodev_pci_remove,
>> },
>> .cryptodev_init = crypto_qat_dev_init,
>> .dev_private_size = sizeof(struct qat_pmd_private),
>> @@ -126,7 +128,8 @@ static int
>> rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
>> {
>> PMD_INIT_FUNC_TRACE();
>> - return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
>> + rte_eal_pci_register(&rte_qat_pmd.pci_drv);
>> + return 0;
>
> So, I finally discovered that this change somehow separates the PCI
> (PDEV) and VDEV initialization. Is that correct?
Yes.
I will separate crypto updates from netdev updates since crypto
framework has a slight different way of initialising.
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index 756b234..17e4f4d 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -239,9 +239,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
>> return 0;
>> }
>>
>> -static int
>> -rte_eth_dev_init(struct rte_pci_driver *pci_drv,
>> - struct rte_pci_device *pci_dev)
>> +int
>> +rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
>> + struct rte_pci_device *pci_dev)
>
> As I've suggested at the beginning, what about "first just rename then
> make it public (non-static)"? I don't see the connection between the
> rename and the NEXT_ABI conditional.
I don't think we need NEXT_ABI checks here.
I am not breaking anything here, just adding a new symbol.
I will introduce this new symbol, then convert all existing
pdev/eth_driver to pdev/pci_driver in a second patch.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers
2016-01-29 14:08 ` [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers David Marchand
@ 2016-02-09 17:05 ` Jan Viktorin
2016-02-10 8:51 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-02-09 17:05 UTC (permalink / raw)
To: David Marchand; +Cc: dev
Maybe, a better subject?
drivers: init pdev drivers in constructors
On Fri, 29 Jan 2016 15:08:30 +0100
David Marchand <david.marchand@6wind.com> wrote:
> Now that pdev drivers have been converted to pci drivers, there is nothing
> left in their init functions that can't go in a constructor.
> pdev / vdev drivers init order is changed by this commit, but I can't see
> why we would need to preserve it.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> drivers/crypto/qat/rte_qat_cryptodev.c | 13 +++---------
> drivers/net/bnx2x/bnx2x_ethdev.c | 26 +++---------------------
> drivers/net/cxgbe/cxgbe_ethdev.c | 19 +++---------------
> drivers/net/e1000/em_ethdev.c | 13 +++---------
> drivers/net/e1000/igb_ethdev.c | 34 ++++----------------------------
> drivers/net/enic/enic_ethdev.c | 18 +++--------------
> drivers/net/fm10k/fm10k_ethdev.c | 19 +++---------------
> drivers/net/i40e/i40e_ethdev.c | 19 +++---------------
> drivers/net/i40e/i40e_ethdev_vf.c | 19 +++---------------
> drivers/net/ixgbe/ixgbe_ethdev.c | 36 +++-------------------------------
> drivers/net/mlx4/mlx4.c | 19 +++---------------
> drivers/net/mlx5/mlx5.c | 19 +++---------------
> drivers/net/nfp/nfp_net.c | 14 +++----------
> drivers/net/virtio/virtio_ethdev.c | 22 ++++-----------------
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 18 +++--------------
> 15 files changed, 47 insertions(+), 261 deletions(-)
>
> diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
> index 6853aee..ded5d60 100644
> --- a/drivers/crypto/qat/rte_qat_cryptodev.c
> +++ b/drivers/crypto/qat/rte_qat_cryptodev.c
> @@ -124,17 +124,10 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
> .dev_private_size = sizeof(struct qat_pmd_private),
> };
>
> -static int
> -rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
> +/* Driver registration */
> +static void __attribute__((constructor, used))
> +rte_qat_pmd_init(void)
> {
> PMD_INIT_FUNC_TRACE();
> rte_eal_pci_register(&rte_qat_pmd.pci_drv);
> - return 0;
> }
> -
> -static struct rte_driver pmd_qat_drv = {
> - .type = PMD_PDEV,
> - .init = rte_qat_pmd_init,
> -};
> -
> -PMD_REGISTER_DRIVER(pmd_qat_drv);
What about introducing a macro for this?
RTE_REGISTER_PCI_DRIVER(rte_qad_pmd);
Regards
Jan
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 5/9] eal: get rid of pmd type
2016-01-29 14:08 ` [dpdk-dev] [PATCH 5/9] eal: get rid of pmd type David Marchand
@ 2016-02-09 17:15 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-02-09 17:15 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Fri, 29 Jan 2016 15:08:32 +0100
David Marchand <david.marchand@6wind.com> wrote:
> Now that we only have vdev drivers, there is no need for a pmd type in
> rte_driver.
> rte_driver is now purely a vdev thing, and could be renamed later
> (then .init would become .probe, .uninit would become .remove).
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 ++
> drivers/net/af_packet/rte_eth_af_packet.c | 2 ++
> drivers/net/bonding/rte_eth_bond_pmd.c | 2 ++
> drivers/net/mpipe/mpipe_tilegx.c | 4 ++++
> drivers/net/null/rte_eth_null.c | 2 ++
> drivers/net/pcap/rte_eth_pcap.c | 2 ++
> drivers/net/ring/rte_eth_ring.c | 2 ++
> drivers/net/szedata2/rte_eth_szedata2.c | 2 ++
> drivers/net/xenvirt/rte_eth_xenvirt.c | 2 ++
> lib/librte_cryptodev/rte_cryptodev.c | 14 ++++++++++++++
> lib/librte_cryptodev/rte_cryptodev.h | 2 ++
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 4 ++++
> lib/librte_eal/common/eal_common_dev.c | 11 ++++++++---
> lib/librte_eal/common/include/rte_dev.h | 4 ++++
> 14 files changed, 52 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> index d8ccf05..94752de 100644
> --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> @@ -661,7 +661,9 @@ cryptodev_aesni_mb_uninit(const char *name)
>
> static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
> .name = CRYPTODEV_NAME_AESNI_MB_PMD,
> +#ifndef RTE_NEXT_ABI
> .type = PMD_VDEV,
> +#endif
What about something like:
#ifdef RTE_NEXT_ABI
#define RTE_PMD_SET_TYPE(t)
#else
#define RTE_PMD_SET_TYPE(t) .type = PMD_##t
#endif
and then just:
static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
.name = CRYPTODEV_NAME_AESNI_MB_PMD,
RTE_PMD_SET_TYPE(VDEV),
> .init = cryptodev_aesni_mb_init,
> .uninit = cryptodev_aesni_mb_uninit
> };
> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
> index 767f36b..6603462 100644
> --- a/drivers/net/af_packet/rte_eth_af_packet.c
> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
> @@ -838,7 +838,9 @@ exit:
> [snip]
>
> struct rte_cryptodev *
> +#ifndef RTE_NEXT_ABI
And maybe...
#ifndef RTE_NEXT_ABI
#define RTE_PMD_HAS_TYPE
#endif
#ifdef RTE_PMD_HAS_TYPE
> rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
> +#else
> +rte_cryptodev_pmd_allocate(const char *name, int socket_id)
> +#endif
> {
> struct rte_cryptodev *cryptodev;
> uint8_t dev_id;
> [snip]
Regards
Jan
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers
2016-02-09 17:05 ` Jan Viktorin
@ 2016-02-10 8:51 ` David Marchand
2016-02-10 9:27 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-02-10 8:51 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev
On Tue, Feb 9, 2016 at 6:05 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> Maybe, a better subject?
>
> drivers: init pdev drivers in constructors
Why not, I will try to find a best one, and if I can't, I will go with this.
> On Fri, 29 Jan 2016 15:08:30 +0100
> David Marchand <david.marchand@6wind.com> wrote:
>> -static int
>> -rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
>> +/* Driver registration */
>> +static void __attribute__((constructor, used))
>> +rte_qat_pmd_init(void)
>> {
>> PMD_INIT_FUNC_TRACE();
>> rte_eal_pci_register(&rte_qat_pmd.pci_drv);
>> - return 0;
>> }
>> -
>> -static struct rte_driver pmd_qat_drv = {
>> - .type = PMD_PDEV,
>> - .init = rte_qat_pmd_init,
>> -};
>> -
>> -PMD_REGISTER_DRIVER(pmd_qat_drv);
>
> What about introducing a macro for this?
>
> RTE_REGISTER_PCI_DRIVER(rte_qad_pmd);
Yes.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers
2016-02-10 8:51 ` David Marchand
@ 2016-02-10 9:27 ` David Marchand
2016-02-10 10:20 ` Jan Viktorin
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-02-10 9:27 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev
On Wed, Feb 10, 2016 at 9:51 AM, David Marchand
<david.marchand@6wind.com> wrote:
> On Tue, Feb 9, 2016 at 6:05 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
>> What about introducing a macro for this?
>>
>> RTE_REGISTER_PCI_DRIVER(rte_qad_pmd);
>
> Yes.
The only problem here, is that rte_qad_pmd is a crypto structure (same
problem with ethdev), so I can't just pass it to eal.
I can't just pass the pci driver, for the cases where multiple drivers
are registered in a single file (look at ixgbe driver).
So, how about :
In rte_pci.h :
#define RTE_EAL_PCI_REGISTER(name, d)\
void pciinitfn_ ##name(void);\
void __attribute__((constructor, used)) pciinitfn_ ##name(void)\
{\
rte_eal_pci_register(d);\
}
Then, in qat driver :
RTE_EAL_PCI_REGISTER(qat, &rte_qat_pmd.pci_drv);
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers
2016-02-10 9:27 ` David Marchand
@ 2016-02-10 10:20 ` Jan Viktorin
2016-02-10 11:38 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-02-10 10:20 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Wed, 10 Feb 2016 10:27:14 +0100
David Marchand <david.marchand@6wind.com> wrote:
> On Wed, Feb 10, 2016 at 9:51 AM, David Marchand
> <david.marchand@6wind.com> wrote:
> > On Tue, Feb 9, 2016 at 6:05 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> >> What about introducing a macro for this?
> >>
> >> RTE_REGISTER_PCI_DRIVER(rte_qad_pmd);
> >
> > Yes.
>
> The only problem here, is that rte_qad_pmd is a crypto structure (same
> problem with ethdev), so I can't just pass it to eal.
> I can't just pass the pci driver, for the cases where multiple drivers
> are registered in a single file (look at ixgbe driver).
>
> So, how about :
>
> In rte_pci.h :
>
> #define RTE_EAL_PCI_REGISTER(name, d)\
> void pciinitfn_ ##name(void);\
> void __attribute__((constructor, used)) pciinitfn_ ##name(void)\
> {\
> rte_eal_pci_register(d);\
I meant
rte_eal_pci_register(&(d)->pci_drv);\
Perhaps, my assumption that a PCI driver is always referred as pci_drv is wrong...
> }
>
> Then, in qat driver :
> RTE_EAL_PCI_REGISTER(qat, &rte_qat_pmd.pci_drv);
>
However, I think that this is a detail. Passing rte_pci_driver is good.
Regards
Jan
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 6/9] eal: initialize vdevs right next to pci devices
2016-01-29 14:08 ` [dpdk-dev] [PATCH 6/9] eal: initialize vdevs right next to pci devices David Marchand
@ 2016-02-10 11:05 ` Jan Viktorin
2016-02-10 11:43 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-02-10 11:05 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Fri, 29 Jan 2016 15:08:33 +0100
David Marchand <david.marchand@6wind.com> wrote:
> This way, the resources probing happens in a common place.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> lib/librte_eal/bsdapp/eal/eal.c | 7 +++++++
> lib/librte_eal/common/include/rte_dev.h | 2 +-
> lib/librte_eal/linuxapp/eal/eal.c | 7 +++++++
> 3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> index a34e61d..b557a9f 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -582,8 +582,10 @@ rte_eal_init(int argc, char **argv)
> rte_config.master_lcore, thread_id, cpuset,
> ret == 0 ? "" : "...");
>
> +#ifndef RTE_NEXT_ABI
> if (rte_eal_dev_init() < 0)
> rte_panic("Cannot init pmd devices\n");
> +#endif
>
> RTE_LCORE_FOREACH_SLAVE(i) {
>
> @@ -617,6 +619,11 @@ rte_eal_init(int argc, char **argv)
> rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
> rte_eal_mp_wait_lcore();
>
> +#ifdef RTE_NEXT_ABI
> + if (rte_eal_dev_init() < 0)
> + rte_panic("Cannot probe vdev devices\n");
> +#endif
> +
> /* Probe & Initialize PCI devices */
> if (rte_eal_pci_probe())
> rte_panic("Cannot probe PCI\n");
> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
> index 88c1a19..df69e28 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -156,7 +156,7 @@ void rte_eal_driver_register(struct rte_driver *driver);
> void rte_eal_driver_unregister(struct rte_driver *driver);
>
> /**
> - * Initalize all the registered drivers in this process
> + * Scan all devargs and attach to drivers if available
> */
> int rte_eal_dev_init(void);
Move this to a separate commit? Is it just a forgotten doc comment?
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index 62241ee..95313af 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -834,8 +834,10 @@ rte_eal_init(int argc, char **argv)
> rte_config.master_lcore, (int)thread_id, cpuset,
> ret == 0 ? "" : "...");
>
> +#ifndef RTE_NEXT_ABI
> if (rte_eal_dev_init() < 0)
> rte_panic("Cannot init pmd devices\n");
> +#endif
>
> RTE_LCORE_FOREACH_SLAVE(i) {
>
> @@ -873,6 +875,11 @@ rte_eal_init(int argc, char **argv)
> rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
> rte_eal_mp_wait_lcore();
>
> +#ifdef RTE_NEXT_ABI
> + if (rte_eal_dev_init() < 0)
> + rte_panic("Cannot probe vdev devices\n");
> +#endif
> +
> /* Probe & Initialize PCI devices */
> if (rte_eal_pci_probe())
> rte_panic("Cannot probe PCI\n");
I cannot see the point why it is enclosed in the RTE_NEXT_ABI. Is it
such a serious breakage?
Regards
Jan
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 7/9] pci: add a helper for device name
2016-01-29 14:08 ` [dpdk-dev] [PATCH 7/9] pci: add a helper for device name David Marchand
@ 2016-02-10 11:10 ` Jan Viktorin
2016-02-10 12:04 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-02-10 11:10 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Fri, 29 Jan 2016 15:08:34 +0100
David Marchand <david.marchand@6wind.com> wrote:
> eal is a better place than ethdev for naming resources.
> Add a helper here, and make use of it in ethdev hotplug code.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> lib/librte_eal/common/include/rte_pci.h | 28 ++++++++++++++++++++++++++++
> lib/librte_ether/rte_ethdev.c | 22 ++--------------------
> 2 files changed, 30 insertions(+), 20 deletions(-)
>
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index 334c12e..9edd5f5 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -309,6 +309,34 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
> }
> #undef GET_PCIADDR_FIELD
>
> +/**
> + * Utility function to write a pci device name, this device name can later be
> + * used to retrieve the corresponding rte_pci_addr using above functions.
> + *
> + * @param addr
> + * The PCI Bus-Device-Function address
> + * @param output
> + * The output buffer string
> + * @param size
> + * The output buffer size
> + * @return
> + * 0 on success, negative on error.
> + */
> +static inline int
> +eal_pci_device_name(const struct rte_pci_addr *addr,
> + char *output, int size)
"size_t size" (or unsigned int) seems to be better to me.
> +{
> + int ret;
> +
> + ret = snprintf(output, size, PCI_PRI_FMT,
> + addr->domain, addr->bus,
> + addr->devid, addr->function);
> + if (ret < 0 || ret >= size)
> + return -1;
The return value is not checked (below). I think, such functions
are usually missing error checking as nobody expects them to fail.
Wouldn't it be better to panic here?
> +
> + return 0;
> +}
> +
> /* Compare two PCI device addresses. */
> /**
> * Utility function to compare two PCI device addresses.
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 17e4f4d..5ba7479 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -214,20 +214,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
> return eth_dev;
> }
>
> -static int
> -rte_eth_dev_create_unique_device_name(char *name, size_t size,
> - struct rte_pci_device *pci_dev)
> -{
> - int ret;
> -
> - ret = snprintf(name, size, "%d:%d.%d",
> - pci_dev->addr.bus, pci_dev->addr.devid,
> - pci_dev->addr.function);
> - if (ret < 0)
> - return ret;
> - return 0;
> -}
> -
> int
> rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
> {
> @@ -251,9 +237,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
>
> eth_drv = (struct eth_driver *)pci_drv;
>
> - /* Create unique Ethernet device name using PCI address */
> - rte_eth_dev_create_unique_device_name(ethdev_name,
> - sizeof(ethdev_name), pci_dev);
> + eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name));
>
> eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
> if (eth_dev == NULL)
> @@ -304,9 +288,7 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
> if (pci_dev == NULL)
> return -EINVAL;
>
> - /* Create unique Ethernet device name using PCI address */
> - rte_eth_dev_create_unique_device_name(ethdev_name,
> - sizeof(ethdev_name), pci_dev);
> + eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name));
>
> eth_dev = rte_eth_dev_allocated(ethdev_name);
> if (eth_dev == NULL)
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device
2016-01-29 14:08 ` [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device David Marchand
@ 2016-02-10 11:23 ` Jan Viktorin
2016-02-10 12:00 ` David Marchand
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-02-10 11:23 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Fri, 29 Jan 2016 15:08:35 +0100
David Marchand <david.marchand@6wind.com> wrote:
> It will be used mainly for hotplug code.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++++
> lib/librte_eal/common/eal_private.h | 13 ++++++++++
> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 ++++++++++
> 3 files changed, 75 insertions(+)
>
> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
> index 4584522..5dd89e3 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> @@ -396,6 +396,55 @@ error:
> return -1;
> }
>
> +int
> +pci_refresh_device(const struct rte_pci_addr *addr)
What about pci_reload_device or pci_reload_device_info? I don't mind
too much, only the word 'refresh' reminds me other associations.
> +{
> + int fd;
> + struct pci_conf matches[2];
> + struct pci_match_conf match = {
> + .pc_sel = {
> + .pc_domain = addr->domain,
> + .pc_bus = addr->bus,
> + .pc_dev = addr->devid,
> + .pc_func = addr->function,
> + },
> + };
> + struct pci_conf_io conf_io = {
> + .pat_buf_len = 0,
> + .num_patterns = 1,
> + .patterns = { &match },
> + .match_buf_len = sizeof(matches),
> + .matches = &matches[0],
> + };
> +
> + fd = open("/dev/pci", O_RDONLY);
Just courious who provides this special file... is a DPDK-specific
thing? I haven't noticed it anywhere in Linux.
> + if (fd < 0) {
> + RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
> + goto error;
If you write:
return -1;
then you can...
> + }
> +
> + if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
> + RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
> + __func__, strerror(errno));
> + goto error;
> + }
> +
> + if (conf_io.num_matches != 1)
> + goto error;
> +
> + if (pci_scan_one(fd, &matches[0]) < 0)
> + goto error;
> +
> + close(fd);
> +
> + return 0;
> +
> +error:
...remove this if:
> + if (fd >= 0)
> + close(fd);
Or, do you consider it more stable in the orignal way?
> + return -1;
> +}
> +
> /* Read PCI config space. */
> int rte_eal_pci_read_config(const struct rte_pci_device *dev,
> void *buf, size_t len, off_t offset)
> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
> index 072e672..ed1903f 100644
> --- a/lib/librte_eal/common/eal_private.h
> +++ b/lib/librte_eal/common/eal_private.h
> @@ -155,6 +155,19 @@ struct rte_pci_driver;
> struct rte_pci_device;
>
> /**
> + * Refresh a pci device object by asking the kernel for the latest information.
> + *
> + * This function is private to EAL.
> + *
> + * @param addr
> + * The PCI Bus-Device-Function address to look for
> + * @return
> + * - 0 on success.
> + * - negative on error.
I don't know whether this is a convention in DPDK, anyway, I don't
like to restrict errors to just negatives. You cannot write
if ((err = pci_refresh_device(...)) /* < 0 */) {
handle_error(err);
}
as the check for < 0 is required (easy to be avoided).
> + */
> +int pci_refresh_device(const struct rte_pci_addr *addr);
> +
> +/**
> * Unbind kernel driver for this device
> *
> * This function is private to EAL.
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index a354f76..4fe8b60 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -393,6 +393,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
> return 0;
> }
>
> +int
> +pci_refresh_device(const struct rte_pci_addr *addr)
> +{
> + char filename[PATH_MAX];
> +
> + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
> + SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
> + addr->function);
> +
> + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
> + addr->function);
> +}
> +
> /*
> * split up a pci address into its constituent parts.
> */
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers
2016-02-10 10:20 ` Jan Viktorin
@ 2016-02-10 11:38 ` David Marchand
2016-02-10 12:29 ` Jan Viktorin
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-02-10 11:38 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev
On Wed, Feb 10, 2016 at 11:20 AM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> On Wed, 10 Feb 2016 10:27:14 +0100
> David Marchand <david.marchand@6wind.com> wrote:
>> #define RTE_EAL_PCI_REGISTER(name, d)\
>> void pciinitfn_ ##name(void);\
>> void __attribute__((constructor, used)) pciinitfn_ ##name(void)\
>> {\
>> rte_eal_pci_register(d);\
>
> I meant
> rte_eal_pci_register(&(d)->pci_drv);\
>
> Perhaps, my assumption that a PCI driver is always referred as pci_drv is wrong...
Well, I suppose we will always have a pci driver embedded in some
other internal pmd structure.
So we can always expect it to be called pci_drv ...
Btw, for drivers like mlx or virtio that need to do some more stuff in
their constructor (the iopl stuff for virtio is the most interesting
case, since the pci register happens only if iopl succeeded), we might
need some RTE_MODULE_INIT for those.
But in such a case, I think having RTE_MODULE_INIT in all pmds would
make more sense, and RTE_EAL_PCI_REGISTER looks unneeded ?
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 6/9] eal: initialize vdevs right next to pci devices
2016-02-10 11:05 ` Jan Viktorin
@ 2016-02-10 11:43 ` David Marchand
0 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-02-10 11:43 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev
On Wed, Feb 10, 2016 at 12:05 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> On Fri, 29 Jan 2016 15:08:33 +0100
> David Marchand <david.marchand@6wind.com> wrote:
>> --- a/lib/librte_eal/common/include/rte_dev.h
>> +++ b/lib/librte_eal/common/include/rte_dev.h
>> @@ -156,7 +156,7 @@ void rte_eal_driver_register(struct rte_driver *driver);
>> void rte_eal_driver_unregister(struct rte_driver *driver);
>>
>> /**
>> - * Initalize all the registered drivers in this process
>> + * Scan all devargs and attach to drivers if available
>> */
>> int rte_eal_dev_init(void);
>
> Move this to a separate commit? Is it just a forgotten doc comment?
Should be in previous commit, yes.
>>
>> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
>> index 62241ee..95313af 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal.c
>> @@ -834,8 +834,10 @@ rte_eal_init(int argc, char **argv)
>> rte_config.master_lcore, (int)thread_id, cpuset,
>> ret == 0 ? "" : "...");
>>
>> +#ifndef RTE_NEXT_ABI
>> if (rte_eal_dev_init() < 0)
>> rte_panic("Cannot init pmd devices\n");
>> +#endif
>>
>> RTE_LCORE_FOREACH_SLAVE(i) {
>>
>> @@ -873,6 +875,11 @@ rte_eal_init(int argc, char **argv)
>> rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
>> rte_eal_mp_wait_lcore();
>>
>> +#ifdef RTE_NEXT_ABI
>> + if (rte_eal_dev_init() < 0)
>> + rte_panic("Cannot probe vdev devices\n");
>> +#endif
>> +
>> /* Probe & Initialize PCI devices */
>> if (rte_eal_pci_probe())
>> rte_panic("Cannot probe PCI\n");
>
> I cannot see the point why it is enclosed in the RTE_NEXT_ABI. Is it
> such a serious breakage?
No.
We can make this move unconditional.
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device
2016-02-10 11:23 ` Jan Viktorin
@ 2016-02-10 12:00 ` David Marchand
2016-02-10 12:20 ` Jan Viktorin
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-02-10 12:00 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev
On Wed, Feb 10, 2016 at 12:23 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> On Fri, 29 Jan 2016 15:08:35 +0100
> David Marchand <david.marchand@6wind.com> wrote:
>
>> It will be used mainly for hotplug code.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> ---
>> lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++++
>> lib/librte_eal/common/eal_private.h | 13 ++++++++++
>> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 ++++++++++
>> 3 files changed, 75 insertions(+)
>>
>> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> index 4584522..5dd89e3 100644
>> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
>> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> @@ -396,6 +396,55 @@ error:
>> return -1;
>> }
>>
>> +int
>> +pci_refresh_device(const struct rte_pci_addr *addr)
>
> What about pci_reload_device or pci_reload_device_info? I don't mind
> too much, only the word 'refresh' reminds me other associations.
Or maybe pci_update_device ?
I added pci_add_device in my other pci patchset, so update sounds better to me.
>> +{
>> + int fd;
>> + struct pci_conf matches[2];
>> + struct pci_match_conf match = {
>> + .pc_sel = {
>> + .pc_domain = addr->domain,
>> + .pc_bus = addr->bus,
>> + .pc_dev = addr->devid,
>> + .pc_func = addr->function,
>> + },
>> + };
>> + struct pci_conf_io conf_io = {
>> + .pat_buf_len = 0,
>> + .num_patterns = 1,
>> + .patterns = { &match },
>> + .match_buf_len = sizeof(matches),
>> + .matches = &matches[0],
>> + };
>> +
>> + fd = open("/dev/pci", O_RDONLY);
>
> Just courious who provides this special file... is a DPDK-specific
> thing? I haven't noticed it anywhere in Linux.
I don't know, just took the bsd pci code and plugged myself in it.
So for me this is a special bsd device.
This is mainly copy/paste.
Look at rte_eal_pci_scan() from lib/librte_eal/bsdapp/eal/eal_pci.c.
>
>> + if (fd < 0) {
>> + RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
>> + goto error;
>
> If you write:
> return -1;
>
> then you can...
>
>> + }
>> +
>> + if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
>> + RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
>> + __func__, strerror(errno));
>> + goto error;
>> + }
>> +
>> + if (conf_io.num_matches != 1)
>> + goto error;
>> +
>> + if (pci_scan_one(fd, &matches[0]) < 0)
>> + goto error;
>> +
>> + close(fd);
>> +
>> + return 0;
>> +
>> +error:
>
> ...remove this if:
>
>> + if (fd >= 0)
>> + close(fd);
>
> Or, do you consider it more stable in the orignal way?
Well, as said above, this is copy/paste code.
But, anyway, when I write functions with goto statements, I prefer
having a minimal number of return statements, matter of taste.
Another way is to add two label error_close: error: but this is a bit
overkill here.
>> + return -1;
>> +}
>> +
>> /* Read PCI config space. */
>> int rte_eal_pci_read_config(const struct rte_pci_device *dev,
>> void *buf, size_t len, off_t offset)
>> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
>> index 072e672..ed1903f 100644
>> --- a/lib/librte_eal/common/eal_private.h
>> +++ b/lib/librte_eal/common/eal_private.h
>> @@ -155,6 +155,19 @@ struct rte_pci_driver;
>> struct rte_pci_device;
>>
>> /**
>> + * Refresh a pci device object by asking the kernel for the latest information.
>> + *
>> + * This function is private to EAL.
>> + *
>> + * @param addr
>> + * The PCI Bus-Device-Function address to look for
>> + * @return
>> + * - 0 on success.
>> + * - negative on error.
>
> I don't know whether this is a convention in DPDK, anyway, I don't
> like to restrict errors to just negatives. You cannot write
>
> if ((err = pci_refresh_device(...)) /* < 0 */) {
> handle_error(err);
> }
>
> as the check for < 0 is required (easy to be avoided).
It is a remnant of a lot of code in eal that tries to have 0 for
success, < 0 for errors, > 0 for special cases.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 7/9] pci: add a helper for device name
2016-02-10 11:10 ` Jan Viktorin
@ 2016-02-10 12:04 ` David Marchand
0 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-02-10 12:04 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev
On Wed, Feb 10, 2016 at 12:10 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> On Fri, 29 Jan 2016 15:08:34 +0100
> David Marchand <david.marchand@6wind.com> wrote:
>
>> eal is a better place than ethdev for naming resources.
>> Add a helper here, and make use of it in ethdev hotplug code.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> ---
>> lib/librte_eal/common/include/rte_pci.h | 28 ++++++++++++++++++++++++++++
>> lib/librte_ether/rte_ethdev.c | 22 ++--------------------
>> 2 files changed, 30 insertions(+), 20 deletions(-)
>>
>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>> index 334c12e..9edd5f5 100644
>> --- a/lib/librte_eal/common/include/rte_pci.h
>> +++ b/lib/librte_eal/common/include/rte_pci.h
>> @@ -309,6 +309,34 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
>> }
>> #undef GET_PCIADDR_FIELD
>>
>> +/**
>> + * Utility function to write a pci device name, this device name can later be
>> + * used to retrieve the corresponding rte_pci_addr using above functions.
>> + *
>> + * @param addr
>> + * The PCI Bus-Device-Function address
>> + * @param output
>> + * The output buffer string
>> + * @param size
>> + * The output buffer size
>> + * @return
>> + * 0 on success, negative on error.
>> + */
>> +static inline int
>> +eal_pci_device_name(const struct rte_pci_addr *addr,
>> + char *output, int size)
>
> "size_t size" (or unsigned int) seems to be better to me.
Yes.
>
>> +{
>> + int ret;
>> +
>> + ret = snprintf(output, size, PCI_PRI_FMT,
>> + addr->domain, addr->bus,
>> + addr->devid, addr->function);
>> + if (ret < 0 || ret >= size)
>> + return -1;
>
> The return value is not checked (below). I think, such functions
> are usually missing error checking as nobody expects them to fail.
> Wouldn't it be better to panic here?
assert or panic, yes.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device
2016-02-10 12:00 ` David Marchand
@ 2016-02-10 12:20 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-02-10 12:20 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Wed, 10 Feb 2016 13:00:50 +0100
David Marchand <david.marchand@6wind.com> wrote:
> On Wed, Feb 10, 2016 at 12:23 PM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> > On Fri, 29 Jan 2016 15:08:35 +0100
> > David Marchand <david.marchand@6wind.com> wrote:
> >
> >> It will be used mainly for hotplug code.
> >>
> >> Signed-off-by: David Marchand <david.marchand@6wind.com>
> >> ---
> >> lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++++
> >> lib/librte_eal/common/eal_private.h | 13 ++++++++++
> >> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 ++++++++++
> >> 3 files changed, 75 insertions(+)
> >>
> >> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
> >> index 4584522..5dd89e3 100644
> >> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> >> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> >> @@ -396,6 +396,55 @@ error:
> >> return -1;
> >> }
> >>
> >> +int
> >> +pci_refresh_device(const struct rte_pci_addr *addr)
> >
> > What about pci_reload_device or pci_reload_device_info? I don't mind
> > too much, only the word 'refresh' reminds me other associations.
>
> Or maybe pci_update_device ?
> I added pci_add_device in my other pci patchset, so update sounds better to me.
>
OK.
>
> >> +{
> >> + int fd;
> >> + struct pci_conf matches[2];
> >> + struct pci_match_conf match = {
> >> + .pc_sel = {
> >> + .pc_domain = addr->domain,
> >> + .pc_bus = addr->bus,
> >> + .pc_dev = addr->devid,
> >> + .pc_func = addr->function,
> >> + },
> >> + };
> >> + struct pci_conf_io conf_io = {
> >> + .pat_buf_len = 0,
> >> + .num_patterns = 1,
> >> + .patterns = { &match },
> >> + .match_buf_len = sizeof(matches),
> >> + .matches = &matches[0],
> >> + };
> >> +
> >> + fd = open("/dev/pci", O_RDONLY);
> >
> > Just courious who provides this special file... is a DPDK-specific
> > thing? I haven't noticed it anywhere in Linux.
>
> I don't know, just took the bsd pci code and plugged myself in it.
> So for me this is a special bsd device.
>
> This is mainly copy/paste.
> Look at rte_eal_pci_scan() from lib/librte_eal/bsdapp/eal/eal_pci.c.
BSD... I didn't notice. That's the answer.
>
> >
> >> + if (fd < 0) {
> >> + RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
> >> + goto error;
> >
> > If you write:
> > return -1;
> >
> > then you can...
> >
> >> + }
> >> +
> >> + if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
> >> + RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
> >> + __func__, strerror(errno));
> >> + goto error;
> >> + }
> >> +
> >> + if (conf_io.num_matches != 1)
> >> + goto error;
> >> +
> >> + if (pci_scan_one(fd, &matches[0]) < 0)
> >> + goto error;
> >> +
> >> + close(fd);
> >> +
> >> + return 0;
> >> +
> >> +error:
> >
> > ...remove this if:
> >
> >> + if (fd >= 0)
> >> + close(fd);
> >
> > Or, do you consider it more stable in the orignal way?
>
> Well, as said above, this is copy/paste code.
> But, anyway, when I write functions with goto statements, I prefer
> having a minimal number of return statements, matter of taste.
> Another way is to add two label error_close: error: but this is a bit
> overkill here.
All of them are OK. As for me, I prefer to not hide simple returns.
>
>
> >> + return -1;
> >> +}
> >> +
> >> /* Read PCI config space. */
> >> int rte_eal_pci_read_config(const struct rte_pci_device *dev,
> >> void *buf, size_t len, off_t offset)
> >> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
> >> index 072e672..ed1903f 100644
> >> --- a/lib/librte_eal/common/eal_private.h
> >> +++ b/lib/librte_eal/common/eal_private.h
> >> @@ -155,6 +155,19 @@ struct rte_pci_driver;
> >> struct rte_pci_device;
> >>
> >> /**
> >> + * Refresh a pci device object by asking the kernel for the latest information.
> >> + *
> >> + * This function is private to EAL.
> >> + *
> >> + * @param addr
> >> + * The PCI Bus-Device-Function address to look for
> >> + * @return
> >> + * - 0 on success.
> >> + * - negative on error.
> >
> > I don't know whether this is a convention in DPDK, anyway, I don't
> > like to restrict errors to just negatives. You cannot write
> >
> > if ((err = pci_refresh_device(...)) /* < 0 */) {
> > handle_error(err);
> > }
> >
> > as the check for < 0 is required (easy to be avoided).
>
> It is a remnant of a lot of code in eal that tries to have 0 for
> success, < 0 for errors, > 0 for special cases.
>
OK, makes sense.
>
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers
2016-02-10 11:38 ` David Marchand
@ 2016-02-10 12:29 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-02-10 12:29 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Wed, 10 Feb 2016 12:38:20 +0100
David Marchand <david.marchand@6wind.com> wrote:
> On Wed, Feb 10, 2016 at 11:20 AM, Jan Viktorin <viktorin@rehivetech.com> wrote:
> > On Wed, 10 Feb 2016 10:27:14 +0100
> > David Marchand <david.marchand@6wind.com> wrote:
> >> #define RTE_EAL_PCI_REGISTER(name, d)\
> >> void pciinitfn_ ##name(void);\
> >> void __attribute__((constructor, used)) pciinitfn_ ##name(void)\
> >> {\
> >> rte_eal_pci_register(d);\
> >
> > I meant
> > rte_eal_pci_register(&(d)->pci_drv);\
> >
> > Perhaps, my assumption that a PCI driver is always referred as pci_drv is wrong...
>
> Well, I suppose we will always have a pci driver embedded in some
> other internal pmd structure.
> So we can always expect it to be called pci_drv ...
>
> Btw, for drivers like mlx or virtio that need to do some more stuff in
> their constructor (the iopl stuff for virtio is the most interesting
> case, since the pci register happens only if iopl succeeded), we might
> need some RTE_MODULE_INIT for those.
>
> But in such a case, I think having RTE_MODULE_INIT in all pmds would
> make more sense, and RTE_EAL_PCI_REGISTER looks unneeded ?
>
The Linux Kernel solves this by allowing both ways. You can do it by
hand and for most cases you can use just a simple oneliner.
So, we can have the RTE_(EAL_)MODULE_INIT for the general case. And then
eg. RTE_EAL_PCI_MODULE_INIT that makes the most common glue code to
register a single driver and who finally calls the RTE_EAL_MODULE_INIT.
Regards
Jan
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (8 preceding siblings ...)
2016-01-29 14:08 ` [dpdk-dev] [PATCH 9/9] eal: relocate hotplug code from ethdev David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 01/17] pci: no need for dynamic tailq init David Marchand
` (18 more replies)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
11 siblings, 19 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Following discussions with Jan [1] and some cleanup I started on pci code,
here is a patchset that reworks pdev drivers registration and hotplug api.
The structures changes mentioned in [1] are still to be done, but at least,
I think we are one step closer to it.
Before this patchset, rte_driver .init semantics differed whether it
concerned a pdev or a vdev driver:
- for vdev, it actually meant that a devargs is given to the driver so
that it creates ethdev / crypto objects, so it was a probing action
- for pdev, it only registered the driver triggering no ethdev / crypto
objects
>From my pov, eal hotplug api introduced in this patchset still needs more
work so that it does not need to know about devargs. So a new devargs api
is needed.
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
[1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
Regards,
--
David Marchand
David Marchand (17):
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: remove duplicate function declaration
eal: introduce init macros
crypto: export init/uninit common wrappers for pci drivers
ethdev: export init/uninit common wrappers for pci drivers
drivers: convert all pdev drivers as pci drivers
crypto: get rid of crypto driver register callback
ethdev: get rid of eth driver register callback
eal/linux: move back interrupt thread init before setting affinity
pci: add a helper for device name
pci: add a helper to update a device
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +--
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/e1000/em_ethdev.c | 16 +-
drivers/net/e1000/igb_ethdev.c | 40 +--
drivers/net/ena/ena_ethdev.c | 20 +-
drivers/net/enic/enic_ethdev.c | 23 +-
drivers/net/fm10k/fm10k_ethdev.c | 23 +-
drivers/net/i40e/i40e_ethdev.c | 26 +-
drivers/net/i40e/i40e_ethdev_vf.c | 25 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +---
drivers/net/mlx4/mlx4.c | 22 +-
drivers/net/mlx5/mlx5.c | 21 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/nfp/nfp_net.c | 23 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 25 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 26 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 67 +----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 +---
lib/librte_cryptodev/rte_cryptodev_version.map | 9 +-
lib/librte_eal/bsdapp/eal/eal_pci.c | 52 +++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +
lib/librte_eal/common/eal_common_dev.c | 39 +++
lib/librte_eal/common/eal_common_pci.c | 17 +-
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_dev.h | 29 ++-
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 32 +++
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/linuxapp/eal/eal.c | 7 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +
lib/librte_ether/rte_ethdev.c | 316 ++++--------------------
lib/librte_ether/rte_ethdev.h | 40 ++-
lib/librte_ether/rte_ether_version.map | 9 +-
47 files changed, 392 insertions(+), 810 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 01/17] pci: no need for dynamic tailq init
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 02/17] crypto: no need for a crypto pmd type David Marchand
` (17 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 2d16d78..cd8e8d3 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -618,9 +618,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 40f4922..80d8ec6 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
{
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index dbf12a8..3fc82b0 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -731,9 +731,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 02/17] crypto: no need for a crypto pmd type
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 01/17] pci: no need for dynamic tailq init David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 03/17] drivers: align pci driver definitions David Marchand
` (16 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index aa4ea42..bf35df0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -230,7 +230,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -269,7 +269,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -318,7 +317,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -360,8 +359,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index d47f1e8..2d0b809 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -697,8 +697,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 03/17] drivers: align pci driver definitions
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 01/17] pci: no need for dynamic tailq init David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 02/17] crypto: no need for a crypto pmd type David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 04/17] eal: remove duplicate function declaration David Marchand
` (15 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index a7912f5..08496ab 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,7 +116,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 02af67a..fbc96ae 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1429,7 +1429,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index bcf5fa9..fb23b74 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2474,7 +2474,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 04/17] eal: remove duplicate function declaration
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (2 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 03/17] drivers: align pci driver definitions David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 05/17] eal: introduce init macros David Marchand
` (14 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 2342fa1..855fd25 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -262,13 +262,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 8aafd51..f26f8d3 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 05/17] eal: introduce init macros
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (3 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 04/17] eal: remove duplicate function declaration David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 12:33 ` Jan Viktorin
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 06/17] crypto: export init/uninit common wrappers for pci drivers David Marchand
` (13 subsequent siblings)
18 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
RTE_EAL_PCI_REGISTER is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 7 +++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f1b5507..85e48f2 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -179,8 +179,8 @@ int rte_eal_vdev_init(const char *name, const char *args);
int rte_eal_vdev_uninit(const char *name);
#define PMD_REGISTER_DRIVER(d)\
-void devinitfn_ ##d(void);\
-void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+RTE_INIT(devinitfn_ ##d);\
+static void devinitfn_ ##d(void)\
{\
rte_eal_driver_register(&d);\
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index e692094..f99b33a 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -471,6 +471,13 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+#define RTE_EAL_PCI_REGISTER(name, d) \
+RTE_INIT(pciinitfn_ ##name); \
+static void pciinitfn_ ##name(void) \
+{ \
+ rte_eal_pci_register(&d); \
+}
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index 4a686e6..71ed3bb 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 06/17] crypto: export init/uninit common wrappers for pci drivers
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (4 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 05/17] eal: introduce init macros David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 07/17] ethdev: " David Marchand
` (12 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
that can be used by pci drivers that assume a 1 to 1 association between
pci resource and upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 8 ++++++++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index bf35df0..19a9939 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -340,9 +340,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -401,8 +401,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -450,15 +450,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 41004e1..8d0edfb 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -32,3 +32,11 @@ DPDK_16.04 {
local: *;
};
+
+DPDK_16.07 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+
+} DPDK_16.04;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 07/17] ethdev: export init/uninit common wrappers for pci drivers
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (5 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 06/17] crypto: export init/uninit common wrappers for pci drivers David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 08/17] drivers: convert all pdev drivers as " David Marchand
` (11 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Preparing for getting rid of eth_drv, here are two wrappers that can be
used by pci drivers that assume a 1 to 1 association between pci resource and
upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 8 ++++++++
3 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a31018e..7b908a7 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -239,9 +239,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -293,8 +293,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -351,8 +351,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 022733e..7a7a69e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4279,6 +4279,19 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
uint32_t mask,
uint8_t en);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 214ecc7..31017d4 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -132,3 +132,11 @@ DPDK_16.04 {
rte_eth_tx_buffer_set_err_callback;
} DPDK_2.2;
+
+DPDK_16.07 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_16.04;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 08/17] drivers: convert all pdev drivers as pci drivers
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (6 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 07/17] ethdev: " David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 09/17] crypto: get rid of crypto driver register callback David Marchand
` (10 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
virtio and mlx* drivers use the general purpose RTE_INIT macro, as they both
need some special stuff to be done before registering a pci driver.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++--------
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +++++-------------------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++--------
drivers/net/e1000/igb_ethdev.c | 40 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 18 +++----------
drivers/net/enic/enic_ethdev.c | 23 +++-------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++-------------
drivers/net/i40e/i40e_ethdev.c | 26 +++---------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +++++----------------------------
drivers/net/mlx4/mlx4.c | 20 +++-----------
drivers/net/mlx5/mlx5.c | 19 +++----------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/szedata2/rte_eth_szedata2.c | 25 +++---------------
drivers/net/virtio/virtio_ethdev.c | 26 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++-------------
17 files changed, 68 insertions(+), 359 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 08496ab..54f0c95 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -120,21 +120,11 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv);
+RTE_EAL_PCI_REGISTER(qat, rte_qat_pmd.pci_drv);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 071b44f..ba194b5 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -506,11 +506,15 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
+RTE_EAL_PCI_REGISTER(bnx2x, rte_bnx2x_pmd.pci_drv);
+
/*
* virtual function driver struct
*/
@@ -519,36 +523,11 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver);
+RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index bb134e5..72b1a7b 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -870,29 +870,11 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .name = "cxgbe_driver",
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver);
+RTE_EAL_PCI_REGISTER(cxgbe, rte_cxgbe_pmd.pci_drv);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 653be09..1f80c05 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -368,18 +368,15 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(em, rte_em_pmd.pci_drv);
static int
em_hw_init(struct e1000_hw *hw)
@@ -1771,10 +1768,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr);
return 0;
}
-
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index e0053fe..9b5f985 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -975,12 +975,16 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
+RTE_EAL_PCI_REGISTER(igb, rte_igb_pmd.pci_drv);
+
/*
* virtual function driver struct
*/
@@ -989,18 +993,15 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(igbvf, rte_igbvf_pmd.pci_drv);
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
@@ -1013,20 +1014,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -4807,16 +4794,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -4977,6 +4954,3 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-
-PMD_REGISTER_DRIVER(pmd_igb_drv);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index fbc96ae..2b60a67 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1433,23 +1433,11 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .name = "ena_driver",
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv);
+RTE_EAL_PCI_REGISTER(ena, rte_ena_pmd.pci_drv);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6bea940..7539811 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -660,28 +660,11 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver);
+RTE_EAL_PCI_REGISTER(enic, rte_enic_pmd.pci_drv);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c2d377f..146bc2a 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3030,29 +3030,12 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver);
+RTE_EAL_PCI_REGISTER(fm10k, rte_pmd_fm10k.pci_drv);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bc28d3c..4e87399 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -641,12 +641,16 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
+RTE_EAL_PCI_REGISTER(i40e, rte_i40e_pmd.pci_drv);
+
static inline int
rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev,
struct rte_eth_link *link)
@@ -676,28 +680,6 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
}
/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver);
-
-/*
* Initialize registers for flexible payload, which should be set by NVM.
* This should be removed from code once it is fixed in NVM.
*/
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 2bce69b..1e41b3a 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1533,34 +1533,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver);
+RTE_EAL_PCI_REGISTER(i40evf, rte_i40evf_pmd.pci_drv);
static int
i40evf_dev_configure(struct rte_eth_dev *dev)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3f1ebc1..5103c7c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1484,12 +1484,16 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
+RTE_EAL_PCI_REGISTER(ixgbe, rte_ixgbe_pmd.pci_drv);
+
/*
* virtual function driver struct
*/
@@ -1498,39 +1502,15 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(ixgbevf, rte_ixgbevf_pmd.pci_drv);
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
@@ -7134,16 +7114,3 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
}
-
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 4f21dbe..8e4b0cc 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5789,15 +5789,10 @@ static struct eth_driver mlx4_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5808,13 +5803,4 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .name = MLX4_DRIVER_NAME,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 041cfc3..1989a37 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -646,14 +646,10 @@ static struct eth_driver mlx5_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -663,13 +659,4 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .name = MLX5_DRIVER_NAME,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index fb23b74..baa840e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2478,29 +2478,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver);
+RTE_EAL_PCI_REGISTER(nfp_net, rte_nfp_net_pmd.pci_drv);
/*
* Local variables:
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 78c43b0..acada05 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,12 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .name = RTE_SZEDATA2_DRIVER_NAME,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver);
+RTE_EAL_PCI_REGISTER(szedata2, szedata2_eth_driver.pci_drv);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 63a368a..f8cc158 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1206,29 +1206,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1452,10 +1447,3 @@ __rte_unused uint8_t is_rx)
{
return 0;
}
-
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index bd7a2bb..375e681 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -332,25 +332,15 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(vmxnet3, rte_vmxnet3_pmd.pci_drv);
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
@@ -949,10 +939,3 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 09/17] crypto: get rid of crypto driver register callback
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (7 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 08/17] drivers: convert all pdev drivers as " David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 10/17] ethdev: get rid of eth " David Marchand
` (9 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Now that all pdev are pci drivers, we don't need to register crypto drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
3 files changed, 53 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 19a9939..d9648a2 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -444,28 +444,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 8d0edfb..e0a9620 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 10/17] ethdev: get rid of eth driver register callback
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (8 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 09/17] crypto: get rid of crypto driver register callback David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 11/17] eal/linux: move back interrupt thread init before setting affinity David Marchand
` (8 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Now that all pdev are pci drivers, we don't need to register ethdev drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 22 ----------------------
lib/librte_ether/rte_ethdev.h | 12 ------------
lib/librte_ether/rte_ether_version.map | 1 -
3 files changed, 35 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 7b908a7..7ec8cdb 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -334,28 +334,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7a7a69e..016ce33 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1868,18 +1868,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 31017d4..d457b21 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -80,7 +80,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 11/17] eal/linux: move back interrupt thread init before setting affinity
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (9 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 10/17] ethdev: get rid of eth " David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name David Marchand
` (7 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Now that virtio pci driver is initialized in a constructor, iopl() stuff
happens early enough so that interrupt thread can be created right after
plugin loading.
This way, chelsio driver should be happy again [1].
[1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index f26f8d3..4b28197 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -825,6 +825,9 @@ rte_eal_init(int argc, char **argv)
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");
+ if (rte_eal_intr_init() < 0)
+ rte_panic("Cannot init interrupt-handling thread\n");
+
eal_thread_init_master(rte_config.master_lcore);
ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
@@ -836,9 +839,6 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
- if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (10 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 11/17] eal/linux: move back interrupt thread init before setting affinity David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-05-04 15:25 ` Bruce Richardson
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 13/17] pci: add a helper to update a device David Marchand
` (6 subsequent siblings)
18 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
eal is a better place than crypto / ethdev for naming resources.
Add a helper in eal and make use of it in crypto / ethdev.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
3 files changed, 33 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index d9648a2..6f4d1c4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -276,23 +276,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -355,9 +338,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -412,9 +394,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index f99b33a..3bb1833 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ extern struct pci_device_list pci_device_list; /**< Global list of PCI devices.
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -309,6 +311,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using above functions.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 7ec8cdb..9d5827b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -214,20 +214,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -251,9 +237,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -304,9 +289,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 13/17] pci: add a helper to update a device
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (11 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 14/17] ethdev: do not scan all pci devices on attach David Marchand
` (5 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
This helper updates a pci device object with latest information it can
find.
It will be used mainly for hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 13 ++++++++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 ++++++++++
3 files changed, 75 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index cd8e8d3..85e49f6 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -401,6 +401,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 855fd25..81816a6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -155,6 +155,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 3fc82b0..61ac21f 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -393,6 +393,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 14/17] ethdev: do not scan all pci devices on attach
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (12 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 13/17] pci: add a helper to update a device David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev David Marchand
` (4 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 80d8ec6..d63b47b 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -325,6 +325,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -337,9 +342,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 9d5827b..6cd6455 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -468,9 +468,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (13 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 14/17] ethdev: do not scan all pci devices on attach David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-05-27 10:39 ` Iremonger, Bernard
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 16/17] ethdev: convert to eal hotplug David Marchand
` (3 subsequent siblings)
18 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
hotplug which deals with resources should come from the layer that already
handles them, i.e. eal.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +++++
lib/librte_eal/common/eal_common_dev.c | 39 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 25 ++++++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +++++
4 files changed, 80 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 58c2951..4d075df 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -151,3 +151,11 @@ DPDK_16.04 {
rte_eal_primary_proc_alive;
} DPDK_2.2;
+
+DPDK_16.07 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+
+} DPDK_16.04;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..59ed3a0 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,42 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+ int ret = -1;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ return ret;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
+ return -1;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 85e48f2..b1c0520 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a resource to a registered driver.
+ *
+ * @param name
+ * The resource name, that refers to a pci resource or some private
+ * way of designating a resource for vdev drivers. Based on this
+ * resource name, eal will identify a driver capable of handling
+ * this resource and pass this resource to the driver probing
+ * function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a resource from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define PMD_REGISTER_DRIVER(d)\
RTE_INIT(devinitfn_ ##d);\
static void devinitfn_ ##d(void)\
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 12503ef..0404a52 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -154,3 +154,11 @@ DPDK_16.04 {
rte_eal_primary_proc_alive;
} DPDK_2.2;
+
+DPDK_16.07 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+
+} DPDK_16.04;
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 16/17] ethdev: convert to eal hotplug
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (14 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 17/17] ethdev: get rid of device type David Marchand
` (2 subsequent siblings)
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 252 ++++++------------------------------------
1 file changed, 33 insertions(+), 219 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6cd6455..1794025 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -210,6 +211,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -342,100 +344,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- if (!rte_eth_dev_is_valid_port(port_id))
- return RTE_ETH_DEV_UNKNOWN;
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
-static int
-rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
-{
- char *tmp;
-
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (name == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- /* shouldn't check 'rte_eth_devices[i].data',
- * because it might be overwritten by VDEV PMD */
- tmp = rte_eth_dev_data[port_id].name;
- strcpy(name, tmp);
- return 0;
-}
-
-static int
-rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
-{
- int i;
-
- if (name == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- if (!strncmp(name,
- rte_eth_dev_data[i].name, strlen(name))) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
@@ -464,124 +372,45 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ ret = -1;
+ goto err;
}
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
+ }
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -589,7 +418,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -597,33 +425,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v2 17/17] ethdev: get rid of device type
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (15 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 16/17] ethdev: convert to eal hotplug David Marchand
@ 2016-04-20 11:44 ` David Marchand
2016-04-20 12:05 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver Bruce Richardson
2016-05-27 10:23 ` Iremonger, Bernard
18 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-04-20 11:44 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, viktorin
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
15 files changed, 15 insertions(+), 51 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f17bd7e..36ac102 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -648,7 +648,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index e9247b5..c72807c 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -193,7 +193,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 8e4b0cc..0c76e72 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5667,7 +5667,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 1989a37..f6399fc 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -519,7 +519,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index adcbc19..4e29931 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 5e8e203..e6c74a6 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -514,7 +514,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index c98e234..2d00d04 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index b1783c3..b78d1cf 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 310cbef..4e99360 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -717,7 +717,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index b9638d9..663fb14 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -663,7 +663,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 83422e8..476d372 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -604,29 +604,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -734,11 +717,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 1794025..55b32da 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -185,7 +185,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -210,7 +210,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -242,7 +241,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 016ce33..d120522 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1600,17 +1600,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1640,7 +1629,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
};
struct rte_eth_dev_sriov {
@@ -1753,8 +1741,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
1.9.1
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (16 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 17/17] ethdev: get rid of device type David Marchand
@ 2016-04-20 12:05 ` Bruce Richardson
2016-04-20 12:41 ` Jan Viktorin
2016-05-27 10:23 ` Iremonger, Bernard
18 siblings, 1 reply; 375+ messages in thread
From: Bruce Richardson @ 2016-04-20 12:05 UTC (permalink / raw)
To: David Marchand; +Cc: dev, thomas.monjalon, viktorin
On Wed, Apr 20, 2016 at 01:44:00PM +0200, David Marchand wrote:
> Following discussions with Jan [1] and some cleanup I started on pci code,
> here is a patchset that reworks pdev drivers registration and hotplug api.
>
> The structures changes mentioned in [1] are still to be done, but at least,
> I think we are one step closer to it.
>
> Before this patchset, rte_driver .init semantics differed whether it
> concerned a pdev or a vdev driver:
> - for vdev, it actually meant that a devargs is given to the driver so
> that it creates ethdev / crypto objects, so it was a probing action
> - for pdev, it only registered the driver triggering no ethdev / crypto
> objects
>
> From my pov, eal hotplug api introduced in this patchset still needs more
> work so that it does not need to know about devargs. So a new devargs api
> is needed.
>
> Changes since v1:
> - rebased on HEAD, new drivers should be okay
> - patches have been split into smaller pieces
> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> - device type has been removed from ethdev, as it was used only by hotplug
> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> dropped for now, we can do this once vdev drivers have been converted
>
> [1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
>
> Regards,
> --
> David Marchand
>
Nice, David. Looks to be some good improvements in there!
/Bruce
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/17] eal: introduce init macros
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 05/17] eal: introduce init macros David Marchand
@ 2016-04-20 12:33 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-04-20 12:33 UTC (permalink / raw)
To: David Marchand; +Cc: dev, thomas.monjalon
Hello,
just an idea...
On Wed, 20 Apr 2016 13:44:05 +0200
David Marchand <david.marchand@6wind.com> wrote:
> Introduce a RTE_INIT macro used to mark an init function as a constructor.
> Current eal macros have been converted to use this (no functional impact).
> RTE_EAL_PCI_REGISTER is added as a helper for pci drivers.
>
> Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
[...]
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index e692094..f99b33a 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -471,6 +471,13 @@ void rte_eal_pci_dump(FILE *f);
> */
> void rte_eal_pci_register(struct rte_pci_driver *driver);
>
> +#define RTE_EAL_PCI_REGISTER(name, d) \
What about a simple version with just a single argument?
#define RTE_EAL_PCI_REGISTER(name)
RTE_INIT(pciinitfn_ ##name); \
static void pciinitfn_ ##name(void) \
{ \
rte_eal_pci_register(&(name).pci_drv); \
}
Then the name pci_drv would be mandatory... But anyway, the 'name' and 'd'
are usually duplicates.
Regards
Jan
> +RTE_INIT(pciinitfn_ ##name); \
> +static void pciinitfn_ ##name(void) \
> +{ \
> + rte_eal_pci_register(&d); \
> +}
> +
> /**
> * Unregister a PCI driver.
> *
> diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
> index 4a686e6..71ed3bb 100644
> --- a/lib/librte_eal/common/include/rte_tailq.h
> +++ b/lib/librte_eal/common/include/rte_tailq.h
> @@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
> int rte_eal_tailq_register(struct rte_tailq_elem *t);
>
> #define EAL_REGISTER_TAILQ(t) \
> -void tailqinitfn_ ##t(void); \
> -void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
> +RTE_INIT(tailqinitfn_ ##t); \
> +static void tailqinitfn_ ##t(void) \
> { \
> if (rte_eal_tailq_register(&t) < 0) \
> rte_panic("Cannot initialize tailq: %s\n", t.name); \
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-04-20 12:05 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver Bruce Richardson
@ 2016-04-20 12:41 ` Jan Viktorin
2016-04-22 10:18 ` Jan Viktorin
2016-05-06 9:26 ` Declan Doherty
0 siblings, 2 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-04-20 12:41 UTC (permalink / raw)
To: Bruce Richardson; +Cc: David Marchand, dev, thomas.monjalon
On Wed, 20 Apr 2016 13:05:24 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> On Wed, Apr 20, 2016 at 01:44:00PM +0200, David Marchand wrote:
> > Following discussions with Jan [1] and some cleanup I started on pci code,
> > here is a patchset that reworks pdev drivers registration and hotplug api.
> >
> > The structures changes mentioned in [1] are still to be done, but at least,
> > I think we are one step closer to it.
> >
> > Before this patchset, rte_driver .init semantics differed whether it
> > concerned a pdev or a vdev driver:
> > - for vdev, it actually meant that a devargs is given to the driver so
> > that it creates ethdev / crypto objects, so it was a probing action
> > - for pdev, it only registered the driver triggering no ethdev / crypto
> > objects
> >
> > From my pov, eal hotplug api introduced in this patchset still needs more
> > work so that it does not need to know about devargs. So a new devargs api
> > is needed.
> >
> > Changes since v1:
> > - rebased on HEAD, new drivers should be okay
> > - patches have been split into smaller pieces
> > - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> > - device type has been removed from ethdev, as it was used only by hotplug
> > - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> > dropped for now, we can do this once vdev drivers have been converted
> >
> > [1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> >
> > Regards,
> > --
> > David Marchand
> >
> Nice, David. Looks to be some good improvements in there!
>
> /Bruce
Looks good for me but I've failed to apply the series on top of
commit 7d619406f31ddf115714b32778c33f6dc0ead470
Author: Thomas Monjalon <thomas.monjalon@6wind.com>
Date: Thu Apr 14 20:49:49 2016 +0200
pci: remove deprecated specific config
Jan
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-04-20 12:41 ` Jan Viktorin
@ 2016-04-22 10:18 ` Jan Viktorin
2016-05-06 9:26 ` Declan Doherty
1 sibling, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-04-22 10:18 UTC (permalink / raw)
To: David Marchand; +Cc: Bruce Richardson, dev, thomas.monjalon
[...]
> > >
> > > Changes since v1:
> > > - rebased on HEAD, new drivers should be okay
> > > - patches have been split into smaller pieces
> > > - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> > > - device type has been removed from ethdev, as it was used only by hotplug
> > > - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> > > dropped for now, we can do this once vdev drivers have been converted
> > >
> > > [1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> > >
> > > Regards,
> > > --
> > > David Marchand
> > >
> > Nice, David. Looks to be some good improvements in there!
> >
> > /Bruce
>
> Looks good for me but I've failed to apply the series on top of
>
> commit 7d619406f31ddf115714b32778c33f6dc0ead470
> Author: Thomas Monjalon <thomas.monjalon@6wind.com>
> Date: Thu Apr 14 20:49:49 2016 +0200
>
> pci: remove deprecated specific config
OK, it works, my fault.
What is the way of removing the pmd_type? Would you like to introduce something like
rte_virt_device/driver pair for this purpose? Or should they use the rte_device/rte_driver
directly?
Other points:
* The devinit/devuninit should be generalized and moved to rte_driver, right?
* Fields name, drv_flags should be moved to rte_driver.
* Fields devargs, intr_handle, numa_node should be moved to rte_device.
* Do we want getter/setters for those? Otherwise, it always looks like pci_dev->dev.numa_node.
* What about pci_driver_list and pci_device_list? Should we have separated lists for every
kind of device + driver? or should there be a single list (and so we have to put some
discriminator into the rte_device/driver)? This influences placing of the TAILQ_ENTRY(...) next.
* if we move the next into the rte_driver/device and a discriminator of their type there, all
TAILQ_FOREACH loops will look ugly as we have to check the discriminator...
Regards
Jan
>
> Jan
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name David Marchand
@ 2016-05-04 15:25 ` Bruce Richardson
2016-05-04 16:26 ` Thomas Monjalon
0 siblings, 1 reply; 375+ messages in thread
From: Bruce Richardson @ 2016-05-04 15:25 UTC (permalink / raw)
To: David Marchand; +Cc: dev, thomas.monjalon, viktorin
On Wed, Apr 20, 2016 at 01:44:12PM +0200, David Marchand wrote:
> eal is a better place than crypto / ethdev for naming resources.
> Add a helper in eal and make use of it in crypto / ethdev.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
> lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
> lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
> 3 files changed, 33 insertions(+), 43 deletions(-)
>
FYI: I see a compile error after applying this patch. It's unrelated directly to
this patch as root cause seems to be rte_debug.h missing an include for
rte_branch_prediction.h
/Bruce
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name
2016-05-04 15:25 ` Bruce Richardson
@ 2016-05-04 16:26 ` Thomas Monjalon
2016-05-04 16:36 ` Bruce Richardson
0 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-05-04 16:26 UTC (permalink / raw)
To: Bruce Richardson; +Cc: David Marchand, dev, viktorin
2016-05-04 16:25, Bruce Richardson:
> On Wed, Apr 20, 2016 at 01:44:12PM +0200, David Marchand wrote:
> > eal is a better place than crypto / ethdev for naming resources.
> > Add a helper in eal and make use of it in crypto / ethdev.
> >
> > Signed-off-by: David Marchand <david.marchand@6wind.com>
> > ---
> > lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
> > lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
> > lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
> > 3 files changed, 33 insertions(+), 43 deletions(-)
> >
> FYI: I see a compile error after applying this patch. It's unrelated directly to
> this patch as root cause seems to be rte_debug.h missing an include for
> rte_branch_prediction.h
It's probably due to this recent commit:
http://dpdk.org/browse/dpdk/diff/lib/librte_eal/common/include/rte_debug.h?id=50705e
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name
2016-05-04 16:26 ` Thomas Monjalon
@ 2016-05-04 16:36 ` Bruce Richardson
0 siblings, 0 replies; 375+ messages in thread
From: Bruce Richardson @ 2016-05-04 16:36 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: David Marchand, dev, viktorin
On Wed, May 04, 2016 at 06:26:18PM +0200, Thomas Monjalon wrote:
> 2016-05-04 16:25, Bruce Richardson:
> > On Wed, Apr 20, 2016 at 01:44:12PM +0200, David Marchand wrote:
> > > eal is a better place than crypto / ethdev for naming resources.
> > > Add a helper in eal and make use of it in crypto / ethdev.
> > >
> > > Signed-off-by: David Marchand <david.marchand@6wind.com>
> > > ---
> > > lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
> > > lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
> > > lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
> > > 3 files changed, 33 insertions(+), 43 deletions(-)
> > >
> > FYI: I see a compile error after applying this patch. It's unrelated directly to
> > this patch as root cause seems to be rte_debug.h missing an include for
> > rte_branch_prediction.h
>
> It's probably due to this recent commit:
> http://dpdk.org/browse/dpdk/diff/lib/librte_eal/common/include/rte_debug.h?id=50705e
Yes, patch is in the works here...
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-04-20 12:41 ` Jan Viktorin
2016-04-22 10:18 ` Jan Viktorin
@ 2016-05-06 9:26 ` Declan Doherty
2016-05-06 11:46 ` Jan Viktorin
1 sibling, 1 reply; 375+ messages in thread
From: Declan Doherty @ 2016-05-06 9:26 UTC (permalink / raw)
To: Jan Viktorin, Bruce Richardson; +Cc: David Marchand, dev, thomas.monjalon
On 20/04/16 13:41, Jan Viktorin wrote:
> On Wed, 20 Apr 2016 13:05:24 +0100
> Bruce Richardson <bruce.richardson@intel.com> wrote:
>
>> On Wed, Apr 20, 2016 at 01:44:00PM +0200, David Marchand wrote:
>>> Following discussions with Jan [1] and some cleanup I started on pci code,
>>> here is a patchset that reworks pdev drivers registration and hotplug api.
>>>
>>> The structures changes mentioned in [1] are still to be done, but at least,
>>> I think we are one step closer to it.
>>>
>>> Before this patchset, rte_driver .init semantics differed whether it
>>> concerned a pdev or a vdev driver:
>>> - for vdev, it actually meant that a devargs is given to the driver so
>>> that it creates ethdev / crypto objects, so it was a probing action
>>> - for pdev, it only registered the driver triggering no ethdev / crypto
>>> objects
>>>
>>> From my pov, eal hotplug api introduced in this patchset still needs more
>>> work so that it does not need to know about devargs. So a new devargs api
>>> is needed.
>>>
>>> Changes since v1:
>>> - rebased on HEAD, new drivers should be okay
>>> - patches have been split into smaller pieces
>>> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
>>> - device type has been removed from ethdev, as it was used only by hotplug
>>> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
>>> dropped for now, we can do this once vdev drivers have been converted
>>>
>>> [1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
>>>
>>> Regards,
>>> --
>>> David Marchand
>>>
>> Nice, David. Looks to be some good improvements in there!
>>
>> /Bruce
>
> Looks good for me but I've failed to apply the series on top of
>
> commit 7d619406f31ddf115714b32778c33f6dc0ead470
> Author: Thomas Monjalon <thomas.monjalon@6wind.com>
> Date: Thu Apr 14 20:49:49 2016 +0200
>
> pci: remove deprecated specific config
>
> Jan
>
The changes look good to me, nice to remove some of the duplication
ethdev/cryptodev.
Regarding enabling hot-plugging for crypto devices it looks like it
should be possible now to implement a mostly generic device
attach/detach functions, just with a simple wrapper to identify a
specific crypto or ethdev device structure. Do you have plans to do
this? If not, I can have a look as I would like to enable hot-plugging
for crypto devices, without duplicating things that still reside in the
ethdev library at the moment.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-05-06 9:26 ` Declan Doherty
@ 2016-05-06 11:46 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-05-06 11:46 UTC (permalink / raw)
To: Declan Doherty; +Cc: Bruce Richardson, David Marchand, dev, thomas.monjalon
Hello,
On Fri, 6 May 2016 10:26:45 +0100
Declan Doherty <declan.doherty@intel.com> wrote:
> On 20/04/16 13:41, Jan Viktorin wrote:
> > On Wed, 20 Apr 2016 13:05:24 +0100
> > Bruce Richardson <bruce.richardson@intel.com> wrote:
> >
> >> On Wed, Apr 20, 2016 at 01:44:00PM +0200, David Marchand wrote:
> >>> Following discussions with Jan [1] and some cleanup I started on pci code,
> >>> here is a patchset that reworks pdev drivers registration and hotplug api.
> >>>
[...]
>
> The changes look good to me, nice to remove some of the duplication
> ethdev/cryptodev.
Yes, I like them too.
>
> Regarding enabling hot-plugging for crypto devices it looks like it
> should be possible now to implement a mostly generic device
> attach/detach functions, just with a simple wrapper to identify a
> specific crypto or ethdev device structure. Do you have plans to do
> this? If not, I can have a look as I would like to enable hot-plugging
Yes. But, first I focused on the new SoC infra to find out what can be
shared by the generic layer. I've got almost ready patch series, I will
post it soon to the mailing list. It does not introduce the generic
rte_driver/device yet, however, it shows that with
[PATCH v2 00/17] prepare for rte_device / rte_driver
it is now possible to do it quite easily.
However, what I am not very sure about is whether we separate
management of the PCI devices and SoC devices and any other such
devices. Or whether we should have a single list for all.
Second, the rte_driver must be removed from DPDK as it conflicts
with the new rte_driver structure to be introduced. This should include
removing of pmd_type, I think. I've expected that David M. will continue
with v3 to move on (otherwise we'll get some merge conflicts I'd like to
avoid).
Another thing, there are structs like rte_pci_addr (etc.) which must
(but I am not so sure) be probably generalized as well.
And, devargs...
Regards
Jan
> for crypto devices, without duplicating things that still reside in the
> ethdev library at the moment.
>
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
` (17 preceding siblings ...)
2016-04-20 12:05 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver Bruce Richardson
@ 2016-05-27 10:23 ` Iremonger, Bernard
2016-06-16 6:32 ` Shreyansh Jain
18 siblings, 1 reply; 375+ messages in thread
From: Iremonger, Bernard @ 2016-05-27 10:23 UTC (permalink / raw)
To: David Marchand, dev; +Cc: thomas.monjalon, viktorin
Hi David,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Marchand
> Sent: Wednesday, April 20, 2016 12:44 PM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; viktorin@rehivetech.com
> Subject: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
>
> Following discussions with Jan [1] and some cleanup I started on pci code,
> here is a patchset that reworks pdev drivers registration and hotplug api.
>
> The structures changes mentioned in [1] are still to be done, but at least, I
> think we are one step closer to it.
>
> Before this patchset, rte_driver .init semantics differed whether it concerned
> a pdev or a vdev driver:
> - for vdev, it actually meant that a devargs is given to the driver so
> that it creates ethdev / crypto objects, so it was a probing action
> - for pdev, it only registered the driver triggering no ethdev / crypto
> objects
>
> From my pov, eal hotplug api introduced in this patchset still needs more
> work so that it does not need to know about devargs. So a new devargs api is
> needed.
>
> Changes since v1:
> - rebased on HEAD, new drivers should be okay
> - patches have been split into smaller pieces
> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> - device type has been removed from ethdev, as it was used only by hotplug
> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> dropped for now, we can do this once vdev drivers have been converted
>
> [1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
>
> Regards,
> --
> David Marchand
>
> David Marchand (17):
> pci: no need for dynamic tailq init
> crypto: no need for a crypto pmd type
> drivers: align pci driver definitions
> eal: remove duplicate function declaration
> eal: introduce init macros
> crypto: export init/uninit common wrappers for pci drivers
> ethdev: export init/uninit common wrappers for pci drivers
> drivers: convert all pdev drivers as pci drivers
> crypto: get rid of crypto driver register callback
> ethdev: get rid of eth driver register callback
> eal/linux: move back interrupt thread init before setting affinity
> pci: add a helper for device name
> pci: add a helper to update a device
> ethdev: do not scan all pci devices on attach
> eal: add hotplug operations for pci and vdev
> ethdev: convert to eal hotplug
> ethdev: get rid of device type
>
> app/test/virtual_pmd.c | 2 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 35 +--
> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 24 +-
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/e1000/em_ethdev.c | 16 +-
> drivers/net/e1000/igb_ethdev.c | 40 +--
> drivers/net/ena/ena_ethdev.c | 20 +-
> drivers/net/enic/enic_ethdev.c | 23 +-
> drivers/net/fm10k/fm10k_ethdev.c | 23 +-
> drivers/net/i40e/i40e_ethdev.c | 26 +-
> drivers/net/i40e/i40e_ethdev_vf.c | 25 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 47 +---
> drivers/net/mlx4/mlx4.c | 22 +-
> drivers/net/mlx5/mlx5.c | 21 +-
> drivers/net/mpipe/mpipe_tilegx.c | 2 +-
> drivers/net/nfp/nfp_net.c | 23 +-
> drivers/net/null/rte_eth_null.c | 2 +-
> drivers/net/pcap/rte_eth_pcap.c | 2 +-
> drivers/net/ring/rte_eth_ring.c | 2 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 25 +-
> drivers/net/vhost/rte_eth_vhost.c | 2 +-
> drivers/net/virtio/virtio_ethdev.c | 26 +-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
> drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
> examples/ip_pipeline/init.c | 22 --
> lib/librte_cryptodev/rte_cryptodev.c | 67 +----
> lib/librte_cryptodev/rte_cryptodev.h | 2 -
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 +---
> lib/librte_cryptodev/rte_cryptodev_version.map | 9 +-
> lib/librte_eal/bsdapp/eal/eal_pci.c | 52 +++-
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +
> lib/librte_eal/common/eal_common_dev.c | 39 +++
> lib/librte_eal/common/eal_common_pci.c | 17 +-
> lib/librte_eal/common/eal_private.h | 20 +-
> lib/librte_eal/common/include/rte_dev.h | 29 ++-
> lib/librte_eal/common/include/rte_eal.h | 3 +
> lib/librte_eal/common/include/rte_pci.h | 32 +++
> lib/librte_eal/common/include/rte_tailq.h | 4 +-
> lib/librte_eal/linuxapp/eal/eal.c | 7 +-
> lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +
> lib/librte_ether/rte_ethdev.c | 316 ++++--------------------
> lib/librte_ether/rte_ethdev.h | 40 ++-
> lib/librte_ether/rte_ether_version.map | 9 +-
> 47 files changed, 392 insertions(+), 810 deletions(-)
>
> --
> 1.9.1
Patches 3,8,16 and 17 no longer apply to the latest master branch.
A rebase is needed.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev David Marchand
@ 2016-05-27 10:39 ` Iremonger, Bernard
0 siblings, 0 replies; 375+ messages in thread
From: Iremonger, Bernard @ 2016-05-27 10:39 UTC (permalink / raw)
To: David Marchand, dev; +Cc: thomas.monjalon, viktorin
Hi David,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Marchand
> Sent: Wednesday, April 20, 2016 12:44 PM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; viktorin@rehivetech.com
> Subject: [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and
> vdev
>
> hotplug which deals with resources should come from the layer that already
> handles them, i.e. eal.
>
> For both attach and detach operations, 'name' is used to select the bus that
> will handle the request.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +++++
> lib/librte_eal/common/eal_common_dev.c | 39
> +++++++++++++++++++++++++
> lib/librte_eal/common/include/rte_dev.h | 25 ++++++++++++++++
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +++++
> 4 files changed, 80 insertions(+)
>
> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> index 58c2951..4d075df 100644
> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> @@ -151,3 +151,11 @@ DPDK_16.04 {
> rte_eal_primary_proc_alive;
>
> } DPDK_2.2;
> +
> +DPDK_16.07 {
> + global:
> +
> + rte_eal_dev_attach;
> + rte_eal_dev_detach;
> +
> +} DPDK_16.04;
> diff --git a/lib/librte_eal/common/eal_common_dev.c
> b/lib/librte_eal/common/eal_common_dev.c
> index a8a4146..59ed3a0 100644
> --- a/lib/librte_eal/common/eal_common_dev.c
> +++ b/lib/librte_eal/common/eal_common_dev.c
> @@ -150,3 +150,42 @@ rte_eal_vdev_uninit(const char *name)
> RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
> return -EINVAL;
> }
> +
> +int rte_eal_dev_attach(const char *name, const char *devargs) {
> + struct rte_pci_addr addr;
> + int ret = -1;
> +
Should the input parameters name and devargs be checked?
> + if (eal_parse_pci_DomBDF(name, &addr) == 0) {
> + if (rte_eal_pci_probe_one(&addr) < 0)
> + goto err;
> +
> + } else {
> + if (rte_eal_vdev_init(name, devargs))
> + goto err;
> + }
> +
> + return 0;
> +
> +err:
> + RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
> + return ret;
> +}
> +
> +int rte_eal_dev_detach(const char *name) {
> + struct rte_pci_addr addr;
> +
Should the name parameter be checked?
> + if (eal_parse_pci_DomBDF(name, &addr) == 0) {
> + if (rte_eal_pci_detach(&addr) < 0)
> + goto err;
> + } else {
> + if (rte_eal_vdev_uninit(name))
> + goto err;
> + }
> + return 0;
> +
> +err:
> + RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
> + return -1;
> +}
> diff --git a/lib/librte_eal/common/include/rte_dev.h
> b/lib/librte_eal/common/include/rte_dev.h
> index 85e48f2..b1c0520 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char
> *args);
> */
> int rte_eal_vdev_uninit(const char *name);
>
> +/**
> + * Attach a resource to a registered driver.
> + *
> + * @param name
> + * The resource name, that refers to a pci resource or some private
> + * way of designating a resource for vdev drivers. Based on this
> + * resource name, eal will identify a driver capable of handling
> + * this resource and pass this resource to the driver probing
> + * function.
> + * @param devargs
> + * Device arguments to be passed to the driver.
> + * @return
> + * 0 on success, negative on error.
> + */
> +int rte_eal_dev_attach(const char *name, const char *devargs);
> +
> +/**
> + * Detach a resource from its driver.
> + *
> + * @param name
> + * Same description as for rte_eal_dev_attach().
> + * Here, eal will call the driver detaching function.
> + */
> +int rte_eal_dev_detach(const char *name);
> +
> #define PMD_REGISTER_DRIVER(d)\
> RTE_INIT(devinitfn_ ##d);\
> static void devinitfn_ ##d(void)\
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index 12503ef..0404a52 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -154,3 +154,11 @@ DPDK_16.04 {
> rte_eal_primary_proc_alive;
>
> } DPDK_2.2;
> +
> +DPDK_16.07 {
> + global:
> +
> + rte_eal_dev_attach;
> + rte_eal_dev_detach;
> +
> +} DPDK_16.04;
> --
> 1.9.1
Regards,
Bernard.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-05-27 10:23 ` Iremonger, Bernard
@ 2016-06-16 6:32 ` Shreyansh Jain
2016-06-16 7:34 ` Thomas Monjalon
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 6:32 UTC (permalink / raw)
To: David Marchand; +Cc: thomas.monjalon, viktorin, dev, Iremonger, Bernard
Hi David,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> Sent: Friday, May 27, 2016 3:54 PM
> To: David Marchand <david.marchand@6wind.com>; dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; viktorin@rehivetech.com
> Subject: Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
>
> Hi David,
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Marchand
> > Sent: Wednesday, April 20, 2016 12:44 PM
> > To: dev@dpdk.org
> > Cc: thomas.monjalon@6wind.com; viktorin@rehivetech.com
> > Subject: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
> >
> > Following discussions with Jan [1] and some cleanup I started on pci code,
> > here is a patchset that reworks pdev drivers registration and hotplug api.
> >
> > The structures changes mentioned in [1] are still to be done, but at least,
> I
> > think we are one step closer to it.
> >
> > Before this patchset, rte_driver .init semantics differed whether it
> concerned
> > a pdev or a vdev driver:
> > - for vdev, it actually meant that a devargs is given to the driver so
> > that it creates ethdev / crypto objects, so it was a probing action
> > - for pdev, it only registered the driver triggering no ethdev / crypto
> > objects
> >
> > From my pov, eal hotplug api introduced in this patchset still needs more
> > work so that it does not need to know about devargs. So a new devargs api
> is
> > needed.
> >
> > Changes since v1:
> > - rebased on HEAD, new drivers should be okay
> > - patches have been split into smaller pieces
> > - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> > - device type has been removed from ethdev, as it was used only by hotplug
> > - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> > dropped for now, we can do this once vdev drivers have been converted
> >
> > [1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> >
> > Regards,
> > --
> > David Marchand
> >
> > David Marchand (17):
> > pci: no need for dynamic tailq init
> > crypto: no need for a crypto pmd type
> > drivers: align pci driver definitions
> > eal: remove duplicate function declaration
> > eal: introduce init macros
> > crypto: export init/uninit common wrappers for pci drivers
> > ethdev: export init/uninit common wrappers for pci drivers
> > drivers: convert all pdev drivers as pci drivers
> > crypto: get rid of crypto driver register callback
> > ethdev: get rid of eth driver register callback
> > eal/linux: move back interrupt thread init before setting affinity
> > pci: add a helper for device name
> > pci: add a helper to update a device
> > ethdev: do not scan all pci devices on attach
> > eal: add hotplug operations for pci and vdev
> > ethdev: convert to eal hotplug
> > ethdev: get rid of device type
> >
> > app/test/virtual_pmd.c | 2 +-
> > drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> > drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
> > drivers/net/bnx2x/bnx2x_ethdev.c | 35 +--
> > drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> > drivers/net/cxgbe/cxgbe_ethdev.c | 24 +-
> > drivers/net/cxgbe/cxgbe_main.c | 2 +-
> > drivers/net/e1000/em_ethdev.c | 16 +-
> > drivers/net/e1000/igb_ethdev.c | 40 +--
> > drivers/net/ena/ena_ethdev.c | 20 +-
> > drivers/net/enic/enic_ethdev.c | 23 +-
> > drivers/net/fm10k/fm10k_ethdev.c | 23 +-
> > drivers/net/i40e/i40e_ethdev.c | 26 +-
> > drivers/net/i40e/i40e_ethdev_vf.c | 25 +-
> > drivers/net/ixgbe/ixgbe_ethdev.c | 47 +---
> > drivers/net/mlx4/mlx4.c | 22 +-
> > drivers/net/mlx5/mlx5.c | 21 +-
> > drivers/net/mpipe/mpipe_tilegx.c | 2 +-
> > drivers/net/nfp/nfp_net.c | 23 +-
> > drivers/net/null/rte_eth_null.c | 2 +-
> > drivers/net/pcap/rte_eth_pcap.c | 2 +-
> > drivers/net/ring/rte_eth_ring.c | 2 +-
> > drivers/net/szedata2/rte_eth_szedata2.c | 25 +-
> > drivers/net/vhost/rte_eth_vhost.c | 2 +-
> > drivers/net/virtio/virtio_ethdev.c | 26 +-
> > drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
> > drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
> > examples/ip_pipeline/init.c | 22 --
> > lib/librte_cryptodev/rte_cryptodev.c | 67 +----
> > lib/librte_cryptodev/rte_cryptodev.h | 2 -
> > lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 +---
> > lib/librte_cryptodev/rte_cryptodev_version.map | 9 +-
> > lib/librte_eal/bsdapp/eal/eal_pci.c | 52 +++-
> > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 +
> > lib/librte_eal/common/eal_common_dev.c | 39 +++
> > lib/librte_eal/common/eal_common_pci.c | 17 +-
> > lib/librte_eal/common/eal_private.h | 20 +-
> > lib/librte_eal/common/include/rte_dev.h | 29 ++-
> > lib/librte_eal/common/include/rte_eal.h | 3 +
> > lib/librte_eal/common/include/rte_pci.h | 32 +++
> > lib/librte_eal/common/include/rte_tailq.h | 4 +-
> > lib/librte_eal/linuxapp/eal/eal.c | 7 +-
> > lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
> > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 +
> > lib/librte_ether/rte_ethdev.c | 316 ++++----------------
> ----
> > lib/librte_ether/rte_ethdev.h | 40 ++-
> > lib/librte_ether/rte_ether_version.map | 9 +-
> > 47 files changed, 392 insertions(+), 810 deletions(-)
> >
> > --
> > 1.9.1
>
> Patches 3,8,16 and 17 no longer apply to the latest master branch.
> A rebase is needed.
>
[...]
With the recent most head (04920e6): 01, 03, 08, 15, 16 and 17 are failing.
Just wanted to check if there is a rebase of this series anytime soon?
I was looking at Jan's non-PCI patchset [1] and they are based on this series.
[1] http://thread.gmane.org/gmane.comp.networking.dpdk.devel/30913/focus=38486
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-06-16 6:32 ` Shreyansh Jain
@ 2016-06-16 7:34 ` Thomas Monjalon
2016-06-16 8:23 ` Jan Viktorin
2016-06-16 8:42 ` Shreyansh Jain
0 siblings, 2 replies; 375+ messages in thread
From: Thomas Monjalon @ 2016-06-16 7:34 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: David Marchand, viktorin, dev, Iremonger, Bernard
2016-06-16 06:32, Shreyansh Jain:
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> > Patches 3,8,16 and 17 no longer apply to the latest master branch.
> > A rebase is needed.
>
> With the recent most head (04920e6): 01, 03, 08, 15, 16 and 17 are failing.
>
> Just wanted to check if there is a rebase of this series anytime soon?
I will take care of this series if time permit.
It would help to have more reviews on other series touching EAL, like pmdinfo.
> I was looking at Jan's non-PCI patchset [1] and they are based on this series.
>
> [1] http://thread.gmane.org/gmane.comp.networking.dpdk.devel/30913/focus=38486
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-06-16 7:34 ` Thomas Monjalon
@ 2016-06-16 8:23 ` Jan Viktorin
2016-06-16 9:19 ` Thomas Monjalon
2016-06-16 8:42 ` Shreyansh Jain
1 sibling, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-06-16 8:23 UTC (permalink / raw)
To: Thomas Monjalon, Shreyansh Jain; +Cc: David Marchand, dev, Iremonger, Bernard
I think, we should consider to move it to somebody else. I would work on it, however, I don't see all the tasks that are to be done. That's why I was waiting to finalize those patchs by David or Thomas. For me, the important things were to generalize certain things to remove dependency on PCI. This is mostly done (otherwise the SoC patchset couldn't be done in the way I've posted it).
Now, there is some pending work to remove pmd_type. Next, to find out some generalization of rte_pci_device/driver to create rte_device/driver (I've posted several suggestions in the 0000 of SoC patchset).
What more?
Jan Viktorin
RehiveTech
Sent from a mobile device
Původní zpráva
Od: Thomas Monjalon
Odesláno: čtvrtek, 16. června 2016 9:34
Komu: Shreyansh Jain
Kopie: David Marchand; viktorin@rehivetech.com; dev@dpdk.org; Iremonger, Bernard
Předmět: Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-06-16 06:32, Shreyansh Jain:
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> > Patches 3,8,16 and 17 no longer apply to the latest master branch.
> > A rebase is needed.
>
> With the recent most head (04920e6): 01, 03, 08, 15, 16 and 17 are failing.
>
> Just wanted to check if there is a rebase of this series anytime soon?
I will take care of this series if time permit.
It would help to have more reviews on other series touching EAL, like pmdinfo.
> I was looking at Jan's non-PCI patchset [1] and they are based on this series.
>
> [1] http://thread.gmane.org/gmane.comp.networking.dpdk.devel/30913/focus=38486
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-06-16 7:34 ` Thomas Monjalon
2016-06-16 8:23 ` Jan Viktorin
@ 2016-06-16 8:42 ` Shreyansh Jain
2016-06-16 10:48 ` Jan Viktorin
1 sibling, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 8:42 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: David Marchand, viktorin, dev, Iremonger, Bernard
Hi,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, June 16, 2016 1:04 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>
> Cc: David Marchand <david.marchand@6wind.com>; viktorin@rehivetech.com;
> dev@dpdk.org; Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
>
> 2016-06-16 06:32, Shreyansh Jain:
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> > > Patches 3,8,16 and 17 no longer apply to the latest master branch.
> > > A rebase is needed.
> >
> > With the recent most head (04920e6): 01, 03, 08, 15, 16 and 17 are failing.
> >
> > Just wanted to check if there is a rebase of this series anytime soon?
>
> I will take care of this series if time permit.
Ok.
By the way, I have already rebased it on master. I can post the patches here if you want.
(only trivial conflicts were there)
> It would help to have more reviews on other series touching EAL, like
> pmdinfo.
Ok. I can try and review this, non-PCI/SoC and similar patchset in next few days.
>
> > I was looking at Jan's non-PCI patchset [1] and they are based on this
> series.
> >
> > [1]
> http://thread.gmane.org/gmane.comp.networking.dpdk.devel/30913/focus=38486
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-06-16 8:23 ` Jan Viktorin
@ 2016-06-16 9:19 ` Thomas Monjalon
2016-06-16 10:45 ` Jan Viktorin
0 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-06-16 9:19 UTC (permalink / raw)
To: Jan Viktorin; +Cc: Shreyansh Jain, David Marchand, dev, Iremonger, Bernard
2016-06-16 10:23, Jan Viktorin:
> I think, we should consider to move it to somebody else. I would work on it, however, I don't see all the tasks that are to be done. That's why I was waiting to finalize those patchs by David or Thomas. For me, the important things were to generalize certain things to remove dependency on PCI. This is mostly done (otherwise the SoC patchset couldn't be done in the way I've posted it).
>
> Now, there is some pending work to remove pmd_type. Next, to find out some generalization of rte_pci_device/driver to create rte_device/driver (I've posted several suggestions in the 0000 of SoC patchset).
>
> What more?
We need a clean devargs API in EAL, not directly related to hotplug.
Then the hotplug can benefit of the devargs API as any other device config.
The EAL resources (also called devices) need an unique naming convention.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-06-16 9:19 ` Thomas Monjalon
@ 2016-06-16 10:45 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-06-16 10:45 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: Shreyansh Jain, David Marchand, dev, Iremonger, Bernard
On Thu, 16 Jun 2016 11:19:59 +0200
Thomas Monjalon <thomas.monjalon@6wind.com> wrote:
> 2016-06-16 10:23, Jan Viktorin:
> > I think, we should consider to move it to somebody else. I would work on it, however, I don't see all the tasks that are to be done. That's why I was waiting to finalize those patchs by David or Thomas. For me, the important things were to generalize certain things to remove dependency on PCI. This is mostly done (otherwise the SoC patchset couldn't be done in the way I've posted it).
> >
> > Now, there is some pending work to remove pmd_type. Next, to find out some generalization of rte_pci_device/driver to create rte_device/driver (I've posted several suggestions in the 0000 of SoC patchset).
For the pmd_type removal, I am not very sure about the original David's intentions. What should be the result?
Should there be a special struct rte_virt_device or something like that?
> >
> > What more?
>
> We need a clean devargs API in EAL, not directly related to hotplug.
> Then the hotplug can benefit of the devargs API as any other device config.
Do we have some requirements for this? Would it be a complete redefinition
of the API? I don't see the relations to hotplug.
>
> The EAL resources (also called devices) need an unique naming convention.
>
No idea about this. What do you mean by the unique naming convention?
Jan
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
2016-06-16 8:42 ` Shreyansh Jain
@ 2016-06-16 10:48 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-06-16 10:48 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: Thomas Monjalon, David Marchand, dev, Iremonger, Bernard
On Thu, 16 Jun 2016 08:42:29 +0000
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Hi,
>
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > Sent: Thursday, June 16, 2016 1:04 PM
> > To: Shreyansh Jain <shreyansh.jain@nxp.com>
> > Cc: David Marchand <david.marchand@6wind.com>; viktorin@rehivetech.com;
> > dev@dpdk.org; Iremonger, Bernard <bernard.iremonger@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver
> >
> > 2016-06-16 06:32, Shreyansh Jain:
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> > > > Patches 3,8,16 and 17 no longer apply to the latest master branch.
> > > > A rebase is needed.
> > >
> > > With the recent most head (04920e6): 01, 03, 08, 15, 16 and 17 are failing.
> > >
> > > Just wanted to check if there is a rebase of this series anytime soon?
> >
> > I will take care of this series if time permit.
>
> Ok.
> By the way, I have already rebased it on master. I can post the patches here if you want.
> (only trivial conflicts were there)
Sounds good. +1
I'd rebase my patchset on top of it and repost.
>
> > It would help to have more reviews on other series touching EAL, like
> > pmdinfo.
>
> Ok. I can try and review this, non-PCI/SoC and similar patchset in next few days.
The original David's patchset was quite OK. I didn't have any comments. The thing
is (from my POV) that it was incomplete.
Jan
>
> >
> > > I was looking at Jan's non-PCI patchset [1] and they are based on this
> > series.
> > >
> > > [1]
> > http://thread.gmane.org/gmane.comp.networking.dpdk.devel/30913/focus=38486
>
> -
> Shreyansh
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 00/17] prepare for rte_device / rte_driver
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (9 preceding siblings ...)
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 01/17] pci: no need for dynamic tailq init Shreyansh Jain
` (16 more replies)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
11 siblings, 17 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
From: David Marchand <david.marchand@6wind.com>
* Original patch series is from David Marchand. This is just a rebase over
master (d76c19309) *
Following discussions with Jan [1] and some cleanup I started on pci code,
here is a patchset that reworks pdev drivers registration and hotplug api.
The structures changes mentioned in [1] are still to be done, but at least,
I think we are one step closer to it.
Before this patchset, rte_driver .init semantics differed whether it
concerned a pdev or a vdev driver:
- for vdev, it actually meant that a devargs is given to the driver so
that it creates ethdev / crypto objects, so it was a probing action
- for pdev, it only registered the driver triggering no ethdev / crypto
objects
>From my pov, eal hotplug api introduced in this patchset still needs more
work so that it does not need to know about devargs. So a new devargs api
is needed.
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
[1] http://dpdk.org/ml/archives/dev/2016-January/031390.html
David Marchand (17):
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: remove duplicate function declaration
eal: introduce init macros
crypto: export init/uninit common wrappers for pci drivers
ethdev: export init/uninit common wrappers for pci drivers
drivers: convert all pdev drivers as pci drivers
crypto: get rid of crypto driver register callback
ethdev: get rid of eth driver register callback
eal/linux: move back interrupt thread init before setting affinity
pci: add a helper for device name
pci: add a helper to update a device
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +--
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/e1000/em_ethdev.c | 16 +-
drivers/net/e1000/igb_ethdev.c | 40 +--
drivers/net/ena/ena_ethdev.c | 20 +-
drivers/net/enic/enic_ethdev.c | 23 +-
drivers/net/fm10k/fm10k_ethdev.c | 23 +-
drivers/net/i40e/i40e_ethdev.c | 26 +-
drivers/net/i40e/i40e_ethdev_vf.c | 25 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +---
drivers/net/mlx4/mlx4.c | 22 +-
drivers/net/mlx5/mlx5.c | 21 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/nfp/nfp_net.c | 23 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 25 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 26 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 67 +----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 +---
lib/librte_cryptodev/rte_cryptodev_version.map | 9 +-
lib/librte_eal/bsdapp/eal/eal_pci.c | 52 +++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 +
lib/librte_eal/common/eal_common_dev.c | 39 +++
lib/librte_eal/common/eal_common_pci.c | 19 +-
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_dev.h | 29 ++-
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 35 +++
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/linuxapp/eal/eal.c | 7 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +
lib/librte_ether/rte_ethdev.c | 315 ++++--------------------
lib/librte_ether/rte_ethdev.h | 40 ++-
lib/librte_ether/rte_ether_version.map | 9 +-
47 files changed, 383 insertions(+), 811 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 01/17] pci: no need for dynamic tailq init
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
` (15 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 7fdd6f1..880483d 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index ba5283d..fee4aa5 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f9c3efd..bfc410f 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 02/17] crypto: no need for a crypto pmd type
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 01/17] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 03/17] drivers: align pci driver definitions Shreyansh Jain
` (14 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 960e2d5..b0d806c 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -230,7 +230,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -269,7 +269,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -318,7 +317,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -360,8 +359,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index d47f1e8..2d0b809 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -697,8 +697,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 03/17] drivers: align pci driver definitions
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 04/17] eal: remove duplicate function declaration Shreyansh Jain
` (13 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index a7912f5..08496ab 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,7 +116,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index e157587..8d01e9a 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1427,7 +1427,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 5c9f350..ef7011e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2463,7 +2463,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 04/17] eal: remove duplicate function declaration
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (2 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 03/17] drivers: align pci driver definitions Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 05/17] eal: introduce init macros Shreyansh Jain
` (12 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 857dc3e..06a68f6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -259,13 +259,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index bba8fea..5ec3d4e 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 05/17] eal: introduce init macros
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (3 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 04/17] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
` (11 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
RTE_EAL_PCI_REGISTER is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 7 +++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f1b5507..85e48f2 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -179,8 +179,8 @@ int rte_eal_vdev_init(const char *name, const char *args);
int rte_eal_vdev_uninit(const char *name);
#define PMD_REGISTER_DRIVER(d)\
-void devinitfn_ ##d(void);\
-void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+RTE_INIT(devinitfn_ ##d);\
+static void devinitfn_ ##d(void)\
{\
rte_eal_driver_register(&d);\
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..d7df1d9 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,13 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+#define RTE_EAL_PCI_REGISTER(name, d) \
+RTE_INIT(pciinitfn_ ##name); \
+static void pciinitfn_ ##name(void) \
+{ \
+ rte_eal_pci_register(&d); \
+}
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index 4a686e6..71ed3bb 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 06/17] crypto: export init/uninit common wrappers for pci drivers
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (4 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 05/17] eal: introduce init macros Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 07/17] ethdev: " Shreyansh Jain
` (10 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
that can be used by pci drivers that assume a 1 to 1 association between
pci resource and upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 8 ++++++++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index b0d806c..65a2e29 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -340,9 +340,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -401,8 +401,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -450,15 +450,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 41004e1..8d0edfb 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -32,3 +32,11 @@ DPDK_16.04 {
local: *;
};
+
+DPDK_16.07 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+
+} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 07/17] ethdev: export init/uninit common wrappers for pci drivers
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (5 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
` (9 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Preparing for getting rid of eth_drv, here are two wrappers that can be
used by pci drivers that assume a 1 to 1 association between pci resource and
upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 8 ++++++++
3 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e148028..d05eada 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -239,9 +239,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -293,8 +293,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -351,8 +351,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index e5e91e4..6deafa2 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4254,6 +4254,19 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
uint32_t mask,
uint8_t en);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 214ecc7..31017d4 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -132,3 +132,11 @@ DPDK_16.04 {
rte_eth_tx_buffer_set_err_callback;
} DPDK_2.2;
+
+DPDK_16.07 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 08/17] drivers: convert all pdev drivers as pci drivers
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (6 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 07/17] ethdev: " Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
` (8 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
virtio and mlx* drivers use the general purpose RTE_INIT macro, as they both
need some special stuff to be done before registering a pci driver.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++--------
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +++++-------------------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++--------
drivers/net/e1000/igb_ethdev.c | 40 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 18 +++----------
drivers/net/enic/enic_ethdev.c | 23 +++-------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++-------------
drivers/net/i40e/i40e_ethdev.c | 26 +++---------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +++++----------------------------
drivers/net/mlx4/mlx4.c | 20 +++-----------
drivers/net/mlx5/mlx5.c | 19 +++----------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/szedata2/rte_eth_szedata2.c | 25 +++---------------
drivers/net/virtio/virtio_ethdev.c | 26 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++-------------
17 files changed, 68 insertions(+), 359 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 08496ab..54f0c95 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -120,21 +120,11 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv);
+RTE_EAL_PCI_REGISTER(qat, rte_qat_pmd.pci_drv);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 071b44f..ba194b5 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -506,11 +506,15 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
+RTE_EAL_PCI_REGISTER(bnx2x, rte_bnx2x_pmd.pci_drv);
+
/*
* virtual function driver struct
*/
@@ -519,36 +523,11 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver);
+RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 04eddaf..358c240 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -869,29 +869,11 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .name = "cxgbe_driver",
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver);
+RTE_EAL_PCI_REGISTER(cxgbe, rte_cxgbe_pmd.pci_drv);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 653be09..1f80c05 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -368,18 +368,15 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(em, rte_em_pmd.pci_drv);
static int
em_hw_init(struct e1000_hw *hw)
@@ -1771,10 +1768,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr);
return 0;
}
-
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index f0921ee..1fc6e83 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -975,12 +975,16 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
+RTE_EAL_PCI_REGISTER(igb, rte_igb_pmd.pci_drv);
+
/*
* virtual function driver struct
*/
@@ -989,18 +993,15 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(igbvf, rte_igbvf_pmd.pci_drv);
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
@@ -1013,20 +1014,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -4802,16 +4789,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -4972,6 +4949,3 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-
-PMD_REGISTER_DRIVER(pmd_igb_drv);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 8d01e9a..ba6f771 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1431,23 +1431,11 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .name = "ena_driver",
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv);
+RTE_EAL_PCI_REGISTER(ena, rte_ena_pmd.pci_drv);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6bea940..7539811 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -660,28 +660,11 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver);
+RTE_EAL_PCI_REGISTER(enic, rte_enic_pmd.pci_drv);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c2d377f..146bc2a 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3030,29 +3030,12 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver);
+RTE_EAL_PCI_REGISTER(fm10k, rte_pmd_fm10k.pci_drv);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 24777d5..07c36d7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -641,12 +641,16 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
+RTE_EAL_PCI_REGISTER(i40e, rte_i40e_pmd.pci_drv);
+
static inline int
rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev,
struct rte_eth_link *link)
@@ -676,28 +680,6 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
}
/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver);
-
-/*
* Initialize registers for flexible payload, which should be set by NVM.
* This should be removed from code once it is fixed in NVM.
*/
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 90682ac..4782ac0 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1536,34 +1536,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver);
+RTE_EAL_PCI_REGISTER(i40evf, rte_i40evf_pmd.pci_drv);
static int
i40evf_dev_configure(struct rte_eth_dev *dev)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 5f3e047..97ae370 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1485,12 +1485,16 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
+RTE_EAL_PCI_REGISTER(ixgbe, rte_ixgbe_pmd.pci_drv);
+
/*
* virtual function driver struct
*/
@@ -1499,39 +1503,15 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(ixgbevf, rte_ixgbevf_pmd.pci_drv);
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
@@ -7164,16 +7144,3 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
}
-
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 9ed1491..b594433 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5837,15 +5837,10 @@ static struct eth_driver mlx4_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5856,13 +5851,4 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .name = MLX4_DRIVER_NAME,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 041cfc3..1989a37 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -646,14 +646,10 @@ static struct eth_driver mlx5_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -663,13 +659,4 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .name = MLX5_DRIVER_NAME,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index ef7011e..c135f8c 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2468,29 +2468,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver);
+RTE_EAL_PCI_REGISTER(nfp_net, rte_nfp_net_pmd.pci_drv);
/*
* Local variables:
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 985a8d6..9adccba 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,12 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .name = RTE_SZEDATA2_DRIVER_NAME,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver);
+RTE_EAL_PCI_REGISTER(szedata2, szedata2_eth_driver.pci_drv);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index c3fb628..14d05fd 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1209,29 +1209,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1453,10 +1448,3 @@ __rte_unused uint8_t is_rx)
{
return 0;
}
-
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 29b469c..25fec79 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -332,25 +332,15 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(vmxnet3, rte_vmxnet3_pmd.pci_drv);
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
@@ -948,10 +938,3 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 09/17] crypto: get rid of crypto driver register callback
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (7 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 10/17] ethdev: get rid of eth " Shreyansh Jain
` (7 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Now that all pdev are pci drivers, we don't need to register crypto drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
3 files changed, 53 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 65a2e29..a7cb33a 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -444,28 +444,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 8d0edfb..e0a9620 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 10/17] ethdev: get rid of eth driver register callback
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (8 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-20 6:16 ` Shreyansh jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
` (6 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Now that all pdev are pci drivers, we don't need to register ethdev drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 22 ----------------------
lib/librte_ether/rte_ethdev.h | 12 ------------
lib/librte_ether/rte_ether_version.map | 1 -
3 files changed, 35 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index d05eada..7258062 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -334,28 +334,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 6deafa2..64d889e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1842,18 +1842,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 31017d4..d457b21 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -80,7 +80,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 11/17] eal/linux: move back interrupt thread init before setting affinity
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (9 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 12/17] pci: add a helper for device name Shreyansh Jain
` (5 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Now that virtio pci driver is initialized in a constructor, iopl() stuff
happens early enough so that interrupt thread can be created right after
plugin loading.
This way, chelsio driver should be happy again [1].
[1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 5ec3d4e..6eca741 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -821,6 +821,9 @@ rte_eal_init(int argc, char **argv)
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");
+ if (rte_eal_intr_init() < 0)
+ rte_panic("Cannot init interrupt-handling thread\n");
+
eal_thread_init_master(rte_config.master_lcore);
ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
@@ -832,9 +835,6 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
- if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 12/17] pci: add a helper for device name
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (10 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 13/17] pci: add a helper to update a device Shreyansh Jain
` (4 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
eal is a better place than crypto / ethdev for naming resources.
Add a helper in eal and make use of it in crypto / ethdev.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
3 files changed, 33 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a7cb33a..3b587e4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -276,23 +276,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -355,9 +338,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -412,9 +394,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index d7df1d9..5e8bd89 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using above functions.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 7258062..5bcf610 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -214,20 +214,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -251,9 +237,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -304,9 +289,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 13/17] pci: add a helper to update a device
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (11 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 12/17] pci: add a helper for device name Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
` (3 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
This helper updates a pci device object with latest information it can
find.
It will be used mainly for hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_common_pci.c | 2 --
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 3 ++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
5 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 880483d..013c953 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index fee4aa5..dfd0a8c 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -87,8 +87,6 @@ struct pci_driver_list pci_driver_list =
struct pci_device_list pci_device_list =
TAILQ_HEAD_INITIALIZER(pci_device_list);
-#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
-
const char *pci_get_sysfs_path(void)
{
const char *path = NULL;
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 06a68f6..b8ff9c5 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -152,6 +152,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 5e8bd89..02d460a 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -107,6 +107,9 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
+/** Default sysfs path for PCI device search. */
+#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
+
/**
* A structure describing a PCI resource.
*/
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bfc410f..0a368c5 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 14/17] ethdev: do not scan all pci devices on attach
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (12 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 13/17] pci: add a helper to update a device Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
` (2 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index dfd0a8c..d05dda4 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -339,6 +339,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -351,9 +356,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 5bcf610..a496521 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -463,9 +463,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 15/17] eal: add hotplug operations for pci and vdev
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (13 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 17/17] ethdev: get rid of device type Shreyansh Jain
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
hotplug which deals with resources should come from the layer that already
handles them, i.e. eal.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
lib/librte_eal/common/eal_common_dev.c | 39 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 25 ++++++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
4 files changed, 68 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index f8c3dea..e776768 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -156,5 +156,7 @@ DPDK_16.07 {
global:
pci_get_sysfs_path;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..59ed3a0 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,42 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+ int ret = -1;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ return ret;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
+ return -1;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 85e48f2..b1c0520 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a resource to a registered driver.
+ *
+ * @param name
+ * The resource name, that refers to a pci resource or some private
+ * way of designating a resource for vdev drivers. Based on this
+ * resource name, eal will identify a driver capable of handling
+ * this resource and pass this resource to the driver probing
+ * function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a resource from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define PMD_REGISTER_DRIVER(d)\
RTE_INIT(devinitfn_ ##d);\
static void devinitfn_ ##d(void)\
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 3d0ff93..50b774b 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -159,5 +159,7 @@ DPDK_16.07 {
global:
pci_get_sysfs_path;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 16/17] ethdev: convert to eal hotplug
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (14 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 17/17] ethdev: get rid of device type Shreyansh Jain
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 251 ++++++------------------------------------
1 file changed, 33 insertions(+), 218 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a496521..12d24ff 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -210,6 +211,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -341,99 +343,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
-static int
-rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
-{
- char *tmp;
-
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (name == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- /* shouldn't check 'rte_eth_devices[i].data',
- * because it might be overwritten by VDEV PMD */
- tmp = rte_eth_dev_data[port_id].name;
- strcpy(name, tmp);
- return 0;
-}
-
-static int
-rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
-{
- int i;
-
- if (name == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- if (!strncmp(name,
- rte_eth_dev_data[i].name, strlen(name))) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
@@ -459,124 +368,45 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ ret = -1;
+ goto err;
}
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
+ }
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -584,7 +414,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -592,33 +421,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v3 17/17] ethdev: get rid of device type
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
` (15 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 16/17] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-06-16 14:06 ` Shreyansh Jain
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-16 14:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
From: David Marchand <david.marchand@6wind.com>
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
15 files changed, 15 insertions(+), 51 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f17bd7e..36ac102 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -648,7 +648,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 53df9fe..b858ee1 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index b594433..ba42c33 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5715,7 +5715,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 1989a37..f6399fc 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -519,7 +519,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 26e1424..9de556e 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 5e8e203..e6c74a6 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -514,7 +514,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index c98e234..2d00d04 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index b1783c3..b78d1cf 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 310cbef..4e99360 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -717,7 +717,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 1adeb5b..72861d8 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -651,7 +651,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 7120bab..0933a5f 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 12d24ff..35ec7f3 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -185,7 +185,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -210,7 +210,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -242,7 +241,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 64d889e..92876e5 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1574,17 +1574,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1614,7 +1603,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
};
struct rte_eth_dev_sriov {
@@ -1727,8 +1715,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/17] ethdev: get rid of eth driver register callback
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-06-20 6:16 ` Shreyansh jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-06-20 6:16 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
On Thursday 16 June 2016 07:36 PM, Shreyansh Jain wrote:
> From: David Marchand <david.marchand@6wind.com>
>
> Now that all pdev are pci drivers, we don't need to register ethdev drivers
> through a dedicated channel.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> lib/librte_ether/rte_ethdev.c | 22 ----------------------
> lib/librte_ether/rte_ethdev.h | 12 ------------
> lib/librte_ether/rte_ether_version.map | 1 -
> 3 files changed, 35 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index d05eada..7258062 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -334,28 +334,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
> return 0;
> }
>
> -/**
> - * Register an Ethernet [Poll Mode] driver.
> - *
> - * Function invoked by the initialization function of an Ethernet driver
> - * to simultaneously register itself as a PCI driver and as an Ethernet
> - * Poll Mode Driver.
> - * Invokes the rte_eal_pci_register() function to register the *pci_drv*
> - * structure embedded in the *eth_drv* structure, after having stored the
> - * address of the rte_eth_dev_init() function in the *devinit* field of
> - * the *pci_drv* structure.
> - * During the PCI probing phase, the rte_eth_dev_init() function is
> - * invoked for each PCI [Ethernet device] matching the embedded PCI
> - * identifiers provided by the driver.
> - */
> -void
> -rte_eth_driver_register(struct eth_driver *eth_drv)
> -{
> - eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
> - eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
> - rte_eal_pci_register(ð_drv->pci_drv);
> -}
> -
Self review (as I rebased this series):
With this applied on master (3901ed99), it would cause issues with qede driver. qede driver uses the rte_eth_driver_register() function.
I will update it (qede driver) and post another version.
> int
> rte_eth_dev_is_valid_port(uint8_t port_id)
> {
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 6deafa2..64d889e 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1842,18 +1842,6 @@ struct eth_driver {
> };
>
> /**
> - * @internal
> - * A function invoked by the initialization function of an Ethernet driver
> - * to simultaneously register itself as a PCI driver and as an Ethernet
> - * Poll Mode Driver (PMD).
> - *
> - * @param eth_drv
> - * The pointer to the *eth_driver* structure associated with
> - * the Ethernet driver.
> - */
> -void rte_eth_driver_register(struct eth_driver *eth_drv);
> -
> -/**
> * Convert a numerical speed in Mbps to a bitmap flag that can be used in
> * the bitmap link_speeds of the struct rte_eth_conf
> *
> diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
> index 31017d4..d457b21 100644
> --- a/lib/librte_ether/rte_ether_version.map
> +++ b/lib/librte_ether/rte_ether_version.map
> @@ -80,7 +80,6 @@ DPDK_2.2 {
> rte_eth_dev_vlan_filter;
> rte_eth_dev_wd_timeout_store;
> rte_eth_dma_zone_reserve;
> - rte_eth_driver_register;
> rte_eth_led_off;
> rte_eth_led_on;
> rte_eth_link;
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
` (10 preceding siblings ...)
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 01/17] pci: no need for dynamic tailq init Shreyansh Jain
` (24 more replies)
11 siblings, 25 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
* Original patch series is from David Marchand [1], [2].
* Cover letter text has been modified to make it author agnostic
David created the original patchset based on the discussions on list [3].
Being a large piece of work, this patchset introduces first level of changes
for generalizing the driver-device relationship for supporting hotplug.
Pending work, as per discussions in thread [3]:
- Heirarchical relationship between rte_driver/device, pci_*, crypto_*
- Cleaner device init/deinit methods (probably from rte_driver onwards)
- Moving generic flags/fields from pci_* structure to rte_* structure
- Removing dependency on devargs for pdev/vdev distinction
- Device/Driver lists: discussion and decision on separate or unified lists
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
David Marchand (17):
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: remove duplicate function declaration
eal: introduce init macros
crypto: export init/uninit common wrappers for pci drivers
ethdev: export init/uninit common wrappers for pci drivers
drivers: convert all pdev drivers as pci drivers
crypto: get rid of crypto driver register callback
ethdev: get rid of eth driver register callback
eal/linux: move back interrupt thread init before setting affinity
pci: add a helper for device name
pci: add a helper to update a device
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +---
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/e1000/em_ethdev.c | 16 +-
drivers/net/e1000/igb_ethdev.c | 40 +----
drivers/net/ena/ena_ethdev.c | 20 +--
drivers/net/enic/enic_ethdev.c | 23 +--
drivers/net/fm10k/fm10k_ethdev.c | 23 +--
drivers/net/i40e/i40e_ethdev.c | 26 +--
drivers/net/i40e/i40e_ethdev_vf.c | 25 +--
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +----
drivers/net/mlx4/mlx4.c | 22 +--
drivers/net/mlx5/mlx5.c | 21 +--
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/nfp/nfp_net.c | 23 +--
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/qede/qede_ethdev.c | 40 +----
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 25 +--
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 26 +--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +--
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ---
lib/librte_cryptodev/rte_cryptodev.c | 67 ++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++---
lib/librte_cryptodev/rte_cryptodev_version.map | 9 +-
lib/librte_eal/bsdapp/eal/eal_pci.c | 52 +++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 +
lib/librte_eal/common/eal_common_dev.c | 47 +++++
lib/librte_eal/common/eal_common_pci.c | 19 +-
lib/librte_eal/common/eal_private.h | 20 ++-
lib/librte_eal/common/include/rte_dev.h | 29 +++-
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 36 ++++
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/linuxapp/eal/eal.c | 7 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +
lib/librte_ether/rte_ethdev.c | 222 +++++-------------------
lib/librte_ether/rte_ethdev.h | 40 ++---
lib/librte_ether/rte_ether_version.map | 4 +-
48 files changed, 395 insertions(+), 750 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 01/17] pci: no need for dynamic tailq init
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
` (23 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 7fdd6f1..880483d 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index ba5283d..fee4aa5 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f9c3efd..bfc410f 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 02/17] crypto: no need for a crypto pmd type
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 01/17] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 03/17] drivers: align pci driver definitions Shreyansh Jain
` (22 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 960e2d5..b0d806c 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -230,7 +230,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -269,7 +269,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -318,7 +317,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -360,8 +359,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 27cf8ef..f22eb43 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -700,8 +700,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 03/17] drivers: align pci driver definitions
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 04/17] eal: remove duplicate function declaration Shreyansh Jain
` (21 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index a7912f5..08496ab 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,7 +116,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index e157587..8d01e9a 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1427,7 +1427,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 5c9f350..ef7011e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2463,7 +2463,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 04/17] eal: remove duplicate function declaration
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (2 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 03/17] drivers: align pci driver definitions Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 05/17] eal: introduce init macros Shreyansh Jain
` (20 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 857dc3e..06a68f6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -259,13 +259,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 4f22c18..29fba52 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 05/17] eal: introduce init macros
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (3 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 04/17] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
` (19 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
RTE_EAL_PCI_REGISTER is added as a helper for pci drivers.
RTE_EAL_PCI_REGISTER assumes that object expanded contains a pci_drv member.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 8 ++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f1b5507..85e48f2 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -179,8 +179,8 @@ int rte_eal_vdev_init(const char *name, const char *args);
int rte_eal_vdev_uninit(const char *name);
#define PMD_REGISTER_DRIVER(d)\
-void devinitfn_ ##d(void);\
-void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+RTE_INIT(devinitfn_ ##d);\
+static void devinitfn_ ##d(void)\
{\
rte_eal_driver_register(&d);\
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..ac890fc 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registeration from driver (eth, crypto) instance */
+#define RTE_EAL_PCI_REGISTER(name) \
+RTE_INIT(pciinitfn_ ##name); \
+static void pciinitfn_ ##name(void) \
+{ \
+ rte_eal_pci_register(&(name).pci_drv); \
+}
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index 4a686e6..71ed3bb 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 06/17] crypto: export init/uninit common wrappers for pci drivers
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (4 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 05/17] eal: introduce init macros Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 07/17] ethdev: " Shreyansh Jain
` (18 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
that can be used by pci drivers that assume a 1 to 1 association between
pci resource and upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 8 ++++++++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index b0d806c..65a2e29 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -340,9 +340,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -401,8 +401,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -450,15 +450,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 41004e1..8d0edfb 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -32,3 +32,11 @@ DPDK_16.04 {
local: *;
};
+
+DPDK_16.07 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+
+} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 07/17] ethdev: export init/uninit common wrappers for pci drivers
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (5 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
` (17 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Preparing for getting rid of eth_drv, here are two wrappers that can be
used by pci drivers that assume a 1 to 1 association between pci resource and
upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 3 +++
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 42aaef7..312c42c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index bd93bf6..2249466 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4354,6 +4354,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 97ed0b0..cf4581c 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -140,4 +140,7 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 08/17] drivers: convert all pdev drivers as pci drivers
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (6 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 07/17] ethdev: " Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
` (16 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
virtio and mlx* drivers use the general purpose RTE_INIT macro, as they both
need some special stuff to be done before registering a pci driver.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++--------
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +++++-------------------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++--------
drivers/net/e1000/igb_ethdev.c | 40 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 18 +++----------
drivers/net/enic/enic_ethdev.c | 23 +++-------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++-------------
drivers/net/i40e/i40e_ethdev.c | 26 +++---------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +++++----------------------------
drivers/net/mlx4/mlx4.c | 20 +++-----------
drivers/net/mlx5/mlx5.c | 19 +++----------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/qede/qede_ethdev.c | 40 ++++++----------------------
drivers/net/szedata2/rte_eth_szedata2.c | 25 +++---------------
drivers/net/virtio/virtio_ethdev.c | 26 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++-------------
18 files changed, 76 insertions(+), 391 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 08496ab..43bccdc 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -120,21 +120,11 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv);
+RTE_EAL_PCI_REGISTER(rte_qat_pmd);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 071b44f..5ab3c75 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -506,11 +506,15 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
+RTE_EAL_PCI_REGISTER(rte_bnx2x_pmd);
+
/*
* virtual function driver struct
*/
@@ -519,36 +523,11 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver);
+RTE_EAL_PCI_REGISTER(rte_bnx2xvf_pmd);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 04eddaf..1389371 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -869,29 +869,11 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .name = "cxgbe_driver",
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver);
+RTE_EAL_PCI_REGISTER(rte_cxgbe_pmd);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 653be09..1f80c05 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -368,18 +368,15 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(em, rte_em_pmd.pci_drv);
static int
em_hw_init(struct e1000_hw *hw)
@@ -1771,10 +1768,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr);
return 0;
}
-
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b822992..a523944 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -983,12 +983,16 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
+RTE_EAL_PCI_REGISTER(rte_igb_pmd);
+
/*
* virtual function driver struct
*/
@@ -997,18 +1001,15 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(rte_igbvf_pmd);
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
@@ -1021,20 +1022,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -4844,16 +4831,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5014,6 +4991,3 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-
-PMD_REGISTER_DRIVER(pmd_igb_drv);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 8d01e9a..dc32435 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1431,23 +1431,11 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .name = "ena_driver",
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv);
+RTE_EAL_PCI_REGISTER(rte_ena_pmd);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6bea940..d5e395d 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -660,28 +660,11 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver);
+RTE_EAL_PCI_REGISTER(rte_enic_pmd);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index ce053b0..8ec8f5e 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3064,29 +3064,12 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver);
+RTE_EAL_PCI_REGISTER(rte_pmd_fm10k);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f94ad87..f2712ab 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -645,12 +645,16 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
+RTE_EAL_PCI_REGISTER(rte_i40e_pmd);
+
static inline int
rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev,
struct rte_eth_link *link)
@@ -680,28 +684,6 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
}
/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver);
-
-/*
* Initialize registers for flexible payload, which should be set by NVM.
* This should be removed from code once it is fixed in NVM.
*/
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 37af399..3411831 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1555,34 +1555,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver);
+RTE_EAL_PCI_REGISTER(rte_i40evf_pmd);
static int
i40evf_dev_configure(struct rte_eth_dev *dev)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index e11a431..dd521e8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1493,12 +1493,16 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
+RTE_EAL_PCI_REGISTER(rte_ixgbe_pmd);
+
/*
* virtual function driver struct
*/
@@ -1507,39 +1511,15 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(rte_ixgbevf_pmd);
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
@@ -7232,16 +7212,3 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
}
-
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 9ed1491..b594433 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5837,15 +5837,10 @@ static struct eth_driver mlx4_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5856,13 +5851,4 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .name = MLX4_DRIVER_NAME,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 041cfc3..1989a37 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -646,14 +646,10 @@ static struct eth_driver mlx5_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -663,13 +659,4 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .name = MLX5_DRIVER_NAME,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index ef7011e..951c8b4 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2468,29 +2468,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver);
+RTE_EAL_PCI_REGISTER(rte_nfp_net_pmd);
/*
* Local variables:
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 1273fd3..4fcb54c 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1056,7 +1056,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1068,39 +1070,13 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver);
-PMD_REGISTER_DRIVER(rte_qedevf_driver);
+RTE_EAL_PCI_REGISTER(rte_qede_pmd);
+RTE_EAL_PCI_REGISTER(rte_qedevf_pmd);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 985a8d6..6815dbb 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,12 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .name = RTE_SZEDATA2_DRIVER_NAME,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver);
+RTE_EAL_PCI_REGISTER(szedata2_eth_driver);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index a833740..9f5faf1 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1255,29 +1255,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1499,10 +1494,3 @@ __rte_unused uint8_t is_rx)
{
return 0;
}
-
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 29b469c..55d8776 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -332,25 +332,15 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(rte_vmxnet3);
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
@@ -948,10 +938,3 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 09/17] crypto: get rid of crypto driver register callback
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (7 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 10/17] ethdev: get rid of eth " Shreyansh Jain
` (15 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that all pdev are pci drivers, we don't need to register crypto drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
3 files changed, 53 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 65a2e29..a7cb33a 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -444,28 +444,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 8d0edfb..e0a9620 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 10/17] ethdev: get rid of eth driver register callback
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (8 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
` (14 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that all pdev are pci drivers, we don't need to register ethdev drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 22 ----------------------
lib/librte_ether/rte_ethdev.h | 12 ------------
lib/librte_ether/rte_ether_version.map | 1 -
3 files changed, 35 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 312c42c..06065fe 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 2249466..ffd24e4 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1862,18 +1862,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index cf4581c..8151007 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -80,7 +80,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 11/17] eal/linux: move back interrupt thread init before setting affinity
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (9 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 12/17] pci: add a helper for device name Shreyansh Jain
` (13 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that virtio pci driver is initialized in a constructor, iopl() stuff
happens early enough so that interrupt thread can be created right after
plugin loading.
This way, chelsio driver should be happy again [1].
[1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 29fba52..748daca 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -821,6 +821,9 @@ rte_eal_init(int argc, char **argv)
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");
+ if (rte_eal_intr_init() < 0)
+ rte_panic("Cannot init interrupt-handling thread\n");
+
eal_thread_init_master(rte_config.master_lcore);
ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
@@ -832,9 +835,6 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
- if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 12/17] pci: add a helper for device name
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (10 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 13/17] pci: add a helper to update a device Shreyansh Jain
` (12 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
eal is a better place than crypto / ethdev for naming resources.
Add a helper in eal and make use of it in crypto / ethdev.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
3 files changed, 33 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a7cb33a..3b587e4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -276,23 +276,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -355,9 +338,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -412,9 +394,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index ac890fc..1666a55 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using above functions.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 06065fe..ace8353 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 13/17] pci: add a helper to update a device
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (11 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 12/17] pci: add a helper for device name Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
` (11 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
This helper updates a pci device object with latest information it can
find.
It will be used mainly for hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_common_pci.c | 2 --
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 3 ++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
5 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 880483d..013c953 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index fee4aa5..dfd0a8c 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -87,8 +87,6 @@ struct pci_driver_list pci_driver_list =
struct pci_device_list pci_device_list =
TAILQ_HEAD_INITIALIZER(pci_device_list);
-#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
-
const char *pci_get_sysfs_path(void)
{
const char *path = NULL;
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 06a68f6..b8ff9c5 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -152,6 +152,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 1666a55..eed6b56 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -107,6 +107,9 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
+/** Default sysfs path for PCI device search. */
+#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
+
/**
* A structure describing a PCI resource.
*/
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bfc410f..0a368c5 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 14/17] ethdev: do not scan all pci devices on attach
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (12 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 13/17] pci: add a helper to update a device Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
` (10 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index dfd0a8c..d05dda4 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -339,6 +339,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -351,9 +356,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index ace8353..6f2b169 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -469,9 +469,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 15/17] eal: add hotplug operations for pci and vdev
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (13 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 16/17] ethdev: convert to eal hotplug Shreyansh Jain
` (9 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
hotplug which deals with resources should come from the layer that already
handles them, i.e. eal.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
lib/librte_eal/common/eal_common_dev.c | 47 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 25 +++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
4 files changed, 76 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 1852c4a..6f9324f 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -159,5 +159,7 @@ DPDK_16.07 {
rte_keepalive_mark_sleep;
rte_keepalive_register_relay_callback;
rte_thread_setname;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..14c6cf1 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,50 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+ int ret = -1;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device arguments provided\n");
+ return ret;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device\n");
+ return ret;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL)
+ goto err;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device\n");
+ return -1;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 85e48f2..b1c0520 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a resource to a registered driver.
+ *
+ * @param name
+ * The resource name, that refers to a pci resource or some private
+ * way of designating a resource for vdev drivers. Based on this
+ * resource name, eal will identify a driver capable of handling
+ * this resource and pass this resource to the driver probing
+ * function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a resource from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define PMD_REGISTER_DRIVER(d)\
RTE_INIT(devinitfn_ ##d);\
static void devinitfn_ ##d(void)\
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 0513467..6c6163e 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -162,5 +162,7 @@ DPDK_16.07 {
rte_keepalive_mark_sleep;
rte_keepalive_register_relay_callback;
rte_thread_setname;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 16/17] ethdev: convert to eal hotplug
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (14 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 17/17] ethdev: get rid of device type Shreyansh Jain
` (8 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 158 +++++++++---------------------------------
1 file changed, 33 insertions(+), 125 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6f2b169..28604ca 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -216,6 +217,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -465,124 +467,45 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ ret = -1;
+ goto err;
}
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
+ }
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -590,7 +513,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -598,33 +520,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v4 17/17] ethdev: get rid of device type
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (15 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 16/17] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-06-21 12:02 ` Shreyansh Jain
2016-06-21 12:31 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh jain
` (7 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-21 12:02 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
15 files changed, 15 insertions(+), 51 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f17bd7e..36ac102 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -648,7 +648,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 53df9fe..b858ee1 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index b594433..ba42c33 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5715,7 +5715,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 1989a37..f6399fc 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -519,7 +519,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 26e1424..9de556e 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 5e8e203..e6c74a6 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -514,7 +514,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index c98e234..2d00d04 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index b1783c3..b78d1cf 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 310cbef..4e99360 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -717,7 +717,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 1adeb5b..72861d8 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -651,7 +651,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 7120bab..0933a5f 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 28604ca..f8c3d71 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -191,7 +191,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -216,7 +216,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -248,7 +247,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ffd24e4..921dfa0 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1594,17 +1594,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1634,7 +1623,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
};
struct rte_eth_dev_sriov {
@@ -1747,8 +1735,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (16 preceding siblings ...)
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 17/17] ethdev: get rid of device type Shreyansh Jain
@ 2016-06-21 12:31 ` Shreyansh jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (6 subsequent siblings)
24 siblings, 0 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-06-21 12:31 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Self NACK.
Rebase over master before posting series broke compilation. Apologies.
On Tuesday 21 June 2016 05:32 PM, Shreyansh Jain wrote:
> * Original patch series is from David Marchand [1], [2].
> * Cover letter text has been modified to make it author agnostic
>
> David created the original patchset based on the discussions on list [3].
> Being a large piece of work, this patchset introduces first level of changes
> for generalizing the driver-device relationship for supporting hotplug.
>
> Pending work, as per discussions in thread [3]:
> - Heirarchical relationship between rte_driver/device, pci_*, crypto_*
> - Cleaner device init/deinit methods (probably from rte_driver onwards)
> - Moving generic flags/fields from pci_* structure to rte_* structure
> - Removing dependency on devargs for pdev/vdev distinction
> - Device/Driver lists: discussion and decision on separate or unified lists
>
> Changes since v3:
> - rebase over HEAD (913154e)
> - Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
> - modify qede driver to use RTE_EAL_PCI_REGISTER
> - Argument check in hotplug functions
>
> Changes since v2:
> - rebase over HEAD (d76c193)
> - Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
>
> Changes since v1:
> - rebased on HEAD, new drivers should be okay
> - patches have been split into smaller pieces
> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> - device type has been removed from ethdev, as it was used only by hotplug
> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> dropped for now, we can do this once vdev drivers have been converted
>
> [1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
> [2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
> [3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
>
> David Marchand (17):
> pci: no need for dynamic tailq init
> crypto: no need for a crypto pmd type
> drivers: align pci driver definitions
> eal: remove duplicate function declaration
> eal: introduce init macros
> crypto: export init/uninit common wrappers for pci drivers
> ethdev: export init/uninit common wrappers for pci drivers
> drivers: convert all pdev drivers as pci drivers
> crypto: get rid of crypto driver register callback
> ethdev: get rid of eth driver register callback
> eal/linux: move back interrupt thread init before setting affinity
> pci: add a helper for device name
> pci: add a helper to update a device
> ethdev: do not scan all pci devices on attach
> eal: add hotplug operations for pci and vdev
> ethdev: convert to eal hotplug
> ethdev: get rid of device type
>
> app/test/virtual_pmd.c | 2 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 35 +---
> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 24 +--
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/e1000/em_ethdev.c | 16 +-
> drivers/net/e1000/igb_ethdev.c | 40 +----
> drivers/net/ena/ena_ethdev.c | 20 +--
> drivers/net/enic/enic_ethdev.c | 23 +--
> drivers/net/fm10k/fm10k_ethdev.c | 23 +--
> drivers/net/i40e/i40e_ethdev.c | 26 +--
> drivers/net/i40e/i40e_ethdev_vf.c | 25 +--
> drivers/net/ixgbe/ixgbe_ethdev.c | 47 +----
> drivers/net/mlx4/mlx4.c | 22 +--
> drivers/net/mlx5/mlx5.c | 21 +--
> drivers/net/mpipe/mpipe_tilegx.c | 2 +-
> drivers/net/nfp/nfp_net.c | 23 +--
> drivers/net/null/rte_eth_null.c | 2 +-
> drivers/net/pcap/rte_eth_pcap.c | 2 +-
> drivers/net/qede/qede_ethdev.c | 40 +----
> drivers/net/ring/rte_eth_ring.c | 2 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 25 +--
> drivers/net/vhost/rte_eth_vhost.c | 2 +-
> drivers/net/virtio/virtio_ethdev.c | 26 +--
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +--
> drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
> examples/ip_pipeline/init.c | 22 ---
> lib/librte_cryptodev/rte_cryptodev.c | 67 ++-----
> lib/librte_cryptodev/rte_cryptodev.h | 2 -
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++---
> lib/librte_cryptodev/rte_cryptodev_version.map | 9 +-
> lib/librte_eal/bsdapp/eal/eal_pci.c | 52 +++++-
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 +
> lib/librte_eal/common/eal_common_dev.c | 47 +++++
> lib/librte_eal/common/eal_common_pci.c | 19 +-
> lib/librte_eal/common/eal_private.h | 20 ++-
> lib/librte_eal/common/include/rte_dev.h | 29 +++-
> lib/librte_eal/common/include/rte_eal.h | 3 +
> lib/librte_eal/common/include/rte_pci.h | 36 ++++
> lib/librte_eal/common/include/rte_tailq.h | 4 +-
> lib/librte_eal/linuxapp/eal/eal.c | 7 +-
> lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +
> lib/librte_ether/rte_ethdev.c | 222 +++++-------------------
> lib/librte_ether/rte_ethdev.h | 40 ++---
> lib/librte_ether/rte_ether_version.map | 4 +-
> 48 files changed, 395 insertions(+), 750 deletions(-)
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 00/17] Prepare for rte_device / rte_driver
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (17 preceding siblings ...)
2016-06-21 12:31 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 01/17] pci: no need for dynamic tailq init Shreyansh Jain
` (16 more replies)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (5 subsequent siblings)
24 siblings, 17 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
* Original patch series is from David Marchand [1], [2].
* Cover letter text has been modified to make it author agnostic
David created the original patchset based on the discussions on list [3].
Being a large piece of work, this patchset introduces first level of changes
for generalizing the driver-device relationship for supporting hotplug.
Pending work, as per discussions in thread [3]:
- Heirarchical relationship between rte_driver/device, pci_*, crypto_*
- Cleaner device init/deinit methods (probably from rte_driver onwards)
- Moving generic flags/fields from pci_* structure to rte_* structure
- Removing dependency on devargs for pdev/vdev distinction
- Device/Driver lists: discussion and decision on separate or unified lists
This patchset is based on master (34d279)
Changes since v4:
- Fix compilation issue after rebase on HEAD (913154e) in previous series
- Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
were removed by previous patchset. These are being used by pdump library
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
David Marchand, Shreyansh Jain (17):
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: remove duplicate function declaration
eal: introduce init macros
crypto: export init/uninit common wrappers for pci drivers
ethdev: export init/uninit common wrappers for pci drivers
drivers: convert all pdev drivers as pci drivers
crypto: get rid of crypto driver register callback
ethdev: get rid of eth driver register callback
eal/linux: move back interrupt thread init before setting affinity
pci: add a helper for device name
pci: add a helper to update a device
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +--
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/e1000/em_ethdev.c | 16 +-
drivers/net/e1000/igb_ethdev.c | 40 +---
drivers/net/ena/ena_ethdev.c | 20 +-
drivers/net/enic/enic_ethdev.c | 23 +-
drivers/net/fm10k/fm10k_ethdev.c | 23 +-
drivers/net/i40e/i40e_ethdev.c | 26 +--
drivers/net/i40e/i40e_ethdev_vf.c | 25 +--
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +---
drivers/net/mlx4/mlx4.c | 22 +-
drivers/net/mlx5/mlx5.c | 21 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/nfp/nfp_net.c | 23 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/qede/qede_ethdev.c | 40 +---
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 25 +--
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 26 +--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 67 ++----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
lib/librte_cryptodev/rte_cryptodev_version.map | 9 +-
lib/librte_eal/bsdapp/eal/eal_pci.c | 52 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 +
lib/librte_eal/common/eal_common_dev.c | 47 ++++
lib/librte_eal/common/eal_common_pci.c | 19 +-
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_dev.h | 29 ++-
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 36 ++++
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/linuxapp/eal/eal.c | 7 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +
lib/librte_ether/rte_ethdev.c | 271 ++++--------------------
lib/librte_ether/rte_ethdev.h | 40 ++--
lib/librte_ether/rte_ether_version.map | 4 +-
48 files changed, 395 insertions(+), 799 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 01/17] pci: no need for dynamic tailq init
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
` (15 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 7fdd6f1..880483d 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index ba5283d..fee4aa5 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f9c3efd..bfc410f 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 02/17] crypto: no need for a crypto pmd type
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 01/17] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 03/17] drivers: align pci driver definitions Shreyansh Jain
` (14 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 960e2d5..b0d806c 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -230,7 +230,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -269,7 +269,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -318,7 +317,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -360,8 +359,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 27cf8ef..f22eb43 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -700,8 +700,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 03/17] drivers: align pci driver definitions
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 04/17] eal: remove duplicate function declaration Shreyansh Jain
` (13 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index f46ec85..0ff3944 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,7 +113,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index e157587..8d01e9a 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1427,7 +1427,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 5c9f350..ef7011e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2463,7 +2463,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 04/17] eal: remove duplicate function declaration
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (2 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 03/17] drivers: align pci driver definitions Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 05/17] eal: introduce init macros Shreyansh Jain
` (12 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 857dc3e..06a68f6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -259,13 +259,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 4f22c18..29fba52 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 05/17] eal: introduce init macros
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (3 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 04/17] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
` (11 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
RTE_EAL_PCI_REGISTER is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 8 ++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f1b5507..85e48f2 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -179,8 +179,8 @@ int rte_eal_vdev_init(const char *name, const char *args);
int rte_eal_vdev_uninit(const char *name);
#define PMD_REGISTER_DRIVER(d)\
-void devinitfn_ ##d(void);\
-void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+RTE_INIT(devinitfn_ ##d);\
+static void devinitfn_ ##d(void)\
{\
rte_eal_driver_register(&d);\
}
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..ac890fc 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registeration from driver (eth, crypto) instance */
+#define RTE_EAL_PCI_REGISTER(name) \
+RTE_INIT(pciinitfn_ ##name); \
+static void pciinitfn_ ##name(void) \
+{ \
+ rte_eal_pci_register(&(name).pci_drv); \
+}
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index 4a686e6..71ed3bb 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 06/17] crypto: export init/uninit common wrappers for pci drivers
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (4 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 05/17] eal: introduce init macros Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 07/17] ethdev: " Shreyansh Jain
` (10 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
that can be used by pci drivers that assume a 1 to 1 association between
pci resource and upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 8 ++++++++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index b0d806c..65a2e29 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -340,9 +340,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -401,8 +401,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -450,15 +450,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 41004e1..8d0edfb 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -32,3 +32,11 @@ DPDK_16.04 {
local: *;
};
+
+DPDK_16.07 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+
+} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 07/17] ethdev: export init/uninit common wrappers for pci drivers
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (5 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
` (9 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Preparing for getting rid of eth_drv, here are two wrappers that can be
used by pci drivers that assume a 1 to 1 association between pci resource and
upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 3 +++
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 42aaef7..312c42c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index bd93bf6..2249466 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4354,6 +4354,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 97ed0b0..cf4581c 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -140,4 +140,7 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 08/17] drivers: convert all pdev drivers as pci drivers
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (6 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 07/17] ethdev: " Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
` (8 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
virtio and mlx* drivers use the general purpose RTE_INIT macro, as they both
need some special stuff to be done before registering a pci driver.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++--------
drivers/net/bnx2x/bnx2x_ethdev.c | 35 +++++-------------------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++--------
drivers/net/e1000/igb_ethdev.c | 40 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 18 +++----------
drivers/net/enic/enic_ethdev.c | 23 +++-------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++-------------
drivers/net/i40e/i40e_ethdev.c | 26 +++---------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 47 +++++----------------------------
drivers/net/mlx4/mlx4.c | 20 +++-----------
drivers/net/mlx5/mlx5.c | 19 +++----------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/qede/qede_ethdev.c | 40 ++++++----------------------
drivers/net/szedata2/rte_eth_szedata2.c | 25 +++---------------
drivers/net/virtio/virtio_ethdev.c | 26 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++-------------
18 files changed, 76 insertions(+), 391 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 0ff3944..970970a 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -117,21 +117,11 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.name = "rte_qat_pmd",
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv);
+RTE_EAL_PCI_REGISTER(rte_qat_pmd);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 071b44f..5ab3c75 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -506,11 +506,15 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
+RTE_EAL_PCI_REGISTER(rte_bnx2x_pmd);
+
/*
* virtual function driver struct
*/
@@ -519,36 +523,11 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver);
+RTE_EAL_PCI_REGISTER(rte_bnx2xvf_pmd);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 04eddaf..1389371 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -869,29 +869,11 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .name = "cxgbe_driver",
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver);
+RTE_EAL_PCI_REGISTER(rte_cxgbe_pmd);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 653be09..c67e67f 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -368,18 +368,15 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(rte_em_pmd);
static int
em_hw_init(struct e1000_hw *hw)
@@ -1771,10 +1768,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr);
return 0;
}
-
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b822992..a523944 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -983,12 +983,16 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
+RTE_EAL_PCI_REGISTER(rte_igb_pmd);
+
/*
* virtual function driver struct
*/
@@ -997,18 +1001,15 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(rte_igbvf_pmd);
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
@@ -1021,20 +1022,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -4844,16 +4831,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5014,6 +4991,3 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-
-PMD_REGISTER_DRIVER(pmd_igb_drv);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 8d01e9a..dc32435 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1431,23 +1431,11 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .name = "ena_driver",
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv);
+RTE_EAL_PCI_REGISTER(rte_ena_pmd);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6bea940..d5e395d 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -660,28 +660,11 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver);
+RTE_EAL_PCI_REGISTER(rte_enic_pmd);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index ce053b0..8ec8f5e 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3064,29 +3064,12 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver);
+RTE_EAL_PCI_REGISTER(rte_pmd_fm10k);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f94ad87..f2712ab 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -645,12 +645,16 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
+RTE_EAL_PCI_REGISTER(rte_i40e_pmd);
+
static inline int
rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev,
struct rte_eth_link *link)
@@ -680,28 +684,6 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
}
/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver);
-
-/*
* Initialize registers for flexible payload, which should be set by NVM.
* This should be removed from code once it is fixed in NVM.
*/
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 37af399..3411831 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1555,34 +1555,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver);
+RTE_EAL_PCI_REGISTER(rte_i40evf_pmd);
static int
i40evf_dev_configure(struct rte_eth_dev *dev)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index e11a431..dd521e8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1493,12 +1493,16 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
+RTE_EAL_PCI_REGISTER(rte_ixgbe_pmd);
+
/*
* virtual function driver struct
*/
@@ -1507,39 +1511,15 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(rte_ixgbevf_pmd);
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
@@ -7232,16 +7212,3 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
}
-
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 9ed1491..b594433 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5837,15 +5837,10 @@ static struct eth_driver mlx4_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5856,13 +5851,4 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .name = MLX4_DRIVER_NAME,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 041cfc3..1989a37 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -646,14 +646,10 @@ static struct eth_driver mlx5_driver = {
.dev_private_size = sizeof(struct priv)
};
-/**
- * Driver initialization routine.
- */
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -663,13 +659,4 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .name = MLX5_DRIVER_NAME,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index ef7011e..951c8b4 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2468,29 +2468,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver);
+RTE_EAL_PCI_REGISTER(rte_nfp_net_pmd);
/*
* Local variables:
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 1273fd3..4fcb54c 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1056,7 +1056,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1068,39 +1070,13 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver);
-PMD_REGISTER_DRIVER(rte_qedevf_driver);
+RTE_EAL_PCI_REGISTER(rte_qede_pmd);
+RTE_EAL_PCI_REGISTER(rte_qedevf_pmd);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 985a8d6..6815dbb 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,12 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .name = RTE_SZEDATA2_DRIVER_NAME,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver);
+RTE_EAL_PCI_REGISTER(szedata2_eth_driver);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index a833740..9f5faf1 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1255,29 +1255,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1499,10 +1494,3 @@ __rte_unused uint8_t is_rx)
{
return 0;
}
-
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 29b469c..79c5f6d 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -332,25 +332,15 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
+RTE_EAL_PCI_REGISTER(rte_vmxnet3_pmd);
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
@@ -948,10 +938,3 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver);
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (7 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 13:27 ` Neil Horman
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 10/17] ethdev: get rid of eth " Shreyansh Jain
` (7 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that all pdev are pci drivers, we don't need to register crypto drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
3 files changed, 53 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 65a2e29..a7cb33a 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -444,28 +444,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 8d0edfb..e0a9620 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 10/17] ethdev: get rid of eth driver register callback
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (8 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 13:28 ` Neil Horman
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
` (6 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that all pdev are pci drivers, we don't need to register ethdev drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 22 ----------------------
lib/librte_ether/rte_ethdev.h | 12 ------------
lib/librte_ether/rte_ether_version.map | 1 -
3 files changed, 35 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 312c42c..06065fe 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 2249466..ffd24e4 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1862,18 +1862,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index cf4581c..8151007 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -80,7 +80,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 11/17] eal/linux: move back interrupt thread init before setting affinity
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (9 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 12/17] pci: add a helper for device name Shreyansh Jain
` (5 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that virtio pci driver is initialized in a constructor, iopl() stuff
happens early enough so that interrupt thread can be created right after
plugin loading.
This way, chelsio driver should be happy again [1].
[1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 29fba52..748daca 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -821,6 +821,9 @@ rte_eal_init(int argc, char **argv)
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");
+ if (rte_eal_intr_init() < 0)
+ rte_panic("Cannot init interrupt-handling thread\n");
+
eal_thread_init_master(rte_config.master_lcore);
ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
@@ -832,9 +835,6 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
- if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 12/17] pci: add a helper for device name
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (10 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 13/17] pci: add a helper to update a device Shreyansh Jain
` (4 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
eal is a better place than crypto / ethdev for naming resources.
Add a helper in eal and make use of it in crypto / ethdev.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
3 files changed, 33 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index a7cb33a..3b587e4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -276,23 +276,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -355,9 +338,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -412,9 +394,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index ac890fc..1666a55 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using above functions.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 06065fe..ace8353 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 13/17] pci: add a helper to update a device
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (11 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 12/17] pci: add a helper for device name Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
` (3 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
This helper updates a pci device object with latest information it can
find.
It will be used mainly for hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_common_pci.c | 2 --
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 3 ++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
5 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 880483d..013c953 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index fee4aa5..dfd0a8c 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -87,8 +87,6 @@ struct pci_driver_list pci_driver_list =
struct pci_device_list pci_device_list =
TAILQ_HEAD_INITIALIZER(pci_device_list);
-#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
-
const char *pci_get_sysfs_path(void)
{
const char *path = NULL;
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 06a68f6..b8ff9c5 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -152,6 +152,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 1666a55..eed6b56 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -107,6 +107,9 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
+/** Default sysfs path for PCI device search. */
+#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
+
/**
* A structure describing a PCI resource.
*/
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bfc410f..0a368c5 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 14/17] ethdev: do not scan all pci devices on attach
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (12 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 13/17] pci: add a helper to update a device Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
` (2 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index dfd0a8c..d05dda4 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -339,6 +339,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -351,9 +356,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index ace8353..6f2b169 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -469,9 +469,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 15/17] eal: add hotplug operations for pci and vdev
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (13 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 17/17] ethdev: get rid of device type Shreyansh Jain
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
hotplug which deals with resources should come from the layer that already
handles them, i.e. eal.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
lib/librte_eal/common/eal_common_dev.c | 47 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 25 +++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
4 files changed, 76 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 1852c4a..6f9324f 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -159,5 +159,7 @@ DPDK_16.07 {
rte_keepalive_mark_sleep;
rte_keepalive_register_relay_callback;
rte_thread_setname;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..14c6cf1 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,50 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+ int ret = -1;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device arguments provided\n");
+ return ret;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device\n");
+ return ret;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL)
+ goto err;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device\n");
+ return -1;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 85e48f2..b1c0520 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a resource to a registered driver.
+ *
+ * @param name
+ * The resource name, that refers to a pci resource or some private
+ * way of designating a resource for vdev drivers. Based on this
+ * resource name, eal will identify a driver capable of handling
+ * this resource and pass this resource to the driver probing
+ * function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a resource from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define PMD_REGISTER_DRIVER(d)\
RTE_INIT(devinitfn_ ##d);\
static void devinitfn_ ##d(void)\
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 0513467..6c6163e 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -162,5 +162,7 @@ DPDK_16.07 {
rte_keepalive_mark_sleep;
rte_keepalive_register_relay_callback;
rte_thread_setname;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 16/17] ethdev: convert to eal hotplug
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (14 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 17/17] ethdev: get rid of device type Shreyansh Jain
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 207 +++++++-----------------------------------
1 file changed, 33 insertions(+), 174 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6f2b169..10e81e1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -216,6 +217,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -347,27 +349,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
@@ -413,34 +394,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t dev_flags;
@@ -465,124 +418,45 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ ret = -1;
+ goto err;
+ }
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
}
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -590,7 +464,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -598,33 +471,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v5 17/17] ethdev: get rid of device type
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
` (15 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 16/17] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-06-22 9:06 ` Shreyansh Jain
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-06-22 9:06 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
15 files changed, 15 insertions(+), 51 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f17bd7e..36ac102 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -648,7 +648,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 53df9fe..b858ee1 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index b594433..ba42c33 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5715,7 +5715,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 1989a37..f6399fc 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -519,7 +519,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 26e1424..9de556e 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 5e8e203..e6c74a6 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -514,7 +514,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index c98e234..2d00d04 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index b1783c3..b78d1cf 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 310cbef..4e99360 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -717,7 +717,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 1adeb5b..72861d8 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -651,7 +651,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..0dbc332 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 10e81e1..48c7254 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -191,7 +191,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -216,7 +216,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -248,7 +247,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ffd24e4..921dfa0 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1594,17 +1594,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1634,7 +1623,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
};
struct rte_eth_dev_sriov {
@@ -1747,8 +1735,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
@ 2016-06-22 13:27 ` Neil Horman
2016-06-22 13:43 ` Shreyansh jain
2016-06-22 13:44 ` Thomas Monjalon
0 siblings, 2 replies; 375+ messages in thread
From: Neil Horman @ 2016-06-22 13:27 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, viktorin, thomas.monjalon
On Wed, Jun 22, 2016 at 02:36:28PM +0530, Shreyansh Jain wrote:
> Now that all pdev are pci drivers, we don't need to register crypto drivers
> through a dedicated channel.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
> lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
> 3 files changed, 53 deletions(-)
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
> index 65a2e29..a7cb33a 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -444,28 +444,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
> return 0;
> }
>
> -int
> -rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
> - enum pmd_type type)
> -{
> - /* Call crypto device initialization directly if device is virtual */
> - if (type == PMD_VDEV)
> - return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
> - NULL);
> -
> - /*
> - * Register PCI driver for physical device intialisation during
> - * PCI probing
> - */
> - cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
> - cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
> -
> - rte_eal_pci_register(&cryptodrv->pci_drv);
> -
> - return 0;
> -}
> -
> -
> uint16_t
> rte_cryptodev_queue_pair_count(uint8_t dev_id)
> {
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> index 3fb7c7c..99fd69e 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> @@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
> extern int
> rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
>
> -
> -/**
> - * Register a Crypto [Poll Mode] driver.
> - *
> - * Function invoked by the initialization function of a Crypto driver
> - * to simultaneously register itself as Crypto Poll Mode Driver and to either:
> - *
> - * a - register itself as PCI driver if the crypto device is a physical
> - * device, by invoking the rte_eal_pci_register() function to
> - * register the *pci_drv* structure embedded in the *crypto_drv*
> - * structure, after having stored the address of the
> - * rte_cryptodev_init() function in the *devinit* field of the
> - * *pci_drv* structure.
> - *
> - * During the PCI probing phase, the rte_cryptodev_init()
> - * function is invoked for each PCI [device] matching the
> - * embedded PCI identifiers provided by the driver.
> - *
> - * b, complete the initialization sequence if the device is a virtual
> - * device by calling the rte_cryptodev_init() directly passing a
> - * NULL parameter for the rte_pci_device structure.
> - *
> - * @param crypto_drv crypto_driver structure associated with the crypto
> - * driver.
> - * @param type pmd type
> - */
> -extern int
> -rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
> - enum pmd_type type);
> -
> /**
> * Executes all the user application registered callbacks for the specific
> * device.
> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
> index 8d0edfb..e0a9620 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> @@ -14,7 +14,6 @@ DPDK_16.04 {
> rte_cryptodev_info_get;
> rte_cryptodev_pmd_allocate;
> rte_cryptodev_pmd_callback_process;
> - rte_cryptodev_pmd_driver_register;
> rte_cryptodev_pmd_release_device;
> rte_cryptodev_pmd_virtual_dev_init;
> rte_cryptodev_sym_session_create;
NAK, you can't just remove exported symbols without going through the
deprecation process. Better still would be to only expose it for DPDK_16.04 and
hide it in the next release
Neil
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v5 10/17] ethdev: get rid of eth driver register callback
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-06-22 13:28 ` Neil Horman
2016-06-22 13:44 ` Shreyansh jain
0 siblings, 1 reply; 375+ messages in thread
From: Neil Horman @ 2016-06-22 13:28 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, viktorin, thomas.monjalon
On Wed, Jun 22, 2016 at 02:36:29PM +0530, Shreyansh Jain wrote:
> Now that all pdev are pci drivers, we don't need to register ethdev drivers
> through a dedicated channel.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_ether/rte_ethdev.c | 22 ----------------------
> lib/librte_ether/rte_ethdev.h | 12 ------------
> lib/librte_ether/rte_ether_version.map | 1 -
> 3 files changed, 35 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 312c42c..06065fe 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
> return 0;
> }
>
> -/**
> - * Register an Ethernet [Poll Mode] driver.
> - *
> - * Function invoked by the initialization function of an Ethernet driver
> - * to simultaneously register itself as a PCI driver and as an Ethernet
> - * Poll Mode Driver.
> - * Invokes the rte_eal_pci_register() function to register the *pci_drv*
> - * structure embedded in the *eth_drv* structure, after having stored the
> - * address of the rte_eth_dev_init() function in the *devinit* field of
> - * the *pci_drv* structure.
> - * During the PCI probing phase, the rte_eth_dev_init() function is
> - * invoked for each PCI [Ethernet device] matching the embedded PCI
> - * identifiers provided by the driver.
> - */
> -void
> -rte_eth_driver_register(struct eth_driver *eth_drv)
> -{
> - eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
> - eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
> - rte_eal_pci_register(ð_drv->pci_drv);
> -}
> -
> int
> rte_eth_dev_is_valid_port(uint8_t port_id)
> {
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 2249466..ffd24e4 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1862,18 +1862,6 @@ struct eth_driver {
> };
>
> /**
> - * @internal
> - * A function invoked by the initialization function of an Ethernet driver
> - * to simultaneously register itself as a PCI driver and as an Ethernet
> - * Poll Mode Driver (PMD).
> - *
> - * @param eth_drv
> - * The pointer to the *eth_driver* structure associated with
> - * the Ethernet driver.
> - */
> -void rte_eth_driver_register(struct eth_driver *eth_drv);
> -
> -/**
> * Convert a numerical speed in Mbps to a bitmap flag that can be used in
> * the bitmap link_speeds of the struct rte_eth_conf
> *
> diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
> index cf4581c..8151007 100644
> --- a/lib/librte_ether/rte_ether_version.map
> +++ b/lib/librte_ether/rte_ether_version.map
> @@ -80,7 +80,6 @@ DPDK_2.2 {
> rte_eth_dev_vlan_filter;
> rte_eth_dev_wd_timeout_store;
> rte_eth_dma_zone_reserve;
> - rte_eth_driver_register;
> rte_eth_led_off;
> rte_eth_led_on;
> rte_eth_link;
Nak, Same issue as the crypto registration
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback
2016-06-22 13:27 ` Neil Horman
@ 2016-06-22 13:43 ` Shreyansh jain
2016-06-22 13:44 ` Thomas Monjalon
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-06-22 13:43 UTC (permalink / raw)
To: Neil Horman; +Cc: dev, viktorin, thomas.monjalon
On Wednesday 22 June 2016 06:57 PM, Neil Horman wrote:
> On Wed, Jun 22, 2016 at 02:36:28PM +0530, Shreyansh Jain wrote:
>> Now that all pdev are pci drivers, we don't need to register crypto drivers
>> through a dedicated channel.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
>> lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
>> lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
>> 3 files changed, 53 deletions(-)
>>
>> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
>> index 65a2e29..a7cb33a 100644
>> --- a/lib/librte_cryptodev/rte_cryptodev.c
>> +++ b/lib/librte_cryptodev/rte_cryptodev.c
>> @@ -444,28 +444,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
>> return 0;
>> }
>>
>> -int
>> -rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
>> - enum pmd_type type)
>> -{
>> - /* Call crypto device initialization directly if device is virtual */
>> - if (type == PMD_VDEV)
>> - return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
>> - NULL);
>> -
>> - /*
>> - * Register PCI driver for physical device intialisation during
>> - * PCI probing
>> - */
>> - cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
>> - cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
>> -
>> - rte_eal_pci_register(&cryptodrv->pci_drv);
>> -
>> - return 0;
>> -}
>> -
>> -
>> uint16_t
>> rte_cryptodev_queue_pair_count(uint8_t dev_id)
>> {
>> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
>> index 3fb7c7c..99fd69e 100644
>> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
>> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
>> @@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
>> extern int
>> rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
>>
>> -
>> -/**
>> - * Register a Crypto [Poll Mode] driver.
>> - *
>> - * Function invoked by the initialization function of a Crypto driver
>> - * to simultaneously register itself as Crypto Poll Mode Driver and to either:
>> - *
>> - * a - register itself as PCI driver if the crypto device is a physical
>> - * device, by invoking the rte_eal_pci_register() function to
>> - * register the *pci_drv* structure embedded in the *crypto_drv*
>> - * structure, after having stored the address of the
>> - * rte_cryptodev_init() function in the *devinit* field of the
>> - * *pci_drv* structure.
>> - *
>> - * During the PCI probing phase, the rte_cryptodev_init()
>> - * function is invoked for each PCI [device] matching the
>> - * embedded PCI identifiers provided by the driver.
>> - *
>> - * b, complete the initialization sequence if the device is a virtual
>> - * device by calling the rte_cryptodev_init() directly passing a
>> - * NULL parameter for the rte_pci_device structure.
>> - *
>> - * @param crypto_drv crypto_driver structure associated with the crypto
>> - * driver.
>> - * @param type pmd type
>> - */
>> -extern int
>> -rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
>> - enum pmd_type type);
>> -
>> /**
>> * Executes all the user application registered callbacks for the specific
>> * device.
>> diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
>> index 8d0edfb..e0a9620 100644
>> --- a/lib/librte_cryptodev/rte_cryptodev_version.map
>> +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
>> @@ -14,7 +14,6 @@ DPDK_16.04 {
>> rte_cryptodev_info_get;
>> rte_cryptodev_pmd_allocate;
>> rte_cryptodev_pmd_callback_process;
>> - rte_cryptodev_pmd_driver_register;
>> rte_cryptodev_pmd_release_device;
>> rte_cryptodev_pmd_virtual_dev_init;
>> rte_cryptodev_sym_session_create;
> NAK, you can't just remove exported symbols without going through the
> deprecation process. Better still would be to only expose it for DPDK_16.04 and
> hide it in the next release
Agree. I will fix it.
>
> Neil
>
>> --
>> 2.7.4
>>
>>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v5 10/17] ethdev: get rid of eth driver register callback
2016-06-22 13:28 ` Neil Horman
@ 2016-06-22 13:44 ` Shreyansh jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-06-22 13:44 UTC (permalink / raw)
To: Neil Horman; +Cc: dev, viktorin, thomas.monjalon
On Wednesday 22 June 2016 06:58 PM, Neil Horman wrote:
> On Wed, Jun 22, 2016 at 02:36:29PM +0530, Shreyansh Jain wrote:
>> Now that all pdev are pci drivers, we don't need to register ethdev drivers
>> through a dedicated channel.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_ether/rte_ethdev.c | 22 ----------------------
>> lib/librte_ether/rte_ethdev.h | 12 ------------
>> lib/librte_ether/rte_ether_version.map | 1 -
>> 3 files changed, 35 deletions(-)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index 312c42c..06065fe 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
>> return 0;
>> }
>>
>> -/**
>> - * Register an Ethernet [Poll Mode] driver.
>> - *
>> - * Function invoked by the initialization function of an Ethernet driver
>> - * to simultaneously register itself as a PCI driver and as an Ethernet
>> - * Poll Mode Driver.
>> - * Invokes the rte_eal_pci_register() function to register the *pci_drv*
>> - * structure embedded in the *eth_drv* structure, after having stored the
>> - * address of the rte_eth_dev_init() function in the *devinit* field of
>> - * the *pci_drv* structure.
>> - * During the PCI probing phase, the rte_eth_dev_init() function is
>> - * invoked for each PCI [Ethernet device] matching the embedded PCI
>> - * identifiers provided by the driver.
>> - */
>> -void
>> -rte_eth_driver_register(struct eth_driver *eth_drv)
>> -{
>> - eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
>> - eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
>> - rte_eal_pci_register(ð_drv->pci_drv);
>> -}
>> -
>> int
>> rte_eth_dev_is_valid_port(uint8_t port_id)
>> {
>> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
>> index 2249466..ffd24e4 100644
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> @@ -1862,18 +1862,6 @@ struct eth_driver {
>> };
>>
>> /**
>> - * @internal
>> - * A function invoked by the initialization function of an Ethernet driver
>> - * to simultaneously register itself as a PCI driver and as an Ethernet
>> - * Poll Mode Driver (PMD).
>> - *
>> - * @param eth_drv
>> - * The pointer to the *eth_driver* structure associated with
>> - * the Ethernet driver.
>> - */
>> -void rte_eth_driver_register(struct eth_driver *eth_drv);
>> -
>> -/**
>> * Convert a numerical speed in Mbps to a bitmap flag that can be used in
>> * the bitmap link_speeds of the struct rte_eth_conf
>> *
>> diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
>> index cf4581c..8151007 100644
>> --- a/lib/librte_ether/rte_ether_version.map
>> +++ b/lib/librte_ether/rte_ether_version.map
>> @@ -80,7 +80,6 @@ DPDK_2.2 {
>> rte_eth_dev_vlan_filter;
>> rte_eth_dev_wd_timeout_store;
>> rte_eth_dma_zone_reserve;
>> - rte_eth_driver_register;
>> rte_eth_led_off;
>> rte_eth_led_on;
>> rte_eth_link;
> Nak, Same issue as the crypto registration
Yes, I agree. I will fix this in next version.
>
>> --
>> 2.7.4
>>
>>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback
2016-06-22 13:27 ` Neil Horman
2016-06-22 13:43 ` Shreyansh jain
@ 2016-06-22 13:44 ` Thomas Monjalon
1 sibling, 0 replies; 375+ messages in thread
From: Thomas Monjalon @ 2016-06-22 13:44 UTC (permalink / raw)
To: Neil Horman; +Cc: Shreyansh Jain, dev, viktorin
2016-06-22 09:27, Neil Horman:
> > +++ b/lib/librte_cryptodev/rte_cryptodev_version.map
> > - rte_cryptodev_pmd_driver_register;
> NAK, you can't just remove exported symbols without going through the
> deprecation process. Better still would be to only expose it for DPDK_16.04 and
> hide it in the next release
This function is not called by the application.
Thus there is no ABI break.
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (18 preceding siblings ...)
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 01/17] pci: no need for dynamic tailq init Shreyansh Jain
` (16 more replies)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (4 subsequent siblings)
24 siblings, 17 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
* Original patch series is from David Marchand [1], [2].
* Link with patch series [4] from Jan Viktorin for a more complete picture
of proposed EAL device heirarchy changes.
* This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
removed [7].
David created the original patchset based on the discussions on list [3].
Being a large piece of work, this patchset introduces first level of changes
for generalizing the driver-device relationship for supporting hotplug.
This patchset is based on master (11c5e45d8)
Overview of this work as per David [3], as well as notes from Thomas, Jan:
- pdev -> PCI registeration using helpers (introduced in this series)
- removal of eth/crypto driver registeration callbacks. These are now handled
by PCI registeration helpers (this patch)
- rte_device=>pci/vdev device heirarchy (by this [4] series)
- removal of PMD_PDEV type (this patch) and PMD_VDEV (by this [4] series)
- Support for hotplugging
In [5], Neil had NACK'd previous series due to removal of symbol from map file
without proper process. I continue with the same patch in this series as I
was not clear after Thomas's reponse [6] whether it is OK to remove these
(rte_cryptodev_pmd_driver_register, rte_eth_driver_register) or not - probably
some procedure of deprecation that I am skipping.
Changes since v5:
- Rebase over master (11c5e45d8)
- Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in sync
with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
- Modifications to bnxt and thunderx driver PMD registeration files for
using the simplified PCI device registeration helper macro
Changes since v4:
- Fix compilation issue after rebase on HEAD (913154e) in previous series
- Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
were removed by previous patchset. These are being used by pdump library
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
[4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
[5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
[6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
[7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
David Marchand, Shreyansh Jain (17):
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: remove duplicate function declaration
eal: introduce init macros
crypto: export init/uninit common wrappers for pci drivers
ethdev: export init/uninit common wrappers for pci drivers
drivers: convert all pdev drivers as pci drivers
crypto: get rid of crypto driver register callback
ethdev: get rid of eth driver register callback
eal/linux: move back interrupt thread init before setting affinity
pci: add a helper for device name
pci: add a helper to update a device
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +--
drivers/net/bnxt/bnxt_ethdev.c | 16 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/e1000/em_ethdev.c | 16 +-
drivers/net/e1000/igb_ethdev.c | 39 +---
drivers/net/ena/ena_ethdev.c | 19 +-
drivers/net/enic/enic_ethdev.c | 23 +-
drivers/net/fm10k/fm10k_ethdev.c | 23 +-
drivers/net/i40e/i40e_ethdev.c | 24 +--
drivers/net/i40e/i40e_ethdev_vf.c | 25 +--
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +---
drivers/net/mlx4/mlx4.c | 17 +-
drivers/net/mlx5/mlx5.c | 16 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/nfp/nfp_net.c | 23 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/qede/qede_ethdev.c | 40 +---
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 24 +--
drivers/net/thunderx/nicvf_ethdev.c | 20 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 25 +--
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 67 ++----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
lib/librte_cryptodev/rte_cryptodev_version.map | 3 +-
lib/librte_eal/bsdapp/eal/eal_pci.c | 52 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 +
lib/librte_eal/common/eal_common_dev.c | 47 ++++
lib/librte_eal/common/eal_common_pci.c | 19 +-
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_dev.h | 29 ++-
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 36 ++++
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/linuxapp/eal/eal.c | 7 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +
lib/librte_ether/rte_ethdev.c | 271 ++++--------------------
lib/librte_ether/rte_ethdev.h | 40 ++--
lib/librte_ether/rte_ether_version.map | 4 +-
51 files changed, 392 insertions(+), 816 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 01/17] pci: no need for dynamic tailq init
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:11 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
` (15 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 374b68f..a73cbb0 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 7248c38..6a0f6ac 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index cd9de7c..f0215ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 02/17] crypto: no need for a crypto pmd type
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 01/17] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:14 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 03/17] drivers: align pci driver definitions Shreyansh Jain
` (14 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 20e5beb..c3cc3e9 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -321,7 +321,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -360,7 +360,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -409,7 +408,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -451,8 +450,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index affbdec..13f46e4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -613,8 +613,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 03/17] drivers: align pci driver definitions
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:12 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 04/17] eal: remove duplicate function declaration Shreyansh Jain
` (13 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 82ab047..1e9e0ba 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,7 +113,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
},
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ac0803d..9418d50 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1685,7 +1685,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 82e3e4e..99a258a 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2459,7 +2459,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 04/17] eal: remove duplicate function declaration
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (2 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 03/17] drivers: align pci driver definitions Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:13 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros Shreyansh Jain
` (12 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 857dc3e..06a68f6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -259,13 +259,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 3fb2188..fe9c704 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (3 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 04/17] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-13 9:20 ` Jan Viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
` (11 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 8 ++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 95789f9..994650b 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void devinitfn_ ##drv(void);\
-void __attribute__((constructor, used)) devinitfn_ ##drv(void)\
+RTE_INIT(devinitfn_ ##drv);\
+static void devinitfn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..3027adf 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registeration from driver (eth, crypto) instance */
+#define DRIVER_REGISTER_PCI(nm, drv) \
+RTE_INIT(pciinitfn_ ##nm); \
+static void pciinitfn_ ##nm(void) \
+{ \
+ rte_eal_pci_register(&drv.pci_drv); \
+}
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index 4a686e6..71ed3bb 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 06/17] crypto: export init/uninit common wrappers for pci drivers
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (4 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:06 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 07/17] ethdev: " Shreyansh Jain
` (10 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
that can be used by pci drivers that assume a 1 to 1 association between
pci resource and upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 2 ++
3 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index c3cc3e9..3a75f2c 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -431,9 +431,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -492,8 +492,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -541,15 +541,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a08fd20..7aa7f4e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -37,5 +37,7 @@ DPDK_16.07 {
global:
rte_cryptodev_parse_vdev_init_params;
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 07/17] ethdev: export init/uninit common wrappers for pci drivers
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (5 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:06 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
` (9 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Preparing for getting rid of eth_drv, here are two wrappers that can be
used by pci drivers that assume a 1 to 1 association between pci resource and
upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 3 +++
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0a6e3f1..25eb032 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 4dac364..a2ec9d1 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4369,6 +4369,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 45ddf44..c5ef869 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -138,4 +138,7 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 08/17] drivers: convert all pdev drivers as pci drivers
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (6 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 07/17] ethdev: " Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
` (8 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++---------
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +++++-------------------
drivers/net/bnxt/bnxt_ethdev.c | 16 +++---------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++---------
drivers/net/e1000/igb_ethdev.c | 39 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 17 +++---------
drivers/net/enic/enic_ethdev.c | 23 +++--------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++--------------
drivers/net/i40e/i40e_ethdev.c | 24 +++--------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +++++----------------------------
drivers/net/mlx4/mlx4.c | 15 +++--------
drivers/net/mlx5/mlx5.c | 14 +++-------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/qede/qede_ethdev.c | 40 ++++++----------------------
drivers/net/szedata2/rte_eth_szedata2.c | 24 +++--------------
drivers/net/thunderx/nicvf_ethdev.c | 20 +++-----------
drivers/net/virtio/virtio_ethdev.c | 25 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++--------------
20 files changed, 78 insertions(+), 407 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1e9e0ba..4c215a6 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,23 +116,13 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv, CRYPTODEV_NAME_QAT_SYM_PMD);
+DRIVER_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd);
DRIVER_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index c8d2bf2..dc7c893 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -621,6 +621,8 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
@@ -634,38 +636,14 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver, bnx2x);
+DRIVER_REGISTER_PCI(bnx2x, rte_bnx2x_pmd);
DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf);
+DRIVER_REGISTER_PCI(bnx2xvf, rte_bnx2xvf_pmd);
DRIVER_REGISTER_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3795fac..607f88c 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1048,23 +1048,13 @@ static struct eth_driver bnxt_rte_pmd = {
.name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = bnxt_dev_init,
.eth_dev_uninit = bnxt_dev_uninit,
.dev_private_size = sizeof(struct bnxt),
};
-static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
-{
- RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
- rte_eth_driver_register(&bnxt_rte_pmd);
- return 0;
-}
-
-static struct rte_driver bnxt_pmd_drv = {
- .type = PMD_PDEV,
- .init = bnxt_rte_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt);
+DRIVER_REGISTER_PCI(bnxt, bnxt_rte_pmd);
DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 9208a61..70cc1f6 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1042,30 +1042,12 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4);
+DRIVER_REGISTER_PCI(cxgb4, rte_cxgbe_pmd);
DRIVER_REGISTER_PCI_TABLE(cxgb4, cxgb4_pci_tbl);
-
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index ad104ed..dc7a3c7 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -395,6 +395,8 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
@@ -402,13 +404,6 @@ static struct eth_driver rte_em_pmd = {
};
static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
-
-static int
em_hw_init(struct e1000_hw *hw)
{
int diag;
@@ -1799,10 +1794,5 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv, em);
+DRIVER_REGISTER_PCI(em, rte_em_pmd);
DRIVER_REGISTER_PCI_TABLE(em, pci_id_em_map);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index fbf4d09..c24a933 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1047,6 +1047,8 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
@@ -1061,19 +1063,14 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
-
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
{
@@ -1085,20 +1082,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -5049,16 +5032,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5220,7 +5193,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-PMD_REGISTER_DRIVER(pmd_igb_drv, igb);
+DRIVER_REGISTER_PCI(igb, rte_igb_pmd);
DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf);
+DRIVER_REGISTER_PCI(igbvf, rte_igbvf_pmd);
DRIVER_REGISTER_PCI_TABLE(igbvf, pci_id_igbvf_map);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 9418d50..9f46d57 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1689,23 +1689,12 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv, ena);
+DRIVER_REGISTER_PCI(ena, rte_ena_pmd);
DRIVER_REGISTER_PCI_TABLE(ena, pci_id_ena_map);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 3c87b49..7e7bae8 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -609,29 +609,12 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver, enic);
+DRIVER_REGISTER_PCI(enic, rte_enic_pmd);
DRIVER_REGISTER_PCI_TABLE(enic, pci_id_enic_map);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 217853f..ee99d60 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3061,30 +3061,13 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver, fm10k);
+DRIVER_REGISTER_PCI(fm10k, rte_pmd_fm10k);
DRIVER_REGISTER_PCI_TABLE(fm10k, pci_id_fm10k_map);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index daac236..4e42ecf 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -667,6 +667,8 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
@@ -701,27 +703,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver, i40e);
+DRIVER_REGISTER_PCI(i40e, rte_i40e_pmd);
DRIVER_REGISTER_PCI_TABLE(i40e, pci_id_i40e_map);
/*
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a616ae0..6526a66 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1557,34 +1557,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver, i40evf);
+DRIVER_REGISTER_PCI(i40evf, rte_i40evf_pmd);
DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map);
static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d478a15..bc33541 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1509,6 +1509,8 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1523,40 +1525,14 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
-
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
@@ -7352,17 +7328,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
ixgbevf_dev_interrupt_action(dev);
}
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver, ixgbe);
+DRIVER_REGISTER_PCI(ixgbe, rte_ixgbe_pmd);
DRIVER_REGISTER_PCI_TABLE(ixgbe, pci_id_ixgbe_map);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver, ixgbevf);
+DRIVER_REGISTER_PCI(ixgbevf, rte_ixgbevf_pmd);
DRIVER_REGISTER_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 304c846..2bed4de 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5922,12 +5922,10 @@ static struct eth_driver mlx4_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5938,13 +5936,6 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver, mlx4);
DRIVER_REGISTER_PCI_TABLE(mlx4, mlx4_pci_id_map);
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index d96a9af..3658769 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -739,11 +739,10 @@ static struct eth_driver mlx5_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -753,13 +752,6 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver, mlx5);
DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99a258a..b37007e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2464,29 +2464,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver, nfp);
+DRIVER_REGISTER_PCI(nfp, rte_nfp_net_pmd);
DRIVER_REGISTER_PCI_TABLE(nfp, pci_id_nfp_net_map);
/*
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 82e44b8..2143d2a 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1482,7 +1482,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1494,41 +1496,15 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver, qede);
+DRIVER_REGISTER_PCI(qede, rte_qede_pmd);
DRIVER_REGISTER_PCI_TABLE(qede, pci_id_qede_map);
-PMD_REGISTER_DRIVER(rte_qedevf_driver, qedevf);
+DRIVER_REGISTER_PCI(qedevf, rte_qedevf_pmd);
DRIVER_REGISTER_PCI_TABLE(qedevf, pci_id_qedevf_map);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 483d789..d5e1551 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,13 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME);
+DRIVER_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver);
DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4f875c0..8d90f8d 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1762,26 +1762,12 @@ static struct eth_driver rte_nicvf_pmd = {
.name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nicvf_eth_dev_init,
.dev_private_size = sizeof(struct nicvf),
};
-static int
-rte_nicvf_pmd_init(const char *name __rte_unused, const char *para __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_thunderx nicvf version %s",
- THUNDERX_NICVF_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nicvf_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nicvf_driver = {
- .type = PMD_PDEV,
- .init = rte_nicvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nicvf_driver, thunderx_nicvf);
+DRIVER_REGISTER_PCI(thunderx_nicvf, rte_nicvf_pmd);
DRIVER_REGISTER_PCI_TABLE(thunderx_nicvf, pci_id_nicvf_map);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 850e3ba..d3cfbaf 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1307,29 +1307,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1563,10 +1558,4 @@ __rte_unused uint8_t is_rx)
return 0;
}
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver, virtio_net);
DRIVER_REGISTER_PCI_TABLE(virtio_net, pci_id_virtio_map);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 5874215..25475f8 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -331,26 +331,14 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
-
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
{
@@ -948,10 +936,5 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver, vmxnet3);
+DRIVER_REGISTER_PCI(vmxnet3, rte_vmxnet3_pmd);
DRIVER_REGISTER_PCI_TABLE(vmxnet3, pci_id_vmxnet3_map);
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 09/17] crypto: get rid of crypto driver register callback
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (7 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:10 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 10/17] ethdev: get rid of eth " Shreyansh Jain
` (7 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Now that all pdev are pci drivers, we don't need to register crypto drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
3 files changed, 53 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 3a75f2c..d7be111 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -535,28 +535,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 7aa7f4e..be016d9 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 10/17] ethdev: get rid of eth driver register callback
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (8 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:09 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
` (6 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Now that all pdev are pci drivers, we don't need to register ethdev drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 22 ----------------------
lib/librte_ether/rte_ethdev.h | 12 ------------
lib/librte_ether/rte_ether_version.map | 1 -
3 files changed, 35 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 25eb032..89c7b31 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index a2ec9d1..d2718b5 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1871,18 +1871,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index c5ef869..27d8161 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -78,7 +78,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 11/17] eal/linux: move back interrupt thread init before setting affinity
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (9 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:09 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name Shreyansh Jain
` (5 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Now that virtio pci driver is initialized in a constructor, iopl() stuff
happens early enough so that interrupt thread can be created right after
plugin loading.
This way, chelsio driver should be happy again [1].
[1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index fe9c704..259a7e4 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -834,6 +834,9 @@ rte_eal_init(int argc, char **argv)
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");
+ if (rte_eal_intr_init() < 0)
+ rte_panic("Cannot init interrupt-handling thread\n");
+
eal_thread_init_master(rte_config.master_lcore);
ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
@@ -845,9 +848,6 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
- if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (10 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 16:55 ` Jan Viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 13/17] pci: add a helper to update a device Shreyansh Jain
` (4 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
eal is a better place than crypto / ethdev for naming resources.
Add a helper in eal and make use of it in crypto / ethdev.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
3 files changed, 33 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index d7be111..60c6384 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -367,23 +367,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -446,9 +429,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -503,9 +485,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 3027adf..06508fa 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using above functions.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 89c7b31..147b26f 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 13/17] pci: add a helper to update a device
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (11 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 17:01 ` Jan Viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
` (3 subsequent siblings)
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
This helper updates a pci device object with latest information it can
find.
It will be used mainly for hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_common_pci.c | 2 --
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 3 ++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
5 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index a73cbb0..1d91c78 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6a0f6ac..58f0c74 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -87,8 +87,6 @@ struct pci_driver_list pci_driver_list =
struct pci_device_list pci_device_list =
TAILQ_HEAD_INITIALIZER(pci_device_list);
-#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
-
const char *pci_get_sysfs_path(void)
{
const char *path = NULL;
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 06a68f6..b8ff9c5 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -152,6 +152,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 06508fa..5c2062c 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -107,6 +107,9 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
+/** Default sysfs path for PCI device search. */
+#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
+
/**
* A structure describing a PCI resource.
*/
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f0215ee..8f3ef20 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 14/17] ethdev: do not scan all pci devices on attach
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (12 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 13/17] pci: add a helper to update a device Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
` (2 subsequent siblings)
16 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 58f0c74..e001837 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -339,6 +339,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -351,9 +356,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 147b26f..a667012 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -469,9 +469,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (13 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 16:50 ` Jan Viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 17/17] ethdev: get rid of device type Shreyansh Jain
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Hotplug which deals with resources should come from the layer that already
handles them, i.e. EAL.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
lib/librte_eal/common/eal_common_dev.c | 47 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 25 +++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
4 files changed, 76 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 1852c4a..6f9324f 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -159,5 +159,7 @@ DPDK_16.07 {
rte_keepalive_mark_sleep;
rte_keepalive_register_relay_callback;
rte_thread_setname;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..14c6cf1 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,50 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+ int ret = -1;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device arguments provided\n");
+ return ret;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device\n");
+ return ret;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL)
+ goto err;
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device\n");
+ return -1;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 994650b..2f0579c 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a resource to a registered driver.
+ *
+ * @param name
+ * The resource name, that refers to a pci resource or some private
+ * way of designating a resource for vdev drivers. Based on this
+ * resource name, eal will identify a driver capable of handling
+ * this resource and pass this resource to the driver probing
+ * function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a resource from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
#define DRIVER_EXPORT_NAME(name, idx) \
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index a617b9e..db866b8 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -163,5 +163,7 @@ DPDK_16.07 {
rte_keepalive_mark_sleep;
rte_keepalive_register_relay_callback;
rte_thread_setname;
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
} DPDK_16.04;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (14 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 16:51 ` Jan Viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 17/17] ethdev: get rid of device type Shreyansh Jain
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 207 +++++++-----------------------------------
1 file changed, 33 insertions(+), 174 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a667012..8d14fd7 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -216,6 +217,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -347,27 +349,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
@@ -413,34 +394,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t dev_flags;
@@ -465,124 +418,45 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ ret = -1;
+ goto err;
+ }
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
}
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -590,7 +464,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -598,33 +471,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v6 17/17] ethdev: get rid of device type
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (15 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-07-12 6:01 ` Shreyansh Jain
2016-07-14 16:33 ` Jan Viktorin
16 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-12 6:01 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, david.marchand
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
16 files changed, 16 insertions(+), 52 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f795566..d629ee3 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -666,7 +666,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 203ebe9..8514652 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 2bed4de..b333ad6 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5803,7 +5803,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3658769..ebad7cb 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -617,7 +617,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 93f8730..c0d0e3b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 7a24884..ce49945 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -517,7 +517,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7e213eb..7fbc60e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index a7048c7..5690dcd 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7539cd4..2bb761b 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -714,7 +714,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 782d7d3..17d5848 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -277,7 +277,7 @@ virtio_user_eth_dev_alloc(const char *name)
struct virtio_hw *hw;
struct virtio_user_dev *dev;
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
return NULL;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 99f6cc8..6b15381 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -654,7 +654,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..0dbc332 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 8d14fd7..58e174e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -191,7 +191,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -216,7 +216,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -248,7 +247,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index d2718b5..f5bee39 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1603,17 +1603,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1643,7 +1632,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
} __rte_cache_aligned;
struct rte_eth_dev_sriov {
@@ -1756,8 +1744,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros Shreyansh Jain
@ 2016-07-13 9:20 ` Jan Viktorin
2016-07-13 17:34 ` Jan Viktorin
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-13 9:20 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
Hello Shreyansh,
On Tue, 12 Jul 2016 11:31:10 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Introduce a RTE_INIT macro used to mark an init function as a constructor.
> Current eal macros have been converted to use this (no functional impact).
> DRIVER_REGISTER_PCI is added as a helper for pci drivers.
>
> Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
[...]
> +#define RTE_INIT(func) \
> +static void __attribute__((constructor, used)) func(void)
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index fa74962..3027adf 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
> */
> void rte_eal_pci_register(struct rte_pci_driver *driver);
>
> +/** Helper for PCI device registeration from driver (eth, crypto) instance */
> +#define DRIVER_REGISTER_PCI(nm, drv) \
> +RTE_INIT(pciinitfn_ ##nm); \
> +static void pciinitfn_ ##nm(void) \
> +{ \
You are missing setting the name here like PMD_REGISTER_DRIVER does
now. Or should I include it in my patch set?
(drv).name = RTE_STR(nm);
> + rte_eal_pci_register(&drv.pci_drv); \
> +}
> +
> /**
> * Unregister a PCI driver.
> *
> diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
> index 4a686e6..71ed3bb 100644
> --- a/lib/librte_eal/common/include/rte_tailq.h
> +++ b/lib/librte_eal/common/include/rte_tailq.h
> @@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
> int rte_eal_tailq_register(struct rte_tailq_elem *t);
>
> #define EAL_REGISTER_TAILQ(t) \
> -void tailqinitfn_ ##t(void); \
> -void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
> +RTE_INIT(tailqinitfn_ ##t); \
> +static void tailqinitfn_ ##t(void) \
> { \
> if (rte_eal_tailq_register(&t) < 0) \
> rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-13 9:20 ` Jan Viktorin
@ 2016-07-13 17:34 ` Jan Viktorin
2016-07-14 5:27 ` Shreyansh jain
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-13 17:34 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Wed, 13 Jul 2016 11:20:43 +0200
Jan Viktorin <viktorin@rehivetech.com> wrote:
> Hello Shreyansh,
>
> On Tue, 12 Jul 2016 11:31:10 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
> > Introduce a RTE_INIT macro used to mark an init function as a constructor.
> > Current eal macros have been converted to use this (no functional impact).
> > DRIVER_REGISTER_PCI is added as a helper for pci drivers.
> >
> > Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
> > Signed-off-by: David Marchand <david.marchand@6wind.com>
> > Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> > ---
>
> [...]
>
> > +#define RTE_INIT(func) \
> > +static void __attribute__((constructor, used)) func(void)
> > +
> > #ifdef __cplusplus
> > }
> > #endif
> > diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> > index fa74962..3027adf 100644
> > --- a/lib/librte_eal/common/include/rte_pci.h
> > +++ b/lib/librte_eal/common/include/rte_pci.h
> > @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
> > */
> > void rte_eal_pci_register(struct rte_pci_driver *driver);
> >
> > +/** Helper for PCI device registeration from driver (eth, crypto) instance */
> > +#define DRIVER_REGISTER_PCI(nm, drv) \
> > +RTE_INIT(pciinitfn_ ##nm); \
> > +static void pciinitfn_ ##nm(void) \
> > +{ \
>
> You are missing setting the name here like PMD_REGISTER_DRIVER does
> now. Or should I include it in my patch set?
>
> (drv).name = RTE_STR(nm);
Moreover, it should accept the rte_pci_driver *, shouldn't it? Here, it
expects a wrapper around it (eth_driver)... I now, my SoC patches were
supposing the some... but I think it is wrong.
The original David's patch set contains calls like this:
RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
So, I think, we should go the original way.
Jan
>
> > + rte_eal_pci_register(&drv.pci_drv); \
> > +}
> > +
> > /**
> > * Unregister a PCI driver.
> > *
> > diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
> > index 4a686e6..71ed3bb 100644
> > --- a/lib/librte_eal/common/include/rte_tailq.h
> > +++ b/lib/librte_eal/common/include/rte_tailq.h
> > @@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
> > int rte_eal_tailq_register(struct rte_tailq_elem *t);
> >
> > #define EAL_REGISTER_TAILQ(t) \
> > -void tailqinitfn_ ##t(void); \
> > -void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
> > +RTE_INIT(tailqinitfn_ ##t); \
> > +static void tailqinitfn_ ##t(void) \
> > { \
> > if (rte_eal_tailq_register(&t) < 0) \
> > rte_panic("Cannot initialize tailq: %s\n", t.name); \
>
>
>
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-13 17:34 ` Jan Viktorin
@ 2016-07-14 5:27 ` Shreyansh jain
2016-07-14 15:57 ` Jan Viktorin
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh jain @ 2016-07-14 5:27 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
Hi Jan,
On Wednesday 13 July 2016 11:04 PM, Jan Viktorin wrote:
> On Wed, 13 Jul 2016 11:20:43 +0200
> Jan Viktorin <viktorin@rehivetech.com> wrote:
>
>> Hello Shreyansh,
>>
>> On Tue, 12 Jul 2016 11:31:10 +0530
>> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>>
>>> Introduce a RTE_INIT macro used to mark an init function as a constructor.
>>> Current eal macros have been converted to use this (no functional impact).
>>> DRIVER_REGISTER_PCI is added as a helper for pci drivers.
>>>
>>> Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
>>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>> ---
>>
>> [...]
>>
>>> +#define RTE_INIT(func) \
>>> +static void __attribute__((constructor, used)) func(void)
>>> +
>>> #ifdef __cplusplus
>>> }
>>> #endif
>>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>>> index fa74962..3027adf 100644
>>> --- a/lib/librte_eal/common/include/rte_pci.h
>>> +++ b/lib/librte_eal/common/include/rte_pci.h
>>> @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
>>> */
>>> void rte_eal_pci_register(struct rte_pci_driver *driver);
>>>
>>> +/** Helper for PCI device registeration from driver (eth, crypto) instance */
>>> +#define DRIVER_REGISTER_PCI(nm, drv) \
>>> +RTE_INIT(pciinitfn_ ##nm); \
>>> +static void pciinitfn_ ##nm(void) \
>>> +{ \
>>
>> You are missing setting the name here like PMD_REGISTER_DRIVER does
>> now. Or should I include it in my patch set?
>>
>> (drv).name = RTE_STR(nm);
That is a miss from my side.
I will publish v7 with this. You want this right away or should I wait a little while (more reviews, or any pending additions as per Thomas's notes) before publishing?
>
> Moreover, it should accept the rte_pci_driver *, shouldn't it? Here, it
> expects a wrapper around it (eth_driver)... I now, my SoC patches were
> supposing the some... but I think it is wrong.
>
> The original David's patch set contains calls like this:
>
> RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
>
> So, I think, we should go the original way.
I have a slightly different opinion of the above.
IMO, aim of the helpers is to hide the PCI details and continue to make driver consider itself as a generic ETH driver. In that case, dereferencing pci_drv would be done by macro.
Also, considering that in future pci_drv would also have soc_drv, the helpers can effectively hide the intra-structure naming of these. It would help when more such device types (would there be?) are introduced - in which case, driver framework has a consistent coding convention.
But, I am ok switching back to David's way as well - I don't have any strong argument against that.
>
> Jan
>
>>
>>> + rte_eal_pci_register(&drv.pci_drv); \
>>> +}
>>> +
>>> /**
>>> * Unregister a PCI driver.
>>> *
[...]
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-14 5:27 ` Shreyansh jain
@ 2016-07-14 15:57 ` Jan Viktorin
2016-07-15 10:48 ` Shreyansh jain
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-14 15:57 UTC (permalink / raw)
To: Shreyansh jain; +Cc: dev, thomas.monjalon, david.marchand
On Thu, 14 Jul 2016 10:57:55 +0530
Shreyansh jain <shreyansh.jain@nxp.com> wrote:
> Hi Jan,
>
> On Wednesday 13 July 2016 11:04 PM, Jan Viktorin wrote:
> > On Wed, 13 Jul 2016 11:20:43 +0200
> > Jan Viktorin <viktorin@rehivetech.com> wrote:
> >
> >> Hello Shreyansh,
> >>
> >> On Tue, 12 Jul 2016 11:31:10 +0530
> >> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> >>
> >>> Introduce a RTE_INIT macro used to mark an init function as a constructor.
> >>> Current eal macros have been converted to use this (no functional impact).
> >>> DRIVER_REGISTER_PCI is added as a helper for pci drivers.
> >>>
> >>> Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
> >>> Signed-off-by: David Marchand <david.marchand@6wind.com>
> >>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> >>> ---
> >>
> >> [...]
> >>
> >>> +#define RTE_INIT(func) \
> >>> +static void __attribute__((constructor, used)) func(void)
> >>> +
> >>> #ifdef __cplusplus
> >>> }
> >>> #endif
> >>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> >>> index fa74962..3027adf 100644
> >>> --- a/lib/librte_eal/common/include/rte_pci.h
> >>> +++ b/lib/librte_eal/common/include/rte_pci.h
> >>> @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
> >>> */
> >>> void rte_eal_pci_register(struct rte_pci_driver *driver);
> >>>
> >>> +/** Helper for PCI device registeration from driver (eth, crypto) instance */
> >>> +#define DRIVER_REGISTER_PCI(nm, drv) \
> >>> +RTE_INIT(pciinitfn_ ##nm); \
> >>> +static void pciinitfn_ ##nm(void) \
> >>> +{ \
> >>
> >> You are missing setting the name here like PMD_REGISTER_DRIVER does
> >> now. Or should I include it in my patch set?
> >>
> >> (drv).name = RTE_STR(nm);
>
> That is a miss from my side.
> I will publish v7 with this. You want this right away or should I wait a little while (more reviews, or any pending additions as per Thomas's notes) before publishing?
Please. The time is almost gone. 18/7/2016 is the release (according
to the roadmap)... I have to fix it in my patchset, otherwise it
does not build (after moving the .name from rte_pci_driver to
rte_driver).
>
> >
> > Moreover, it should accept the rte_pci_driver *, shouldn't it? Here, it
> > expects a wrapper around it (eth_driver)... I now, my SoC patches were
> > supposing the some... but I think it is wrong.
> >
> > The original David's patch set contains calls like this:
> >
> > RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
> >
> > So, I think, we should go the original way.
>
> I have a slightly different opinion of the above.
> IMO, aim of the helpers is to hide the PCI details and continue to make driver consider itself as a generic ETH driver. In that case, dereferencing pci_drv would be done by macro.
In this case, I'd prefer to see DRIVER_REGISTER_PCI_ETH.
At first, this was also my way of thinking. But I've changed my mind. I
find it to be a bit overdesigned.
>
> Also, considering that in future pci_drv would also have soc_drv, the helpers can effectively hide the intra-structure naming of these. It would help when more such device types (would there be?) are introduced - in which case, driver framework has a consistent coding convention.
Hide? I am afraid, I don't understand clearly what you mean.
>
> But, I am ok switching back to David's way as well - I don't have any strong argument against that.
I'd like to preserve the clear semantics. That is DRIVER_REGISTER_PCI
-> give a pci device.
Has anybody a different opinion? David? Thomas?
>
> >
> > Jan
> >
> >>
> >>> + rte_eal_pci_register(&drv.pci_drv); \
> >>> +}
> >>> +
> >>> /**
> >>> * Unregister a PCI driver.
> >>> *
> [...]
>
> -
> Shreyansh
>
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 17/17] ethdev: get rid of device type
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 17/17] ethdev: get rid of device type Shreyansh Jain
@ 2016-07-14 16:33 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-07-14 16:33 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:22 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Now that hotplug has been moved to eal, there is no reason to keep the device
> type in this layer.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> app/test/virtual_pmd.c | 2 +-
> drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/mlx4/mlx4.c | 2 +-
> drivers/net/mlx5/mlx5.c | 2 +-
> drivers/net/mpipe/mpipe_tilegx.c | 2 +-
> drivers/net/null/rte_eth_null.c | 2 +-
> drivers/net/pcap/rte_eth_pcap.c | 2 +-
> drivers/net/ring/rte_eth_ring.c | 2 +-
> drivers/net/vhost/rte_eth_vhost.c | 2 +-
> drivers/net/virtio/virtio_user_ethdev.c | 2 +-
> drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
> examples/ip_pipeline/init.c | 22 ----------------------
> lib/librte_ether/rte_ethdev.c | 5 ++---
> lib/librte_ether/rte_ethdev.h | 15 +--------------
> 16 files changed, 16 insertions(+), 52 deletions(-)
>
[...]
>
> -static int
> -app_link_is_virtual(struct app_link_params *p)
> -{
> - uint32_t pmd_id = p->pmd_id;
> - struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
> -
> - if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
> - return 1;
> -
> - return 0;
> -}
> -
> void
> app_link_up_internal(struct app_params *app, struct app_link_params *cp)
> {
> uint32_t i;
> int status;
>
> - if (app_link_is_virtual(cp)) {
> - cp->state = 1;
> - return;
> - }
> -
> /* For each link, add filters for IP of current link */
> if (cp->ip != 0) {
> for (i = 0; i < app->n_links; i++) {
> @@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
> uint32_t i;
> int status;
>
> - if (app_link_is_virtual(cp)) {
> - cp->state = 0;
> - return;
> - }
> -
> /* PMD link down */
I understand that app_link_is_virtual is useless. However, it changes
semantics. What is the behaviour of the app_link_up_internal after this
change?
> status = rte_eth_dev_set_link_down(cp->pmd_id);
> if (status < 0)
[...]
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-07-14 16:50 ` Jan Viktorin
2016-07-15 9:52 ` Shreyansh jain
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-14 16:50 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:20 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Hotplug which deals with resources should come from the layer that already
> handles them, i.e. EAL.
>
> For both attach and detach operations, 'name' is used to select the bus
> that will handle the request.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
> lib/librte_eal/common/eal_common_dev.c | 47 +++++++++++++++++++++++++
> lib/librte_eal/common/include/rte_dev.h | 25 +++++++++++++
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
> 4 files changed, 76 insertions(+)
>
> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> index 1852c4a..6f9324f 100644
> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> @@ -159,5 +159,7 @@ DPDK_16.07 {
> rte_keepalive_mark_sleep;
> rte_keepalive_register_relay_callback;
> rte_thread_setname;
> + rte_eal_dev_attach;
> + rte_eal_dev_detach;
>
> } DPDK_16.04;
> diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
> index a8a4146..14c6cf1 100644
> --- a/lib/librte_eal/common/eal_common_dev.c
> +++ b/lib/librte_eal/common/eal_common_dev.c
> @@ -150,3 +150,50 @@ rte_eal_vdev_uninit(const char *name)
> RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
> return -EINVAL;
> }
> +
> +int rte_eal_dev_attach(const char *name, const char *devargs)
> +{
> + struct rte_pci_addr addr;
> + int ret = -1;
> +
> + if (name == NULL || devargs == NULL) {
> + RTE_LOG(ERR, EAL, "Invalid device arguments provided\n");
> + return ret;
> + }
> +
> + if (eal_parse_pci_DomBDF(name, &addr) == 0) {
> + if (rte_eal_pci_probe_one(&addr) < 0)
> + goto err;
> +
> + } else {
> + if (rte_eal_vdev_init(name, devargs))
> + goto err;
> + }
> +
> + return 0;
> +
> +err:
> + RTE_LOG(ERR, EAL, "Driver cannot attach the device\n");
I think this log can be more specific. We have the name of the device.
It might be confusing to the user when the attach fails and there is
no simple way how to determine which one.
> + return ret;
> +}
> +
> +int rte_eal_dev_detach(const char *name)
> +{
> + struct rte_pci_addr addr;
> +
> + if (name == NULL)
> + goto err;
> +
> + if (eal_parse_pci_DomBDF(name, &addr) == 0) {
> + if (rte_eal_pci_detach(&addr) < 0)
> + goto err;
> + } else {
> + if (rte_eal_vdev_uninit(name))
> + goto err;
> + }
> + return 0;
> +
> +err:
> + RTE_LOG(ERR, EAL, "Driver cannot detach the device\n");
Same as for attach.
> + return -1;
> +}
> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
> index 994650b..2f0579c 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
> */
> int rte_eal_vdev_uninit(const char *name);
>
> +/**
> + * Attach a resource to a registered driver.
From my POV, the term "resource" is not good here. We have
rte_pci_resource but we refer to a device here. The function is called
rte_eal_DEV_attach. No idea why to call it a resource.
> + *
> + * @param name
> + * The resource name, that refers to a pci resource or some private
> + * way of designating a resource for vdev drivers. Based on this
> + * resource name, eal will identify a driver capable of handling
> + * this resource and pass this resource to the driver probing
> + * function.
> + * @param devargs
> + * Device arguments to be passed to the driver.
> + * @return
> + * 0 on success, negative on error.
> + */
> +int rte_eal_dev_attach(const char *name, const char *devargs);
> +
> +/**
> + * Detach a resource from its driver.
Same here for resource.
Jan
> + *
> + * @param name
> + * Same description as for rte_eal_dev_attach().
> + * Here, eal will call the driver detaching function.
> + */
> +int rte_eal_dev_detach(const char *name);
> +
> #define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
>
> #define DRIVER_EXPORT_NAME(name, idx) \
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index a617b9e..db866b8 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -163,5 +163,7 @@ DPDK_16.07 {
> rte_keepalive_mark_sleep;
> rte_keepalive_register_relay_callback;
> rte_thread_setname;
> + rte_eal_dev_attach;
> + rte_eal_dev_detach;
>
> } DPDK_16.04;
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-07-14 16:51 ` Jan Viktorin
2016-07-15 10:36 ` Shreyansh jain
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-14 16:51 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:21 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Remove bus logic from ethdev hotplug by using eal for this.
>
> Current api is preserved:
> - the last port that has been created is tracked to return it to the
> application when attaching,
> - the internal device name is reused when detaching.
>
> We can not get rid of ethdev hotplug yet since we still need some mechanism
> to inform applications of port creation/removal to substitute for ethdev
> hotplug api.
>
> dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
> is, but this information is not needed anymore and is removed in the following
> commit.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_ether/rte_ethdev.c | 207 +++++++-----------------------------------
> 1 file changed, 33 insertions(+), 174 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index a667012..8d14fd7 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -72,6 +72,7 @@
> static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
> struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
> static struct rte_eth_dev_data *rte_eth_dev_data;
> +static uint8_t eth_dev_last_created_port;
> static uint8_t nb_ports;
>
[...]
> -
> /* attach the new device, then store port_id of the device */
> int
> rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
> {
> - struct rte_pci_addr addr;
> int ret = -1;
> + int current = eth_dev_last_created_port;
> + char *name = NULL;
> + char *args = NULL;
>
> if ((devargs == NULL) || (port_id == NULL)) {
> ret = -EINVAL;
> goto err;
> }
>
> - if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
> - ret = rte_eth_dev_attach_pdev(&addr, port_id);
> - if (ret < 0)
> - goto err;
> - } else {
> - ret = rte_eth_dev_attach_vdev(devargs, port_id);
> - if (ret < 0)
> - goto err;
> + /* parse devargs, then retrieve device name and args */
> + if (rte_eal_parse_devargs_str(devargs, &name, &args))
> + goto err;
> +
> + ret = rte_eal_dev_attach(name, args);
> + if (ret < 0)
> + goto err;
> +
> + /* no point looking at eth_dev_last_created_port if no port exists */
I am not sure about this comment. What is "no point"?
Isn't this also a potential bug? (Like the one below.) How could it
happen there is no port after a successful attach?
> + if (!nb_ports) {
> + ret = -1;
> + goto err;
> + }
> + /* if nothing happened, there is a bug here, since some driver told us
> + * it did attach a device, but did not create a port */
> + if (current == eth_dev_last_created_port) {
> + ret = -1;
> + goto err;
Should we log this? Or call some kind panic?
> }
> + *port_id = eth_dev_last_created_port;
> + ret = 0;
>
> - return 0;
> err:
> - RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
> + free(name);
> + free(args);
> return ret;
> }
>
> @@ -590,7 +464,6 @@ err:
> int
> rte_eth_dev_detach(uint8_t port_id, char *name)
> {
> - struct rte_pci_addr addr;
> int ret = -1;
>
> if (name == NULL) {
> @@ -598,33 +471,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
> goto err;
> }
>
> - /* check whether the driver supports detach feature, or not */
> + /* FIXME: move this to eal, once device flags are relocated there */
> if (rte_eth_dev_is_detachable(port_id))
> goto err;
>
> - if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
> - ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
> - if (ret < 0)
> - goto err;
> -
> - ret = rte_eth_dev_detach_pdev(port_id, &addr);
> - if (ret < 0)
> - goto err;
> -
> - snprintf(name, RTE_ETH_NAME_MAX_LEN,
> - "%04x:%02x:%02x.%d",
> - addr.domain, addr.bus,
> - addr.devid, addr.function);
> - } else {
> - ret = rte_eth_dev_detach_vdev(port_id, name);
> - if (ret < 0)
> - goto err;
> - }
> + snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
> + "%s", rte_eth_devices[port_id].data->name);
> + ret = rte_eal_dev_detach(name);
> + if (ret < 0)
> + goto err;
>
> return 0;
>
> err:
> - RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
I'd be more specific about the failing device, we have its name.
> return ret;
> }
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name Shreyansh Jain
@ 2016-07-14 16:55 ` Jan Viktorin
2016-07-15 9:39 ` Shreyansh jain
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-14 16:55 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:17 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> eal is a better place than crypto / ethdev for naming resources.
s/for naming/to name/
What is meant by "resources" here?
> Add a helper in eal and make use of it in crypto / ethdev.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
> lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
> lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
> 3 files changed, 33 insertions(+), 43 deletions(-)
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
> index d7be111..60c6384 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -367,23 +367,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
> return cryptodev;
> }
>
> -static inline int
> -rte_cryptodev_create_unique_device_name(char *name, size_t size,
> - struct rte_pci_device *pci_dev)
> -{
> - int ret;
> -
> - if ((name == NULL) || (pci_dev == NULL))
> - return -EINVAL;
> -
> - ret = snprintf(name, size, "%d:%d.%d",
> - pci_dev->addr.bus, pci_dev->addr.devid,
> - pci_dev->addr.function);
> - if (ret < 0)
> - return ret;
> - return 0;
> -}
> -
> int
> rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
> {
> @@ -446,9 +429,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
> if (cryptodrv == NULL)
> return -ENODEV;
>
> - /* Create unique Crypto device name using PCI address */
> - rte_cryptodev_create_unique_device_name(cryptodev_name,
> - sizeof(cryptodev_name), pci_dev);
> + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
> + sizeof(cryptodev_name));
>
> cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
> if (cryptodev == NULL)
> @@ -503,9 +485,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
> if (pci_dev == NULL)
> return -EINVAL;
>
> - /* Create unique device name using PCI address */
> - rte_cryptodev_create_unique_device_name(cryptodev_name,
> - sizeof(cryptodev_name), pci_dev);
> + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
> + sizeof(cryptodev_name));
>
> cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
> if (cryptodev == NULL)
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index 3027adf..06508fa 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -82,6 +82,7 @@ extern "C" {
> #include <stdint.h>
> #include <inttypes.h>
>
> +#include <rte_debug.h>
> #include <rte_interrupts.h>
>
> TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
> @@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
>
> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
> #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
>
> /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
> #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> @@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
> }
> #undef GET_PCIADDR_FIELD
>
> +/**
> + * Utility function to write a pci device name, this device name can later be
> + * used to retrieve the corresponding rte_pci_addr using above functions.
What about saying "using functions eal_parse_pci_*BDF"? The
specification "above" is quite uncertain...
> + *
> + * @param addr
> + * The PCI Bus-Device-Function address
> + * @param output
> + * The output buffer string
> + * @param size
> + * The output buffer size
> + * @return
> + * 0 on success, negative on error.
> + */
> +static inline void
> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
> + char *output, size_t size)
> +{
> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
> + addr->domain, addr->bus,
> + addr->devid, addr->function) >= 0);
> +}
> +
> /* Compare two PCI device addresses. */
> /**
[...]
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 13/17] pci: add a helper to update a device
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 13/17] pci: add a helper to update a device Shreyansh Jain
@ 2016-07-14 17:01 ` Jan Viktorin
2016-07-15 9:44 ` Shreyansh jain
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-14 17:01 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:18 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> This helper updates a pci device object with latest information it can
> find.
> It will be used mainly for hotplug code.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
> lib/librte_eal/common/eal_common_pci.c | 2 --
> lib/librte_eal/common/eal_private.h | 13 +++++++++
> lib/librte_eal/common/include/rte_pci.h | 3 ++
> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
> 5 files changed, 78 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
> index a73cbb0..1d91c78 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> @@ -406,6 +406,55 @@ error:
> return -1;
> }
>
> +int
> +pci_update_device(const struct rte_pci_addr *addr)
> +{
> + int fd;
> + struct pci_conf matches[2];
> + struct pci_match_conf match = {
> + .pc_sel = {
> + .pc_domain = addr->domain,
> + .pc_bus = addr->bus,
> + .pc_dev = addr->devid,
> + .pc_func = addr->function,
> + },
> + };
> + struct pci_conf_io conf_io = {
> + .pat_buf_len = 0,
> + .num_patterns = 1,
> + .patterns = &match,
> + .match_buf_len = sizeof(matches),
> + .matches = &matches[0],
> + };
> +
> + fd = open("/dev/pci", O_RDONLY);
> + if (fd < 0) {
> + RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
> + goto error;
> + }
> +
> + if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
> + RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
> + __func__, strerror(errno));
> + goto error;
> + }
> +
> + if (conf_io.num_matches != 1)
> + goto error;
> +
> + if (pci_scan_one(fd, &matches[0]) < 0)
> + goto error;
> +
> + close(fd);
> +
> + return 0;
> +
> +error:
> + if (fd >= 0)
> + close(fd);
> + return -1;
> +}
> +
> /* Read PCI config space. */
> int rte_eal_pci_read_config(const struct rte_pci_device *dev,
> void *buf, size_t len, off_t offset)
> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
> index 6a0f6ac..58f0c74 100644
> --- a/lib/librte_eal/common/eal_common_pci.c
> +++ b/lib/librte_eal/common/eal_common_pci.c
> @@ -87,8 +87,6 @@ struct pci_driver_list pci_driver_list =
> struct pci_device_list pci_device_list =
> TAILQ_HEAD_INITIALIZER(pci_device_list);
>
> -#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
> -
Is this delete correct? The SYSFS_PCI_DEVICES was moved here from
rte_pci.h. A relict of some rebase?
> const char *pci_get_sysfs_path(void)
> {
> const char *path = NULL;
> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
> index 06a68f6..b8ff9c5 100644
> --- a/lib/librte_eal/common/eal_private.h
> +++ b/lib/librte_eal/common/eal_private.h
> @@ -152,6 +152,19 @@ struct rte_pci_driver;
> struct rte_pci_device;
>
> /**
> + * Update a pci device object by asking the kernel for the latest information.
> + *
> + * This function is private to EAL.
> + *
> + * @param addr
> + * The PCI Bus-Device-Function address to look for
> + * @return
> + * - 0 on success.
> + * - negative on error.
> + */
> +int pci_update_device(const struct rte_pci_addr *addr);
> +
> +/**
> * Unbind kernel driver for this device
> *
> * This function is private to EAL.
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index 06508fa..5c2062c 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -107,6 +107,9 @@ const char *pci_get_sysfs_path(void);
> /** Nb. of values in PCI resource format. */
> #define PCI_RESOURCE_FMT_NVAL 3
>
> +/** Default sysfs path for PCI device search. */
> +#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
> +
Why adding SYSFS_PCI_DEVICES here? The pci_get_sysfs_path is used for
this purpose. Again, a rebase issue?
> /**
> * A structure describing a PCI resource.
> */
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index f0215ee..8f3ef20 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
> return 0;
> }
>
> +int
> +pci_update_device(const struct rte_pci_addr *addr)
> +{
> + char filename[PATH_MAX];
> +
> + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
> + SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
Use pci_get_sysfs_path here.
> + addr->function);
> +
> + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
> + addr->function);
> +}
> +
> /*
> * split up a pci address into its constituent parts.
> */
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 06/17] crypto: export init/uninit common wrappers for pci drivers
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
@ 2016-07-14 17:06 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:06 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:11 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
> that can be used by pci drivers that assume a 1 to 1 association between
> pci resource and upper interface.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 07/17] ethdev: export init/uninit common wrappers for pci drivers
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 07/17] ethdev: " Shreyansh Jain
@ 2016-07-14 17:06 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:06 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:12 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Preparing for getting rid of eth_drv, here are two wrappers that can be
> used by pci drivers that assume a 1 to 1 association between pci resource and
> upper interface.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 11/17] eal/linux: move back interrupt thread init before setting affinity
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
@ 2016-07-14 17:09 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:09 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:16 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Now that virtio pci driver is initialized in a constructor, iopl() stuff
> happens early enough so that interrupt thread can be created right after
> plugin loading.
> This way, chelsio driver should be happy again [1].
>
> [1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Tested-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 10/17] ethdev: get rid of eth driver register callback
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-07-14 17:09 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:09 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:15 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Now that all pdev are pci drivers, we don't need to register ethdev drivers
> through a dedicated channel.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 09/17] crypto: get rid of crypto driver register callback
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
@ 2016-07-14 17:10 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:10 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:14 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Now that all pdev are pci drivers, we don't need to register crypto drivers
> through a dedicated channel.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 01/17] pci: no need for dynamic tailq init
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 01/17] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-07-14 17:11 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:11 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:06 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> These lists can be initialized once and for all at build time.
> With this, those lists are only manipulated in a common place
> (and we could even make them private).
>
> A nice side effect is that pci drivers can now register in constructors.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Tested-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 03/17] drivers: align pci driver definitions
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 03/17] drivers: align pci driver definitions Shreyansh Jain
@ 2016-07-14 17:12 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:12 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:08 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Pure coding style, but it might make it easier later if we want to move
> fields in rte_cryptodev_driver and eth_driver structures.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 04/17] eal: remove duplicate function declaration
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 04/17] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-07-14 17:13 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:13 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:09 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
> introduction.
> This function has been exported in ABI, so remove it from eal_private.h
>
> Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 02/17] crypto: no need for a crypto pmd type
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-07-14 17:14 ` viktorin
0 siblings, 0 replies; 375+ messages in thread
From: viktorin @ 2016-07-14 17:14 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Tue, 12 Jul 2016 11:31:07 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> This information is not used and just adds noise.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name
2016-07-14 16:55 ` Jan Viktorin
@ 2016-07-15 9:39 ` Shreyansh jain
2016-07-15 9:56 ` Thomas Monjalon
` (2 more replies)
0 siblings, 3 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-07-15 9:39 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
On Thursday 14 July 2016 10:25 PM, Jan Viktorin wrote:
> On Tue, 12 Jul 2016 11:31:17 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
>> eal is a better place than crypto / ethdev for naming resources.
>
> s/for naming/to name/
OK.
>
> What is meant by "resources" here?
This has historic context (from earlier version of this patch).
But I could relate the word 'resources' to EAL representation of devices - whether PCI or Crypto.
Or, Resource == Device.
>
>> Add a helper in eal and make use of it in crypto / ethdev.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
>> lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
>> lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
>> 3 files changed, 33 insertions(+), 43 deletions(-)
>>
>> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
>> index d7be111..60c6384 100644
>> --- a/lib/librte_cryptodev/rte_cryptodev.c
>> +++ b/lib/librte_cryptodev/rte_cryptodev.c
>> @@ -367,23 +367,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
>> return cryptodev;
>> }
>>
>> -static inline int
>> -rte_cryptodev_create_unique_device_name(char *name, size_t size,
>> - struct rte_pci_device *pci_dev)
>> -{
>> - int ret;
>> -
>> - if ((name == NULL) || (pci_dev == NULL))
>> - return -EINVAL;
>> -
>> - ret = snprintf(name, size, "%d:%d.%d",
>> - pci_dev->addr.bus, pci_dev->addr.devid,
>> - pci_dev->addr.function);
>> - if (ret < 0)
>> - return ret;
>> - return 0;
>> -}
>> -
>> int
>> rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
>> {
>> @@ -446,9 +429,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
>> if (cryptodrv == NULL)
>> return -ENODEV;
>>
>> - /* Create unique Crypto device name using PCI address */
>> - rte_cryptodev_create_unique_device_name(cryptodev_name,
>> - sizeof(cryptodev_name), pci_dev);
>> + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
>> + sizeof(cryptodev_name));
>>
>> cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
>> if (cryptodev == NULL)
>> @@ -503,9 +485,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
>> if (pci_dev == NULL)
>> return -EINVAL;
>>
>> - /* Create unique device name using PCI address */
>> - rte_cryptodev_create_unique_device_name(cryptodev_name,
>> - sizeof(cryptodev_name), pci_dev);
>> + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
>> + sizeof(cryptodev_name));
>>
>> cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
>> if (cryptodev == NULL)
>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>> index 3027adf..06508fa 100644
>> --- a/lib/librte_eal/common/include/rte_pci.h
>> +++ b/lib/librte_eal/common/include/rte_pci.h
>> @@ -82,6 +82,7 @@ extern "C" {
>> #include <stdint.h>
>> #include <inttypes.h>
>>
>> +#include <rte_debug.h>
>> #include <rte_interrupts.h>
>>
>> TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
>> @@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
>>
>> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
>> #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
>> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
>>
>> /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
>> #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
>> @@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
>> }
>> #undef GET_PCIADDR_FIELD
>>
>> +/**
>> + * Utility function to write a pci device name, this device name can later be
>> + * used to retrieve the corresponding rte_pci_addr using above functions.
>
> What about saying "using functions eal_parse_pci_*BDF"? The
> specification "above" is quite uncertain...
Agree that 'above' is positional word and should be avoided.
I will change that to "... using eal_parse_pci_* BDF helpers". OK?
>
>> + *
>> + * @param addr
>> + * The PCI Bus-Device-Function address
>> + * @param output
>> + * The output buffer string
>> + * @param size
>> + * The output buffer size
>> + * @return
>> + * 0 on success, negative on error.
>> + */
>> +static inline void
>> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
>> + char *output, size_t size)
>> +{
>> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
>> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
>> + addr->domain, addr->bus,
>> + addr->devid, addr->function) >= 0);
>> +}
>> +
>> /* Compare two PCI device addresses. */
>> /**
>
> [...]
>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 13/17] pci: add a helper to update a device
2016-07-14 17:01 ` Jan Viktorin
@ 2016-07-15 9:44 ` Shreyansh jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-07-15 9:44 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
On Thursday 14 July 2016 10:31 PM, Jan Viktorin wrote:
> On Tue, 12 Jul 2016 11:31:18 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
>> This helper updates a pci device object with latest information it can
>> find.
>> It will be used mainly for hotplug code.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
>> lib/librte_eal/common/eal_common_pci.c | 2 --
>> lib/librte_eal/common/eal_private.h | 13 +++++++++
>> lib/librte_eal/common/include/rte_pci.h | 3 ++
>> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
>> 5 files changed, 78 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> index a73cbb0..1d91c78 100644
>> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
>> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> @@ -406,6 +406,55 @@ error:
>> return -1;
>> }
>>
>> +int
>> +pci_update_device(const struct rte_pci_addr *addr)
>> +{
>> + int fd;
>> + struct pci_conf matches[2];
>> + struct pci_match_conf match = {
>> + .pc_sel = {
>> + .pc_domain = addr->domain,
>> + .pc_bus = addr->bus,
>> + .pc_dev = addr->devid,
>> + .pc_func = addr->function,
>> + },
>> + };
>> + struct pci_conf_io conf_io = {
>> + .pat_buf_len = 0,
>> + .num_patterns = 1,
>> + .patterns = &match,
>> + .match_buf_len = sizeof(matches),
>> + .matches = &matches[0],
>> + };
>> +
>> + fd = open("/dev/pci", O_RDONLY);
>> + if (fd < 0) {
>> + RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
>> + goto error;
>> + }
>> +
>> + if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
>> + RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
>> + __func__, strerror(errno));
>> + goto error;
>> + }
>> +
>> + if (conf_io.num_matches != 1)
>> + goto error;
>> +
>> + if (pci_scan_one(fd, &matches[0]) < 0)
>> + goto error;
>> +
>> + close(fd);
>> +
>> + return 0;
>> +
>> +error:
>> + if (fd >= 0)
>> + close(fd);
>> + return -1;
>> +}
>> +
>> /* Read PCI config space. */
>> int rte_eal_pci_read_config(const struct rte_pci_device *dev,
>> void *buf, size_t len, off_t offset)
>> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
>> index 6a0f6ac..58f0c74 100644
>> --- a/lib/librte_eal/common/eal_common_pci.c
>> +++ b/lib/librte_eal/common/eal_common_pci.c
>> @@ -87,8 +87,6 @@ struct pci_driver_list pci_driver_list =
>> struct pci_device_list pci_device_list =
>> TAILQ_HEAD_INITIALIZER(pci_device_list);
>>
>> -#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
>> -
>
> Is this delete correct? The SYSFS_PCI_DEVICES was moved here from
> rte_pci.h. A relict of some rebase?
My miss - I had though of using pci_get_sysfs_path post v5, (as you have mentioned below) but while re-creating the patches I missed out.
>
>> const char *pci_get_sysfs_path(void)
>> {
>> const char *path = NULL;
>> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
>> index 06a68f6..b8ff9c5 100644
>> --- a/lib/librte_eal/common/eal_private.h
>> +++ b/lib/librte_eal/common/eal_private.h
>> @@ -152,6 +152,19 @@ struct rte_pci_driver;
>> struct rte_pci_device;
>>
>> /**
>> + * Update a pci device object by asking the kernel for the latest information.
>> + *
>> + * This function is private to EAL.
>> + *
>> + * @param addr
>> + * The PCI Bus-Device-Function address to look for
>> + * @return
>> + * - 0 on success.
>> + * - negative on error.
>> + */
>> +int pci_update_device(const struct rte_pci_addr *addr);
>> +
>> +/**
>> * Unbind kernel driver for this device
>> *
>> * This function is private to EAL.
>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>> index 06508fa..5c2062c 100644
>> --- a/lib/librte_eal/common/include/rte_pci.h
>> +++ b/lib/librte_eal/common/include/rte_pci.h
>> @@ -107,6 +107,9 @@ const char *pci_get_sysfs_path(void);
>> /** Nb. of values in PCI resource format. */
>> #define PCI_RESOURCE_FMT_NVAL 3
>>
>> +/** Default sysfs path for PCI device search. */
>> +#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
>> +
>
> Why adding SYSFS_PCI_DEVICES here? The pci_get_sysfs_path is used for
> this purpose. Again, a rebase issue?
Once pci_get_sysfs_path is used, this change would be redundant.
>
>> /**
>> * A structure describing a PCI resource.
>> */
>> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
>> index f0215ee..8f3ef20 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
>> @@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
>> return 0;
>> }
>>
>> +int
>> +pci_update_device(const struct rte_pci_addr *addr)
>> +{
>> + char filename[PATH_MAX];
>> +
>> + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
>> + SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,
>
> Use pci_get_sysfs_path here.
My miss. I will change this.
>
>> + addr->function);
>> +
>> + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
>> + addr->function);
>> +}
>> +
>> /*
>> * split up a pci address into its constituent parts.
>> */
>
>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev
2016-07-14 16:50 ` Jan Viktorin
@ 2016-07-15 9:52 ` Shreyansh jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-07-15 9:52 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
On Thursday 14 July 2016 10:20 PM, Jan Viktorin wrote:
> On Tue, 12 Jul 2016 11:31:20 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
>> Hotplug which deals with resources should come from the layer that already
>> handles them, i.e. EAL.
>>
>> For both attach and detach operations, 'name' is used to select the bus
>> that will handle the request.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
>> lib/librte_eal/common/eal_common_dev.c | 47 +++++++++++++++++++++++++
>> lib/librte_eal/common/include/rte_dev.h | 25 +++++++++++++
>> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
>> 4 files changed, 76 insertions(+)
>>
>> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> index 1852c4a..6f9324f 100644
>> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> @@ -159,5 +159,7 @@ DPDK_16.07 {
>> rte_keepalive_mark_sleep;
>> rte_keepalive_register_relay_callback;
>> rte_thread_setname;
>> + rte_eal_dev_attach;
>> + rte_eal_dev_detach;
>>
>> } DPDK_16.04;
>> diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
>> index a8a4146..14c6cf1 100644
>> --- a/lib/librte_eal/common/eal_common_dev.c
>> +++ b/lib/librte_eal/common/eal_common_dev.c
>> @@ -150,3 +150,50 @@ rte_eal_vdev_uninit(const char *name)
>> RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
>> return -EINVAL;
>> }
>> +
>> +int rte_eal_dev_attach(const char *name, const char *devargs)
>> +{
>> + struct rte_pci_addr addr;
>> + int ret = -1;
>> +
>> + if (name == NULL || devargs == NULL) {
>> + RTE_LOG(ERR, EAL, "Invalid device arguments provided\n");
>> + return ret;
>> + }
>> +
>> + if (eal_parse_pci_DomBDF(name, &addr) == 0) {
>> + if (rte_eal_pci_probe_one(&addr) < 0)
>> + goto err;
>> +
>> + } else {
>> + if (rte_eal_vdev_init(name, devargs))
>> + goto err;
>> + }
>> +
>> + return 0;
>> +
>> +err:
>> + RTE_LOG(ERR, EAL, "Driver cannot attach the device\n");
>
> I think this log can be more specific. We have the name of the device.
> It might be confusing to the user when the attach fails and there is
> no simple way how to determine which one.
Agree. I will update with 'name'.
>
>> + return ret;
>> +}
>> +
>> +int rte_eal_dev_detach(const char *name)
>> +{
>> + struct rte_pci_addr addr;
>> +
>> + if (name == NULL)
>> + goto err;
>> +
>> + if (eal_parse_pci_DomBDF(name, &addr) == 0) {
>> + if (rte_eal_pci_detach(&addr) < 0)
>> + goto err;
>> + } else {
>> + if (rte_eal_vdev_uninit(name))
>> + goto err;
>> + }
>> + return 0;
>> +
>> +err:
>> + RTE_LOG(ERR, EAL, "Driver cannot detach the device\n");
>
> Same as for attach.
OK.
>
>> + return -1;
>> +}
>> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
>> index 994650b..2f0579c 100644
>> --- a/lib/librte_eal/common/include/rte_dev.h
>> +++ b/lib/librte_eal/common/include/rte_dev.h
>> @@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args);
>> */
>> int rte_eal_vdev_uninit(const char *name);
>>
>> +/**
>> + * Attach a resource to a registered driver.
>
> From my POV, the term "resource" is not good here. We have
> rte_pci_resource but we refer to a device here. The function is called
> rte_eal_DEV_attach. No idea why to call it a resource.
Your point of 'resource' for 'rte_eal_*dev*_attach' makes sense.
Ideally I wouldn't have given much heed to this - for me 'resource' is just a device representation within EAL.
But, now that you have highlighted, name<=>comment is certainly mismatch.
I will change.
>
>> + *
>> + * @param name
>> + * The resource name, that refers to a pci resource or some private
>> + * way of designating a resource for vdev drivers. Based on this
>> + * resource name, eal will identify a driver capable of handling
>> + * this resource and pass this resource to the driver probing
>> + * function.
>> + * @param devargs
>> + * Device arguments to be passed to the driver.
>> + * @return
>> + * 0 on success, negative on error.
>> + */
>> +int rte_eal_dev_attach(const char *name, const char *devargs);
>> +
>> +/**
>> + * Detach a resource from its driver.
>
> Same here for resource.
I will change to "Detach a device from its driver".
>
> Jan
>
>> + *
>> + * @param name
>> + * Same description as for rte_eal_dev_attach().
>> + * Here, eal will call the driver detaching function.
>> + */
>> +int rte_eal_dev_detach(const char *name);
>> +
>> #define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
>>
>> #define DRIVER_EXPORT_NAME(name, idx) \
>> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> index a617b9e..db866b8 100644
>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> @@ -163,5 +163,7 @@ DPDK_16.07 {
>> rte_keepalive_mark_sleep;
>> rte_keepalive_register_relay_callback;
>> rte_thread_setname;
>> + rte_eal_dev_attach;
>> + rte_eal_dev_detach;
>>
>> } DPDK_16.04;
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name
2016-07-15 9:39 ` Shreyansh jain
@ 2016-07-15 9:56 ` Thomas Monjalon
2016-07-15 11:32 ` Jan Viktorin
2016-07-15 9:56 ` Jan Viktorin
2016-07-15 13:14 ` Shreyansh Jain
2 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-07-15 9:56 UTC (permalink / raw)
To: Shreyansh jain, Jan Viktorin; +Cc: dev, david.marchand
2016-07-15 15:09, Shreyansh jain:
> On Thursday 14 July 2016 10:25 PM, Jan Viktorin wrote:
> > What is meant by "resources" here?
>
> This has historic context (from earlier version of this patch).
> But I could relate the word 'resources' to EAL representation of devices - whether PCI or Crypto.
> Or, Resource == Device.
We need to define a precise wording, especially for the words
- interface
- resource
- device
- driver
- module
Following are my thoughts:
An interface is a view of a resource through an API (e.g. an ethdev port).
A resource is a well identified hardware (e.g. a PCI device id).
A device is a hardware function (e.g. a networking port).
Note that some PCI NICs have only one PCI device id for several ports
(Chelsio and Mellanox cases). That's why we need to distinguish device
and resource.
A driver is the code handling a device.
I have read the word module in some patch proposals but I don't really know
what it refers to. Is it a group of drivers in the same file/directory?
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name
2016-07-15 9:39 ` Shreyansh jain
2016-07-15 9:56 ` Thomas Monjalon
@ 2016-07-15 9:56 ` Jan Viktorin
2016-07-15 13:14 ` Shreyansh Jain
2 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-07-15 9:56 UTC (permalink / raw)
To: Shreyansh jain; +Cc: dev, thomas.monjalon, david.marchand
On Fri, 15 Jul 2016 15:09:58 +0530
Shreyansh jain <shreyansh.jain@nxp.com> wrote:
> On Thursday 14 July 2016 10:25 PM, Jan Viktorin wrote:
> > On Tue, 12 Jul 2016 11:31:17 +0530
> > Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> >
> >> eal is a better place than crypto / ethdev for naming resources.
> >
> > s/for naming/to name/
>
> OK.
>
> >
> > What is meant by "resources" here?
>
> This has historic context (from earlier version of this patch).
> But I could relate the word 'resources' to EAL representation of devices - whether PCI or Crypto.
> Or, Resource == Device.
If it is possible I'd like more "device". But I think it's not that critical thing...
>
> >
> >> Add a helper in eal and make use of it in crypto / ethdev.
[...]
> >> TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
> >> @@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
> >>
> >> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
> >> #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> >> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
> >>
> >> /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
> >> #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> >> @@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
> >> }
> >> #undef GET_PCIADDR_FIELD
> >>
> >> +/**
> >> + * Utility function to write a pci device name, this device name can later be
> >> + * used to retrieve the corresponding rte_pci_addr using above functions.
> >
> > What about saying "using functions eal_parse_pci_*BDF"? The
> > specification "above" is quite uncertain...
>
> Agree that 'above' is positional word and should be avoided.
> I will change that to "... using eal_parse_pci_* BDF helpers". OK?
OK.
[...]
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug
2016-07-14 16:51 ` Jan Viktorin
@ 2016-07-15 10:36 ` Shreyansh jain
2016-07-15 11:27 ` Jan Viktorin
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh jain @ 2016-07-15 10:36 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
On Thursday 14 July 2016 10:21 PM, Jan Viktorin wrote:
> On Tue, 12 Jul 2016 11:31:21 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
>> Remove bus logic from ethdev hotplug by using eal for this.
>>
>> Current api is preserved:
>> - the last port that has been created is tracked to return it to the
>> application when attaching,
>> - the internal device name is reused when detaching.
>>
>> We can not get rid of ethdev hotplug yet since we still need some mechanism
>> to inform applications of port creation/removal to substitute for ethdev
>> hotplug api.
>>
>> dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
>> is, but this information is not needed anymore and is removed in the following
>> commit.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_ether/rte_ethdev.c | 207 +++++++-----------------------------------
>> 1 file changed, 33 insertions(+), 174 deletions(-)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index a667012..8d14fd7 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -72,6 +72,7 @@
>> static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
>> struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
>> static struct rte_eth_dev_data *rte_eth_dev_data;
>> +static uint8_t eth_dev_last_created_port;
>> static uint8_t nb_ports;
>>
>
> [...]
>
>> -
>> /* attach the new device, then store port_id of the device */
>> int
>> rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
>> {
>> - struct rte_pci_addr addr;
>> int ret = -1;
>> + int current = eth_dev_last_created_port;
>> + char *name = NULL;
>> + char *args = NULL;
>>
>> if ((devargs == NULL) || (port_id == NULL)) {
>> ret = -EINVAL;
>> goto err;
>> }
>>
>> - if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
>> - ret = rte_eth_dev_attach_pdev(&addr, port_id);
>> - if (ret < 0)
>> - goto err;
>> - } else {
>> - ret = rte_eth_dev_attach_vdev(devargs, port_id);
>> - if (ret < 0)
>> - goto err;
>> + /* parse devargs, then retrieve device name and args */
>> + if (rte_eal_parse_devargs_str(devargs, &name, &args))
>> + goto err;
>> +
>> + ret = rte_eal_dev_attach(name, args);
>> + if (ret < 0)
>> + goto err;
>> +
>> + /* no point looking at eth_dev_last_created_port if no port exists */
>
> I am not sure about this comment. What is "no point"?
>
> Isn't this also a potential bug? (Like the one below.) How could it
> happen there is no port after a successful attach?
Yes, even searching through code path I couldn't find a positive case where control would reach here without nb_ports>0.
Though, i am not sure if some rough application attempts to mix-up calls - and that, in my opinion, is not worth checking.
Should I remove it?
>
>> + if (!nb_ports) {
>> + ret = -1;
>> + goto err;
>> + }
>> + /* if nothing happened, there is a bug here, since some driver told us
>> + * it did attach a device, but did not create a port */
>> + if (current == eth_dev_last_created_port) {
>> + ret = -1;
>> + goto err;
>
> Should we log this? Or call some kind panic?
I will place a log because applications should have a chance to ignore a device which cannot be attached for whatever reason.
>
>> }
>> + *port_id = eth_dev_last_created_port;
>> + ret = 0;
>>
>> - return 0;
>> err:
>> - RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
>> + free(name);
>> + free(args);
>> return ret;
>> }
>>
>> @@ -590,7 +464,6 @@ err:
>> int
>> rte_eth_dev_detach(uint8_t port_id, char *name)
>> {
>> - struct rte_pci_addr addr;
>> int ret = -1;
>>
>> if (name == NULL) {
>> @@ -598,33 +471,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
>> goto err;
>> }
>>
>> - /* check whether the driver supports detach feature, or not */
>> + /* FIXME: move this to eal, once device flags are relocated there */
>> if (rte_eth_dev_is_detachable(port_id))
>> goto err;
>>
>> - if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
>> - ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
>> - if (ret < 0)
>> - goto err;
>> -
>> - ret = rte_eth_dev_detach_pdev(port_id, &addr);
>> - if (ret < 0)
>> - goto err;
>> -
>> - snprintf(name, RTE_ETH_NAME_MAX_LEN,
>> - "%04x:%02x:%02x.%d",
>> - addr.domain, addr.bus,
>> - addr.devid, addr.function);
>> - } else {
>> - ret = rte_eth_dev_detach_vdev(port_id, name);
>> - if (ret < 0)
>> - goto err;
>> - }
>> + snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
>> + "%s", rte_eth_devices[port_id].data->name);
>> + ret = rte_eal_dev_detach(name);
>> + if (ret < 0)
>> + goto err;
>>
>> return 0;
>>
>> err:
>> - RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
>
> I'd be more specific about the failing device, we have its name.
Agree. I will add 'name' to this.
>> return ret;
>> }
>>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-14 15:57 ` Jan Viktorin
@ 2016-07-15 10:48 ` Shreyansh jain
2016-07-15 12:38 ` Thomas Monjalon
2016-07-28 9:36 ` Shreyansh Jain
0 siblings, 2 replies; 375+ messages in thread
From: Shreyansh jain @ 2016-07-15 10:48 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
On Thursday 14 July 2016 09:27 PM, Jan Viktorin wrote:
> On Thu, 14 Jul 2016 10:57:55 +0530
> Shreyansh jain <shreyansh.jain@nxp.com> wrote:
>
>> Hi Jan,
>>
>> On Wednesday 13 July 2016 11:04 PM, Jan Viktorin wrote:
>>> On Wed, 13 Jul 2016 11:20:43 +0200
>>> Jan Viktorin <viktorin@rehivetech.com> wrote:
>>>
>>>> Hello Shreyansh,
>>>>
>>>> On Tue, 12 Jul 2016 11:31:10 +0530
>>>> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>>>>
>>>>> Introduce a RTE_INIT macro used to mark an init function as a constructor.
>>>>> Current eal macros have been converted to use this (no functional impact).
>>>>> DRIVER_REGISTER_PCI is added as a helper for pci drivers.
>>>>>
>>>>> Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
>>>>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>>>>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>>>> ---
>>>>
>>>> [...]
>>>>
>>>>> +#define RTE_INIT(func) \
>>>>> +static void __attribute__((constructor, used)) func(void)
>>>>> +
>>>>> #ifdef __cplusplus
>>>>> }
>>>>> #endif
>>>>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>>>>> index fa74962..3027adf 100644
>>>>> --- a/lib/librte_eal/common/include/rte_pci.h
>>>>> +++ b/lib/librte_eal/common/include/rte_pci.h
>>>>> @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
>>>>> */
>>>>> void rte_eal_pci_register(struct rte_pci_driver *driver);
>>>>>
>>>>> +/** Helper for PCI device registeration from driver (eth, crypto) instance */
>>>>> +#define DRIVER_REGISTER_PCI(nm, drv) \
>>>>> +RTE_INIT(pciinitfn_ ##nm); \
>>>>> +static void pciinitfn_ ##nm(void) \
>>>>> +{ \
>>>>
>>>> You are missing setting the name here like PMD_REGISTER_DRIVER does
>>>> now. Or should I include it in my patch set?
>>>>
>>>> (drv).name = RTE_STR(nm);
>>
>> That is a miss from my side.
>> I will publish v7 with this. You want this right away or should I wait a little while (more reviews, or any pending additions as per Thomas's notes) before publishing?
>
> Please. The time is almost gone. 18/7/2016 is the release (according
> to the roadmap)... I have to fix it in my patchset, otherwise it
> does not build (after moving the .name from rte_pci_driver to
> rte_driver).
>
I didn't consider 18/Jul.
Please go ahead. I will continue to send v7 _without_ the above change so that your patchset doesn't break. This way you will not get blocked because of me.
>>
>>>
>>> Moreover, it should accept the rte_pci_driver *, shouldn't it? Here, it
>>> expects a wrapper around it (eth_driver)... I now, my SoC patches were
>>> supposing the some... but I think it is wrong.
>>>
>>> The original David's patch set contains calls like this:
>>>
>>> RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
>>>
>>> So, I think, we should go the original way.
>>
>> I have a slightly different opinion of the above.
>> IMO, aim of the helpers is to hide the PCI details and continue to make driver consider itself as a generic ETH driver. In that case, dereferencing pci_drv would be done by macro.
>
> In this case, I'd prefer to see DRIVER_REGISTER_PCI_ETH.
>
> At first, this was also my way of thinking. But I've changed my mind. I
> find it to be a bit overdesigned.
There is:
DRIVER_REGISTER_PCI(...)
DRIVER_REGISTER_PCI_TABLE(...)
Wouldn't DRIVER_REGISTER_PCI_ETH look out-of-place?
>
>>
>> Also, considering that in future pci_drv would also have soc_drv, the helpers can effectively hide the intra-structure naming of these. It would help when more such device types (would there be?) are introduced - in which case, driver framework has a consistent coding convention.
>
> Hide? I am afraid, I don't understand clearly what you mean.
DRIVER_REGISTER_PCI(eth_driver)
DRIVER_REGISTER_SOC(eth_driver)
DRIVER_REGISTER_XXX(eth_driver)
...
In either case, the caller always creates the eth_driver and populates internal specific driver structure (pci_drv) as a sub-part of eth_driver specification. Macro 'hides' the internal structure name (pci_drv, soc_drv...).
But again, nothing critical. Just a way of usage. We might not even have a 'XXX' in near future.
>
>>
>> But, I am ok switching back to David's way as well - I don't have any strong argument against that.
>
> I'd like to preserve the clear semantics. That is DRIVER_REGISTER_PCI
> -> give a pci device.
>
> Has anybody a different opinion? David? Thomas?
Yes please.
Or else, if nothing comes up soon, I will simply go ahead and change to DRIVER_REGISTER_PCI(eth_driver.pci_drv) as this trivial issue shouldn't hold back this series.
>
>>
>>>
>>> Jan
>>>
>>>>
>>>>> + rte_eal_pci_register(&drv.pci_drv); \
>>>>> +}
>>>>> +
>>>>> /**
>>>>> * Unregister a PCI driver.
>>>>> *
>> [...]
>>
>> -
>> Shreyansh
>>
>
>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug
2016-07-15 10:36 ` Shreyansh jain
@ 2016-07-15 11:27 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-07-15 11:27 UTC (permalink / raw)
To: Shreyansh jain; +Cc: dev, thomas.monjalon, david.marchand
On Fri, 15 Jul 2016 16:06:25 +0530
Shreyansh jain <shreyansh.jain@nxp.com> wrote:
> On Thursday 14 July 2016 10:21 PM, Jan Viktorin wrote:
> > On Tue, 12 Jul 2016 11:31:21 +0530
> > Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> >
> >> Remove bus logic from ethdev hotplug by using eal for this.
> >>
> >> Current api is preserved:
> >> - the last port that has been created is tracked to return it to the
> >> application when attaching,
> >> - the internal device name is reused when detaching.
> >>
> >> We can not get rid of ethdev hotplug yet since we still need some mechanism
> >> to inform applications of port creation/removal to substitute for ethdev
> >> hotplug api.
> >>
> >> dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
> >> is, but this information is not needed anymore and is removed in the following
> >> commit.
> >>
> >> Signed-off-by: David Marchand <david.marchand@6wind.com>
> >> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> >> ---
> >> lib/librte_ether/rte_ethdev.c | 207 +++++++-----------------------------------
> >> 1 file changed, 33 insertions(+), 174 deletions(-)
> >>
> >> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> >> index a667012..8d14fd7 100644
> >> --- a/lib/librte_ether/rte_ethdev.c
> >> +++ b/lib/librte_ether/rte_ethdev.c
> >> @@ -72,6 +72,7 @@
> >> static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
> >> struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
> >> static struct rte_eth_dev_data *rte_eth_dev_data;
> >> +static uint8_t eth_dev_last_created_port;
> >> static uint8_t nb_ports;
> >>
> >
> > [...]
> >
> >> -
> >> /* attach the new device, then store port_id of the device */
> >> int
> >> rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
> >> {
> >> - struct rte_pci_addr addr;
> >> int ret = -1;
> >> + int current = eth_dev_last_created_port;
> >> + char *name = NULL;
> >> + char *args = NULL;
> >>
> >> if ((devargs == NULL) || (port_id == NULL)) {
> >> ret = -EINVAL;
> >> goto err;
> >> }
> >>
> >> - if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
> >> - ret = rte_eth_dev_attach_pdev(&addr, port_id);
> >> - if (ret < 0)
> >> - goto err;
> >> - } else {
> >> - ret = rte_eth_dev_attach_vdev(devargs, port_id);
> >> - if (ret < 0)
> >> - goto err;
> >> + /* parse devargs, then retrieve device name and args */
> >> + if (rte_eal_parse_devargs_str(devargs, &name, &args))
> >> + goto err;
> >> +
> >> + ret = rte_eal_dev_attach(name, args);
> >> + if (ret < 0)
> >> + goto err;
> >> +
> >> + /* no point looking at eth_dev_last_created_port if no port exists */
> >
> > I am not sure about this comment. What is "no point"?
> >
> > Isn't this also a potential bug? (Like the one below.) How could it
> > happen there is no port after a successful attach?
>
> Yes, even searching through code path I couldn't find a positive case where control would reach here without nb_ports>0.
> Though, i am not sure if some rough application attempts to mix-up calls - and that, in my opinion, is not worth checking.
> Should I remove it?
At least a loud log might be helpful. If there is really no path to reach this point, I'd put RTE_VERIFY here.
>
> >
> >> + if (!nb_ports) {
> >> + ret = -1;
> >> + goto err;
> >> + }
> >> + /* if nothing happened, there is a bug here, since some driver told us
> >> + * it did attach a device, but did not create a port */
> >> + if (current == eth_dev_last_created_port) {
> >> + ret = -1;
> >> + goto err;
> >
> > Should we log this? Or call some kind panic?
>
> I will place a log because applications should have a chance to ignore a device which cannot be attached for whatever reason.
OK, we just should shout loudly if it means a bug...
[...]
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name
2016-07-15 9:56 ` Thomas Monjalon
@ 2016-07-15 11:32 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-07-15 11:32 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: Shreyansh jain, dev, david.marchand
On Fri, 15 Jul 2016 11:56:38 +0200
Thomas Monjalon <thomas.monjalon@6wind.com> wrote:
> 2016-07-15 15:09, Shreyansh jain:
> > On Thursday 14 July 2016 10:25 PM, Jan Viktorin wrote:
> > > What is meant by "resources" here?
> >
> > This has historic context (from earlier version of this patch).
> > But I could relate the word 'resources' to EAL representation of devices - whether PCI or Crypto.
> > Or, Resource == Device.
>
> We need to define a precise wording, especially for the words
> - interface
> - resource
> - device
> - driver
> - module
> Following are my thoughts:
>
> An interface is a view of a resource through an API (e.g. an ethdev port).
> A resource is a well identified hardware (e.g. a PCI device id).
> A device is a hardware function (e.g. a networking port).
> Note that some PCI NICs have only one PCI device id for several ports
> (Chelsio and Mellanox cases). That's why we need to distinguish device
> and resource.
>
> A driver is the code handling a device.
> I have read the word module in some patch proposals but I don't really know
> what it refers to. Is it a group of drivers in the same file/directory?
Well, yes, initially there was proposed a kind of module. However, after David
as sent the patchset prepare for rte_device/driver, you can see that there
is no need for such object (probably). A module might be helpful when thinking
about the metadata (as done by Neil Horman). But as far as I know there was no
need for this... So a module has no data abstraction now and I am not going to
make any.
Jan
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-15 10:48 ` Shreyansh jain
@ 2016-07-15 12:38 ` Thomas Monjalon
2016-07-28 9:36 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Thomas Monjalon @ 2016-07-15 12:38 UTC (permalink / raw)
To: Shreyansh jain, Jan Viktorin; +Cc: dev, david.marchand
Hi guys,
2016-07-15 16:18, Shreyansh jain:
> On Thursday 14 July 2016 09:27 PM, Jan Viktorin wrote:
> > Please. The time is almost gone. 18/7/2016 is the release (according
> > to the roadmap)... I have to fix it in my patchset, otherwise it
> > does not build (after moving the .name from rte_pci_driver to
> > rte_driver).
>
> I didn't consider 18/Jul.
> Please go ahead. I will continue to send v7 _without_ the above change
> so that your patchset doesn't break. This way you will not get blocked
> because of me.
[...]
> > I'd like to preserve the clear semantics. That is DRIVER_REGISTER_PCI
> > -> give a pci device.
> >
> > Has anybody a different opinion? David? Thomas?
>
> Yes please.
> Or else, if nothing comes up soon, I will simply go ahead and change to
> DRIVER_REGISTER_PCI(eth_driver.pci_drv) as this trivial issue shouldn't
> hold back this series.
I'm sorry I have no time to review these series shortly.
I think it is too late to consider an integration in 16.07 unfortunately.
I feel you are doing a great job and we can target to have these changes
in the early days of 16.11 (in August).
As this is a big refactoring, it is probably a good idea to integrate it
in the beginning of the next release integration cycle.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name
2016-07-15 9:39 ` Shreyansh jain
2016-07-15 9:56 ` Thomas Monjalon
2016-07-15 9:56 ` Jan Viktorin
@ 2016-07-15 13:14 ` Shreyansh Jain
2 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-15 13:14 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
On Friday 15 July 2016 03:09 PM, Shreyansh jain wrote:
> On Thursday 14 July 2016 10:25 PM, Jan Viktorin wrote:
>> On Tue, 12 Jul 2016 11:31:17 +0530
>> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>>
>>> eal is a better place than crypto / ethdev for naming resources.
>>
>> s/for naming/to name/
>
> OK.
>
>>
>> What is meant by "resources" here?
>
> This has historic context (from earlier version of this patch).
> But I could relate the word 'resources' to EAL representation of devices - whether PCI or Crypto.
> Or, Resource == Device.
>
If I go by what Thomas is proposing for meaning of 'resource' [1], and the fact that all methods in this patchset refer to 'devices', I will change the patch context to 'EAL is a better place than crypto / ethdev to name devices'.
[1] http://dpdk.org/ml/archives/dev/2016-July/044056.html
>>
>>> Add a helper in eal and make use of it in crypto / ethdev.
>>>
>>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>> ---
>>> lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
>>> lib/librte_eal/common/include/rte_pci.h | 25 +++++++++++++++++++++++++
>>> lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
>>> 3 files changed, 33 insertions(+), 43 deletions(-)
>>>
>>> diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
>>> index d7be111..60c6384 100644
>>> --- a/lib/librte_cryptodev/rte_cryptodev.c
>>> +++ b/lib/librte_cryptodev/rte_cryptodev.c
>>> @@ -367,23 +367,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
>>> return cryptodev;
>>> }
>>>
>>> -static inline int
>>> -rte_cryptodev_create_unique_device_name(char *name, size_t size,
>>> - struct rte_pci_device *pci_dev)
>>> -{
>>> - int ret;
>>> -
>>> - if ((name == NULL) || (pci_dev == NULL))
>>> - return -EINVAL;
>>> -
>>> - ret = snprintf(name, size, "%d:%d.%d",
>>> - pci_dev->addr.bus, pci_dev->addr.devid,
>>> - pci_dev->addr.function);
>>> - if (ret < 0)
>>> - return ret;
>>> - return 0;
>>> -}
>>> -
>>> int
>>> rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
>>> {
>>> @@ -446,9 +429,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
>>> if (cryptodrv == NULL)
>>> return -ENODEV;
>>>
>>> - /* Create unique Crypto device name using PCI address */
>>> - rte_cryptodev_create_unique_device_name(cryptodev_name,
>>> - sizeof(cryptodev_name), pci_dev);
>>> + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
>>> + sizeof(cryptodev_name));
>>>
>>> cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
>>> if (cryptodev == NULL)
>>> @@ -503,9 +485,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
>>> if (pci_dev == NULL)
>>> return -EINVAL;
>>>
>>> - /* Create unique device name using PCI address */
>>> - rte_cryptodev_create_unique_device_name(cryptodev_name,
>>> - sizeof(cryptodev_name), pci_dev);
>>> + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
>>> + sizeof(cryptodev_name));
>>>
>>> cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
>>> if (cryptodev == NULL)
>>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>>> index 3027adf..06508fa 100644
>>> --- a/lib/librte_eal/common/include/rte_pci.h
>>> +++ b/lib/librte_eal/common/include/rte_pci.h
>>> @@ -82,6 +82,7 @@ extern "C" {
>>> #include <stdint.h>
>>> #include <inttypes.h>
>>>
>>> +#include <rte_debug.h>
>>> #include <rte_interrupts.h>
>>>
>>> TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
>>> @@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
>>>
>>> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
>>> #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
>>> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
>>>
>>> /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
>>> #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
>>> @@ -308,6 +310,29 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
>>> }
>>> #undef GET_PCIADDR_FIELD
>>>
>>> +/**
>>> + * Utility function to write a pci device name, this device name can later be
>>> + * used to retrieve the corresponding rte_pci_addr using above functions.
>>
>> What about saying "using functions eal_parse_pci_*BDF"? The
>> specification "above" is quite uncertain...
>
> Agree that 'above' is positional word and should be avoided.
> I will change that to "... using eal_parse_pci_* BDF helpers". OK?
>
>>
>>> + *
>>> + * @param addr
>>> + * The PCI Bus-Device-Function address
>>> + * @param output
>>> + * The output buffer string
>>> + * @param size
>>> + * The output buffer size
>>> + * @return
>>> + * 0 on success, negative on error.
>>> + */
>>> +static inline void
>>> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
>>> + char *output, size_t size)
>>> +{
>>> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
>>> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
>>> + addr->domain, addr->bus,
>>> + addr->devid, addr->function) >= 0);
>>> +}
>>> +
>>> /* Compare two PCI device addresses. */
>>> /**
>>
>> [...]
>>
>>
>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-15 10:48 ` Shreyansh jain
2016-07-15 12:38 ` Thomas Monjalon
@ 2016-07-28 9:36 ` Shreyansh Jain
2016-07-30 8:14 ` Jan Viktorin
1 sibling, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-07-28 9:36 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
Hi Jan,
On Friday 15 July 2016 04:18 PM, Shreyansh jain wrote:
> On Thursday 14 July 2016 09:27 PM, Jan Viktorin wrote:
>> On Thu, 14 Jul 2016 10:57:55 +0530
>> Shreyansh jain <shreyansh.jain@nxp.com> wrote:
>>
>>> Hi Jan,
>>>
>>> On Wednesday 13 July 2016 11:04 PM, Jan Viktorin wrote:
>>>> On Wed, 13 Jul 2016 11:20:43 +0200
>>>> Jan Viktorin <viktorin@rehivetech.com> wrote:
>>>>
>>>>> Hello Shreyansh,
>>>>>
>>>>> On Tue, 12 Jul 2016 11:31:10 +0530
>>>>> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>>>>>
>>>>>> Introduce a RTE_INIT macro used to mark an init function as a constructor.
>>>>>> Current eal macros have been converted to use this (no functional impact).
>>>>>> DRIVER_REGISTER_PCI is added as a helper for pci drivers.
>>>>>>
>>>>>> Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
>>>>>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>>>>>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>>>>> ---
>>>>>
>>>>> [...]
>>>>>
>>>>>> +#define RTE_INIT(func) \
>>>>>> +static void __attribute__((constructor, used)) func(void)
>>>>>> +
>>>>>> #ifdef __cplusplus
>>>>>> }
>>>>>> #endif
>>>>>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>>>>>> index fa74962..3027adf 100644
>>>>>> --- a/lib/librte_eal/common/include/rte_pci.h
>>>>>> +++ b/lib/librte_eal/common/include/rte_pci.h
>>>>>> @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f);
>>>>>> */
>>>>>> void rte_eal_pci_register(struct rte_pci_driver *driver);
>>>>>>
>>>>>> +/** Helper for PCI device registeration from driver (eth, crypto) instance */
>>>>>> +#define DRIVER_REGISTER_PCI(nm, drv) \
>>>>>> +RTE_INIT(pciinitfn_ ##nm); \
>>>>>> +static void pciinitfn_ ##nm(void) \
>>>>>> +{ \
>>>>>
>>>>> You are missing setting the name here like PMD_REGISTER_DRIVER does
>>>>> now. Or should I include it in my patch set?
>>>>>
>>>>> (drv).name = RTE_STR(nm);
>>>
>>> That is a miss from my side.
>>> I will publish v7 with this. You want this right away or should I wait a little while (more reviews, or any pending additions as per Thomas's notes) before publishing?
>>
>> Please. The time is almost gone. 18/7/2016 is the release (according
>> to the roadmap)... I have to fix it in my patchset, otherwise it
>> does not build (after moving the .name from rte_pci_driver to
>> rte_driver).
>>
>
> I didn't consider 18/Jul.
> Please go ahead. I will continue to send v7 _without_ the above change so that your patchset doesn't break. This way you will not get blocked because of me.
>
Now that we have already skipped the 16.07, I will fix this in my code and release an updated version as soon as 16.07 is officially available. Is that OK?
Also, I have fixed most review comments except [1]. I am still not sure of the impact of this change. So, I will publish the v7 without this and then probably a v8 in case this change has any impact. That way we can have your patchset not blocked because of this series.
[1] http://dpdk.org/ml/archives/dev/2016-July/044004.html
[...]
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-28 9:36 ` Shreyansh Jain
@ 2016-07-30 8:14 ` Jan Viktorin
2016-08-01 11:00 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-07-30 8:14 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon, david.marchand
On Thu, 28 Jul 2016 15:06:10 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Hi Jan,
>
> On Friday 15 July 2016 04:18 PM, Shreyansh jain wrote:
> > On Thursday 14 July 2016 09:27 PM, Jan Viktorin wrote:
[...]
> >>>>> (drv).name = RTE_STR(nm);
> >>>
> >>> That is a miss from my side.
> >>> I will publish v7 with this. You want this right away or should I wait a little while (more reviews, or any pending additions as per Thomas's notes) before publishing?
> >>
> >> Please. The time is almost gone. 18/7/2016 is the release (according
> >> to the roadmap)... I have to fix it in my patchset, otherwise it
> >> does not build (after moving the .name from rte_pci_driver to
> >> rte_driver).
> >>
> >
> > I didn't consider 18/Jul.
> > Please go ahead. I will continue to send v7 _without_ the above change so that your patchset doesn't break. This way you will not get blocked because of me.
> >
>
> Now that we have already skipped the 16.07, I will fix this in my code and release an updated version as soon as 16.07 is officially available. Is that OK?
Sure :). The thing is that during August-September, I've got significantly
less time for this then in June-July :/. That's why I was trying to fit in
the 16.07.
>
> Also, I have fixed most review comments except [1]. I am still not sure of the impact of this change. So, I will publish the v7 without this and then probably a v8 in case this change has any impact.
I have no idea about this. Hopefully, it's not a very serious thing.
> That way we can have your patchset not blocked because of this series.
Thank you!
>
> [1] http://dpdk.org/ml/archives/dev/2016-July/044004.html
>
> [...]
>
>
> -
> Shreyansh
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (19 preceding siblings ...)
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 01/17] pci: no need for dynamic tailq init Shreyansh Jain
` (17 more replies)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (3 subsequent siblings)
24 siblings, 18 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon
* Original patch series is from David Marchand [1], [2].
* Link with patch series [4] from Jan Viktorin for a more complete picture
of proposed EAL device heirarchy changes.
* This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
removed [7].
David created the original patchset based on the discussions on list [3].
Being a large piece of work, this patchset introduces first level of changes
for generalizing the driver-device relationship for supporting hotplug.
Overview of this work as per David [3], as well as notes from Thomas [9] &
Jan:
- pdev -> PCI registeration using helpers (introduced in this series)
- removal of eth/crypto driver registeration callbacks. These are now handled
by PCI registeration helpers (this patch)
- rte_device=>pci/vdev device heirarchy (by this [4] series)
- removal of PMD_PDEV type (this patch) and PMD_VDEV (by this [4] series)
- Support for hotplugging
This patchset is based on master (b0a1419)
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
[4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
[5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
[6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
[7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
[8] http://dpdk.org/ml/archives/dev/2016-July/044004.html
[9] http://dpdk.org/ml/archives/dev/2016-July/044086.html
Changes since v6:
- rebase over 16.07 (b0a1419)
- DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
- review comments regarding missing information in log messages
- new API additions to 16.11 map objects
- review comment in [5] and [7] are not included in this series.
Changes since v5:
- Rebase over master (11c5e45d8)
- Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in sync
with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
- Modifications to bnxt and thunderx driver PMD registeration files for
using the simplified PCI device registeration helper macro
Changes since v4:
- Fix compilation issue after rebase on HEAD (913154e) in previous series
- Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
were removed by previous patchset. These are being used by pdump library
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
David Marchand, Shreyansh Jain (17):
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: remove duplicate function declaration
eal: introduce init macros
crypto: export init/uninit common wrappers for pci drivers
ethdev: export init/uninit common wrappers for pci drivers
drivers: convert all pdev drivers as pci drivers
crypto: get rid of crypto driver register callback
ethdev: get rid of eth driver register callback
eal/linux: move back interrupt thread init before setting affinity
pci: add a helper for device name
pci: add a helper to update a device
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +--
drivers/net/bnxt/bnxt_ethdev.c | 16 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/e1000/em_ethdev.c | 16 +-
drivers/net/e1000/igb_ethdev.c | 39 +---
drivers/net/ena/ena_ethdev.c | 19 +-
drivers/net/enic/enic_ethdev.c | 23 +-
drivers/net/fm10k/fm10k_ethdev.c | 23 +-
drivers/net/i40e/i40e_ethdev.c | 24 +--
drivers/net/i40e/i40e_ethdev_vf.c | 25 +--
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +---
drivers/net/mlx4/mlx4.c | 17 +-
drivers/net/mlx5/mlx5.c | 16 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/nfp/nfp_net.c | 23 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/qede/qede_ethdev.c | 40 +---
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/szedata2/rte_eth_szedata2.c | 24 +--
drivers/net/thunderx/nicvf_ethdev.c | 20 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_ethdev.c | 25 +--
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 67 ++----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
lib/librte_eal/bsdapp/eal/eal_pci.c | 52 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
lib/librte_eal/common/eal_common_dev.c | 48 +++++
lib/librte_eal/common/eal_common_pci.c | 17 +-
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_dev.h | 30 ++-
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 35 +++
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/linuxapp/eal/eal.c | 7 +-
lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +
lib/librte_ether/rte_ethdev.c | 272 ++++--------------------
lib/librte_ether/rte_ethdev.h | 40 ++--
lib/librte_ether/rte_ether_version.map | 9 +
51 files changed, 415 insertions(+), 813 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 01/17] pci: no need for dynamic tailq init
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
` (16 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 374b68f..a73cbb0 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 7248c38..6a0f6ac 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index cd9de7c..f0215ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 02/17] crypto: no need for a crypto pmd type
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 01/17] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 03/17] drivers: align pci driver definitions Shreyansh Jain
` (15 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index fc4123b..6434894 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -319,7 +319,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -358,7 +358,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -407,7 +406,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -449,8 +448,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index affbdec..13f46e4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -613,8 +613,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 03/17] drivers: align pci driver definitions
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 04/17] eal: remove duplicate function declaration Shreyansh Jain
` (14 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 82ab047..1e9e0ba 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,7 +113,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
},
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ac0803d..9418d50 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1685,7 +1685,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 82e3e4e..99a258a 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2459,7 +2459,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 04/17] eal: remove duplicate function declaration
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (2 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 03/17] drivers: align pci driver definitions Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 05/17] eal: introduce init macros Shreyansh Jain
` (13 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 857dc3e..06a68f6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -259,13 +259,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 3fb2188..fe9c704 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 05/17] eal: introduce init macros
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (3 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 04/17] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
` (12 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 9 +++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 95789f9..994650b 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void devinitfn_ ##drv(void);\
-void __attribute__((constructor, used)) devinitfn_ ##drv(void)\
+RTE_INIT(devinitfn_ ##drv);\
+static void devinitfn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..ffeb94c 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,15 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registeration from driver (eth, crypto) instance */
+#define DRIVER_REGISTER_PCI(nm, pci_drv) \
+RTE_INIT(pciinitfn_ ##nm); \
+static void pciinitfn_ ##nm(void) \
+{ \
+ (pci_drv).name = RTE_STR(nm);\
+ rte_eal_pci_register(&pci_drv); \
+}
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index cc3c0f1..cc386e4 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 06/17] crypto: export init/uninit common wrappers for pci drivers
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (4 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 05/17] eal: introduce init macros Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 07/17] ethdev: " Shreyansh Jain
` (11 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
that can be used by pci drivers that assume a 1 to 1 association between
pci resource and upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 7 +++++++
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 6434894..b1e82b6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -429,9 +429,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -490,8 +490,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -539,15 +539,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a08fd20..1fc0d57 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -39,3 +39,10 @@ DPDK_16.07 {
rte_cryptodev_parse_vdev_init_params;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 07/17] ethdev: export init/uninit common wrappers for pci drivers
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (5 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
` (10 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Preparing for getting rid of eth_drv, here are two wrappers that can be
used by pci drivers that assume a 1 to 1 association between pci resource and
upper interface.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 9 +++++++++
3 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f62a9ec..8825219 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b0fe033..37d78bf 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4368,6 +4368,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 45ddf44..17e7448 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -138,4 +138,13 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 08/17] drivers: convert all pdev drivers as pci drivers
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (6 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 07/17] ethdev: " Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
` (9 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++---------
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +++++-------------------
drivers/net/bnxt/bnxt_ethdev.c | 16 +++---------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++---------
drivers/net/e1000/igb_ethdev.c | 39 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 17 +++---------
drivers/net/enic/enic_ethdev.c | 23 +++--------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++--------------
drivers/net/i40e/i40e_ethdev.c | 24 +++--------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +++++----------------------------
drivers/net/mlx4/mlx4.c | 15 +++--------
drivers/net/mlx5/mlx5.c | 14 +++-------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/qede/qede_ethdev.c | 40 ++++++----------------------
drivers/net/szedata2/rte_eth_szedata2.c | 24 +++--------------
drivers/net/thunderx/nicvf_ethdev.c | 20 +++-----------
drivers/net/virtio/virtio_ethdev.c | 25 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++--------------
20 files changed, 78 insertions(+), 407 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1e9e0ba..b94af59 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,23 +116,13 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv, CRYPTODEV_NAME_QAT_SYM_PMD);
+DRIVER_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f3ab355..214b655 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -621,6 +621,8 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
@@ -634,38 +636,14 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver, bnx2x);
+DRIVER_REGISTER_PCI(bnx2x, rte_bnx2x_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf);
+DRIVER_REGISTER_PCI(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3795fac..28eb8b9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1048,23 +1048,13 @@ static struct eth_driver bnxt_rte_pmd = {
.name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = bnxt_dev_init,
.eth_dev_uninit = bnxt_dev_uninit,
.dev_private_size = sizeof(struct bnxt),
};
-static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
-{
- RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
- rte_eth_driver_register(&bnxt_rte_pmd);
- return 0;
-}
-
-static struct rte_driver bnxt_pmd_drv = {
- .type = PMD_PDEV,
- .init = bnxt_rte_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt);
+DRIVER_REGISTER_PCI(bnxt, bnxt_rte_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 9208a61..431b06d 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1042,30 +1042,12 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4);
+DRIVER_REGISTER_PCI(cxgb4, rte_cxgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(cxgb4, cxgb4_pci_tbl);
-
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index ad104ed..1281c8b 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -395,6 +395,8 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
@@ -402,13 +404,6 @@ static struct eth_driver rte_em_pmd = {
};
static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
-
-static int
em_hw_init(struct e1000_hw *hw)
{
int diag;
@@ -1799,10 +1794,5 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv, em);
+DRIVER_REGISTER_PCI(em, rte_em_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(em, pci_id_em_map);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index fbf4d09..6842eab 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1047,6 +1047,8 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
@@ -1061,19 +1063,14 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
-
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
{
@@ -1085,20 +1082,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -5049,16 +5032,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5220,7 +5193,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-PMD_REGISTER_DRIVER(pmd_igb_drv, igb);
+DRIVER_REGISTER_PCI(igb, rte_igb_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf);
+DRIVER_REGISTER_PCI(igbvf, rte_igbvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igbvf, pci_id_igbvf_map);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 9418d50..ee906d4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1689,23 +1689,12 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv, ena);
+DRIVER_REGISTER_PCI(ena, rte_ena_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ena, pci_id_ena_map);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 47b07c9..59812d0 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -616,29 +616,12 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver, enic);
+DRIVER_REGISTER_PCI(enic, rte_enic_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(enic, pci_id_enic_map);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 01f4a72..26cdc10 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3059,30 +3059,13 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver, fm10k);
+DRIVER_REGISTER_PCI(fm10k, rte_pmd_fm10k.pci_drv);
DRIVER_REGISTER_PCI_TABLE(fm10k, pci_id_fm10k_map);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0aeb70..dacaaea 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -667,6 +667,8 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
@@ -701,27 +703,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver, i40e);
+DRIVER_REGISTER_PCI(i40e, rte_i40e_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40e, pci_id_i40e_map);
/*
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a616ae0..4a745f9 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1557,34 +1557,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver, i40evf);
+DRIVER_REGISTER_PCI(i40evf, rte_i40evf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map);
static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d478a15..5c115db 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1509,6 +1509,8 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1523,40 +1525,14 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
-
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
@@ -7352,17 +7328,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
ixgbevf_dev_interrupt_action(dev);
}
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver, ixgbe);
+DRIVER_REGISTER_PCI(ixgbe, rte_ixgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbe, pci_id_ixgbe_map);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver, ixgbevf);
+DRIVER_REGISTER_PCI(ixgbevf, rte_ixgbevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 304c846..2bed4de 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5922,12 +5922,10 @@ static struct eth_driver mlx4_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5938,13 +5936,6 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver, mlx4);
DRIVER_REGISTER_PCI_TABLE(mlx4, mlx4_pci_id_map);
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index d96a9af..3658769 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -739,11 +739,10 @@ static struct eth_driver mlx5_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -753,13 +752,6 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver, mlx5);
DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99a258a..cbaf219 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2464,29 +2464,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver, nfp);
+DRIVER_REGISTER_PCI(nfp, rte_nfp_net_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(nfp, pci_id_nfp_net_map);
/*
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 82e44b8..a92dd3b 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1482,7 +1482,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1494,41 +1496,15 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver, qede);
+DRIVER_REGISTER_PCI(qede, rte_qede_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qede, pci_id_qede_map);
-PMD_REGISTER_DRIVER(rte_qedevf_driver, qedevf);
+DRIVER_REGISTER_PCI(qedevf, rte_qedevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qedevf, pci_id_qedevf_map);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 483d789..6d21024 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,13 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME);
+DRIVER_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv);
DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4f875c0..ad7d607 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1762,26 +1762,12 @@ static struct eth_driver rte_nicvf_pmd = {
.name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nicvf_eth_dev_init,
.dev_private_size = sizeof(struct nicvf),
};
-static int
-rte_nicvf_pmd_init(const char *name __rte_unused, const char *para __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_thunderx nicvf version %s",
- THUNDERX_NICVF_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nicvf_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nicvf_driver = {
- .type = PMD_PDEV,
- .init = rte_nicvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nicvf_driver, thunderx_nicvf);
+DRIVER_REGISTER_PCI(thunderx_nicvf, rte_nicvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(thunderx_nicvf, pci_id_nicvf_map);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 07d6449..5453709 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1307,29 +1307,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1563,10 +1558,4 @@ __rte_unused uint8_t is_rx)
return 0;
}
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver, virtio_net);
DRIVER_REGISTER_PCI_TABLE(virtio_net, pci_id_virtio_map);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 5874215..d732979 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -331,26 +331,14 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
-
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
{
@@ -948,10 +936,5 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver, vmxnet3);
+DRIVER_REGISTER_PCI(vmxnet3, rte_vmxnet3_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(vmxnet3, pci_id_vmxnet3_map);
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 09/17] crypto: get rid of crypto driver register callback
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (7 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 10/17] ethdev: get rid of eth " Shreyansh Jain
` (8 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Now that all pdev are pci drivers, we don't need to register crypto drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
3 files changed, 53 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index b1e82b6..2a3b649 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -533,28 +533,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 1fc0d57..9627ac4 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 10/17] ethdev: get rid of eth driver register callback
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (8 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
` (7 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Now that all pdev are pci drivers, we don't need to register ethdev drivers
through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 22 ----------------------
lib/librte_ether/rte_ethdev.h | 12 ------------
2 files changed, 34 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 8825219..3bccf20 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 37d78bf..b005c1b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1871,18 +1871,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 11/17] eal/linux: move back interrupt thread init before setting affinity
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (9 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 10/17] ethdev: get rid of eth " Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 12/17] pci: add a helper for device name Shreyansh Jain
` (6 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Now that virtio pci driver is initialized in a constructor, iopl() stuff
happens early enough so that interrupt thread can be created right after
plugin loading.
This way, chelsio driver should be happy again [1].
[1] http://dpdk.org/ml/archives/dev/2015-November/028289.html
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index fe9c704..259a7e4 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -834,6 +834,9 @@ rte_eal_init(int argc, char **argv)
if (eal_plugins_init() < 0)
rte_panic("Cannot init plugins\n");
+ if (rte_eal_intr_init() < 0)
+ rte_panic("Cannot init interrupt-handling thread\n");
+
eal_thread_init_master(rte_config.master_lcore);
ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
@@ -845,9 +848,6 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
- if (rte_eal_intr_init() < 0)
- rte_panic("Cannot init interrupt-handling thread\n");
-
RTE_LCORE_FOREACH_SLAVE(i) {
/*
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 12/17] pci: add a helper for device name
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (10 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 13/17] pci: add a helper to update a device Shreyansh Jain
` (5 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Eal is a better place than crypto / ethdev to name devices.
Add a helper in eal and make use of it in crypto / ethdev.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 ++++-----------------------
lib/librte_eal/common/include/rte_pci.h | 26 ++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.c | 24 ++++--------------------
3 files changed, 34 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 2a3b649..c81e366 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -444,9 +427,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -501,9 +483,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index ffeb94c..9eea092 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,30 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
+ * BDF helpers.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 3bccf20..a1bb043 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 13/17] pci: add a helper to update a device
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (11 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 12/17] pci: add a helper for device name Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
` (4 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
This helper updates a pci device object with latest information it can
find.
It will be used mainly for hotplug code.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 13 ++++++++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 ++++++++++
3 files changed, 75 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index a73cbb0..1d91c78 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 06a68f6..b8ff9c5 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -152,6 +152,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f0215ee..62da4d4 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 14/17] ethdev: do not scan all pci devices on attach
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (12 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 13/17] pci: add a helper to update a device Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
` (3 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6a0f6ac..da0038f 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -341,6 +341,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -353,9 +358,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a1bb043..fdeac86 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -469,9 +469,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 15/17] eal: add hotplug operations for pci and vdev
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (13 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 16/17] ethdev: convert to eal hotplug Shreyansh Jain
` (2 subsequent siblings)
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Hotplug invocations, which deals with devices, should come from the layer that
already handles them, i.e. EAL.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 ++++
lib/librte_eal/common/eal_common_dev.c | 48 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 26 ++++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 ++++
4 files changed, 88 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index a335e04..7b3d409 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -162,3 +162,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..88f9d3f 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,51 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", name);
+ return -EINVAL;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device provided.\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 994650b..a4f08b5 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,32 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a device to a registered driver.
+ *
+ * @param name
+ * The device name, that refers to a pci device (or some private
+ * way of designating a vdev device). Based on this device name, eal
+ * will identify a driver capable of handling it and pass it to the
+ * driver probing function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a device from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
#define DRIVER_EXPORT_NAME(name, idx) \
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index db8c984..c0bd391 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -166,3 +166,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 16/17] ethdev: convert to eal hotplug
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (14 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 17/17] ethdev: get rid of device type Shreyansh Jain
2016-08-01 15:43 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Jan Viktorin
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 208 +++++++-----------------------------------
1 file changed, 34 insertions(+), 174 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fdeac86..86c9d1a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -216,6 +217,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -347,27 +349,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
@@ -413,34 +394,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t dev_flags;
@@ -465,124 +418,46 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ RTE_LOG(ERR, EAL, "No ports founds for device (%s)\n", name);
+ ret = -1;
+ goto err;
+ }
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
}
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -590,7 +465,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -598,33 +472,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v7 17/17] ethdev: get rid of device type
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (15 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 16/17] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-08-01 10:45 ` Shreyansh Jain
2016-08-01 15:43 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Jan Viktorin
17 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 10:45 UTC (permalink / raw)
To: dev; +Cc: viktorin, thomas.monjalon, David Marchand
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
16 files changed, 16 insertions(+), 52 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f795566..d629ee3 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -666,7 +666,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 203ebe9..8514652 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 2bed4de..b333ad6 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5803,7 +5803,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3658769..ebad7cb 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -617,7 +617,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 93f8730..c0d0e3b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 7a24884..ce49945 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -517,7 +517,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7e213eb..7fbc60e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index a7048c7..5690dcd 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7539cd4..2bb761b 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -714,7 +714,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index daef09b..aadfdc0 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -277,7 +277,7 @@ virtio_user_eth_dev_alloc(const char *name)
struct virtio_hw *hw;
struct virtio_user_dev *dev;
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
return NULL;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 99f6cc8..6b15381 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -654,7 +654,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..0dbc332 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 86c9d1a..cf38f32 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -191,7 +191,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -216,7 +216,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -248,7 +247,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b005c1b..2a697ec 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1603,17 +1603,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1643,7 +1632,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
} __rte_cache_aligned;
struct rte_eth_dev_sriov {
@@ -1756,8 +1744,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros
2016-07-30 8:14 ` Jan Viktorin
@ 2016-08-01 11:00 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-01 11:00 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, thomas.monjalon, david.marchand
Hi Jan,
On Saturday 30 July 2016 01:44 PM, Jan Viktorin wrote:
> On Thu, 28 Jul 2016 15:06:10 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
>> Hi Jan,
>>
>> On Friday 15 July 2016 04:18 PM, Shreyansh jain wrote:
>>> On Thursday 14 July 2016 09:27 PM, Jan Viktorin wrote:
>
> [...]
>
>>>>>>> (drv).name = RTE_STR(nm);
>>>>>
>>>>> That is a miss from my side.
>>>>> I will publish v7 with this. You want this right away or should I wait a little while (more reviews, or any pending additions as per Thomas's notes) before publishing?
>>>>
>>>> Please. The time is almost gone. 18/7/2016 is the release (according
>>>> to the roadmap)... I have to fix it in my patchset, otherwise it
>>>> does not build (after moving the .name from rte_pci_driver to
>>>> rte_driver).
>>>>
>>>
>>> I didn't consider 18/Jul.
>>> Please go ahead. I will continue to send v7 _without_ the above change so that your patchset doesn't break. This way you will not get blocked because of me.
>>>
>>
>> Now that we have already skipped the 16.07, I will fix this in my code and release an updated version as soon as 16.07 is officially available. Is that OK?
>
> Sure :). The thing is that during August-September, I've got significantly
> less time for this then in June-July :/. That's why I was trying to fit in
> the 16.07.
Well, then lets try and get things out for review as soon as we can.
I have sent across v7 of rte_driver set.
Unfortunately, I forgot to add your sign-off. If the set works for you, can you bulk ack?
>
>>
>> Also, I have fixed most review comments except [1]. I am still not sure of the impact of this change. So, I will publish the v7 without this and then probably a v8 in case this change has any impact.
>
> I have no idea about this. Hopefully, it's not a very serious thing.
>
>> That way we can have your patchset not blocked because of this series.
>
> Thank you!
>
>>
>> [1] http://dpdk.org/ml/archives/dev/2016-July/044004.html
>
>>
>> [...]
>>
>>
>> -
>> Shreyansh
>
>
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
` (16 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 17/17] ethdev: get rid of device type Shreyansh Jain
@ 2016-08-01 15:43 ` Jan Viktorin
17 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-08-01 15:43 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, thomas.monjalon
Thank you. Hope to find some time this week to do my part.
Jan
On Mon, 1 Aug 2016 16:15:15 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> * Original patch series is from David Marchand [1], [2].
> * Link with patch series [4] from Jan Viktorin for a more complete picture
> of proposed EAL device heirarchy changes.
> * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
> removed [7].
>
> David created the original patchset based on the discussions on list [3].
> Being a large piece of work, this patchset introduces first level of changes
> for generalizing the driver-device relationship for supporting hotplug.
>
> Overview of this work as per David [3], as well as notes from Thomas [9] &
> Jan:
> - pdev -> PCI registeration using helpers (introduced in this series)
> - removal of eth/crypto driver registeration callbacks. These are now handled
> by PCI registeration helpers (this patch)
> - rte_device=>pci/vdev device heirarchy (by this [4] series)
> - removal of PMD_PDEV type (this patch) and PMD_VDEV (by this [4] series)
> - Support for hotplugging
>
> This patchset is based on master (b0a1419)
>
> [1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
> [2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
> [3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> [4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
> [5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
> [6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
> [7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
> [8] http://dpdk.org/ml/archives/dev/2016-July/044004.html
> [9] http://dpdk.org/ml/archives/dev/2016-July/044086.html
>
> Changes since v6:
> - rebase over 16.07 (b0a1419)
> - DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
> - review comments regarding missing information in log messages
> - new API additions to 16.11 map objects
> - review comment in [5] and [7] are not included in this series.
>
> Changes since v5:
> - Rebase over master (11c5e45d8)
> - Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in sync
> with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
> - Modifications to bnxt and thunderx driver PMD registeration files for
> using the simplified PCI device registeration helper macro
>
> Changes since v4:
> - Fix compilation issue after rebase on HEAD (913154e) in previous series
> - Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
> were removed by previous patchset. These are being used by pdump library
>
> Changes since v3:
> - rebase over HEAD (913154e)
> - Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
> - modify qede driver to use RTE_EAL_PCI_REGISTER
> - Argument check in hotplug functions
>
> Changes since v2:
> - rebase over HEAD (d76c193)
> - Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
>
> Changes since v1:
> - rebased on HEAD, new drivers should be okay
> - patches have been split into smaller pieces
> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> - device type has been removed from ethdev, as it was used only by hotplug
> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> dropped for now, we can do this once vdev drivers have been converted
>
> David Marchand, Shreyansh Jain (17):
> pci: no need for dynamic tailq init
> crypto: no need for a crypto pmd type
> drivers: align pci driver definitions
> eal: remove duplicate function declaration
> eal: introduce init macros
> crypto: export init/uninit common wrappers for pci drivers
> ethdev: export init/uninit common wrappers for pci drivers
> drivers: convert all pdev drivers as pci drivers
> crypto: get rid of crypto driver register callback
> ethdev: get rid of eth driver register callback
> eal/linux: move back interrupt thread init before setting affinity
> pci: add a helper for device name
> pci: add a helper to update a device
> ethdev: do not scan all pci devices on attach
> eal: add hotplug operations for pci and vdev
> ethdev: convert to eal hotplug
> ethdev: get rid of device type
>
> app/test/virtual_pmd.c | 2 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 34 +--
> drivers/net/bnxt/bnxt_ethdev.c | 16 +-
> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 24 +--
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/e1000/em_ethdev.c | 16 +-
> drivers/net/e1000/igb_ethdev.c | 39 +---
> drivers/net/ena/ena_ethdev.c | 19 +-
> drivers/net/enic/enic_ethdev.c | 23 +-
> drivers/net/fm10k/fm10k_ethdev.c | 23 +-
> drivers/net/i40e/i40e_ethdev.c | 24 +--
> drivers/net/i40e/i40e_ethdev_vf.c | 25 +--
> drivers/net/ixgbe/ixgbe_ethdev.c | 46 +---
> drivers/net/mlx4/mlx4.c | 17 +-
> drivers/net/mlx5/mlx5.c | 16 +-
> drivers/net/mpipe/mpipe_tilegx.c | 2 +-
> drivers/net/nfp/nfp_net.c | 23 +-
> drivers/net/null/rte_eth_null.c | 2 +-
> drivers/net/pcap/rte_eth_pcap.c | 2 +-
> drivers/net/qede/qede_ethdev.c | 40 +---
> drivers/net/ring/rte_eth_ring.c | 2 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 24 +--
> drivers/net/thunderx/nicvf_ethdev.c | 20 +-
> drivers/net/vhost/rte_eth_vhost.c | 2 +-
> drivers/net/virtio/virtio_ethdev.c | 25 +--
> drivers/net/virtio/virtio_user_ethdev.c | 2 +-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +-
> drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
> examples/ip_pipeline/init.c | 22 --
> lib/librte_cryptodev/rte_cryptodev.c | 67 ++----
> lib/librte_cryptodev/rte_cryptodev.h | 2 -
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
> lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
> lib/librte_eal/bsdapp/eal/eal_pci.c | 52 ++++-
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
> lib/librte_eal/common/eal_common_dev.c | 48 +++++
> lib/librte_eal/common/eal_common_pci.c | 17 +-
> lib/librte_eal/common/eal_private.h | 20 +-
> lib/librte_eal/common/include/rte_dev.h | 30 ++-
> lib/librte_eal/common/include/rte_eal.h | 3 +
> lib/librte_eal/common/include/rte_pci.h | 35 +++
> lib/librte_eal/common/include/rte_tailq.h | 4 +-
> lib/librte_eal/linuxapp/eal/eal.c | 7 +-
> lib/librte_eal/linuxapp/eal/eal_pci.c | 16 +-
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +
> lib/librte_ether/rte_ethdev.c | 272 ++++--------------------
> lib/librte_ether/rte_ethdev.h | 40 ++--
> lib/librte_ether/rte_ether_version.map | 9 +
> 51 files changed, 415 insertions(+), 813 deletions(-)
>
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (20 preceding siblings ...)
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of Shreyansh Jain
` (26 more replies)
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (2 subsequent siblings)
24 siblings, 27 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Based on master (e22856313fff2)
Background:
===========
It includes two different patch-sets floated on ML earlier:
* Original patch series is from David Marchand [1], [2].
`- This focused mainly on PCI (PDEV) part
`- v7 of this was posted by me [8] in August/2016
* Patch series [4] from Jan Viktorin
`- This focused on VDEV and rte_device integration
Introduction:
=============
This patch series introduces a generic device model, moving away from PCI
centric code layout. Key change is to introduce rte_driver/rte_device
structures at the top level which are inherited by
rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
future),...}.
Key motivation for this series is to move away from PCI centric design of
EAL to a more hierarchical device model - pivoted around a generic driver
and device. Each specific driver and device can inherit the common
properties of the generic set and build upon it through driver/device
specific functions.
Earlier, the EAL device initialization model was:
(Refer: [3])
--
Constructor:
|- PMD_DRIVER_REGISTER(rte_driver)
`- insert into dev_driver_list, rte_driver object
rte_eal_init():
|- rte_eal_pci_init()
| `- scan and fill pci_device_list from sysfs
|
|- rte_eal_dev_init()
| `- For each rte_driver in dev_driver_list
| `- call the rte_driver->init() function
| |- PMDs designed to call rte_eth_driver_register(eth_driver)
| |- eth_driver have rte_pci_driver embedded in them
| `- rte_eth_driver_register installs the
| rte_pci_driver->devinit/devuninit callbacks.
|
|- rte_eal_pci_probe()
| |- For each device detected, dev_driver_list is parsed and matching is
| | done.
| |- For each matching device, the rte_pci_driver->devinit() is called.
| |- Default map is to rte_eth_dev_init() which in turn creates a
| | new ethernet device (eth_dev)
| | `- eth_drv->eth_dev_init() is called which is implemented by
`--| individual PMD drivers.
--
The structure of driver looks something like:
+------------+ ._____.
| rte_driver <-----| PMD |___
| .init | `-----` \
+----.-------+ | \
`-. | What PMD actually is
\ | |
+----------v----+ |
| eth_driver | |
| .eth_dev_init | |
+----.----------+ |
`-. |
\ |
+------------v---+
| rte_pci_driver |
| .pci_devinit |
+----------------+
and all devices are part of a following linked lists:
- dev_driver_list for all rte_drivers
- pci_device_list for all devices, whether PCI or VDEV
>From the above:
* a PMD initializes a rte_driver, eth_driver even though actually it is a
pci_driver
* initialization routines are passed from rte_driver->pci_driver->eth_driver
even though they should ideally be rte_eal_init()->rte_pci_driver()
* For a single driver/device type model, this is not necessarily a
functional issue - but more of a design language.
* But, when number of driver/device type increase, this would create problem
in how driver<=>device links are represented.
Proposed Architecture:
======================
A nice representation has already been created by David in [3]. Copying that
here:
+------------------+ +-------------------------------+
| | | |
| rte_pci_device | | rte_pci_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
+-------------------------------+
- for ethdev on top of vdev devices
+------------------+ +-------------------------------+
| | | |
| drv specific | | rte_vdev_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
| int priv_size |
| |
+-------------------------------+
Representing from above, it would be:
+--------------+
| rte_driver |
| name |
| <Future> |
+------^-------+ pci_driver_list
| / vdev_driver_list
`---. <<Inherits>> / /
|\____________/_______ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_driver | | rte_vdev_driver |
| pci_devinit() | | vdev_devinit() |
| pci_devuninit()| | vdev_devuninit()|
| <more> | | <more> |
+-----------------+ +------------------+
+--------------+
| rte_device |
| name |
| <Future> |
+------^-------+ pci_device_list
| / xxx_device_list
`---. <<Inherits>> / /
|\____________/________ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_device | | rte_xxx_device |
| <dev data> | | <dev data> |
| <flags/intr> | | <flags/intr> |
| <more> | | <more> |
+-----------------+ +------------------+
* Each driver type has its own structure which derives from the generic
rte_driver structure.
\- Each driver type maintains its own list, at the same time, rte_driver
list also exists - so that *all* drivers can be looped on, if required.
* Each device, associated with one or more drivers, has its own type
derived from rte_device
\- Each device _may_ maintain its own list (for example, in current
implementation, vdev is not maintaining it).
==Introducing a new device/driver type implies==
- creating their own rte_<xxx>.h file which contains the device/driver
definitions.
- defining the DRIVER_REGISTER_XXX helpers
==Hotplugging Support==
- devices should be able to support attach/detach operations.
- Earlier these functions were part of ethdev. They have been moved to eal
to be more generic.
About the Patches:
==================
There are a large number of patches for this - primarily because the changes
are quite varied and keeping them logically separate yet compilable is
important. Most of the patches are small and those which are large touch the
drivers (PMDs) to accommodate the structure changes:
- Patches 0001~0003 are for introducing the container_of function (so that
rte_device can be obtained from rte_pci_device, for example), and
removing unused code.
- Patches 0004~0007 just perform the ground work for enabling change from
rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
- In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
including cryptodev, which is eventually generalized with PCI)
- Patch 0009~0010 merge the crypto and pci functions for registration and
naming.
- Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
complete bus and has been generalized into EAl from ethdev.
- Patches 0015 introduces vdev init/uninit into separate C units and
enables its compilation. Patch 0016~0017 build on it and remove the
remaining legacy support for vdev/pdev distinctions.
- Patches 0018~0022 enable the vdev drivers to register using the
DRIVER_REGISTER_* operations, and remove their rte_driver->init()
- Patch 0023 enables the rte_driver registration into a common driver
linked list.
- Patches 0024~0025 introduce the rte_device, a generalization of
rte_xxx_device, and associated operation of creating rte_device linked
list. It also enables the drivers to use rte_device.name/numa_node
members rather than rte_xxx_device specific members.
Notes:
======
* Some sign-off were already provided by Jan on the original v5; But, as a
large number of merges have been made, I am leaving those out just in case
it is not sync with initial understanding.
* This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
removed [7].
References:
===========
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
[4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
[5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
[6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
[7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
[8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
Changes since v7:
- Rebase over master (e22856313fff2)
- Merge the patch series by David [1][2] and Jan [4] into a single set
hereafter, PCI and VDEV, both are re-factored for rte_device/driver model
Changes since v6:
- rebase over 16.07 (b0a1419)
- DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
- review comments regarding missing information in log messages
- new API additions to 16.11 map objects
- review comment in [5] and [7] are not included in this series.
Changes since v5:
- Rebase over master (11c5e45d8)
- Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in
sync
with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
- Modifications to bnxt and thunderx driver PMD registration files for
using the simplified PCI device registration helper macro
Changes since v4:
- Fix compilation issue after rebase on HEAD (913154e) in previous series
- Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
were removed by previous patchset. These are being used by pdump library
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
Shreyansh Jain (25):
eal: define macro container_of
eal: remove duplicate function declaration
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: introduce init macros
driver: init/uninit common wrappers for PCI drivers
drivers: convert all pdev drivers as pci drivers
driver: Remove driver register callbacks for crypto/net
eal/pci: Helpers for device name parsing/update
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
eal: extract vdev infra
eal: Remove PDEV/VDEV unused code
drivers: convert PMD_VDEV drivers to use rte_vdev_driver
eal: move init/uninit to rte_vdev_driver
eal: remove PMD_DRIVER_REGISTER and unused pmd_types
eal: rte_pci.h includes rte_dev.h
eal: rename and move rte_pci_resource
eal/pci: inherit rte_driver by rte_pci_driver
eal: call rte_eal_driver_register
eal: introduce rte_device
eal/pci: Create rte_device list and fallback on its members
app/test/test_pci.c | 10 +-
app/test/virtual_pmd.c | 8 +-
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
drivers/crypto/null/null_crypto_pmd.c | 7 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
drivers/net/af_packet/rte_eth_af_packet.c | 11 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
drivers/net/bnxt/bnxt_ethdev.c | 17 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 9 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/cxgbe/sge.c | 7 +-
drivers/net/e1000/em_ethdev.c | 17 +-
drivers/net/e1000/igb_ethdev.c | 41 +---
drivers/net/ena/ena_ethdev.c | 20 +-
drivers/net/enic/enic_ethdev.c | 24 +-
drivers/net/fm10k/fm10k_ethdev.c | 30 +--
drivers/net/i40e/i40e_ethdev.c | 31 +--
drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
drivers/net/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
drivers/net/mlx4/mlx4.c | 21 +-
drivers/net/mlx5/mlx5.c | 20 +-
drivers/net/mpipe/mpipe_tilegx.c | 18 +-
drivers/net/nfp/nfp_net.c | 28 +--
drivers/net/null/rte_eth_null.c | 11 +-
drivers/net/pcap/rte_eth_pcap.c | 11 +-
drivers/net/qede/qede_ethdev.c | 42 +---
drivers/net/ring/rte_eth_ring.c | 11 +-
drivers/net/szedata2/rte_eth_szedata2.c | 28 +--
drivers/net/thunderx/nicvf_ethdev.c | 21 +-
drivers/net/vhost/rte_eth_vhost.c | 11 +-
drivers/net/virtio/virtio_ethdev.c | 28 +--
drivers/net/virtio/virtio_pci.c | 5 +-
drivers/net/virtio/virtio_user_ethdev.c | 10 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 9 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 95 ++++----
lib/librte_eal/common/eal_common_pci.c | 34 ++-
lib/librte_eal/common/eal_common_vdev.c | 106 +++++++++
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_common.h | 16 ++
lib/librte_eal/common/include/rte_dev.h | 77 +++++--
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 53 +++--
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/common/include/rte_vdev.h | 96 ++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
lib/librte_eal/linuxapp/eal/eal.c | 1 +
lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
lib/librte_ether/rte_ethdev.c | 280 +++++-------------------
lib/librte_ether/rte_ethdev.h | 40 ++--
lib/librte_ether/rte_ether_version.map | 9 +
69 files changed, 784 insertions(+), 1020 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-29 16:43 ` Ferruh Yigit
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 02/25] eal: remove duplicate function declaration Shreyansh Jain
` (25 subsequent siblings)
26 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 332f2a4..a9b6792 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -322,6 +322,22 @@ rte_bsf32(uint32_t v)
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#endif
+/**
+ * Return pointer to the wrapping struct instance.
+ * Example:
+ *
+ * struct wrapper {
+ * ...
+ * struct child c;
+ * ...
+ * };
+ *
+ * struct child *x = obtain(...);
+ * struct wrapper *w = container_of(x, struct wrapper, c);
+ */
+#define container_of(p, type, member) \
+ ((type *) (((char *) (p)) - offsetof(type, member)))
+
#define _RTE_STR(x) #x
/** Take a macro value and get a string version of it */
#define RTE_STR(x) _RTE_STR(x)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 02/25] eal: remove duplicate function declaration
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 03/25] pci: no need for dynamic tailq init Shreyansh Jain
` (24 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 19f7535..ca1aec6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -237,13 +237,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d5b81a3..9412983 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 03/25] pci: no need for dynamic tailq init
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 02/25] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 04/25] crypto: no need for a crypto pmd type Shreyansh Jain
` (23 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 374b68f..a73cbb0 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 7248c38..6a0f6ac 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index cd9de7c..f0215ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 04/25] crypto: no need for a crypto pmd type
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (2 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 03/25] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 05/25] drivers: align pci driver definitions Shreyansh Jain
` (22 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index fc4123b..6434894 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -319,7 +319,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -358,7 +358,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -407,7 +406,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -449,8 +448,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index affbdec..13f46e4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -613,8 +613,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 05/25] drivers: align pci driver definitions
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (3 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 04/25] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 06/25] eal: introduce init macros Shreyansh Jain
` (21 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 82ab047..1e9e0ba 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,7 +113,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
},
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ac0803d..9418d50 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1685,7 +1685,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 82e3e4e..99a258a 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2459,7 +2459,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 06/25] eal: introduce init macros
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (4 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 05/25] drivers: align pci driver definitions Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 07/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
` (20 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 10 ++++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 95789f9..994650b 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void devinitfn_ ##drv(void);\
-void __attribute__((constructor, used)) devinitfn_ ##drv(void)\
+RTE_INIT(devinitfn_ ##drv);\
+static void devinitfn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..cf673e4 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,16 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registeration from driver (eth, crypto) instance */
+#define DRIVER_REGISTER_PCI(nm, pci_drv) \
+RTE_INIT(pciinitfn_ ##nm); \
+static void pciinitfn_ ##nm(void) \
+{ \
+ (pci_drv).name = RTE_STR(nm);\
+ rte_eal_pci_register(&pci_drv); \
+}\
+DRIVER_EXPORT_NAME(nm, __COUNTER__)
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index cc3c0f1..cc386e4 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 07/25] driver: init/uninit common wrappers for PCI drivers
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (5 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 06/25] eal: introduce init macros Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 08/25] drivers: convert all pdev drivers as pci drivers Shreyansh Jain
` (19 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
crypto and ethdev drivers aligned to PCI probe/remove. Existing handlers for
init/uninit can be easily reused for this.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 7 +++++++
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 9 +++++++++
6 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 6434894..b1e82b6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -429,9 +429,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -490,8 +490,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -539,15 +539,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a08fd20..1fc0d57 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -39,3 +39,10 @@ DPDK_16.07 {
rte_cryptodev_parse_vdev_init_params;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+} DPDK_16.07;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f62a9ec..8825219 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b0fe033..37d78bf 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4368,6 +4368,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 45ddf44..17e7448 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -138,4 +138,13 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 08/25] drivers: convert all pdev drivers as pci drivers
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (6 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 07/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net Shreyansh Jain
` (18 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++---------
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +++++-------------------
drivers/net/bnxt/bnxt_ethdev.c | 16 +++---------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++---------
drivers/net/e1000/igb_ethdev.c | 39 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 17 +++---------
drivers/net/enic/enic_ethdev.c | 23 +++--------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++--------------
drivers/net/i40e/i40e_ethdev.c | 24 +++--------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +++++----------------------------
drivers/net/mlx4/mlx4.c | 15 +++--------
drivers/net/mlx5/mlx5.c | 14 +++-------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/qede/qede_ethdev.c | 40 ++++++----------------------
drivers/net/szedata2/rte_eth_szedata2.c | 24 +++--------------
drivers/net/thunderx/nicvf_ethdev.c | 20 +++-----------
drivers/net/virtio/virtio_ethdev.c | 25 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++--------------
20 files changed, 78 insertions(+), 407 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1e9e0ba..b94af59 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,23 +116,13 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv, CRYPTODEV_NAME_QAT_SYM_PMD);
+DRIVER_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f3ab355..214b655 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -621,6 +621,8 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
@@ -634,38 +636,14 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver, bnx2x);
+DRIVER_REGISTER_PCI(bnx2x, rte_bnx2x_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf);
+DRIVER_REGISTER_PCI(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3795fac..28eb8b9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1048,23 +1048,13 @@ static struct eth_driver bnxt_rte_pmd = {
.name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = bnxt_dev_init,
.eth_dev_uninit = bnxt_dev_uninit,
.dev_private_size = sizeof(struct bnxt),
};
-static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
-{
- RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
- rte_eth_driver_register(&bnxt_rte_pmd);
- return 0;
-}
-
-static struct rte_driver bnxt_pmd_drv = {
- .type = PMD_PDEV,
- .init = bnxt_rte_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt);
+DRIVER_REGISTER_PCI(bnxt, bnxt_rte_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 9208a61..431b06d 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1042,30 +1042,12 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4);
+DRIVER_REGISTER_PCI(cxgb4, rte_cxgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(cxgb4, cxgb4_pci_tbl);
-
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index ad104ed..1281c8b 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -395,6 +395,8 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
@@ -402,13 +404,6 @@ static struct eth_driver rte_em_pmd = {
};
static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
-
-static int
em_hw_init(struct e1000_hw *hw)
{
int diag;
@@ -1799,10 +1794,5 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv, em);
+DRIVER_REGISTER_PCI(em, rte_em_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(em, pci_id_em_map);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 4e9e6a3..395477e 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1082,6 +1082,8 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
@@ -1096,19 +1098,14 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
-
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
{
@@ -1120,20 +1117,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -5084,16 +5067,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5255,7 +5228,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-PMD_REGISTER_DRIVER(pmd_igb_drv, igb);
+DRIVER_REGISTER_PCI(igb, rte_igb_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf);
+DRIVER_REGISTER_PCI(igbvf, rte_igbvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igbvf, pci_id_igbvf_map);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 9418d50..ee906d4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1689,23 +1689,12 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv, ena);
+DRIVER_REGISTER_PCI(ena, rte_ena_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ena, pci_id_ena_map);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 47b07c9..59812d0 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -616,29 +616,12 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver, enic);
+DRIVER_REGISTER_PCI(enic, rte_enic_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(enic, pci_id_enic_map);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 01f4a72..26cdc10 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3059,30 +3059,13 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver, fm10k);
+DRIVER_REGISTER_PCI(fm10k, rte_pmd_fm10k.pci_drv);
DRIVER_REGISTER_PCI_TABLE(fm10k, pci_id_fm10k_map);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0aeb70..dacaaea 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -667,6 +667,8 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
@@ -701,27 +703,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver, i40e);
+DRIVER_REGISTER_PCI(i40e, rte_i40e_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40e, pci_id_i40e_map);
/*
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a616ae0..4a745f9 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1557,34 +1557,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver, i40evf);
+DRIVER_REGISTER_PCI(i40evf, rte_i40evf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map);
static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb618ef..d2f46bc 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1566,6 +1566,8 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1580,40 +1582,14 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
-
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
@@ -7409,17 +7385,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
ixgbevf_dev_interrupt_action(dev);
}
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver, ixgbe);
+DRIVER_REGISTER_PCI(ixgbe, rte_ixgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbe, pci_id_ixgbe_map);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver, ixgbevf);
+DRIVER_REGISTER_PCI(ixgbevf, rte_ixgbevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 304c846..2bed4de 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5922,12 +5922,10 @@ static struct eth_driver mlx4_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5938,13 +5936,6 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver, mlx4);
DRIVER_REGISTER_PCI_TABLE(mlx4, mlx4_pci_id_map);
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index d96a9af..3658769 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -739,11 +739,10 @@ static struct eth_driver mlx5_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -753,13 +752,6 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver, mlx5);
DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99a258a..cbaf219 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2464,29 +2464,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver, nfp);
+DRIVER_REGISTER_PCI(nfp, rte_nfp_net_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(nfp, pci_id_nfp_net_map);
/*
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 82e44b8..a92dd3b 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1482,7 +1482,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1494,41 +1496,15 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver, qede);
+DRIVER_REGISTER_PCI(qede, rte_qede_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qede, pci_id_qede_map);
-PMD_REGISTER_DRIVER(rte_qedevf_driver, qedevf);
+DRIVER_REGISTER_PCI(qedevf, rte_qedevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qedevf, pci_id_qedevf_map);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 483d789..6d21024 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,13 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME);
+DRIVER_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv);
DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4f875c0..ad7d607 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1762,26 +1762,12 @@ static struct eth_driver rte_nicvf_pmd = {
.name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nicvf_eth_dev_init,
.dev_private_size = sizeof(struct nicvf),
};
-static int
-rte_nicvf_pmd_init(const char *name __rte_unused, const char *para __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_thunderx nicvf version %s",
- THUNDERX_NICVF_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nicvf_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nicvf_driver = {
- .type = PMD_PDEV,
- .init = rte_nicvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nicvf_driver, thunderx_nicvf);
+DRIVER_REGISTER_PCI(thunderx_nicvf, rte_nicvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(thunderx_nicvf, pci_id_nicvf_map);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 07d6449..5453709 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1307,29 +1307,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1563,10 +1558,4 @@ __rte_unused uint8_t is_rx)
return 0;
}
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver, virtio_net);
DRIVER_REGISTER_PCI_TABLE(virtio_net, pci_id_virtio_map);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 5874215..d732979 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -331,26 +331,14 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
-
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
{
@@ -948,10 +936,5 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver, vmxnet3);
+DRIVER_REGISTER_PCI(vmxnet3, rte_vmxnet3_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(vmxnet3, pci_id_vmxnet3_map);
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (7 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 08/25] drivers: convert all pdev drivers as pci drivers Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-29 17:20 ` Ferruh Yigit
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update Shreyansh Jain
` (17 subsequent siblings)
26 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Now that all pdev are pci drivers, we don't need to register crypto and ethdev
drivers through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
lib/librte_ether/rte_ethdev.c | 22 -------------------
lib/librte_ether/rte_ethdev.h | 12 -----------
5 files changed, 87 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index b1e82b6..2a3b649 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -533,28 +533,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 1fc0d57..9627ac4 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 8825219..3bccf20 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 37d78bf..b005c1b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1871,18 +1871,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (8 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-30 16:34 ` Pattan, Reshma
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 11/25] ethdev: do not scan all pci devices on attach Shreyansh Jain
` (16 subsequent siblings)
26 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
- Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common method,
can be used across crypto/net PCI PMDs.
- Remove crypto specific routine and fallback to common name function.
- Introduce a eal private Update function for PCI device naming.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 +++---------------
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 26 +++++++++++++++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
lib/librte_ether/rte_ethdev.c | 24 +++-------------
6 files changed, 109 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 2a3b649..c81e366 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -444,9 +427,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -501,9 +483,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index a73cbb0..1d91c78 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index ca1aec6..431d6c2 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -130,6 +130,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index cf673e4..8227232 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,30 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
+ * BDF helpers.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ * @return
+ * 0 on success, negative on error.
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f0215ee..62da4d4 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 3bccf20..a1bb043 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 11/25] ethdev: do not scan all pci devices on attach
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (9 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 12/25] eal: add hotplug operations for pci and vdev Shreyansh Jain
` (15 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6a0f6ac..da0038f 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -341,6 +341,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -353,9 +358,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a1bb043..fdeac86 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -469,9 +469,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 12/25] eal: add hotplug operations for pci and vdev
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (10 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 11/25] ethdev: do not scan all pci devices on attach Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 13/25] ethdev: convert to eal hotplug Shreyansh Jain
` (14 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Hotplug invocations, which deals with devices, should come from the layer that
already handles them, i.e. EAL.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 ++++
lib/librte_eal/common/eal_common_dev.c | 48 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 26 ++++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 ++++
4 files changed, 88 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index a335e04..7b3d409 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -162,3 +162,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..88f9d3f 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,51 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", name);
+ return -EINVAL;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device provided.\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 994650b..a4f08b5 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,32 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a device to a registered driver.
+ *
+ * @param name
+ * The device name, that refers to a pci device (or some private
+ * way of designating a vdev device). Based on this device name, eal
+ * will identify a driver capable of handling it and pass it to the
+ * driver probing function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a device from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
#define DRIVER_EXPORT_NAME(name, idx) \
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index db8c984..c0bd391 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -166,3 +166,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 13/25] ethdev: convert to eal hotplug
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (11 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 12/25] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 14/25] ethdev: get rid of device type Shreyansh Jain
` (13 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 208 +++++++-----------------------------------
1 file changed, 34 insertions(+), 174 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fdeac86..86c9d1a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -216,6 +217,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -347,27 +349,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
@@ -413,34 +394,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t dev_flags;
@@ -465,124 +418,46 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ RTE_LOG(ERR, EAL, "No ports founds for device (%s)\n", name);
+ ret = -1;
+ goto err;
+ }
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
}
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -590,7 +465,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -598,33 +472,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 14/25] ethdev: get rid of device type
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (12 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 13/25] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 15/25] eal: extract vdev infra Shreyansh Jain
` (12 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
16 files changed, 16 insertions(+), 52 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f795566..d629ee3 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -666,7 +666,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 203ebe9..8514652 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 2bed4de..b333ad6 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5803,7 +5803,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3658769..ebad7cb 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -617,7 +617,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 93f8730..c0d0e3b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 7a24884..ce49945 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -517,7 +517,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7e213eb..7fbc60e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index a7048c7..5690dcd 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7539cd4..2bb761b 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -714,7 +714,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index daef09b..aadfdc0 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -277,7 +277,7 @@ virtio_user_eth_dev_alloc(const char *name)
struct virtio_hw *hw;
struct virtio_user_dev *dev;
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
return NULL;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 99f6cc8..6b15381 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -654,7 +654,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..0dbc332 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 86c9d1a..cf38f32 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -191,7 +191,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -216,7 +216,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -248,7 +247,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b005c1b..2a697ec 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1603,17 +1603,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1643,7 +1632,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
} __rte_cache_aligned;
struct rte_eth_dev_sriov {
@@ -1756,8 +1744,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 15/25] eal: extract vdev infra
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (13 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 14/25] ethdev: get rid of device type Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 16/25] eal: Remove PDEV/VDEV unused code Shreyansh Jain
` (11 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Move all PMD_VDEV-specific code into a separate module and header
file to not polute the generic code anymore. There is now a list
of virtual devices available.
The rte_vdev_driver integrates the original rte_driver inside
(C inheritance). The rte_driver will be however change in the
future to serve as a common base for all other types of drivers.
The existing PMDs (PMD_VDEV) are to be modified later (there is
no change for them at the moment).
Unlike DRIVER_REGISTER_PCI, DRIVER_EXPORT_NAME is not being called on vdev
registration.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 54 +--------------
lib/librte_eal/common/eal_common_vdev.c | 110 +++++++++++++++++++++++++++++++
lib/librte_eal/common/include/rte_vdev.h | 84 +++++++++++++++++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
6 files changed, 198 insertions(+), 54 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 7a0fea5..5a3fc1d 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -69,6 +69,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index bb9810d..dfd64aa 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -38,7 +38,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_dev.h
+INC += rte_hexdump.h rte_devargs.h rte_dev.h rte_vdev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 88f9d3f..555e0d9 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -64,32 +64,6 @@ rte_eal_driver_unregister(struct rte_driver *driver)
}
int
-rte_eal_vdev_init(const char *name, const char *args)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->init(name, args);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
-int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
@@ -98,7 +72,7 @@ rte_eal_dev_init(void)
/*
* Note that the dev_driver_list is populated here
* from calls made to rte_eal_driver_register from constructor functions
- * embedded into PMD modules via the PMD_REGISTER_DRIVER macro
+ * embedded into PMD modules via the DRIVER_REGISTER_VDEV macro
*/
/* call the init function for each virtual device */
@@ -125,32 +99,6 @@ rte_eal_dev_init(void)
return 0;
}
-int
-rte_eal_vdev_uninit(const char *name)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->uninit(name);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
int rte_eal_dev_attach(const char *name, const char *devargs)
{
struct rte_pci_addr addr;
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
new file mode 100644
index 0000000..d225e86
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -0,0 +1,110 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/queue.h>
+
+#include <rte_vdev.h>
+#include <rte_common.h>
+
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_eal_vdrv_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+int
+rte_eal_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
+ return driver->driver.init(name, args);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
+
+int
+rte_eal_vdev_uninit(const char *name)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
+ return driver->driver.uninit(name);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
new file mode 100644
index 0000000..9a2e2d5
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -0,0 +1,84 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_eal_vdrv_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver);
+
+#define DRIVER_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ rte_eal_vdrv_register(&vdrv);\
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 193957f..4e206f0 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -77,6 +77,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 16/25] eal: Remove PDEV/VDEV unused code
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (14 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 15/25] eal: extract vdev infra Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
` (10 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
- Remove checks for VDEV from rte_eal_vdev_(init/uninint) as all devices are
inherently virtual here.
- PDEVs perform PCI specific inits - rte_eal_dev_init() need not call
rte_driver->init();
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 8 --------
lib/librte_eal/common/eal_common_vdev.c | 6 ------
2 files changed, 14 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 555e0d9..afa33fa 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -67,7 +67,6 @@ int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
- struct rte_driver *driver;
/*
* Note that the dev_driver_list is populated here
@@ -89,13 +88,6 @@ rte_eal_dev_init(void)
}
}
- /* Once the vdevs are initalized, start calling all the pdev drivers */
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_PDEV)
- continue;
- /* PDEV drivers don't get passed any parameters */
- driver->init(NULL, NULL);
- }
return 0;
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index d225e86..e1ca8e0 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -66,9 +66,6 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -92,9 +89,6 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (15 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 16/25] eal: Remove PDEV/VDEV unused code Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-29 16:57 ` Ferruh Yigit
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 18/25] eal: move init/uninit to rte_vdev_driver Shreyansh Jain
` (9 subsequent siblings)
26 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
All PMD_VDEV drivers can now use rte_vdev_driver instead of the
rte_driver (which is embedded in the rte_vdev_driver).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 14 ++++++++------
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 14 ++++++++------
drivers/crypto/kasumi/rte_kasumi_pmd.c | 14 ++++++++------
drivers/crypto/null/null_crypto_pmd.c | 14 ++++++++------
drivers/crypto/snow3g/rte_snow3g_pmd.c | 14 ++++++++------
drivers/net/af_packet/rte_eth_af_packet.c | 14 ++++++++------
drivers/net/bonding/rte_eth_bond_pmd.c | 14 ++++++++------
drivers/net/mpipe/mpipe_tilegx.c | 22 +++++++++++++---------
drivers/net/null/rte_eth_null.c | 14 ++++++++------
drivers/net/pcap/rte_eth_pcap.c | 14 ++++++++------
drivers/net/ring/rte_eth_ring.c | 14 ++++++++------
drivers/net/vhost/rte_eth_vhost.c | 14 ++++++++------
drivers/net/virtio/virtio_user_ethdev.c | 13 ++++++++-----
drivers/net/xenvirt/rte_eth_xenvirt.c | 12 +++++++-----
14 files changed, 116 insertions(+), 85 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dc0b033..e1d5e37 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -37,7 +37,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -514,13 +514,15 @@ aesni_gcm_uninit(const char *name)
return 0;
}
-static struct rte_driver aesni_gcm_pmd_drv = {
- .type = PMD_VDEV,
- .init = aesni_gcm_init,
- .uninit = aesni_gcm_uninit
+static struct rte_vdev_driver aesni_gcm_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = aesni_gcm_init,
+ .uninit = aesni_gcm_uninit
+ },
};
-PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv, CRYPTODEV_NAME_AESNI_GCM_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b2d0c8c..2ba5389 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -714,13 +714,15 @@ cryptodev_aesni_mb_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_aesni_mb_init,
- .uninit = cryptodev_aesni_mb_uninit
+static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_aesni_mb_init,
+ .uninit = cryptodev_aesni_mb_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drv, CRYPTODEV_NAME_AESNI_MB_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_MB_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 4e21743..a30e776 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -650,13 +650,15 @@ cryptodev_kasumi_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_kasumi_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_kasumi_init,
- .uninit = cryptodev_kasumi_uninit
+static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_kasumi_init,
+ .uninit = cryptodev_kasumi_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv, CRYPTODEV_NAME_KASUMI_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 909b04f..8ab34de 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,7 @@
#include <rte_common.h>
#include <rte_config.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include "null_crypto_pmd_private.h"
@@ -268,13 +268,15 @@ cryptodev_null_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_null_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_null_init,
- .uninit = cryptodev_null_uninit
+static struct rte_vdev_driver cryptodev_null_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_null_init,
+ .uninit = cryptodev_null_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv, CRYPTODEV_NAME_NULL_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 87cd070..8b356a3 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -638,13 +638,15 @@ cryptodev_snow3g_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_snow3g_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_snow3g_init,
- .uninit = cryptodev_snow3g_uninit
+static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_snow3g_init,
+ .uninit = cryptodev_snow3g_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv, CRYPTODEV_NAME_SNOW3G_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, cryptodev_snow3g_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SNOW3G_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index d629ee3..95aa573 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -40,7 +40,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
@@ -889,13 +889,15 @@ rte_pmd_af_packet_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_af_packet_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_af_packet_devinit,
- .uninit = rte_pmd_af_packet_devuninit,
+static struct rte_vdev_driver pmd_af_packet_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_af_packet_devinit,
+ .uninit = rte_pmd_af_packet_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_af_packet_drv, eth_af_packet);
+DRIVER_REGISTER_VDEV(eth_af_packet, pmd_af_packet_drv);
DRIVER_REGISTER_PARAM_STRING(eth_af_packet,
"iface=<string> "
"qpairs=<int> "
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b20a272..3209dbc 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -42,7 +42,7 @@
#include <rte_ip_frag.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_alarm.h>
#include <rte_cycles.h>
@@ -2508,13 +2508,15 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
return 0;
}
-static struct rte_driver bond_drv = {
- .type = PMD_VDEV,
- .init = bond_init,
- .uninit = bond_uninit,
+static struct rte_vdev_driver bond_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = bond_init,
+ .uninit = bond_uninit
+ },
};
-PMD_REGISTER_DRIVER(bond_drv, eth_bond);
+DRIVER_REGISTER_VDEV(eth_bond, bond_drv);
DRIVER_REGISTER_PARAM_STRING(eth_bond,
"slave=<ifc> "
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index c0d0e3b..6d0dc86 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <rte_eal.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_eal_memconfig.h>
#include <rte_ethdev.h>
#include <rte_malloc.h>
@@ -1623,18 +1623,22 @@ rte_pmd_mpipe_devinit(const char *ifname,
return 0;
}
-static struct rte_driver pmd_mpipe_xgbe_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_mpipe_devinit
+ },
};
-static struct rte_driver pmd_mpipe_gbe_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_mpipe_devinit
+ },
};
-PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv, xgbe);
-PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv, gbe);
+DRIVER_REGISTER_VDEV(xgbe, pmd_mpipe_xgbe_drv);
+DRIVER_REGISTER_VDEV(gbe, pmd_mpipe_gbe_drv);
static void __attribute__((constructor, used))
mpipe_init_contexts(void)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index ce49945..75bad6c 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -35,7 +35,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_spinlock.h>
@@ -686,13 +686,15 @@ rte_pmd_null_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_null_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_null_devinit,
- .uninit = rte_pmd_null_devuninit,
+static struct rte_vdev_driver pmd_null_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_null_devinit,
+ .uninit = rte_pmd_null_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_null_drv, eth_null);
+DRIVER_REGISTER_VDEV(eth_null, pmd_null_drv);
DRIVER_REGISTER_PARAM_STRING(eth_null,
"size=<int> "
"copy=<int>");
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7fbc60e..b72d07e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -40,7 +40,7 @@
#include <rte_string_fns.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <net/if.h>
@@ -1083,13 +1083,15 @@ rte_pmd_pcap_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_pcap_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_pcap_devinit,
- .uninit = rte_pmd_pcap_devuninit,
+static struct rte_vdev_driver pmd_pcap_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_pcap_devinit,
+ .uninit = rte_pmd_pcap_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_pcap_drv, eth_pcap);
+DRIVER_REGISTER_VDEV(eth_pcap, pmd_pcap_drv);
DRIVER_REGISTER_PARAM_STRING(eth_pcap,
"rx_pcap=<string> "
"tx_pcap=<string> "
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 5690dcd..67cbee3 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -38,7 +38,7 @@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
@@ -623,12 +623,14 @@ rte_pmd_ring_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_ring_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_ring_devinit,
- .uninit = rte_pmd_ring_devuninit,
+static struct rte_vdev_driver pmd_ring_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_ring_drv, eth_ring);
+DRIVER_REGISTER_VDEV(eth_ring, pmd_ring_drv);
DRIVER_REGISTER_PARAM_STRING(eth_ring,
"nodeaction=[attach|detach]");
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 2bb761b..94577e9 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -41,7 +41,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_virtio_net.h>
#include <rte_spinlock.h>
@@ -924,13 +924,15 @@ rte_pmd_vhost_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_vhost_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_vhost_devinit,
- .uninit = rte_pmd_vhost_devuninit,
+static struct rte_vdev_driver pmd_vhost_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_vhost_devinit,
+ .uninit = rte_pmd_vhost_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_vhost_drv, eth_vhost);
+DRIVER_REGISTER_VDEV(eth_vhost, pmd_vhost_drv);
DRIVER_REGISTER_PARAM_STRING(eth_vhost,
"iface=<ifc> "
"queues=<int>");
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index aadfdc0..08cd4c2 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -37,6 +37,7 @@
#include <rte_malloc.h>
#include <rte_kvargs.h>
+#include <rte_vdev.h>
#include "virtio_ethdev.h"
#include "virtio_logs.h"
@@ -461,13 +462,15 @@ virtio_user_pmd_devuninit(const char *name)
return 0;
}
-static struct rte_driver virtio_user_driver = {
- .type = PMD_VDEV,
- .init = virtio_user_pmd_devinit,
- .uninit = virtio_user_pmd_devuninit,
+static struct rte_vdev_driver virtio_user_driver = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = virtio_user_pmd_devinit,
+ .uninit = virtio_user_pmd_devuninit
+ },
};
-PMD_REGISTER_DRIVER(virtio_user_driver, virtio_user);
+DRIVER_REGISTER_VDEV(virtio_user, virtio_user_driver);
DRIVER_REGISTER_PARAM_STRING(virtio_user,
"path=<path> "
"mac=<mac addr> "
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 6b15381..fa00e52 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_xenvirt_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_xenvirt_devinit,
- .uninit = rte_pmd_xenvirt_devuninit,
+static struct rte_vdev_driver pmd_xenvirt_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_xenvirt_devinit,
+ .uninit = rte_pmd_xenvirt_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_xenvirt_drv, eth_xenvirt);
+DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
DRIVER_REGISTER_PARAM_STRING(eth_xenvirt,
"mac=<mac addr>");
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 18/25] eal: move init/uninit to rte_vdev_driver
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (16 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types Shreyansh Jain
` (8 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
These functions are virtual-device specific and they are never called
for any PCI driver (after introducing DRIVER_REGISTER_PCI, there is
no way to do it). All affected drivers are updated.
The prototypes are renamed to rte_vdev_init_t and rte_vdev_uninit_t.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 4 ++--
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 ++--
drivers/crypto/kasumi/rte_kasumi_pmd.c | 4 ++--
drivers/crypto/null/null_crypto_pmd.c | 4 ++--
drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 ++--
drivers/net/af_packet/rte_eth_af_packet.c | 4 ++--
drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++--
drivers/net/mpipe/mpipe_tilegx.c | 4 ++--
drivers/net/null/rte_eth_null.c | 4 ++--
drivers/net/pcap/rte_eth_pcap.c | 4 ++--
drivers/net/ring/rte_eth_ring.c | 4 ++--
drivers/net/vhost/rte_eth_vhost.c | 4 ++--
drivers/net/virtio/virtio_user_ethdev.c | 4 ++--
drivers/net/xenvirt/rte_eth_xenvirt.c | 4 ++--
lib/librte_eal/common/eal_common_vdev.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 12 ------------
lib/librte_eal/common/include/rte_vdev.h | 12 ++++++++++++
17 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index e1d5e37..c93ebfe 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -517,9 +517,9 @@ aesni_gcm_uninit(const char *name)
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = aesni_gcm_init,
- .uninit = aesni_gcm_uninit
},
+ .init = aesni_gcm_init,
+ .uninit = aesni_gcm_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 2ba5389..30c0706 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -717,9 +717,9 @@ cryptodev_aesni_mb_uninit(const char *name)
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_aesni_mb_init,
- .uninit = cryptodev_aesni_mb_uninit
},
+ .init = cryptodev_aesni_mb_init,
+ .uninit = cryptodev_aesni_mb_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index a30e776..ba2829d 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -653,9 +653,9 @@ cryptodev_kasumi_uninit(const char *name)
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_kasumi_init,
- .uninit = cryptodev_kasumi_uninit
},
+ .init = cryptodev_kasumi_init,
+ .uninit = cryptodev_kasumi_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 8ab34de..4c12faa 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -271,9 +271,9 @@ cryptodev_null_uninit(const char *name)
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_null_init,
- .uninit = cryptodev_null_uninit
},
+ .init = cryptodev_null_init,
+ .uninit = cryptodev_null_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv);
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 8b356a3..10c6b83 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -641,9 +641,9 @@ cryptodev_snow3g_uninit(const char *name)
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_snow3g_init,
- .uninit = cryptodev_snow3g_uninit
},
+ .init = cryptodev_snow3g_init,
+ .uninit = cryptodev_snow3g_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, cryptodev_snow3g_pmd_drv);
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 95aa573..9a9a2ee 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -892,9 +892,9 @@ rte_pmd_af_packet_devuninit(const char *name)
static struct rte_vdev_driver pmd_af_packet_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_af_packet_devinit,
- .uninit = rte_pmd_af_packet_devuninit
},
+ .init = rte_pmd_af_packet_devinit,
+ .uninit = rte_pmd_af_packet_devuninit
};
DRIVER_REGISTER_VDEV(eth_af_packet, pmd_af_packet_drv);
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 3209dbc..5fa2a93 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2511,9 +2511,9 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
static struct rte_vdev_driver bond_drv = {
.driver = {
.type = PMD_VDEV,
- .init = bond_init,
- .uninit = bond_uninit
},
+ .init = bond_init,
+ .uninit = bond_uninit
};
DRIVER_REGISTER_VDEV(eth_bond, bond_drv);
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 6d0dc86..efb000b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1626,15 +1626,15 @@ rte_pmd_mpipe_devinit(const char *ifname,
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit
},
+ .init = rte_pmd_mpipe_devinit
};
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit
},
+ .init = rte_pmd_mpipe_devinit
};
DRIVER_REGISTER_VDEV(xgbe, pmd_mpipe_xgbe_drv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 75bad6c..be4169e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -689,9 +689,9 @@ rte_pmd_null_devuninit(const char *name)
static struct rte_vdev_driver pmd_null_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_null_devinit,
- .uninit = rte_pmd_null_devuninit
},
+ .init = rte_pmd_null_devinit,
+ .uninit = rte_pmd_null_devuninit
};
DRIVER_REGISTER_VDEV(eth_null, pmd_null_drv);
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index b72d07e..d6718b8 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1086,9 +1086,9 @@ rte_pmd_pcap_devuninit(const char *name)
static struct rte_vdev_driver pmd_pcap_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_pcap_devinit,
- .uninit = rte_pmd_pcap_devuninit
},
+ .init = rte_pmd_pcap_devinit,
+ .uninit = rte_pmd_pcap_devuninit
};
DRIVER_REGISTER_VDEV(eth_pcap, pmd_pcap_drv);
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 67cbee3..77bd664 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -626,9 +626,9 @@ rte_pmd_ring_devuninit(const char *name)
static struct rte_vdev_driver pmd_ring_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_ring_devinit,
- .uninit = rte_pmd_ring_devuninit
},
+ .init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit
};
DRIVER_REGISTER_VDEV(eth_ring, pmd_ring_drv);
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 94577e9..e2610b4 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -927,9 +927,9 @@ rte_pmd_vhost_devuninit(const char *name)
static struct rte_vdev_driver pmd_vhost_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_vhost_devinit,
- .uninit = rte_pmd_vhost_devuninit
},
+ .init = rte_pmd_vhost_devinit,
+ .uninit = rte_pmd_vhost_devuninit
};
DRIVER_REGISTER_VDEV(eth_vhost, pmd_vhost_drv);
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 08cd4c2..7975298 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -465,9 +465,9 @@ virtio_user_pmd_devuninit(const char *name)
static struct rte_vdev_driver virtio_user_driver = {
.driver = {
.type = PMD_VDEV,
- .init = virtio_user_pmd_devinit,
- .uninit = virtio_user_pmd_devuninit
},
+ .init = virtio_user_pmd_devinit,
+ .uninit = virtio_user_pmd_devuninit
};
DRIVER_REGISTER_VDEV(virtio_user, virtio_user_driver);
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index fa00e52..0bbe130 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -762,9 +762,9 @@ rte_pmd_xenvirt_devuninit(const char *name)
static struct rte_vdev_driver pmd_xenvirt_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_xenvirt_devinit,
- .uninit = rte_pmd_xenvirt_devuninit
},
+ .init = rte_pmd_xenvirt_devinit,
+ .uninit = rte_pmd_xenvirt_devuninit
};
DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index e1ca8e0..83f8ea8 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -73,7 +73,7 @@ rte_eal_vdev_init(const char *name, const char *args)
* So use strncmp to compare.
*/
if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
- return driver->driver.init(name, args);
+ return driver->init(name, args);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
@@ -96,7 +96,7 @@ rte_eal_vdev_uninit(const char *name)
* So use strncmp to compare.
*/
if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
- return driver->driver.uninit(name);
+ return driver->uninit(name);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index a4f08b5..3097194 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,16 +105,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Initialization function called for each device driver once.
- */
-typedef int (rte_dev_init_t)(const char *name, const char *args);
-
-/**
- * Uninitilization function called for each device driver once.
- */
-typedef int (rte_dev_uninit_t)(const char *name);
-
-/**
* Driver type enumeration
*/
enum pmd_type {
@@ -129,8 +119,6 @@ struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
- rte_dev_init_t *init; /**< Device init. function. */
- rte_dev_uninit_t *uninit; /**< Device uninit. function. */
};
/**
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 9a2e2d5..70a62c0 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -44,11 +44,23 @@ extern "C" {
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
/**
+ * Initialization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_init_t)(const char *name, const char *args);
+
+/**
+ * Uninitilization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_uninit_t)(const char *name);
+
+/**
* A virtual device driver abstraction.
*/
struct rte_vdev_driver {
TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_init_t *init; /**< Virtual device init. function. */
+ rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */
};
/**
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (17 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 18/25] eal: move init/uninit to rte_vdev_driver Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 20/25] eal: rte_pci.h includes rte_dev.h Shreyansh Jain
` (7 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
- All devices register themselfs by calling a kind of DRIVER_REGISTER_XXX.
The PMD_REGISTER_DRIVER is not used anymore.
- PMD_VDEV type is also not being used - can be removed from all VDEVs.
Note: PMD_REGISTER_DRIVER usage by PMDINFO tool and its documentation has not
yet been removed.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ---
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 ---
drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ---
drivers/crypto/null/null_crypto_pmd.c | 3 ---
drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ---
drivers/net/af_packet/rte_eth_af_packet.c | 3 ---
drivers/net/bonding/rte_eth_bond_pmd.c | 3 ---
drivers/net/mpipe/mpipe_tilegx.c | 6 ------
drivers/net/null/rte_eth_null.c | 3 ---
drivers/net/pcap/rte_eth_pcap.c | 3 ---
drivers/net/ring/rte_eth_ring.c | 3 ---
drivers/net/vhost/rte_eth_vhost.c | 3 ---
drivers/net/virtio/virtio_user_ethdev.c | 3 ---
drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ---
lib/librte_eal/common/include/rte_dev.h | 18 ------------------
15 files changed, 63 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index c93ebfe..fc939fa 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -515,9 +515,6 @@ aesni_gcm_uninit(const char *name)
}
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = aesni_gcm_init,
.uninit = aesni_gcm_uninit
};
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 30c0706..2047269 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -715,9 +715,6 @@ cryptodev_aesni_mb_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index ba2829d..d1b0b99 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -651,9 +651,6 @@ cryptodev_kasumi_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_kasumi_init,
.uninit = cryptodev_kasumi_uninit
};
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 4c12faa..bd139b4 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -269,9 +269,6 @@ cryptodev_null_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_null_init,
.uninit = cryptodev_null_uninit
};
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 10c6b83..c46d7e5 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -639,9 +639,6 @@ cryptodev_snow3g_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_snow3g_init,
.uninit = cryptodev_snow3g_uninit
};
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 9a9a2ee..810ec48 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -890,9 +890,6 @@ rte_pmd_af_packet_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_af_packet_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_af_packet_devinit,
.uninit = rte_pmd_af_packet_devuninit
};
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5fa2a93..1496cdf 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2509,9 +2509,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
}
static struct rte_vdev_driver bond_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = bond_init,
.uninit = bond_uninit
};
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index efb000b..9382bcf 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1624,16 +1624,10 @@ rte_pmd_mpipe_devinit(const char *ifname,
}
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit
};
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit
};
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index be4169e..e85c67e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -687,9 +687,6 @@ rte_pmd_null_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_null_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit
};
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index d6718b8..2d76a7e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1084,9 +1084,6 @@ rte_pmd_pcap_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_pcap_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit
};
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 77bd664..d687ed6 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -624,9 +624,6 @@ rte_pmd_ring_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_ring_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit
};
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index e2610b4..ae49f15 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -925,9 +925,6 @@ rte_pmd_vhost_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_vhost_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_vhost_devinit,
.uninit = rte_pmd_vhost_devuninit
};
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 7975298..7c604f9 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -463,9 +463,6 @@ virtio_user_pmd_devuninit(const char *name)
}
static struct rte_vdev_driver virtio_user_driver = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = virtio_user_pmd_devinit,
.uninit = virtio_user_pmd_devuninit
};
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 0bbe130..7203742 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -760,9 +760,6 @@ rte_pmd_xenvirt_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_xenvirt_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit
};
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 3097194..3d0d2b8 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,19 +105,10 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Driver type enumeration
- */
-enum pmd_type {
- PMD_VDEV = 0,
- PMD_PDEV = 1,
-};
-
-/**
* A structure describing a device driver.
*/
struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
- enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
};
@@ -198,15 +189,6 @@ int rte_eal_dev_detach(const char *name);
static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
-#define PMD_REGISTER_DRIVER(drv, nm)\
-RTE_INIT(devinitfn_ ##drv);\
-static void devinitfn_ ##drv(void)\
-{\
- (drv).name = RTE_STR(nm);\
- rte_eal_driver_register(&drv);\
-} \
-DRIVER_EXPORT_NAME(nm, __COUNTER__)
-
#define DRV_EXP_TAG(name, tag) __##name##_##tag
#define DRIVER_REGISTER_PCI_TABLE(name, table) \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 20/25] eal: rte_pci.h includes rte_dev.h
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (18 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 21/25] eal: rename and move rte_pci_resource Shreyansh Jain
` (6 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Further refactoring and generalization of PCI infrastructure will
require access to the rte_dev.h contents.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_pci.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 8227232..4a37a32 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -84,6 +84,7 @@ extern "C" {
#include <rte_debug.h>
#include <rte_interrupts.h>
+#include <rte_dev.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 21/25] eal: rename and move rte_pci_resource
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (19 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 20/25] eal: rte_pci.h includes rte_dev.h Shreyansh Jain
@ 2016-08-26 13:56 ` Shreyansh Jain
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
` (5 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:56 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/net/szedata2/rte_eth_szedata2.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 8 ++++++++
lib/librte_eal/common/include/rte_pci.h | 11 +----------
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 6d21024..1b9e88a 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1416,7 +1416,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
int ret;
uint32_t szedata2_index;
struct rte_pci_addr *pci_addr = &dev->pci_dev->addr;
- struct rte_pci_resource *pci_rsc =
+ struct rte_mem_resource *pci_rsc =
&dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER];
char rsc_filename[PATH_MAX];
void *pci_resource_ptr = NULL;
@@ -1473,7 +1473,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, dev->pci_dev);
- /* mmap pci resource0 file to rte_pci_resource structure */
+ /* mmap pci resource0 file to rte_mem_resource structure */
if (dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].phys_addr ==
0) {
RTE_LOG(ERR, PMD, "Missing resource%u file\n",
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 3d0d2b8..5c314bf 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -100,6 +100,14 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
} \
} while (0)
+/**
+ * A generic memory resource representation.
+ */
+struct rte_mem_resource {
+ uint64_t phys_addr; /**< Physical address, 0 if not resource. */
+ uint64_t len; /**< Length of the resource. */
+ void *addr; /**< Virtual address, NULL when not mapped. */
+};
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 4a37a32..2b36727 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -108,15 +108,6 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
-/**
- * A structure describing a PCI resource.
- */
-struct rte_pci_resource {
- uint64_t phys_addr; /**< Physical address, 0 if no resource. */
- uint64_t len; /**< Length of the resource. */
- void *addr; /**< Virtual address, NULL when not mapped. */
-};
-
/** Maximum number of PCI resources. */
#define PCI_MAX_RESOURCE 6
@@ -160,7 +151,7 @@ struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
- struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
+ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (20 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 21/25] eal: rename and move rte_pci_resource Shreyansh Jain
@ 2016-08-26 13:57 ` Shreyansh Jain
2016-08-29 16:49 ` Ferruh Yigit
2016-08-30 15:47 ` Ferruh Yigit
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 23/25] eal: call rte_eal_driver_register Shreyansh Jain
` (4 subsequent siblings)
26 siblings, 2 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:57 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
populated into the rte_driver.name member - assignments through eth_driver
has been removed.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/test_pci.c | 10 +++++++---
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
drivers/net/bnxt/bnxt_ethdev.c | 1 -
drivers/net/cxgbe/cxgbe_ethdev.c | 1 -
drivers/net/cxgbe/sge.c | 7 ++++---
drivers/net/e1000/em_ethdev.c | 1 -
drivers/net/e1000/igb_ethdev.c | 2 --
drivers/net/ena/ena_ethdev.c | 1 -
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/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 2 --
drivers/net/mlx4/mlx4.c | 4 +++-
drivers/net/mlx5/mlx5.c | 4 +++-
drivers/net/nfp/nfp_net.c | 5 ++---
drivers/net/qede/qede_ethdev.c | 2 --
drivers/net/thunderx/nicvf_ethdev.c | 1 -
drivers/net/virtio/virtio_ethdev.c | 3 +--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 ++--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 4 ++--
lib/librte_eal/common/eal_common_pci.c | 4 ++--
lib/librte_eal/common/include/rte_pci.h | 4 ++--
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 +++
lib/librte_ether/rte_ethdev.c | 6 +++---
29 files changed, 38 insertions(+), 45 deletions(-)
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 69f78d9..ae597ab 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -78,14 +78,18 @@ struct rte_pci_id my_driver_id2[] = {
};
struct rte_pci_driver my_driver = {
- .name = "test_driver",
+ .driver = {
+ .name = "test_driver"
+ },
.devinit = my_driver_init,
.id_table = my_driver_id,
.drv_flags = 0,
};
struct rte_pci_driver my_driver2 = {
- .name = "test_driver2",
+ .driver = {
+ .name = "test_driver2"
+ },
.devinit = my_driver_init,
.id_table = my_driver_id2,
.drv_flags = 0,
@@ -95,7 +99,7 @@ static int
my_driver_init(__attribute__((unused)) struct rte_pci_driver *dr,
struct rte_pci_device *dev)
{
- printf("My driver init called in %s\n", dr->name);
+ printf("My driver init called in %s\n", dr->driver.name);
printf("%x:%x:%x.%d", dev->addr.domain, dev->addr.bus,
dev->addr.devid, dev->addr.function);
printf(" - vendor:%x device:%x\n", dev->id.vendor_id, dev->id.device_id);
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 8a1f0d0..56eeb99 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -586,7 +586,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
pci_dev->numa_node = socket_id;
- pci_drv->name = virtual_ethdev_driver_name;
+ pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
if (isr_support)
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index 5de47e3..2e7188b 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -300,7 +300,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
* Allocate a memzone for the queue - create a unique name.
*/
snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d",
- dev->driver->pci_drv.name, "qp_mem", dev->data->dev_id,
+ dev->driver->pci_drv.driver.name, "qp_mem", dev->data->dev_id,
queue->hw_bundle_number, queue->hw_queue_number);
qp_mz = queue_dma_zone_reserve(queue->memz_name, queue_size_bytes,
socket_id);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 214b655..847888e 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -618,7 +618,6 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_bnx2x_pmd = {
.pci_drv = {
- .name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
@@ -633,7 +632,6 @@ static struct eth_driver rte_bnx2x_pmd = {
*/
static struct eth_driver rte_bnx2xvf_pmd = {
.pci_drv = {
- .name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 28eb8b9..d5ca9bf 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1045,7 +1045,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
static struct eth_driver bnxt_rte_pmd = {
.pci_drv = {
- .name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 431b06d..a37b124 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1039,7 +1039,6 @@ out_free_adapter:
static struct eth_driver rte_cxgbe_pmd = {
.pci_drv = {
- .name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index ab5a842..736f08c 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1645,7 +1645,8 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
iq->size = cxgbe_roundup(iq->size, 16);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, fwevtq ? "fwq_ring" : "rx_ring",
+ eth_dev->driver->pci_drv.driver.name,
+ fwevtq ? "fwq_ring" : "rx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1697,7 +1698,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
fl->size = cxgbe_roundup(fl->size, 8);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
fwevtq ? "fwq_ring" : "fl_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1893,7 +1894,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, "tx_ring",
+ eth_dev->driver->pci_drv.driver.name, "tx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 1281c8b..7f8fc21 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -391,7 +391,6 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_em_pmd = {
.pci_drv = {
- .name = "rte_em_pmd",
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 395477e..811d9ae 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1078,7 +1078,6 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_igb_pmd = {
.pci_drv = {
- .name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1095,7 +1094,6 @@ static struct eth_driver rte_igb_pmd = {
*/
static struct eth_driver rte_igbvf_pmd = {
.pci_drv = {
- .name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ee906d4..4d6e83f 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1686,7 +1686,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
static struct eth_driver rte_ena_pmd = {
.pci_drv = {
- .name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 59812d0..c80b8f7 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -613,7 +613,6 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_enic_pmd = {
.pci_drv = {
- .name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 26cdc10..11e4014 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3055,7 +3055,6 @@ static const struct rte_pci_id pci_id_fm10k_map[] = {
static struct eth_driver rte_pmd_fm10k = {
.pci_drv = {
- .name = "rte_pmd_fm10k",
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dacaaea..892a221 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -663,7 +663,6 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
static struct eth_driver rte_i40e_pmd = {
.pci_drv = {
- .name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 4a745f9..952bcd3 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1554,7 +1554,6 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
*/
static struct eth_driver rte_i40evf_pmd = {
.pci_drv = {
- .name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index f65c411..a4efc6d 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -251,7 +251,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
/* reserve memory for the fdir programming packet */
snprintf(z_name, sizeof(z_name), "%s_%s_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
I40E_FDIR_MZ_NAME,
eth_dev->data->port_id);
mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN, SOCKET_ID_ANY);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d2f46bc..65ec846 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1562,7 +1562,6 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_ixgbe_pmd = {
.pci_drv = {
- .name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1579,7 +1578,6 @@ static struct eth_driver rte_ixgbe_pmd = {
*/
static struct eth_driver rte_ixgbevf_pmd = {
.pci_drv = {
- .name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index b333ad6..3d2df9c 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5911,7 +5911,9 @@ static const struct rte_pci_id mlx4_pci_id_map[] = {
static struct eth_driver mlx4_driver = {
.pci_drv = {
- .name = MLX4_DRIVER_NAME,
+ .driver = {
+ .name = MLX4_DRIVER_NAME
+ },
.id_table = mlx4_pci_id_map,
.devinit = mlx4_pci_devinit,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ebad7cb..82c11f3 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -728,7 +728,9 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
static struct eth_driver mlx5_driver = {
.pci_drv = {
- .name = MLX5_DRIVER_NAME,
+ .driver = {
+ .name = MLX5_DRIVER_NAME
+ },
.id_table = mlx5_pci_id_map,
.devinit = mlx5_pci_devinit,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index cbaf219..764d58d 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -214,7 +214,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name,
+ dev->driver->pci_drv.driver.name,
ring_name, dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -1000,7 +1000,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->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
@@ -2460,7 +2460,6 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
static struct eth_driver rte_nfp_net_pmd = {
.pci_drv = {
- .name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a92dd3b..2ef432f 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1478,7 +1478,6 @@ static struct rte_pci_id pci_id_qede_map[] = {
static struct eth_driver rte_qedevf_pmd = {
.pci_drv = {
- .name = "rte_qedevf_pmd",
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
@@ -1492,7 +1491,6 @@ static struct eth_driver rte_qedevf_pmd = {
static struct eth_driver rte_qede_pmd = {
.pci_drv = {
- .name = "rte_qede_pmd",
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index ad7d607..783acbf 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1759,7 +1759,6 @@ static const struct rte_pci_id pci_id_nicvf_map[] = {
static struct eth_driver rte_nicvf_pmd = {
.pci_drv = {
- .name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 5453709..7abacd3 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1304,7 +1304,6 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_virtio_pmd = {
.pci_drv = {
- .name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
@@ -1534,7 +1533,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct virtio_hw *hw = dev->data->dev_private;
if (dev->pci_dev)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
else
dev_info->driver_name = "virtio_user PMD";
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index d732979..857e59a 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -137,7 +137,8 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%d_%s",
- dev->driver->pci_drv.name, dev->data->port_id, post_string);
+ dev->driver->pci_drv.driver.name,
+ dev->data->port_id, post_string);
mz = rte_memzone_lookup(z_name);
if (mz)
@@ -328,7 +329,6 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_vmxnet3_pmd = {
.pci_drv = {
- .name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index 9deeb3f..e6d93f3 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -774,7 +774,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index c81e366..2e17169 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -459,7 +459,7 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_drv->name,
+ " failed", pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
@@ -870,7 +870,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
dev_info->pci_dev = dev->pci_dev;
if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
}
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index da0038f..308c2a9 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -195,7 +195,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
RTE_LOG(INFO, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
/* map resources for devices that use igb_uio */
@@ -255,7 +255,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
loc->function, dev->numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->devuninit && (dr->devuninit(dev) < 0))
return -1; /* negative value is an error */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 2b36727..60a5222 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -199,7 +199,7 @@ typedef int (pci_devuninit_t)(struct rte_pci_device *);
*/
struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
- const char *name; /**< Driver name. */
+ struct rte_driver driver; /**< Inherit core driver. */
pci_devinit_t *devinit; /**< Device init. function. */
pci_devuninit_t *devuninit; /**< Device uninit function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
@@ -493,7 +493,7 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);
RTE_INIT(pciinitfn_ ##nm); \
static void pciinitfn_ ##nm(void) \
{ \
- (pci_drv).name = RTE_STR(nm);\
+ (pci_drv).driver.name = RTE_STR(nm);\
rte_eal_pci_register(&pci_drv); \
}\
DRIVER_EXPORT_NAME(nm, __COUNTER__)
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index c0bd391..b8bfd4b 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -172,4 +172,7 @@ DPDK_16.11 {
rte_eal_dev_attach;
rte_eal_dev_detach;
+ rte_eal_vdrv_register;
+ rte_eal_vdrv_unregister;
+
} DPDK_16.07;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index cf38f32..d7179e1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -276,7 +276,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
- pci_drv->name,
+ pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
@@ -2566,7 +2566,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -3208,7 +3208,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->kdrv = pci_dev->kdrv;
eth_dev->data->numa_node = pci_dev->numa_node;
- eth_dev->data->drv_name = pci_dev->driver->name;
+ eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
int
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 23/25] eal: call rte_eal_driver_register
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (21 preceding siblings ...)
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
@ 2016-08-26 13:57 ` Shreyansh Jain
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 24/25] eal: introduce rte_device Shreyansh Jain
` (3 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:57 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
To register both vdev and pci drivers into the list of all rte_driver,
we have to call rte_eal_driver_register explicitly.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 2 ++
lib/librte_eal/common/eal_common_vdev.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 308c2a9..2c89530 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -470,11 +470,13 @@ void
rte_eal_pci_register(struct rte_pci_driver *driver)
{
TAILQ_INSERT_TAIL(&pci_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_pci_unregister(struct rte_pci_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&pci_driver_list, driver, next);
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 83f8ea8..9fff0cb 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -48,12 +48,14 @@ void
rte_eal_vdrv_register(struct rte_vdev_driver *driver)
{
TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&vdev_driver_list, driver, next);
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 24/25] eal: introduce rte_device
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (22 preceding siblings ...)
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 23/25] eal: call rte_eal_driver_register Shreyansh Jain
@ 2016-08-26 13:57 ` Shreyansh Jain
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members Shreyansh Jain
` (2 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:57 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 13 +++++++++++++
lib/librte_eal/common/include/rte_dev.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index afa33fa..d1f0ad8 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -48,6 +48,9 @@
/** Global list of device drivers. */
static struct rte_driver_list dev_driver_list =
TAILQ_HEAD_INITIALIZER(dev_driver_list);
+/** Global list of device drivers. */
+static struct rte_device_list dev_device_list =
+ TAILQ_HEAD_INITIALIZER(dev_device_list);
/* register a driver */
void
@@ -63,6 +66,16 @@ rte_eal_driver_unregister(struct rte_driver *driver)
TAILQ_REMOVE(&dev_driver_list, driver, next);
}
+void rte_eal_device_insert(struct rte_device *dev)
+{
+ TAILQ_INSERT_TAIL(&dev_device_list, dev, next);
+}
+
+void rte_eal_device_remove(struct rte_device *dev)
+{
+ TAILQ_REMOVE(&dev_device_list, dev, next);
+}
+
int
rte_eal_dev_init(void)
{
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 5c314bf..d159991 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -111,6 +111,37 @@ struct rte_mem_resource {
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
+/** Double linked list of devices. */
+TAILQ_HEAD(rte_device_list, rte_device);
+
+/* Forward declaration */
+struct rte_driver;
+
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+ TAILQ_ENTRY(rte_device) next; /**< Next device */
+ struct rte_driver *driver; /**< Associated driver */
+ int numa_node; /**< NUMA node connection */
+ struct rte_devargs *devargs; /**< Device user arguments */
+};
+
+/**
+ * Insert a device detected by a bus scanning.
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the detected device.
+ */
+void rte_eal_device_insert(struct rte_device *dev);
+
+/**
+ * Remove a device (e.g. when being unplugged).
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the device to be removed.
+ */
+void rte_eal_device_remove(struct rte_device *dev);
/**
* A structure describing a device driver.
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (23 preceding siblings ...)
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 24/25] eal: introduce rte_device Shreyansh Jain
@ 2016-08-26 13:57 ` Shreyansh Jain
2016-08-29 16:53 ` Ferruh Yigit
2016-08-30 13:27 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Ferruh Yigit
2016-09-01 18:29 ` Jan Viktorin
26 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-26 13:57 UTC (permalink / raw)
To: dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal,
Shreyansh Jain
Now that rte_device is available, drivers can start using its members (numa,
name) as well as link themselves into another rte_device list.
As of now no one is using this list, but can be used for moving over all
devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 4 ++--
drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
drivers/net/i40e/i40e_ethdev.c | 6 ++++--
drivers/net/virtio/virtio_pci.c | 5 +++--
lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
lib/librte_eal/common/include/rte_pci.h | 3 +--
lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
lib/librte_ether/rte_ethdev.c | 2 +-
9 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 56eeb99..4831113 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -585,7 +585,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
if (eth_dev == NULL)
goto err;
- pci_dev->numa_node = socket_id;
+ pci_dev->device.numa_node = socket_id;
pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
@@ -626,7 +626,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
eth_dev->dev_ops = &dev_private->dev_ops;
eth_dev->pci_dev = pci_dev;
- eth_dev->pci_dev->driver = ð_drv->pci_drv;
+ eth_dev->pci_dev->device.driver = ð_drv->pci_drv.driver;
eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success;
eth_dev->tx_pkt_burst = virtual_ethdev_tx_burst_success;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 11e4014..8d815fd 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -675,7 +675,7 @@ fm10k_dev_tx_init(struct rte_eth_dev *dev)
/* Enable use of FTAG bit in TX descriptor, PFVTCTL
* register is read-only for VF.
*/
- if (fm10k_check_ftag(dev->pci_dev->devargs)) {
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs)) {
if (hw->mac.type == fm10k_mac_pf) {
FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i),
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
@@ -2731,7 +2731,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
int use_sse = 1;
uint16_t tx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
tx_ftag_en = 1;
for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -2762,7 +2762,7 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)
uint16_t i, rx_using_sse;
uint16_t rx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
rx_ftag_en = 1;
/* In order to allow Vector Rx there are a few configuration
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 892a221..6d2f027 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -905,8 +905,10 @@ config_floating_veb(struct rte_eth_dev *dev)
memset(pf->floating_veb_list, 0, sizeof(pf->floating_veb_list));
if (hw->aq.fw_maj_ver >= FLOATING_VEB_SUPPORTED_FW_MAJ) {
- pf->floating_veb = is_floating_veb_supported(pci_dev->devargs);
- config_vf_floating_veb(pci_dev->devargs, pf->floating_veb,
+ pf->floating_veb =
+ is_floating_veb_supported(pci_dev->device.devargs);
+ config_vf_floating_veb(pci_dev->device.devargs,
+ pf->floating_veb,
pf->floating_veb_list);
} else {
pf->floating_veb = false;
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index f1a7ca7..9b47165 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -745,8 +745,9 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
- (!dev->devargs ||
- dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
+ (!dev->device.devargs ||
+ dev->device.devargs->type !=
+ RTE_DEVTYPE_WHITELISTED_PCI)) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
return 1;
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 1d91c78..8b3ed88 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -287,7 +287,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
dev->max_vfs = 0;
/* FreeBSD has no NUMA support (yet) */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
/* FreeBSD has only one pass through driver */
dev->kdrv = RTE_KDRV_NIC_UIO;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 2c89530..96f6db4 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -185,11 +185,12 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
RTE_LOG(INFO, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid, loc->function,
- dev->numa_node);
+ dev->device.numa_node);
/* no initialization when blacklisted, return without error */
- if (dev->devargs != NULL &&
- dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
+ if (dev->device.devargs != NULL &&
+ dev->device.devargs->type ==
+ RTE_DEVTYPE_BLACKLISTED_PCI) {
RTE_LOG(INFO, EAL, " Device is blacklisted, not initializing\n");
return 1;
}
@@ -252,7 +253,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid,
- loc->function, dev->numa_node);
+ loc->function, dev->device.numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->driver.name);
@@ -417,7 +418,7 @@ rte_eal_pci_probe(void)
/* set devargs in PCI structure */
devargs = pci_devargs_lookup(dev);
if (devargs != NULL)
- dev->devargs = devargs;
+ dev->device.devargs = devargs;
/* probe all or only whitelisted devices */
if (probe_all)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 60a5222..a42d1de 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -149,14 +149,13 @@ enum rte_kernel_driver {
*/
struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
+ struct rte_device device; /**< Inherit core device */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
- int numa_node; /**< NUMA node connection */
- struct rte_devargs *devargs; /**< Device user arguments */
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
};
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 62da4d4..876ba38 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -350,13 +350,13 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
dirname);
if (access(filename, R_OK) != 0) {
/* if no NUMA support, set default to 0 */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
} else {
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
free(dev);
return -1;
}
- dev->numa_node = tmp;
+ dev->device.numa_node = tmp;
}
/* parse resources */
@@ -390,6 +390,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
/* device is valid, add in list (sorted) */
if (TAILQ_EMPTY(&pci_device_list)) {
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
} else {
struct rte_pci_device *dev2;
@@ -402,6 +403,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
if (ret < 0) {
TAILQ_INSERT_BEFORE(dev2, dev, next);
+ rte_eal_device_insert(&dev->device);
} else { /* already registered */
dev2->kdrv = dev->kdrv;
dev2->max_vfs = dev->max_vfs;
@@ -411,6 +413,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
return 0;
}
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index d7179e1..d54ec9e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3207,7 +3207,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = pci_dev->kdrv;
- eth_dev->data->numa_node = pci_dev->numa_node;
+ eth_dev->data->numa_node = pci_dev->device.numa_node;
eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of Shreyansh Jain
@ 2016-08-29 16:43 ` Ferruh Yigit
2016-08-30 4:27 ` Shreyansh Jain
` (2 more replies)
0 siblings, 3 replies; 375+ messages in thread
From: Ferruh Yigit @ 2016-08-29 16:43 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
> index 332f2a4..a9b6792 100644
> --- a/lib/librte_eal/common/include/rte_common.h
> +++ b/lib/librte_eal/common/include/rte_common.h
> @@ -322,6 +322,22 @@ rte_bsf32(uint32_t v)
> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
> #endif
>
> +/**
> + * Return pointer to the wrapping struct instance.
> + * Example:
> + *
> + * struct wrapper {
> + * ...
> + * struct child c;
> + * ...
> + * };
> + *
> + * struct child *x = obtain(...);
> + * struct wrapper *w = container_of(x, struct wrapper, c);
> + */
> +#define container_of(p, type, member) \
> + ((type *) (((char *) (p)) - offsetof(type, member)))
> +
> #define _RTE_STR(x) #x
> /** Take a macro value and get a string version of it */
> #define RTE_STR(x) _RTE_STR(x)
>
This gives compilation error for mlx5, because the libraries mlx depends
defines same macro:
.../rte_common.h:338:9: error: 'container_of' macro redefined
/usr/include/infiniband/verbs.h:77:9: note: previous definition is here
Does it make sense to protect macro with
#ifndef container_of
...
#endif
OR
add a dpdk prefix?
Regards,
ferruh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
@ 2016-08-29 16:49 ` Ferruh Yigit
2016-08-30 4:59 ` Shreyansh Jain
2016-09-08 5:51 ` Shreyansh Jain
2016-08-30 15:47 ` Ferruh Yigit
1 sibling, 2 replies; 375+ messages in thread
From: Ferruh Yigit @ 2016-08-29 16:49 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
> Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
>
> Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
> as well as assigning a name to eth_driver.pci_drv.name member.
> In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
> populated into the rte_driver.name member - assignments through eth_driver
> has been removed.
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> app/test/test_pci.c | 10 +++++++---
> app/test/virtual_pmd.c | 2 +-
> drivers/crypto/qat/qat_qp.c | 2 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
bnx2x_rxtx.c also needs to be updated:
CC bnx2x_rxtx.o
.../drivers/net/bnx2x/bnx2x_rxtx.c:22:25: error: no member named 'name'
in 'struct rte_pci_driver'
dev->driver->pci_drv.name, ring_name,
dev->data->port_id, queue_id);
...
Also szedata2 driver seems missed:
CC rte_eth_szedata2.o
.../drivers/net/szedata2/rte_eth_szedata2.c:1575:4: error: field
designator 'name' does not refer to any field in type 'struct
rte_pci_driver'
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
^
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members Shreyansh Jain
@ 2016-08-29 16:53 ` Ferruh Yigit
2016-08-30 4:38 ` Shreyansh Jain
2016-09-08 5:55 ` Shreyansh Jain
0 siblings, 2 replies; 375+ messages in thread
From: Ferruh Yigit @ 2016-08-29 16:53 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
> Now that rte_device is available, drivers can start using its members (numa,
> name) as well as link themselves into another rte_device list.
>
> As of now no one is using this list, but can be used for moving over all
> devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> app/test/virtual_pmd.c | 4 ++--
> drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
> drivers/net/i40e/i40e_ethdev.c | 6 ++++--
> drivers/net/virtio/virtio_pci.c | 5 +++--
> lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
> lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
> lib/librte_eal/common/include/rte_pci.h | 3 +--
> lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
> lib/librte_ether/rte_ethdev.c | 2 +-
> 9 files changed, 26 insertions(+), 20 deletions(-)
mlx5.c needs to be updated too:
CC mlx5.o
.../drivers/net/mlx5/mlx5.c:514:34: error: no member named 'devargs' in
'struct rte_pci_device'
err = mlx5_args(priv, pci_dev->devargs);
~~~~~~~ ^
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
@ 2016-08-29 16:57 ` Ferruh Yigit
2016-08-30 4:38 ` Shreyansh Jain
2016-09-08 5:49 ` Shreyansh Jain
0 siblings, 2 replies; 375+ messages in thread
From: Ferruh Yigit @ 2016-08-29 16:57 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
> All PMD_VDEV drivers can now use rte_vdev_driver instead of the
> rte_driver (which is embedded in the rte_vdev_driver).
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
...
> diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
> index 6b15381..fa00e52 100644
> --- a/drivers/net/xenvirt/rte_eth_xenvirt.c
> +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
> @@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
> return 0;
> }
xenvirt missing header file rte_vdev.h:
CC rte_eth_xenvirt.o
.../drivers/net/xenvirt/rte_eth_xenvirt.c:762:31: error: variable has
incomplete type 'struct rte_vdev_driver'
static struct rte_vdev_driver pmd_xenvirt_drv = {
>
> -static struct rte_driver pmd_xenvirt_drv = {
> - .type = PMD_VDEV,
> - .init = rte_pmd_xenvirt_devinit,
> - .uninit = rte_pmd_xenvirt_devuninit,
> +static struct rte_vdev_driver pmd_xenvirt_drv = {
> + .driver = {
> + .type = PMD_VDEV,
> + .init = rte_pmd_xenvirt_devinit,
> + .uninit = rte_pmd_xenvirt_devuninit
> + },
> };
>
> -PMD_REGISTER_DRIVER(pmd_xenvirt_drv, eth_xenvirt);
> +DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
> DRIVER_REGISTER_PARAM_STRING(eth_xenvirt,
> "mac=<mac addr>");
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net Shreyansh Jain
@ 2016-08-29 17:20 ` Ferruh Yigit
2016-08-30 4:36 ` Shreyansh Jain
2016-09-08 5:46 ` Shreyansh Jain
0 siblings, 2 replies; 375+ messages in thread
From: Ferruh Yigit @ 2016-08-29 17:20 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
> Now that all pdev are pci drivers, we don't need to register crypto and ethdev
> drivers through a dedicated channel.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
...
> -void rte_eth_driver_register(struct eth_driver *eth_drv);
Function needs to be removed from .map file
> -
> -/**
> * Convert a numerical speed in Mbps to a bitmap flag that can be used in
> * the bitmap link_speeds of the struct rte_eth_conf
> *
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-29 16:43 ` Ferruh Yigit
@ 2016-08-30 4:27 ` Shreyansh Jain
2016-08-30 10:30 ` Thomas Monjalon
2016-08-30 4:31 ` Shreyansh Jain
2016-09-08 5:45 ` Shreyansh Jain
2 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-30 4:27 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
On Monday 29 August 2016 10:13 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
>> index 332f2a4..a9b6792 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -322,6 +322,22 @@ rte_bsf32(uint32_t v)
>> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
>> #endif
>>
>> +/**
>> + * Return pointer to the wrapping struct instance.
>> + * Example:
>> + *
>> + * struct wrapper {
>> + * ...
>> + * struct child c;
>> + * ...
>> + * };
>> + *
>> + * struct child *x = obtain(...);
>> + * struct wrapper *w = container_of(x, struct wrapper, c);
>> + */
>> +#define container_of(p, type, member) \
>> + ((type *) (((char *) (p)) - offsetof(type, member)))
>> +
>> #define _RTE_STR(x) #x
>> /** Take a macro value and get a string version of it */
>> #define RTE_STR(x) _RTE_STR(x)
>>
>
> This gives compilation error for mlx5, because the libraries mlx depends
> defines same macro:
> ..../rte_common.h:338:9: error: 'container_of' macro redefined
> /usr/include/infiniband/verbs.h:77:9: note: previous definition is here
I thought testing with scripts/test-build.sh and default configuration
would compile all drivers - I was wrong. I will retest the patches and
release again.
Is there a better way to test that no driver breaks? Any particular
parameters I should use for test-build.sh?
I used 'x86_64-native-linuxapp-gcc+default+debug+shared' for all patches.
>
> Does it make sense to protect macro with
> #ifndef container_of
> ....
> #endif
>
> OR
>
> add a dpdk prefix?
>
>
> Regards,
> ferruh
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-29 16:43 ` Ferruh Yigit
2016-08-30 4:27 ` Shreyansh Jain
@ 2016-08-30 4:31 ` Shreyansh Jain
2016-09-08 5:45 ` Shreyansh Jain
2 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-30 4:31 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
Forgot to add a comment in previous reply to this email:
On Monday 29 August 2016 10:13 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
>> index 332f2a4..a9b6792 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -322,6 +322,22 @@ rte_bsf32(uint32_t v)
>> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
>> #endif
>>
>> +/**
>> + * Return pointer to the wrapping struct instance.
>> + * Example:
>> + *
>> + * struct wrapper {
>> + * ...
>> + * struct child c;
>> + * ...
>> + * };
>> + *
>> + * struct child *x = obtain(...);
>> + * struct wrapper *w = container_of(x, struct wrapper, c);
>> + */
>> +#define container_of(p, type, member) \
>> + ((type *) (((char *) (p)) - offsetof(type, member)))
>> +
>> #define _RTE_STR(x) #x
>> /** Take a macro value and get a string version of it */
>> #define RTE_STR(x) _RTE_STR(x)
>>
>
> This gives compilation error for mlx5, because the libraries mlx depends
> defines same macro:
> ..../rte_common.h:338:9: error: 'container_of' macro redefined
> /usr/include/infiniband/verbs.h:77:9: note: previous definition is here
>
> Does it make sense to protect macro with
> #ifndef container_of
> ....
> #endif
Sounds good - probably would prevent double definition in future if
someone includes any linux header having similar definition.
Generally the container_of definitions are consistent - that is, they
would invariably use the offsetof from member. In which case, creating a
new dpdk_* would only duplicate. Thus, I prefer the #ifndef.
>
> OR
>
> add a dpdk prefix?
>
>
> Regards,
> ferruh
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net
2016-08-29 17:20 ` Ferruh Yigit
@ 2016-08-30 4:36 ` Shreyansh Jain
2016-09-08 5:46 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-30 4:36 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
On Monday 29 August 2016 10:50 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> Now that all pdev are pci drivers, we don't need to register crypto and ethdev
>> drivers through a dedicated channel.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> ....
>
>> -void rte_eth_driver_register(struct eth_driver *eth_drv);
>
> Function needs to be removed from .map file
Actually here I was a little confused.
This is part of DPDK_2.2 - an old release. Would removing from an old
release break compatibility for any system using the new release but
still adhering to older APIs?
Also, there is the case of this comment [1] from Neil Horman (and
counter argument [2]) about not removing
'rte_cryptodev_pmd_driver_register' from map file because there was no
deprecation notice.
Overall situation is that I have maintained the previous patch of
'rte_cryptodev_pmd_driver_register' removal but refrained from removing
new symbol - waiting for a little more clarification.
Is it OK to remove a symbol from an older release without a deprecation
notice? Or, should a deprecation notice follow this patch?
[1] http://dpdk.org/ml/archives/dev/2016-June/042439.html
[2] http://dpdk.org/ml/archives/dev/2016-June/042444.html
>
>> -
>> -/**
>> * Convert a numerical speed in Mbps to a bitmap flag that can be used in
>> * the bitmap link_speeds of the struct rte_eth_conf
>> *
>>
>
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-08-29 16:57 ` Ferruh Yigit
@ 2016-08-30 4:38 ` Shreyansh Jain
2016-09-08 5:49 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-30 4:38 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On Monday 29 August 2016 10:27 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> All PMD_VDEV drivers can now use rte_vdev_driver instead of the
>> rte_driver (which is embedded in the rte_vdev_driver).
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>
> ....
>
>> diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
>> index 6b15381..fa00e52 100644
>> --- a/drivers/net/xenvirt/rte_eth_xenvirt.c
>> +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
>> @@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
>> return 0;
>> }
>
> xenvirt missing header file rte_vdev.h:
>
> CC rte_eth_xenvirt.o
> ..../drivers/net/xenvirt/rte_eth_xenvirt.c:762:31: error: variable has
> incomplete type 'struct rte_vdev_driver'
> static struct rte_vdev_driver pmd_xenvirt_drv = {
Thanks for highlighting. I will fix this.
>
>
>>
>> -static struct rte_driver pmd_xenvirt_drv = {
>> - .type = PMD_VDEV,
>> - .init = rte_pmd_xenvirt_devinit,
>> - .uninit = rte_pmd_xenvirt_devuninit,
>> +static struct rte_vdev_driver pmd_xenvirt_drv = {
>> + .driver = {
>> + .type = PMD_VDEV,
>> + .init = rte_pmd_xenvirt_devinit,
>> + .uninit = rte_pmd_xenvirt_devuninit
>> + },
>> };
>>
>> -PMD_REGISTER_DRIVER(pmd_xenvirt_drv, eth_xenvirt);
>> +DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
>> DRIVER_REGISTER_PARAM_STRING(eth_xenvirt,
>> "mac=<mac addr>");
>>
>
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members
2016-08-29 16:53 ` Ferruh Yigit
@ 2016-08-30 4:38 ` Shreyansh Jain
2016-09-08 5:55 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-30 4:38 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On Monday 29 August 2016 10:23 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
>> Now that rte_device is available, drivers can start using its members (numa,
>> name) as well as link themselves into another rte_device list.
>>
>> As of now no one is using this list, but can be used for moving over all
>> devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> app/test/virtual_pmd.c | 4 ++--
>> drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
>> drivers/net/i40e/i40e_ethdev.c | 6 ++++--
>> drivers/net/virtio/virtio_pci.c | 5 +++--
>> lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
>> lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
>> lib/librte_eal/common/include/rte_pci.h | 3 +--
>> lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
>> lib/librte_ether/rte_ethdev.c | 2 +-
>> 9 files changed, 26 insertions(+), 20 deletions(-)
>
> mlx5.c needs to be updated too:
>
> CC mlx5.o
> ..../drivers/net/mlx5/mlx5.c:514:34: error: no member named 'devargs' in
> 'struct rte_pci_device'
> err = mlx5_args(priv, pci_dev->devargs);
> ~~~~~~~ ^
>
>
Ok. I will fix this. Thanks.
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-08-29 16:49 ` Ferruh Yigit
@ 2016-08-30 4:59 ` Shreyansh Jain
2016-09-08 5:51 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-30 4:59 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On Monday 29 August 2016 10:19 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
>> Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
>>
>> Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
>> as well as assigning a name to eth_driver.pci_drv.name member.
>> In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
>> populated into the rte_driver.name member - assignments through eth_driver
>> has been removed.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> app/test/test_pci.c | 10 +++++++---
>> app/test/virtual_pmd.c | 2 +-
>> drivers/crypto/qat/qat_qp.c | 2 +-
>> drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
>
> bnx2x_rxtx.c also needs to be updated:
>
> CC bnx2x_rxtx.o
> ..../drivers/net/bnx2x/bnx2x_rxtx.c:22:25: error: no member named 'name'
> in 'struct rte_pci_driver'
> dev->driver->pci_drv.name, ring_name,
> dev->data->port_id, queue_id);
>
> ....
>
>
> Also szedata2 driver seems missed:
>
> CC rte_eth_szedata2.o
> ..../drivers/net/szedata2/rte_eth_szedata2.c:1575:4: error: field
> designator 'name' does not refer to any field in type 'struct
> rte_pci_driver'
> .name = RTE_SZEDATA2_PCI_DRIVER_NAME,
> ^
>
>
>
Ok - I will fix this. It seems I really need a better way to test before
sending out the patches.
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-30 4:27 ` Shreyansh Jain
@ 2016-08-30 10:30 ` Thomas Monjalon
2016-08-30 11:59 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-08-30 10:30 UTC (permalink / raw)
To: Shreyansh Jain
Cc: Ferruh Yigit, dev, viktorin, david.marchand, hemant.agrawal
2016-08-30 09:57, Shreyansh Jain:
> On Monday 29 August 2016 10:13 PM, Ferruh Yigit wrote:
> > This gives compilation error for mlx5, because the libraries mlx depends
> > defines same macro:
> > ..../rte_common.h:338:9: error: 'container_of' macro redefined
> > /usr/include/infiniband/verbs.h:77:9: note: previous definition is here
>
> I thought testing with scripts/test-build.sh and default configuration
> would compile all drivers - I was wrong. I will retest the patches and
> release again.
>
> Is there a better way to test that no driver breaks? Any particular
> parameters I should use for test-build.sh?
Yes I suggest to create a file ~/.config/dpdk/devel.config to adapt the
configuration to your system.
Once you have installed the required dependencies, you can make this kind
of configuration:
mlxdep=$root/mlx/mofed-3.3-1.0.0.0
szedep=$root/sze/usr-1.1.4
if echo $DPDK_TARGET | grep -q '^x86_64' ; then
export DPDK_DEP_ARCHIVE=y
export DPDK_DEP_ZLIB=y
export DPDK_DEP_PCAP=y
export DPDK_DEP_SSL=y
export DPDK_DEP_MOFED=y
export DPDK_DEP_SZE=y
export DPDK_DEP_CFLAGS="-I$mlxdep/include -I$szedep/include"
export DPDK_DEP_LDFLAGS="-L$mlxdep/lib -L$szedep/lib64 -rpath=$szedep/lib64"
export AESNI_MULTI_BUFFER_LIB_PATH=$root/aesni/ipsec-043
export LIBSSO_SNOW3G_PATH=$root/libsso/libsso-snow3g-0.3.1
export LIBSSO_KASUMI_PATH=$root/libsso/libsso-kasumi-0.3.1
fi
> I used 'x86_64-native-linuxapp-gcc+default+debug+shared' for all patches.
It is a good idea to test also with clang (x86_64-native-linuxapp-clang)
and another arch (e.g. arm64-thunderx-linuxapp-gcc).
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-30 10:30 ` Thomas Monjalon
@ 2016-08-30 11:59 ` Shreyansh Jain
2016-08-30 13:42 ` Thomas Monjalon
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-30 11:59 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Ferruh Yigit, dev, viktorin, david.marchand, hemant.agrawal
Hi Thomas,
On Tuesday 30 August 2016 04:00 PM, Thomas Monjalon wrote:
> 2016-08-30 09:57, Shreyansh Jain:
>> On Monday 29 August 2016 10:13 PM, Ferruh Yigit wrote:
>>> This gives compilation error for mlx5, because the libraries mlx depends
>>> defines same macro:
>>> ..../rte_common.h:338:9: error: 'container_of' macro redefined
>>> /usr/include/infiniband/verbs.h:77:9: note: previous definition is here
>>
>> I thought testing with scripts/test-build.sh and default configuration
>> would compile all drivers - I was wrong. I will retest the patches and
>> release again.
>>
>> Is there a better way to test that no driver breaks? Any particular
>> parameters I should use for test-build.sh?
>
> Yes I suggest to create a file ~/.config/dpdk/devel.config to adapt the
> configuration to your system.
> Once you have installed the required dependencies, you can make this kind
> of configuration:
Ok.
>
> mlxdep=$root/mlx/mofed-3.3-1.0.0.0
> szedep=$root/sze/usr-1.1.4
What does '$root' here refer to?
I am assuming 'mofed-3.3-1.0.0.0' and 'usr-1.1.4' are part of some
dependencies that I should be revolving. Is that so?
As of now I don't have much idea about this - I will have a look and
ping back in case I am stuck.
> if echo $DPDK_TARGET | grep -q '^x86_64' ; then
> export DPDK_DEP_ARCHIVE=y
> export DPDK_DEP_ZLIB=y
> export DPDK_DEP_PCAP=y
> export DPDK_DEP_SSL=y
> export DPDK_DEP_MOFED=y
> export DPDK_DEP_SZE=y
> export DPDK_DEP_CFLAGS="-I$mlxdep/include -I$szedep/include"
> export DPDK_DEP_LDFLAGS="-L$mlxdep/lib -L$szedep/lib64 -rpath=$szedep/lib64"
> export AESNI_MULTI_BUFFER_LIB_PATH=$root/aesni/ipsec-043
> export LIBSSO_SNOW3G_PATH=$root/libsso/libsso-snow3g-0.3.1
> export LIBSSO_KASUMI_PATH=$root/libsso/libsso-kasumi-0.3.1
> fi
Thanks. I will try the above.
>
>> I used 'x86_64-native-linuxapp-gcc+default+debug+shared' for all patches.
>
> It is a good idea to test also with clang (x86_64-native-linuxapp-clang)
> and another arch (e.g. arm64-thunderx-linuxapp-gcc).
Before releasing v9, I will do these steps.
Thank you for suggestions.
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (24 preceding siblings ...)
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members Shreyansh Jain
@ 2016-08-30 13:27 ` Ferruh Yigit
2016-09-01 12:36 ` Shreyansh Jain
2016-09-01 18:29 ` Jan Viktorin
26 siblings, 1 reply; 375+ messages in thread
From: Ferruh Yigit @ 2016-08-30 13:27 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
> Based on master (e22856313fff2)
>
> Background:
> ===========
>
> It includes two different patch-sets floated on ML earlier:
> * Original patch series is from David Marchand [1], [2].
> `- This focused mainly on PCI (PDEV) part
> `- v7 of this was posted by me [8] in August/2016
> * Patch series [4] from Jan Viktorin
> `- This focused on VDEV and rte_device integration
>
> Introduction:
> =============
>
> This patch series introduces a generic device model, moving away from PCI
> centric code layout. Key change is to introduce rte_driver/rte_device
> structures at the top level which are inherited by
> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> future),...}.
>
> Key motivation for this series is to move away from PCI centric design of
> EAL to a more hierarchical device model - pivoted around a generic driver
> and device. Each specific driver and device can inherit the common
> properties of the generic set and build upon it through driver/device
> specific functions.
>
> Earlier, the EAL device initialization model was:
> (Refer: [3])
>
> --
> Constructor:
> |- PMD_DRIVER_REGISTER(rte_driver)
> `- insert into dev_driver_list, rte_driver object
>
> rte_eal_init():
> |- rte_eal_pci_init()
> | `- scan and fill pci_device_list from sysfs
> |
> |- rte_eal_dev_init()
> | `- For each rte_driver in dev_driver_list
> | `- call the rte_driver->init() function
> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
> | |- eth_driver have rte_pci_driver embedded in them
> | `- rte_eth_driver_register installs the
> | rte_pci_driver->devinit/devuninit callbacks.
> |
> |- rte_eal_pci_probe()
> | |- For each device detected, dev_driver_list is parsed and matching is
> | | done.
> | |- For each matching device, the rte_pci_driver->devinit() is called.
> | |- Default map is to rte_eth_dev_init() which in turn creates a
> | | new ethernet device (eth_dev)
> | | `- eth_drv->eth_dev_init() is called which is implemented by
> `--| individual PMD drivers.
>
> --
>
> The structure of driver looks something like:
>
> +------------+ ._____.
> | rte_driver <-----| PMD |___
> | .init | `-----` \
> +----.-------+ | \
> `-. | What PMD actually is
> \ | |
> +----------v----+ |
> | eth_driver | |
> | .eth_dev_init | |
> +----.----------+ |
> `-. |
> \ |
> +------------v---+
> | rte_pci_driver |
> | .pci_devinit |
> +----------------+
>
> and all devices are part of a following linked lists:
> - dev_driver_list for all rte_drivers
> - pci_device_list for all devices, whether PCI or VDEV
>
>
> From the above:
> * a PMD initializes a rte_driver, eth_driver even though actually it is a
> pci_driver
> * initialization routines are passed from rte_driver->pci_driver->eth_driver
> even though they should ideally be rte_eal_init()->rte_pci_driver()
> * For a single driver/device type model, this is not necessarily a
> functional issue - but more of a design language.
> * But, when number of driver/device type increase, this would create problem
> in how driver<=>device links are represented.
>
> Proposed Architecture:
> ======================
>
> A nice representation has already been created by David in [3]. Copying that
> here:
>
> +------------------+ +-------------------------------+
> | | | |
> | rte_pci_device | | rte_pci_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> +-------------------------------+
>
> - for ethdev on top of vdev devices
>
> +------------------+ +-------------------------------+
> | | | |
> | drv specific | | rte_vdev_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> | int priv_size |
> | |
> +-------------------------------+
There are also "eth_driver" and "rte_cryptodev_driver", which can be
represent as:
+-----------------------------------+
| |
| eth_driver / rte_cryptodev_driver |
| |
| +-------------------------------+ |
| | | |
| | rte_pci_driver | |
| | | |
| | +---------------------------+ | |
| | | | | |
| | | rte_driver | | |
| | | char name[] | | |
| | | int init(rte_device *) | | |
| | | int uninit(rte_device *) | | |
| | | | | |
| | +---------------------------+ | |
| | | |
| +-------------------------------+ |
| |
+-----------------------------------+
Is eth_driver really needs to be inherited from rte_pci_driver?
It is possible to have ethernet driver, without PCI bus, at least we
have virtual driver samples.
How about:
+-------------------------------+
| |
| rte_pci_driver / |
| rte_vdev_driver |
| +---------------------------+ | +-------------------+
| | | | | eth_driver |
| | rte_driver |<---------- driver |
| | char name[] | | | eth_dev_init |
| | int init(rte_device *) | | | eth_dev_uninit |
| | int uninit(rte_device *) | | | |
| | | | | |
| +---------------------------+ | | |
| functional_driver ------------------>| |
+-------------------------------+ +-------------------+
Currently there is no way to reference rte_vdev_driver from eth_driver,
since it only has pci_drv field.
With this update, it can be possible to create eth_driver and
rte_eth_vdev_probe() for virtual drivers for example. (Although this may
not necessary right now, this gives ability to do.)
Another think, what do you think moving "dev_private_size" from
eth_driver and rte_cryptodev_driver to rte_driver, since this looks like
generic need for drivers.
And last think, what do you think renaming eth_driver to rte_eth_driver
to be consistent?
Thanks,
ferruh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-30 11:59 ` Shreyansh Jain
@ 2016-08-30 13:42 ` Thomas Monjalon
2016-08-31 4:26 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-08-30 13:42 UTC (permalink / raw)
To: Shreyansh Jain
Cc: Ferruh Yigit, dev, viktorin, david.marchand, hemant.agrawal
2016-08-30 17:29, Shreyansh Jain:
> On Tuesday 30 August 2016 04:00 PM, Thomas Monjalon wrote:
> > 2016-08-30 09:57, Shreyansh Jain:
> >> Is there a better way to test that no driver breaks? Any particular
> >> parameters I should use for test-build.sh?
> >
> > Yes I suggest to create a file ~/.config/dpdk/devel.config to adapt the
> > configuration to your system.
> > Once you have installed the required dependencies, you can make this kind
> > of configuration:
>
> Ok.
>
> > mlxdep=$root/mlx/mofed-3.3-1.0.0.0
> > szedep=$root/sze/usr-1.1.4
>
> What does '$root' here refer to?
It is the directory where I compile the DPDK dependencies.
> I am assuming 'mofed-3.3-1.0.0.0' and 'usr-1.1.4' are part of some
> dependencies that I should be revolving. Is that so?
Yes, download and compile them as explain in the respective guides.
> As of now I don't have much idea about this - I will have a look and
> ping back in case I am stuck.
>
> > if echo $DPDK_TARGET | grep -q '^x86_64' ; then
> > export DPDK_DEP_ARCHIVE=y
> > export DPDK_DEP_ZLIB=y
> > export DPDK_DEP_PCAP=y
> > export DPDK_DEP_SSL=y
You need to install the packages to resolve these dependencies
(libarchive-dev, libzip-dev, libpcap-dev, libcrypto-dev).
> > export DPDK_DEP_MOFED=y
> > export DPDK_DEP_SZE=y
> > export DPDK_DEP_CFLAGS="-I$mlxdep/include -I$szedep/include"
> > export DPDK_DEP_LDFLAGS="-L$mlxdep/lib -L$szedep/lib64 -rpath=$szedep/lib64"
> > export AESNI_MULTI_BUFFER_LIB_PATH=$root/aesni/ipsec-043
> > export LIBSSO_SNOW3G_PATH=$root/libsso/libsso-snow3g-0.3.1
> > export LIBSSO_KASUMI_PATH=$root/libsso/libsso-kasumi-0.3.1
> > fi
>
> Thanks. I will try the above.
>
> >
> >> I used 'x86_64-native-linuxapp-gcc+default+debug+shared' for all patches.
> >
> > It is a good idea to test also with clang (x86_64-native-linuxapp-clang)
> > and another arch (e.g. arm64-thunderx-linuxapp-gcc).
>
> Before releasing v9, I will do these steps.
> Thank you for suggestions.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
2016-08-29 16:49 ` Ferruh Yigit
@ 2016-08-30 15:47 ` Ferruh Yigit
2016-09-01 13:54 ` Shreyansh Jain
1 sibling, 1 reply; 375+ messages in thread
From: Ferruh Yigit @ 2016-08-30 15:47 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
> Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
>
> Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
> as well as assigning a name to eth_driver.pci_drv.name member.
> In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
> populated into the rte_driver.name member - assignments through eth_driver
> has been removed.
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
There are a few name fields:
1) eth_dev->data->name
2) eth_dev->data->drv_name
3) rte_driver->name
4) dev_info->driver_name
What should be the relation between them?
I guess 1) is device_name, 2, 3, 4 are same thing and driver_name.
If this is correct, virtual drivers needs to be updated for this,
because for them 3 != (2 == 4). They all use global variable for 2 & 4.
And what do you think removing 2) completely?
I guess it exists for virtual devices, since for them eth_driver is not
exists and not able to access to rte_driver->name from eth_dev, but this
is solvable.
Thanks,
ferruh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update Shreyansh Jain
@ 2016-08-30 16:34 ` Pattan, Reshma
2016-08-31 4:24 ` Shreyansh Jain
2016-09-08 5:48 ` Shreyansh Jain
0 siblings, 2 replies; 375+ messages in thread
From: Pattan, Reshma @ 2016-08-30 16:34 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi,
> +/**
> + * Utility function to write a pci device name, this device name can
> +later be
> + * used to retrieve the corresponding rte_pci_addr using
> +eal_parse_pci_*
> + * BDF helpers.
> + *
> + * @param addr
> + * The PCI Bus-Device-Function address
> + * @param output
> + * The output buffer string
> + * @param size
> + * The output buffer size
> + * @return
> + * 0 on success, negative on error.
> + */
This function doesn't have any return value. Need to change the @return description.
> +static inline void
> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
> + char *output, size_t size)
> +{
> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
> + addr->domain, addr->bus,
> + addr->devid, addr->function) >= 0); }
> +
Thanks,
Reshma
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update
2016-08-30 16:34 ` Pattan, Reshma
@ 2016-08-31 4:24 ` Shreyansh Jain
2016-09-08 5:48 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-31 4:24 UTC (permalink / raw)
To: Pattan, Reshma, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi,
On Tuesday 30 August 2016 10:04 PM, Pattan, Reshma wrote:
> Hi,
>
>> +/**
>> + * Utility function to write a pci device name, this device name can
>> +later be
>> + * used to retrieve the corresponding rte_pci_addr using
>> +eal_parse_pci_*
>> + * BDF helpers.
>> + *
>> + * @param addr
>> + * The PCI Bus-Device-Function address
>> + * @param output
>> + * The output buffer string
>> + * @param size
>> + * The output buffer size
>> + * @return
>> + * 0 on success, negative on error.
>> + */
>
> This function doesn't have any return value. Need to change the @return description.
I will correct this in v9. Thanks for review.
>
>> +static inline void
>> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
>> + char *output, size_t size)
>> +{
>> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
>> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
>> + addr->domain, addr->bus,
>> + addr->devid, addr->function) >= 0); }
>> +
>
> Thanks,
> Reshma
>
-
Shreyansh
--
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-30 13:42 ` Thomas Monjalon
@ 2016-08-31 4:26 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-08-31 4:26 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Ferruh Yigit, dev, viktorin, david.marchand, hemant.agrawal
Hi Thomas,
On Tuesday 30 August 2016 07:12 PM, Thomas Monjalon wrote:
> 2016-08-30 17:29, Shreyansh Jain:
>> On Tuesday 30 August 2016 04:00 PM, Thomas Monjalon wrote:
>>> 2016-08-30 09:57, Shreyansh Jain:
>>>> Is there a better way to test that no driver breaks? Any particular
>>>> parameters I should use for test-build.sh?
>>>
>>> Yes I suggest to create a file ~/.config/dpdk/devel.config to adapt the
>>> configuration to your system.
>>> Once you have installed the required dependencies, you can make this kind
>>> of configuration:
>>
>> Ok.
>>
>>> mlxdep=$root/mlx/mofed-3.3-1.0.0.0
>>> szedep=$root/sze/usr-1.1.4
>>
>> What does '$root' here refer to?
>
> It is the directory where I compile the DPDK dependencies.
Ok - understood. I guessed the same
>
>> I am assuming 'mofed-3.3-1.0.0.0' and 'usr-1.1.4' are part of some
>> dependencies that I should be revolving. Is that so?
>
> Yes, download and compile them as explain in the respective guides.
Ok.
>
>> As of now I don't have much idea about this - I will have a look and
>> ping back in case I am stuck.
>>
>>> if echo $DPDK_TARGET | grep -q '^x86_64' ; then
>>> export DPDK_DEP_ARCHIVE=y
>>> export DPDK_DEP_ZLIB=y
>>> export DPDK_DEP_PCAP=y
>>> export DPDK_DEP_SSL=y
>
> You need to install the packages to resolve these dependencies
> (libarchive-dev, libzip-dev, libpcap-dev, libcrypto-dev).
Thanks for the info.
>
>>> export DPDK_DEP_MOFED=y
>>> export DPDK_DEP_SZE=y
>>> export DPDK_DEP_CFLAGS="-I$mlxdep/include -I$szedep/include"
>>> export DPDK_DEP_LDFLAGS="-L$mlxdep/lib -L$szedep/lib64 -rpath=$szedep/lib64"
>>> export AESNI_MULTI_BUFFER_LIB_PATH=$root/aesni/ipsec-043
>>> export LIBSSO_SNOW3G_PATH=$root/libsso/libsso-snow3g-0.3.1
>>> export LIBSSO_KASUMI_PATH=$root/libsso/libsso-kasumi-0.3.1
>>> fi
>>
>> Thanks. I will try the above.
>>
>>>
>>>> I used 'x86_64-native-linuxapp-gcc+default+debug+shared' for all patches.
>>>
>>> It is a good idea to test also with clang (x86_64-native-linuxapp-clang)
>>> and another arch (e.g. arm64-thunderx-linuxapp-gcc).
>>
>> Before releasing v9, I will do these steps.
>> Thank you for suggestions.
>
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization
2016-08-30 13:27 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Ferruh Yigit
@ 2016-09-01 12:36 ` Shreyansh Jain
2016-09-08 7:03 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-01 12:36 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
Sorry for the delay in my reply.
Please find some comments inline.
On Tuesday 30 August 2016 06:57 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> Based on master (e22856313fff2)
>>
>> Background:
>> ===========
>>
>> It includes two different patch-sets floated on ML earlier:
>> * Original patch series is from David Marchand [1], [2].
>> `- This focused mainly on PCI (PDEV) part
>> `- v7 of this was posted by me [8] in August/2016
>> * Patch series [4] from Jan Viktorin
>> `- This focused on VDEV and rte_device integration
>>
>> Introduction:
>> =============
>>
>> This patch series introduces a generic device model, moving away from PCI
>> centric code layout. Key change is to introduce rte_driver/rte_device
>> structures at the top level which are inherited by
>> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
>> future),...}.
>>
>> Key motivation for this series is to move away from PCI centric design of
>> EAL to a more hierarchical device model - pivoted around a generic driver
>> and device. Each specific driver and device can inherit the common
>> properties of the generic set and build upon it through driver/device
>> specific functions.
>>
>> Earlier, the EAL device initialization model was:
>> (Refer: [3])
>>
>> --
>> Constructor:
>> |- PMD_DRIVER_REGISTER(rte_driver)
>> `- insert into dev_driver_list, rte_driver object
>>
>> rte_eal_init():
>> |- rte_eal_pci_init()
>> | `- scan and fill pci_device_list from sysfs
>> |
>> |- rte_eal_dev_init()
>> | `- For each rte_driver in dev_driver_list
>> | `- call the rte_driver->init() function
>> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
>> | |- eth_driver have rte_pci_driver embedded in them
>> | `- rte_eth_driver_register installs the
>> | rte_pci_driver->devinit/devuninit callbacks.
>> |
>> |- rte_eal_pci_probe()
>> | |- For each device detected, dev_driver_list is parsed and matching is
>> | | done.
>> | |- For each matching device, the rte_pci_driver->devinit() is called.
>> | |- Default map is to rte_eth_dev_init() which in turn creates a
>> | | new ethernet device (eth_dev)
>> | | `- eth_drv->eth_dev_init() is called which is implemented by
>> `--| individual PMD drivers.
>>
>> --
>>
>> The structure of driver looks something like:
>>
>> +------------+ ._____.
>> | rte_driver <-----| PMD |___
>> | .init | `-----` \
>> +----.-------+ | \
>> `-. | What PMD actually is
>> \ | |
>> +----------v----+ |
>> | eth_driver | |
>> | .eth_dev_init | |
>> +----.----------+ |
>> `-. |
>> \ |
>> +------------v---+
>> | rte_pci_driver |
>> | .pci_devinit |
>> +----------------+
>>
>> and all devices are part of a following linked lists:
>> - dev_driver_list for all rte_drivers
>> - pci_device_list for all devices, whether PCI or VDEV
>>
>>
>> From the above:
>> * a PMD initializes a rte_driver, eth_driver even though actually it is a
>> pci_driver
>> * initialization routines are passed from rte_driver->pci_driver->eth_driver
>> even though they should ideally be rte_eal_init()->rte_pci_driver()
>> * For a single driver/device type model, this is not necessarily a
>> functional issue - but more of a design language.
>> * But, when number of driver/device type increase, this would create problem
>> in how driver<=>device links are represented.
>>
>> Proposed Architecture:
>> ======================
>>
>> A nice representation has already been created by David in [3]. Copying that
>> here:
>>
>> +------------------+ +-------------------------------+
>> | | | |
>> | rte_pci_device | | rte_pci_driver |
>> | | | |
>> +-------------+ | +--------------+ | | +---------------------------+ |
>> | | | | | | | | | |
>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>> | | | | char name[] | | | | char name[] | |
>> +-------------+ | | | | | | int init(rte_device *) | |
>> | +--------------+ | | | int uninit(rte_device *) | |
>> | | | | | |
>> +------------------+ | +---------------------------+ |
>> | |
>> +-------------------------------+
>>
>> - for ethdev on top of vdev devices
>>
>> +------------------+ +-------------------------------+
>> | | | |
>> | drv specific | | rte_vdev_driver |
>> | | | |
>> +-------------+ | +--------------+ | | +---------------------------+ |
>> | | | | | | | | | |
>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>> | | | | char name[] | | | | char name[] | |
>> +-------------+ | | | | | | int init(rte_device *) | |
>> | +--------------+ | | | int uninit(rte_device *) | |
>> | | | | | |
>> +------------------+ | +---------------------------+ |
>> | |
>> | int priv_size |
>> | |
>> +-------------------------------+
I am in agreement to all the points you have raised below.
Still, there are some comments:
>
> There are also "eth_driver" and "rte_cryptodev_driver", which can be
> represent as:
> +-----------------------------------+
> | |
> | eth_driver / rte_cryptodev_driver |
> | |
> | +-------------------------------+ |
> | | | |
> | | rte_pci_driver | |
> | | | |
> | | +---------------------------+ | |
> | | | | | |
> | | | rte_driver | | |
> | | | char name[] | | |
> | | | int init(rte_device *) | | |
> | | | int uninit(rte_device *) | | |
> | | | | | |
> | | +---------------------------+ | |
> | | | |
> | +-------------------------------+ |
> | |
> +-----------------------------------+
>
> Is eth_driver really needs to be inherited from rte_pci_driver?
> It is possible to have ethernet driver, without PCI bus, at least we
> have virtual driver samples.
I agree with this. There would be cases where even non-PCI devices are
ethernet devices. As of now, in the proposed patchset, rte_soc_driver
has been added into this but it is not a scalable solution. We cannot go
on and add all type of devices into this.
Having said this, back reference to type of ethernet device would be
important if the ethernet driver needs to refer to some hardware
specific information as part of rte_xxx_driver.
>
> How about:
> +-------------------------------+
> | |
> | rte_pci_driver / |
> | rte_vdev_driver |
> | +---------------------------+ | +-------------------+
> | | | | | eth_driver |
> | | rte_driver |<---------- driver |
> | | char name[] | | | eth_dev_init |
> | | int init(rte_device *) | | | eth_dev_uninit |
> | | int uninit(rte_device *) | | | |
> | | | | | |
> | +---------------------------+ | | |
> | functional_driver ------------------>| |
> +-------------------------------+ +-------------------+
Even while I was re-creating this patchset I was wondering how to
realign the eth_driver<=>rte_eth_dev (even naming is inconsistent) with
rte_*_driver/device and rte_driver/device.
I agree with you that we should link eth_driver->rte_driver.
My only concern being a case where a PCI (or other) based ethernet
device needs access to driver structure for some info. Is that even a
possible usecase?
>
> Currently there is no way to reference rte_vdev_driver from eth_driver,
> since it only has pci_drv field.
True.
>
> With this update, it can be possible to create eth_driver and
> rte_eth_vdev_probe() for virtual drivers for example. (Although this may
> not necessary right now, this gives ability to do.)
>
Agree with you. This change can help various other similar cases.
>
>
> Another think, what do you think moving "dev_private_size" from
> eth_driver and rte_cryptodev_driver to rte_driver, since this looks like
> generic need for drivers.
I don't see any problem in this as well.
>
>
>
> And last think, what do you think renaming eth_driver to rte_eth_driver
> to be consistent?
Yes, I think it should have been a most basic patch -
eth_driver<->rte_eth_dev combination has existed too long.
>
>
> Thanks,
> ferruh
>
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-08-30 15:47 ` Ferruh Yigit
@ 2016-09-01 13:54 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-01 13:54 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi,
On Tuesday 30 August 2016 09:17 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
>> Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
>>
>> Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
>> as well as assigning a name to eth_driver.pci_drv.name member.
>> In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
>> populated into the rte_driver.name member - assignments through eth_driver
>> has been removed.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>
> There are a few name fields:
>
> 1) eth_dev->data->name
> 2) eth_dev->data->drv_name
> 3) rte_driver->name
> 4) dev_info->driver_name
>
>
> What should be the relation between them?
>
> I guess 1) is device_name, 2, 3, 4 are same thing and driver_name.
Yes, (1) is the ethernet device name.
(2), (3) are same, i.e. driver name
(4) is an output field for eth_dev_info_get method and would represent
same thing as (2) and (3).
>
> If this is correct, virtual drivers needs to be updated for this,
> because for them 3 != (2 == 4). They all use global variable for 2 & 4.
Ok. I didn't notice this. I will check it once again.
>
> And what do you think removing 2) completely?
> I guess it exists for virtual devices, since for them eth_driver is not
> exists and not able to access to rte_driver->name from eth_dev, but this
> is solvable.
Ok.
Probably, one way to solve is to make eth_dev->driver point to
rte_vdev_driver. That way, rte_driver->name would replace
eth_dev->data->drv_name.
I will give it a thought. Thanks for pointing out.
>
>
> Thanks,
> ferruh
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
` (25 preceding siblings ...)
2016-08-30 13:27 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Ferruh Yigit
@ 2016-09-01 18:29 ` Jan Viktorin
2016-09-02 5:32 ` Shreyansh Jain
26 siblings, 1 reply; 375+ messages in thread
From: Jan Viktorin @ 2016-09-01 18:29 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, david.marchand, thomas.monjalon, hemant.agrawal
Hi Shreyansh,
I am sorry to be quiet on this thread. I am traveling in those
two weeks and have some vacation. However, I passively follow the
conversation. Thank you for your work so far!
Regards
Jan
On Fri, 26 Aug 2016 19:26:38 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Based on master (e22856313fff2)
>
> Background:
> ===========
>
> It includes two different patch-sets floated on ML earlier:
> * Original patch series is from David Marchand [1], [2].
> `- This focused mainly on PCI (PDEV) part
> `- v7 of this was posted by me [8] in August/2016
> * Patch series [4] from Jan Viktorin
> `- This focused on VDEV and rte_device integration
>
> Introduction:
> =============
>
> This patch series introduces a generic device model, moving away from PCI
> centric code layout. Key change is to introduce rte_driver/rte_device
> structures at the top level which are inherited by
> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> future),...}.
>
> Key motivation for this series is to move away from PCI centric design of
> EAL to a more hierarchical device model - pivoted around a generic driver
> and device. Each specific driver and device can inherit the common
> properties of the generic set and build upon it through driver/device
> specific functions.
>
> Earlier, the EAL device initialization model was:
> (Refer: [3])
>
> --
> Constructor:
> |- PMD_DRIVER_REGISTER(rte_driver)
> `- insert into dev_driver_list, rte_driver object
>
> rte_eal_init():
> |- rte_eal_pci_init()
> | `- scan and fill pci_device_list from sysfs
> |
> |- rte_eal_dev_init()
> | `- For each rte_driver in dev_driver_list
> | `- call the rte_driver->init() function
> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
> | |- eth_driver have rte_pci_driver embedded in them
> | `- rte_eth_driver_register installs the
> | rte_pci_driver->devinit/devuninit callbacks.
> |
> |- rte_eal_pci_probe()
> | |- For each device detected, dev_driver_list is parsed and matching is
> | | done.
> | |- For each matching device, the rte_pci_driver->devinit() is called.
> | |- Default map is to rte_eth_dev_init() which in turn creates a
> | | new ethernet device (eth_dev)
> | | `- eth_drv->eth_dev_init() is called which is implemented by
> `--| individual PMD drivers.
>
> --
>
> The structure of driver looks something like:
>
> +------------+ ._____.
> | rte_driver <-----| PMD |___
> | .init | `-----` \
> +----.-------+ | \
> `-. | What PMD actually is
> \ | |
> +----------v----+ |
> | eth_driver | |
> | .eth_dev_init | |
> +----.----------+ |
> `-. |
> \ |
> +------------v---+
> | rte_pci_driver |
> | .pci_devinit |
> +----------------+
>
> and all devices are part of a following linked lists:
> - dev_driver_list for all rte_drivers
> - pci_device_list for all devices, whether PCI or VDEV
>
>
> From the above:
> * a PMD initializes a rte_driver, eth_driver even though actually it is a
> pci_driver
> * initialization routines are passed from rte_driver->pci_driver->eth_driver
> even though they should ideally be rte_eal_init()->rte_pci_driver()
> * For a single driver/device type model, this is not necessarily a
> functional issue - but more of a design language.
> * But, when number of driver/device type increase, this would create problem
> in how driver<=>device links are represented.
>
> Proposed Architecture:
> ======================
>
> A nice representation has already been created by David in [3]. Copying that
> here:
>
> +------------------+ +-------------------------------+
> | | | |
> | rte_pci_device | | rte_pci_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> +-------------------------------+
>
> - for ethdev on top of vdev devices
>
> +------------------+ +-------------------------------+
> | | | |
> | drv specific | | rte_vdev_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> | int priv_size |
> | |
> +-------------------------------+
>
> Representing from above, it would be:
>
> +--------------+
> | rte_driver |
> | name |
> | <Future> |
> +------^-------+ pci_driver_list
> | / vdev_driver_list
> `---. <<Inherits>> / /
> |\____________/_______ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_driver | | rte_vdev_driver |
> | pci_devinit() | | vdev_devinit() |
> | pci_devuninit()| | vdev_devuninit()|
> | <more> | | <more> |
> +-----------------+ +------------------+
>
>
> +--------------+
> | rte_device |
> | name |
> | <Future> |
> +------^-------+ pci_device_list
> | / xxx_device_list
> `---. <<Inherits>> / /
> |\____________/________ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_device | | rte_xxx_device |
> | <dev data> | | <dev data> |
> | <flags/intr> | | <flags/intr> |
> | <more> | | <more> |
> +-----------------+ +------------------+
>
> * Each driver type has its own structure which derives from the generic
> rte_driver structure.
> \- Each driver type maintains its own list, at the same time, rte_driver
> list also exists - so that *all* drivers can be looped on, if required.
> * Each device, associated with one or more drivers, has its own type
> derived from rte_device
> \- Each device _may_ maintain its own list (for example, in current
> implementation, vdev is not maintaining it).
>
> ==Introducing a new device/driver type implies==
> - creating their own rte_<xxx>.h file which contains the device/driver
> definitions.
> - defining the DRIVER_REGISTER_XXX helpers
>
>
> ==Hotplugging Support==
> - devices should be able to support attach/detach operations.
> - Earlier these functions were part of ethdev. They have been moved to eal
> to be more generic.
>
>
> About the Patches:
> ==================
>
> There are a large number of patches for this - primarily because the changes
> are quite varied and keeping them logically separate yet compilable is
> important. Most of the patches are small and those which are large touch the
> drivers (PMDs) to accommodate the structure changes:
>
> - Patches 0001~0003 are for introducing the container_of function (so that
> rte_device can be obtained from rte_pci_device, for example), and
> removing unused code.
> - Patches 0004~0007 just perform the ground work for enabling change from
> rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
> - In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
> including cryptodev, which is eventually generalized with PCI)
> - Patch 0009~0010 merge the crypto and pci functions for registration and
> naming.
> - Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
> complete bus and has been generalized into EAl from ethdev.
> - Patches 0015 introduces vdev init/uninit into separate C units and
> enables its compilation. Patch 0016~0017 build on it and remove the
> remaining legacy support for vdev/pdev distinctions.
> - Patches 0018~0022 enable the vdev drivers to register using the
> DRIVER_REGISTER_* operations, and remove their rte_driver->init()
> - Patch 0023 enables the rte_driver registration into a common driver
> linked list.
> - Patches 0024~0025 introduce the rte_device, a generalization of
> rte_xxx_device, and associated operation of creating rte_device linked
> list. It also enables the drivers to use rte_device.name/numa_node
> members rather than rte_xxx_device specific members.
>
> Notes:
> ======
>
> * Some sign-off were already provided by Jan on the original v5; But, as a
> large number of merges have been made, I am leaving those out just in case
> it is not sync with initial understanding.
>
> * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
> removed [7].
>
> References:
> ===========
>
> [1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
> [2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
> [3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> [4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
> [5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
> [6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
> [7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
> [8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
>
> Changes since v7:
> - Rebase over master (e22856313fff2)
> - Merge the patch series by David [1][2] and Jan [4] into a single set
> hereafter, PCI and VDEV, both are re-factored for rte_device/driver model
>
> Changes since v6:
> - rebase over 16.07 (b0a1419)
> - DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
> - review comments regarding missing information in log messages
> - new API additions to 16.11 map objects
> - review comment in [5] and [7] are not included in this series.
>
> Changes since v5:
> - Rebase over master (11c5e45d8)
> - Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in
> sync
> with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
> - Modifications to bnxt and thunderx driver PMD registration files for
> using the simplified PCI device registration helper macro
>
> Changes since v4:
> - Fix compilation issue after rebase on HEAD (913154e) in previous series
> - Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
> were removed by previous patchset. These are being used by pdump library
>
> Changes since v3:
> - rebase over HEAD (913154e)
> - Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
> - modify qede driver to use RTE_EAL_PCI_REGISTER
> - Argument check in hotplug functions
>
> Changes since v2:
> - rebase over HEAD (d76c193)
> - Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
>
> Changes since v1:
> - rebased on HEAD, new drivers should be okay
> - patches have been split into smaller pieces
> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> - device type has been removed from ethdev, as it was used only by hotplug
> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> dropped for now, we can do this once vdev drivers have been converted
>
> Shreyansh Jain (25):
> eal: define macro container_of
> eal: remove duplicate function declaration
> pci: no need for dynamic tailq init
> crypto: no need for a crypto pmd type
> drivers: align pci driver definitions
> eal: introduce init macros
> driver: init/uninit common wrappers for PCI drivers
> drivers: convert all pdev drivers as pci drivers
> driver: Remove driver register callbacks for crypto/net
> eal/pci: Helpers for device name parsing/update
> ethdev: do not scan all pci devices on attach
> eal: add hotplug operations for pci and vdev
> ethdev: convert to eal hotplug
> ethdev: get rid of device type
> eal: extract vdev infra
> eal: Remove PDEV/VDEV unused code
> drivers: convert PMD_VDEV drivers to use rte_vdev_driver
> eal: move init/uninit to rte_vdev_driver
> eal: remove PMD_DRIVER_REGISTER and unused pmd_types
> eal: rte_pci.h includes rte_dev.h
> eal: rename and move rte_pci_resource
> eal/pci: inherit rte_driver by rte_pci_driver
> eal: call rte_eal_driver_register
> eal: introduce rte_device
> eal/pci: Create rte_device list and fallback on its members
>
> app/test/test_pci.c | 10 +-
> app/test/virtual_pmd.c | 8 +-
> drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
> drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
> drivers/crypto/null/null_crypto_pmd.c | 7 +-
> drivers/crypto/qat/qat_qp.c | 2 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
> drivers/net/af_packet/rte_eth_af_packet.c | 11 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
> drivers/net/bnxt/bnxt_ethdev.c | 17 +-
> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> drivers/net/bonding/rte_eth_bond_pmd.c | 9 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/cxgbe/sge.c | 7 +-
> drivers/net/e1000/em_ethdev.c | 17 +-
> drivers/net/e1000/igb_ethdev.c | 41 +---
> drivers/net/ena/ena_ethdev.c | 20 +-
> drivers/net/enic/enic_ethdev.c | 24 +-
> drivers/net/fm10k/fm10k_ethdev.c | 30 +--
> drivers/net/i40e/i40e_ethdev.c | 31 +--
> drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
> drivers/net/i40e/i40e_fdir.c | 2 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
> drivers/net/mlx4/mlx4.c | 21 +-
> drivers/net/mlx5/mlx5.c | 20 +-
> drivers/net/mpipe/mpipe_tilegx.c | 18 +-
> drivers/net/nfp/nfp_net.c | 28 +--
> drivers/net/null/rte_eth_null.c | 11 +-
> drivers/net/pcap/rte_eth_pcap.c | 11 +-
> drivers/net/qede/qede_ethdev.c | 42 +---
> drivers/net/ring/rte_eth_ring.c | 11 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 28 +--
> drivers/net/thunderx/nicvf_ethdev.c | 21 +-
> drivers/net/vhost/rte_eth_vhost.c | 11 +-
> drivers/net/virtio/virtio_ethdev.c | 28 +--
> drivers/net/virtio/virtio_pci.c | 5 +-
> drivers/net/virtio/virtio_user_ethdev.c | 10 +-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
> drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
> drivers/net/xenvirt/rte_eth_xenvirt.c | 9 +-
> examples/ip_pipeline/init.c | 22 --
> lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
> lib/librte_cryptodev/rte_cryptodev.h | 2 -
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
> lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
> lib/librte_eal/bsdapp/eal/Makefile | 1 +
> lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
> lib/librte_eal/common/Makefile | 2 +-
> lib/librte_eal/common/eal_common_dev.c | 95 ++++----
> lib/librte_eal/common/eal_common_pci.c | 34 ++-
> lib/librte_eal/common/eal_common_vdev.c | 106 +++++++++
> lib/librte_eal/common/eal_private.h | 20 +-
> lib/librte_eal/common/include/rte_common.h | 16 ++
> lib/librte_eal/common/include/rte_dev.h | 77 +++++--
> lib/librte_eal/common/include/rte_eal.h | 3 +
> lib/librte_eal/common/include/rte_pci.h | 53 +++--
> lib/librte_eal/common/include/rte_tailq.h | 4 +-
> lib/librte_eal/common/include/rte_vdev.h | 96 ++++++++
> lib/librte_eal/linuxapp/eal/Makefile | 1 +
> lib/librte_eal/linuxapp/eal/eal.c | 1 +
> lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
> lib/librte_ether/rte_ethdev.c | 280 +++++-------------------
> lib/librte_ether/rte_ethdev.h | 40 ++--
> lib/librte_ether/rte_ether_version.map | 9 +
> 69 files changed, 784 insertions(+), 1020 deletions(-)
> create mode 100644 lib/librte_eal/common/eal_common_vdev.c
> create mode 100644 lib/librte_eal/common/include/rte_vdev.h
>
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization
2016-09-01 18:29 ` Jan Viktorin
@ 2016-09-02 5:32 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-02 5:32 UTC (permalink / raw)
To: Jan Viktorin; +Cc: dev, david.marchand, thomas.monjalon, Hemant Agrawal
Hi Jan,
> -----Original Message-----
> From: Jan Viktorin [mailto:viktorin@rehivetech.com]
> Sent: Thursday, September 01, 2016 11:59 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>
> Cc: dev@dpdk.org; david.marchand@6wind.com; thomas.monjalon@6wind.com; Hemant
> Agrawal <hemant.agrawal@nxp.com>
> Subject: Re: [PATCH v8 00/25] Introducing rte_driver/rte_device generalization
>
> Hi Shreyansh,
>
> I am sorry to be quiet on this thread. I am traveling in those
> two weeks and have some vacation. However, I passively follow the
> conversation. Thank you for your work so far!
No issues.
Thanks for your help.
>
> Regards
> Jan
>
> On Fri, 26 Aug 2016 19:26:38 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
> > Based on master (e22856313fff2)
> >
> > Background:
> > ===========
> >
> > It includes two different patch-sets floated on ML earlier:
> > * Original patch series is from David Marchand [1], [2].
> > `- This focused mainly on PCI (PDEV) part
> > `- v7 of this was posted by me [8] in August/2016
> > * Patch series [4] from Jan Viktorin
> > `- This focused on VDEV and rte_device integration
> >
> > Introduction:
> > =============
> >
> > This patch series introduces a generic device model, moving away from PCI
> > centric code layout. Key change is to introduce rte_driver/rte_device
> > structures at the top level which are inherited by
> > rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> > future),...}.
> >
> > Key motivation for this series is to move away from PCI centric design of
> > EAL to a more hierarchical device model - pivoted around a generic driver
> > and device. Each specific driver and device can inherit the common
> > properties of the generic set and build upon it through driver/device
> > specific functions.
> >
> > Earlier, the EAL device initialization model was:
> > (Refer: [3])
> >
> > --
> > Constructor:
> > |- PMD_DRIVER_REGISTER(rte_driver)
> > `- insert into dev_driver_list, rte_driver object
> >
> > rte_eal_init():
> > |- rte_eal_pci_init()
> > | `- scan and fill pci_device_list from sysfs
> > |
> > |- rte_eal_dev_init()
> > | `- For each rte_driver in dev_driver_list
> > | `- call the rte_driver->init() function
> > | |- PMDs designed to call rte_eth_driver_register(eth_driver)
> > | |- eth_driver have rte_pci_driver embedded in them
> > | `- rte_eth_driver_register installs the
> > | rte_pci_driver->devinit/devuninit callbacks.
> > |
> > |- rte_eal_pci_probe()
> > | |- For each device detected, dev_driver_list is parsed and matching is
> > | | done.
> > | |- For each matching device, the rte_pci_driver->devinit() is called.
> > | |- Default map is to rte_eth_dev_init() which in turn creates a
> > | | new ethernet device (eth_dev)
> > | | `- eth_drv->eth_dev_init() is called which is implemented by
> > `--| individual PMD drivers.
> >
> > --
> >
> > The structure of driver looks something like:
> >
> > +------------+ ._____.
> > | rte_driver <-----| PMD |___
> > | .init | `-----` \
> > +----.-------+ | \
> > `-. | What PMD actually is
> > \ | |
> > +----------v----+ |
> > | eth_driver | |
> > | .eth_dev_init | |
> > +----.----------+ |
> > `-. |
> > \ |
> > +------------v---+
> > | rte_pci_driver |
> > | .pci_devinit |
> > +----------------+
> >
> > and all devices are part of a following linked lists:
> > - dev_driver_list for all rte_drivers
> > - pci_device_list for all devices, whether PCI or VDEV
> >
> >
> > From the above:
> > * a PMD initializes a rte_driver, eth_driver even though actually it is a
> > pci_driver
> > * initialization routines are passed from rte_driver->pci_driver->eth_driver
> > even though they should ideally be rte_eal_init()->rte_pci_driver()
> > * For a single driver/device type model, this is not necessarily a
> > functional issue - but more of a design language.
> > * But, when number of driver/device type increase, this would create problem
> > in how driver<=>device links are represented.
> >
> > Proposed Architecture:
> > ======================
> >
> > A nice representation has already been created by David in [3]. Copying that
> > here:
> >
> > +------------------+ +-------------------------------+
> > | | | |
> > | rte_pci_device | | rte_pci_driver |
> > | | | |
> > +-------------+ | +--------------+ | | +---------------------------+ |
> > | | | | | | | | | |
> > | rte_eth_dev +---> rte_device +-----> rte_driver | |
> > | | | | char name[] | | | | char name[] | |
> > +-------------+ | | | | | | int init(rte_device *) | |
> > | +--------------+ | | | int uninit(rte_device *) | |
> > | | | | | |
> > +------------------+ | +---------------------------+ |
> > | |
> > +-------------------------------+
> >
> > - for ethdev on top of vdev devices
> >
> > +------------------+ +-------------------------------+
> > | | | |
> > | drv specific | | rte_vdev_driver |
> > | | | |
> > +-------------+ | +--------------+ | | +---------------------------+ |
> > | | | | | | | | | |
> > | rte_eth_dev +---> rte_device +-----> rte_driver | |
> > | | | | char name[] | | | | char name[] | |
> > +-------------+ | | | | | | int init(rte_device *) | |
> > | +--------------+ | | | int uninit(rte_device *) | |
> > | | | | | |
> > +------------------+ | +---------------------------+ |
> > | |
> > | int priv_size |
> > | |
> > +-------------------------------+
> >
> > Representing from above, it would be:
> >
> > +--------------+
> > | rte_driver |
> > | name |
> > | <Future> |
> > +------^-------+ pci_driver_list
> > | / vdev_driver_list
> > `---. <<Inherits>> / /
> > |\____________/_______ /
> > | / \ /
> > +-----------/-----+ +--------/---------+
> > | rte_pci_driver | | rte_vdev_driver |
> > | pci_devinit() | | vdev_devinit() |
> > | pci_devuninit()| | vdev_devuninit()|
> > | <more> | | <more> |
> > +-----------------+ +------------------+
> >
> >
> > +--------------+
> > | rte_device |
> > | name |
> > | <Future> |
> > +------^-------+ pci_device_list
> > | / xxx_device_list
> > `---. <<Inherits>> / /
> > |\____________/________ /
> > | / \ /
> > +-----------/-----+ +--------/---------+
> > | rte_pci_device | | rte_xxx_device |
> > | <dev data> | | <dev data> |
> > | <flags/intr> | | <flags/intr> |
> > | <more> | | <more> |
> > +-----------------+ +------------------+
> >
> > * Each driver type has its own structure which derives from the generic
> > rte_driver structure.
> > \- Each driver type maintains its own list, at the same time, rte_driver
> > list also exists - so that *all* drivers can be looped on, if required.
> > * Each device, associated with one or more drivers, has its own type
> > derived from rte_device
> > \- Each device _may_ maintain its own list (for example, in current
> > implementation, vdev is not maintaining it).
> >
> > ==Introducing a new device/driver type implies==
> > - creating their own rte_<xxx>.h file which contains the device/driver
> > definitions.
> > - defining the DRIVER_REGISTER_XXX helpers
> >
> >
> > ==Hotplugging Support==
> > - devices should be able to support attach/detach operations.
> > - Earlier these functions were part of ethdev. They have been moved to eal
> > to be more generic.
> >
> >
> > About the Patches:
> > ==================
> >
> > There are a large number of patches for this - primarily because the changes
> > are quite varied and keeping them logically separate yet compilable is
> > important. Most of the patches are small and those which are large touch the
> > drivers (PMDs) to accommodate the structure changes:
> >
> > - Patches 0001~0003 are for introducing the container_of function (so that
> > rte_device can be obtained from rte_pci_device, for example), and
> > removing unused code.
> > - Patches 0004~0007 just perform the ground work for enabling change from
> > rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
> > - In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
> > including cryptodev, which is eventually generalized with PCI)
> > - Patch 0009~0010 merge the crypto and pci functions for registration and
> > naming.
> > - Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
> > complete bus and has been generalized into EAl from ethdev.
> > - Patches 0015 introduces vdev init/uninit into separate C units and
> > enables its compilation. Patch 0016~0017 build on it and remove the
> > remaining legacy support for vdev/pdev distinctions.
> > - Patches 0018~0022 enable the vdev drivers to register using the
> > DRIVER_REGISTER_* operations, and remove their rte_driver->init()
> > - Patch 0023 enables the rte_driver registration into a common driver
> > linked list.
> > - Patches 0024~0025 introduce the rte_device, a generalization of
> > rte_xxx_device, and associated operation of creating rte_device linked
> > list. It also enables the drivers to use rte_device.name/numa_node
> > members rather than rte_xxx_device specific members.
> >
> > Notes:
> > ======
> >
> > * Some sign-off were already provided by Jan on the original v5; But, as a
> > large number of merges have been made, I am leaving those out just in case
> > it is not sync with initial understanding.
> >
> > * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
> > removed [7].
> >
> > References:
> > ===========
> >
> > [1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
> > [2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
> > [3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> > [4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
> > [5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
> > [6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
> > [7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
> > [8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
> >
> > Changes since v7:
> > - Rebase over master (e22856313fff2)
> > - Merge the patch series by David [1][2] and Jan [4] into a single set
> > hereafter, PCI and VDEV, both are re-factored for rte_device/driver model
> >
> > Changes since v6:
> > - rebase over 16.07 (b0a1419)
> > - DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
> > - review comments regarding missing information in log messages
> > - new API additions to 16.11 map objects
> > - review comment in [5] and [7] are not included in this series.
> >
> > Changes since v5:
> > - Rebase over master (11c5e45d8)
> > - Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in
> > sync
> > with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
> > - Modifications to bnxt and thunderx driver PMD registration files for
> > using the simplified PCI device registration helper macro
> >
> > Changes since v4:
> > - Fix compilation issue after rebase on HEAD (913154e) in previous series
> > - Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
> > were removed by previous patchset. These are being used by pdump library
> >
> > Changes since v3:
> > - rebase over HEAD (913154e)
> > - Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
> > - modify qede driver to use RTE_EAL_PCI_REGISTER
> > - Argument check in hotplug functions
> >
> > Changes since v2:
> > - rebase over HEAD (d76c193)
> > - Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
> >
> > Changes since v1:
> > - rebased on HEAD, new drivers should be okay
> > - patches have been split into smaller pieces
> > - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> > - device type has been removed from ethdev, as it was used only by hotplug
> > - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> > dropped for now, we can do this once vdev drivers have been converted
> >
> > Shreyansh Jain (25):
> > eal: define macro container_of
> > eal: remove duplicate function declaration
> > pci: no need for dynamic tailq init
> > crypto: no need for a crypto pmd type
> > drivers: align pci driver definitions
> > eal: introduce init macros
> > driver: init/uninit common wrappers for PCI drivers
> > drivers: convert all pdev drivers as pci drivers
> > driver: Remove driver register callbacks for crypto/net
> > eal/pci: Helpers for device name parsing/update
> > ethdev: do not scan all pci devices on attach
> > eal: add hotplug operations for pci and vdev
> > ethdev: convert to eal hotplug
> > ethdev: get rid of device type
> > eal: extract vdev infra
> > eal: Remove PDEV/VDEV unused code
> > drivers: convert PMD_VDEV drivers to use rte_vdev_driver
> > eal: move init/uninit to rte_vdev_driver
> > eal: remove PMD_DRIVER_REGISTER and unused pmd_types
> > eal: rte_pci.h includes rte_dev.h
> > eal: rename and move rte_pci_resource
> > eal/pci: inherit rte_driver by rte_pci_driver
> > eal: call rte_eal_driver_register
> > eal: introduce rte_device
> > eal/pci: Create rte_device list and fallback on its members
> >
> > app/test/test_pci.c | 10 +-
> > app/test/virtual_pmd.c | 8 +-
> > drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
> > drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
> > drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
> > drivers/crypto/null/null_crypto_pmd.c | 7 +-
> > drivers/crypto/qat/qat_qp.c | 2 +-
> > drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> > drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
> > drivers/net/af_packet/rte_eth_af_packet.c | 11 +-
> > drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
> > drivers/net/bnxt/bnxt_ethdev.c | 17 +-
> > drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> > drivers/net/bonding/rte_eth_bond_pmd.c | 9 +-
> > drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
> > drivers/net/cxgbe/cxgbe_main.c | 2 +-
> > drivers/net/cxgbe/sge.c | 7 +-
> > drivers/net/e1000/em_ethdev.c | 17 +-
> > drivers/net/e1000/igb_ethdev.c | 41 +---
> > drivers/net/ena/ena_ethdev.c | 20 +-
> > drivers/net/enic/enic_ethdev.c | 24 +-
> > drivers/net/fm10k/fm10k_ethdev.c | 30 +--
> > drivers/net/i40e/i40e_ethdev.c | 31 +--
> > drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
> > drivers/net/i40e/i40e_fdir.c | 2 +-
> > drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
> > drivers/net/mlx4/mlx4.c | 21 +-
> > drivers/net/mlx5/mlx5.c | 20 +-
> > drivers/net/mpipe/mpipe_tilegx.c | 18 +-
> > drivers/net/nfp/nfp_net.c | 28 +--
> > drivers/net/null/rte_eth_null.c | 11 +-
> > drivers/net/pcap/rte_eth_pcap.c | 11 +-
> > drivers/net/qede/qede_ethdev.c | 42 +---
> > drivers/net/ring/rte_eth_ring.c | 11 +-
> > drivers/net/szedata2/rte_eth_szedata2.c | 28 +--
> > drivers/net/thunderx/nicvf_ethdev.c | 21 +-
> > drivers/net/vhost/rte_eth_vhost.c | 11 +-
> > drivers/net/virtio/virtio_ethdev.c | 28 +--
> > drivers/net/virtio/virtio_pci.c | 5 +-
> > drivers/net/virtio/virtio_user_ethdev.c | 10 +-
> > drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
> > drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
> > drivers/net/xenvirt/rte_eth_xenvirt.c | 9 +-
> > examples/ip_pipeline/init.c | 22 --
> > lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
> > lib/librte_cryptodev/rte_cryptodev.h | 2 -
> > lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
> > lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
> > lib/librte_eal/bsdapp/eal/Makefile | 1 +
> > lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
> > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
> > lib/librte_eal/common/Makefile | 2 +-
> > lib/librte_eal/common/eal_common_dev.c | 95 ++++----
> > lib/librte_eal/common/eal_common_pci.c | 34 ++-
> > lib/librte_eal/common/eal_common_vdev.c | 106 +++++++++
> > lib/librte_eal/common/eal_private.h | 20 +-
> > lib/librte_eal/common/include/rte_common.h | 16 ++
> > lib/librte_eal/common/include/rte_dev.h | 77 +++++--
> > lib/librte_eal/common/include/rte_eal.h | 3 +
> > lib/librte_eal/common/include/rte_pci.h | 53 +++--
> > lib/librte_eal/common/include/rte_tailq.h | 4 +-
> > lib/librte_eal/common/include/rte_vdev.h | 96 ++++++++
> > lib/librte_eal/linuxapp/eal/Makefile | 1 +
> > lib/librte_eal/linuxapp/eal/eal.c | 1 +
> > lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
> > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
> > lib/librte_ether/rte_ethdev.c | 280 +++++------------------
> -
> > lib/librte_ether/rte_ethdev.h | 40 ++--
> > lib/librte_ether/rte_ether_version.map | 9 +
> > 69 files changed, 784 insertions(+), 1020 deletions(-)
> > create mode 100644 lib/librte_eal/common/eal_common_vdev.c
> > create mode 100644 lib/librte_eal/common/include/rte_vdev.h
> >
>
>
>
> --
> Jan Viktorin E-mail: Viktorin@RehiveTech.com
> System Architect Web: www.RehiveTech.com
> RehiveTech
> Brno, Czech Republic
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (21 preceding siblings ...)
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of Shreyansh Jain
` (27 more replies)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
24 siblings, 28 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain
Based on master (e22856313)
Background:
===========
It includes two different patch-sets floated on ML earlier:
* Original patch series is from David Marchand [1], [2].
`- This focused mainly on PCI (PDEV) part
`- v7 of this was posted by me [8] in August/2016
* Patch series [4] from Jan Viktorin
`- This focused on VDEV and rte_device integration
Introduction:
=============
This patch series introduces a generic device model, moving away from PCI
centric code layout. Key change is to introduce rte_driver/rte_device
structures at the top level which are inherited by
rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
future),...}.
Key motivation for this series is to move away from PCI centric design of
EAL to a more hierarchical device model - pivoted around a generic driver
and device. Each specific driver and device can inherit the common
properties of the generic set and build upon it through driver/device
specific functions.
Earlier, the EAL device initialization model was:
(Refer: [3])
--
Constructor:
|- PMD_DRIVER_REGISTER(rte_driver)
`- insert into dev_driver_list, rte_driver object
rte_eal_init():
|- rte_eal_pci_init()
| `- scan and fill pci_device_list from sysfs
|
|- rte_eal_dev_init()
| `- For each rte_driver in dev_driver_list
| `- call the rte_driver->init() function
| |- PMDs designed to call rte_eth_driver_register(eth_driver)
| |- eth_driver have rte_pci_driver embedded in them
| `- rte_eth_driver_register installs the
| rte_pci_driver->devinit/devuninit callbacks.
|
|- rte_eal_pci_probe()
| |- For each device detected, dev_driver_list is parsed and matching is
| | done.
| |- For each matching device, the rte_pci_driver->devinit() is called.
| |- Default map is to rte_eth_dev_init() which in turn creates a
| | new ethernet device (eth_dev)
| | `- eth_drv->eth_dev_init() is called which is implemented by
`--| individual PMD drivers.
--
The structure of driver looks something like:
+------------+ ._____.
| rte_driver <-----| PMD |___
| .init | `-----` \
+----.-------+ | \
`-. | What PMD actually is
\ | |
+----------v----+ |
| eth_driver | |
| .eth_dev_init | |
+----.----------+ |
`-. |
\ |
+------------v---+
| rte_pci_driver |
| .pci_devinit |
+----------------+
and all devices are part of a following linked lists:
- dev_driver_list for all rte_drivers
- pci_device_list for all devices, whether PCI or VDEV
>From the above:
* a PMD initializes a rte_driver, eth_driver even though actually it is a
pci_driver
* initialization routines are passed from rte_driver->pci_driver->eth_driver
even though they should ideally be rte_eal_init()->rte_pci_driver()
* For a single driver/device type model, this is not necessarily a
functional issue - but more of a design language.
* But, when number of driver/device type increase, this would create problem
in how driver<=>device links are represented.
Proposed Architecture:
======================
A nice representation has already been created by David in [3]. Copying that
here:
+------------------+ +-------------------------------+
| | | |
| rte_pci_device | | rte_pci_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
+-------------------------------+
- for ethdev on top of vdev devices
+------------------+ +-------------------------------+
| | | |
| drv specific | | rte_vdev_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
| int priv_size |
| |
+-------------------------------+
Representing from above, it would be:
+--------------+
| rte_driver |
| name |
| <Future> |
+------^-------+ pci_driver_list
| / vdev_driver_list
`---. <<Inherits>> / /
|\____________/_______ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_driver | | rte_vdev_driver |
| pci_devinit() | | vdev_devinit() |
| pci_devuninit()| | vdev_devuninit()|
| <more> | | <more> |
+-----------------+ +------------------+
+--------------+
| rte_device |
| name |
| <Future> |
+------^-------+ pci_device_list
| / xxx_device_list
`---. <<Inherits>> / /
|\____________/________ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_device | | rte_xxx_device |
| <dev data> | | <dev data> |
| <flags/intr> | | <flags/intr> |
| <more> | | <more> |
+-----------------+ +------------------+
* Each driver type has its own structure which derives from the generic
rte_driver structure.
\- Each driver type maintains its own list, at the same time, rte_driver
list also exists - so that *all* drivers can be looped on, if required.
* Each device, associated with one or more drivers, has its own type
derived from rte_device
\- Each device _may_ maintain its own list (for example, in current
implementation, vdev is not maintaining it).
==Introducing a new device/driver type implies==
- creating their own rte_<xxx>.h file which contains the device/driver
definitions.
- defining the DRIVER_REGISTER_XXX helpers
==Hotplugging Support==
- devices should be able to support attach/detach operations.
- Earlier these functions were part of ethdev. They have been moved to eal
to be more generic.
This patch is part of larger aim to:
--------------------+ <is type of>
eth_driver (PMD) |-------------> rte_driver
crypto_driver (PMD) | ^
<more in future> | |
--------------------+ | <inherits>
/
+-----------------------/+
| rte_pci_driver |
| rte_vdev_driver |
| rte_soc_driver |
| rte_xxx_driver |
Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
drivers rather than explicitly inheriting type specific driver (PCI, etc).
About the Patches:
==================
There are a large number of patches for this - primarily because the changes
are quite varied and keeping them logically separate yet compilable is
important. Most of the patches are small and those which are large touch the
drivers (PMDs) to accommodate the structure changes:
- Patches 0001~0003 are for introducing the container_of function (so that
rte_device can be obtained from rte_pci_device, for example), and
removing unused code.
- Patches 0004~0007 just perform the ground work for enabling change from
rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
- In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
including cryptodev, which is eventually generalized with PCI)
- Patch 0009~0010 merge the crypto and pci functions for registration and
naming.
- Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
complete bus and has been generalized into EAl from ethdev.
- Patches 0015 introduces vdev init/uninit into separate C units and
enables its compilation. Patch 0016~0017 build on it and remove the
remaining legacy support for vdev/pdev distinctions.
- Patches 0018~0022 enable the vdev drivers to register using the
DRIVER_REGISTER_* operations, and remove their rte_driver->init()
- Patch 0023 enables the rte_driver registration into a common driver
linked list.
- Patches 0024~0025 introduce the rte_device, a generalization of
rte_xxx_device, and associated operation of creating rte_device linked
list. It also enables the drivers to use rte_device.name/numa_node
members rather than rte_xxx_device specific members.
Notes:
======
* Some sign-off were already provided by Jan on the original v5; But, as a
large number of merges have been made, I am leaving those out just in case
it is not sync with initial understanding.
* This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
removed [7].
Future Work/Pending:
===================
- Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
rte_device model. eth_driver still is a PCI specific entity. This
has been highlighted by comments from Ferruh in [9].
- cryptodev driver too still remains to be normalized over the rte_driver
model
- Some variables, like drv_name (as highlighted by Ferruh), are getting
duplicated across rte_xxx_driver/device and rte_driver/device.
References:
===========
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
[4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
[5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
[6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
[7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
[8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
[9] http://dpdk.org/ml/archives/dev/2016-August/045947.html
Changes since v8:
- Some review comments from Ferruh Yigit & Reshma Pattan have been fixed.
= Though changes in mlx4/mlx5/szedata2 have been done, I am still unable to
verify those in absence of a proper environment at my end.
= Comment from Ferruh for eth_driver, drv_name are not fixed yet.
- Added a 'Future work' section in Covering letter
Changes since v7:
- Rebase over master (e22856313fff2)
- Merge the patch series by David [1][2] and Jan [4] into a single set
hereafter, PCI and VDEV, both are re-factored for rte_device/driver model
Changes since v6:
- rebase over 16.07 (b0a1419)
- DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
- review comments regarding missing information in log messages
- new API additions to 16.11 map objects
- review comment in [5] and [7] are not included in this series.
Changes since v5:
- Rebase over master (11c5e45d8)
- Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in
sync
with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
- Modifications to bnxt and thunderx driver PMD registration files for
using the simplified PCI device registration helper macro
Changes since v4:
- Fix compilation issue after rebase on HEAD (913154e) in previous series
- Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
were removed by previous patchset. These are being used by pdump library
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
Shreyansh Jain (25):
eal: define macro container_of
eal: remove duplicate function declaration
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align pci driver definitions
eal: introduce init macros
driver: init/uninit common wrappers for PCI drivers
drivers: convert all pdev drivers as pci drivers
driver: Remove driver register callbacks for crypto/net
eal/pci: Helpers for device name parsing/update
ethdev: do not scan all pci devices on attach
eal: add hotplug operations for pci and vdev
ethdev: convert to eal hotplug
ethdev: get rid of device type
eal: extract vdev infra
eal: Remove PDEV/VDEV unused code
drivers: convert PMD_VDEV drivers to use rte_vdev_driver
eal: move init/uninit to rte_vdev_driver
eal: remove PMD_DRIVER_REGISTER and unused pmd_types
eal: rte_pci.h includes rte_dev.h
eal: rename and move rte_pci_resource
eal/pci: inherit rte_driver by rte_pci_driver
eal: call rte_eal_driver_register
eal: introduce rte_device
eal/pci: Create rte_device list and fallback on its members
app/test/test_pci.c | 10 +-
app/test/virtual_pmd.c | 8 +-
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
drivers/crypto/null/null_crypto_pmd.c | 7 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
drivers/net/af_packet/rte_eth_af_packet.c | 11 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
drivers/net/bnx2x/bnx2x_rxtx.c | 3 +-
drivers/net/bnxt/bnxt_ethdev.c | 17 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 9 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/cxgbe/sge.c | 7 +-
drivers/net/e1000/em_ethdev.c | 17 +-
drivers/net/e1000/igb_ethdev.c | 41 +---
drivers/net/ena/ena_ethdev.c | 20 +-
drivers/net/enic/enic_ethdev.c | 24 +-
drivers/net/fm10k/fm10k_ethdev.c | 30 +--
drivers/net/i40e/i40e_ethdev.c | 31 +--
drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
drivers/net/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
drivers/net/mlx4/mlx4.c | 21 +-
drivers/net/mlx5/mlx5.c | 22 +-
drivers/net/mpipe/mpipe_tilegx.c | 18 +-
drivers/net/nfp/nfp_net.c | 28 +--
drivers/net/null/rte_eth_null.c | 11 +-
drivers/net/pcap/rte_eth_pcap.c | 11 +-
drivers/net/qede/qede_ethdev.c | 42 +---
drivers/net/ring/rte_eth_ring.c | 11 +-
drivers/net/szedata2/rte_eth_szedata2.c | 29 +--
drivers/net/thunderx/nicvf_ethdev.c | 21 +-
drivers/net/vhost/rte_eth_vhost.c | 11 +-
drivers/net/virtio/virtio_ethdev.c | 28 +--
drivers/net/virtio/virtio_pci.c | 5 +-
drivers/net/virtio/virtio_user_ethdev.c | 10 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 11 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 95 ++++----
lib/librte_eal/common/eal_common_pci.c | 34 ++-
lib/librte_eal/common/eal_common_vdev.c | 106 +++++++++
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_common.h | 21 ++
lib/librte_eal/common/include/rte_dev.h | 77 +++++--
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 51 +++--
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/common/include/rte_vdev.h | 96 ++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
lib/librte_eal/linuxapp/eal/eal.c | 1 +
lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
lib/librte_ether/rte_ethdev.c | 280 +++++-------------------
lib/librte_ether/rte_ethdev.h | 40 ++--
lib/librte_ether/rte_ether_version.map | 10 +-
70 files changed, 791 insertions(+), 1025 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-08 14:16 ` Ferruh Yigit
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 02/25] eal: remove duplicate function declaration Shreyansh Jain
` (26 subsequent siblings)
27 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_common.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 332f2a4..c5d94f3 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -322,6 +322,27 @@ rte_bsf32(uint32_t v)
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#endif
+/**
+ * Return pointer to the wrapping struct instance.
+ * Example:
+ *
+ * struct wrapper {
+ * ...
+ * struct child c;
+ * ...
+ * };
+ *
+ * struct child *x = obtain(...);
+ * struct wrapper *w = container_of(x, struct wrapper, c);
+ *
+ * Some implementation already have this defined, thus, conditional
+ * declaration.
+ */
+#ifndef container_of
+#define container_of(p, type, member) \
+ ((type *) (((char *) (p)) - offsetof(type, member)))
+#endif
+
#define _RTE_STR(x) #x
/** Take a macro value and get a string version of it */
#define RTE_STR(x) _RTE_STR(x)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 02/25] eal: remove duplicate function declaration
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 03/25] pci: no need for dynamic tailq init Shreyansh Jain
` (25 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 19f7535..ca1aec6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -237,13 +237,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d5b81a3..9412983 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 03/25] pci: no need for dynamic tailq init
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 02/25] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 04/25] crypto: no need for a crypto pmd type Shreyansh Jain
` (24 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 374b68f..a73cbb0 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 7248c38..6a0f6ac 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index cd9de7c..f0215ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 04/25] crypto: no need for a crypto pmd type
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (2 preceding siblings ...)
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 03/25] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 05/25] drivers: align pci driver definitions Shreyansh Jain
` (23 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index fc4123b..6434894 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -319,7 +319,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -358,7 +358,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -407,7 +406,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -449,8 +448,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index affbdec..13f46e4 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -613,8 +613,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..c977c61 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -454,13 +454,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 05/25] drivers: align pci driver definitions
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (3 preceding siblings ...)
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 04/25] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 06/25] eal: introduce init macros Shreyansh Jain
` (22 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 82ab047..1e9e0ba 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,7 +113,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
},
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ac0803d..9418d50 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1685,7 +1685,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 82e3e4e..99a258a 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2459,7 +2459,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 06/25] eal: introduce init macros
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (4 preceding siblings ...)
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 05/25] drivers: align pci driver definitions Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-12 7:15 ` David Marchand
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 07/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
` (21 subsequent siblings)
27 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 10 ++++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 95789f9..994650b 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void devinitfn_ ##drv(void);\
-void __attribute__((constructor, used)) devinitfn_ ##drv(void)\
+RTE_INIT(devinitfn_ ##drv);\
+static void devinitfn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index a71d6f5..186f3c6 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -252,6 +252,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..cf673e4 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,16 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registeration from driver (eth, crypto) instance */
+#define DRIVER_REGISTER_PCI(nm, pci_drv) \
+RTE_INIT(pciinitfn_ ##nm); \
+static void pciinitfn_ ##nm(void) \
+{ \
+ (pci_drv).name = RTE_STR(nm);\
+ rte_eal_pci_register(&pci_drv); \
+}\
+DRIVER_EXPORT_NAME(nm, __COUNTER__)
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index cc3c0f1..cc386e4 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 07/25] driver: init/uninit common wrappers for PCI drivers
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (5 preceding siblings ...)
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 06/25] eal: introduce init macros Shreyansh Jain
@ 2016-09-07 14:07 ` Shreyansh Jain
2016-09-12 7:16 ` David Marchand
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 08/25] drivers: convert all pdev drivers as pci drivers Shreyansh Jain
` (20 subsequent siblings)
27 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:07 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
crypto and ethdev drivers aligned to PCI probe/remove. Existing handlers for
init/uninit can be easily reused for this.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 7 +++++++
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 9 +++++++++
6 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 6434894..b1e82b6 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -429,9 +429,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -490,8 +490,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -539,15 +539,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c977c61..3fb7c7c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a08fd20..1fc0d57 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -39,3 +39,10 @@ DPDK_16.07 {
rte_cryptodev_parse_vdev_init_params;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+} DPDK_16.07;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f62a9ec..8825219 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b0fe033..37d78bf 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4368,6 +4368,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 45ddf44..17e7448 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -138,4 +138,13 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 08/25] drivers: convert all pdev drivers as pci drivers
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (6 preceding siblings ...)
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 07/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-12 7:16 ` David Marchand
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 09/25] driver: Remove driver register callbacks for crypto/net Shreyansh Jain
` (19 subsequent siblings)
27 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++---------
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +++++-------------------
drivers/net/bnxt/bnxt_ethdev.c | 16 +++---------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++---------
drivers/net/e1000/igb_ethdev.c | 39 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 17 +++---------
drivers/net/enic/enic_ethdev.c | 23 +++--------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++--------------
drivers/net/i40e/i40e_ethdev.c | 24 +++--------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +++++----------------------------
drivers/net/mlx4/mlx4.c | 15 +++--------
drivers/net/mlx5/mlx5.c | 14 +++-------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/qede/qede_ethdev.c | 40 ++++++----------------------
drivers/net/szedata2/rte_eth_szedata2.c | 24 +++--------------
drivers/net/thunderx/nicvf_ethdev.c | 20 +++-----------
drivers/net/virtio/virtio_ethdev.c | 25 +++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++--------------
20 files changed, 78 insertions(+), 407 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1e9e0ba..b94af59 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,23 +116,13 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_cryptodev_pci_probe,
+ .devuninit = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv, CRYPTODEV_NAME_QAT_SYM_PMD);
+DRIVER_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f3ab355..214b655 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -621,6 +621,8 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
@@ -634,38 +636,14 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver, bnx2x);
+DRIVER_REGISTER_PCI(bnx2x, rte_bnx2x_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf);
+DRIVER_REGISTER_PCI(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3795fac..28eb8b9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1048,23 +1048,13 @@ static struct eth_driver bnxt_rte_pmd = {
.name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = bnxt_dev_init,
.eth_dev_uninit = bnxt_dev_uninit,
.dev_private_size = sizeof(struct bnxt),
};
-static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
-{
- RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
- rte_eth_driver_register(&bnxt_rte_pmd);
- return 0;
-}
-
-static struct rte_driver bnxt_pmd_drv = {
- .type = PMD_PDEV,
- .init = bnxt_rte_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt);
+DRIVER_REGISTER_PCI(bnxt, bnxt_rte_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 9208a61..431b06d 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1042,30 +1042,12 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4);
+DRIVER_REGISTER_PCI(cxgb4, rte_cxgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(cxgb4, cxgb4_pci_tbl);
-
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index ad104ed..1281c8b 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -395,6 +395,8 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
@@ -402,13 +404,6 @@ static struct eth_driver rte_em_pmd = {
};
static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
-
-static int
em_hw_init(struct e1000_hw *hw)
{
int diag;
@@ -1799,10 +1794,5 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv, em);
+DRIVER_REGISTER_PCI(em, rte_em_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(em, pci_id_em_map);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 4e9e6a3..395477e 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1082,6 +1082,8 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
@@ -1096,19 +1098,14 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
-
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
{
@@ -1120,20 +1117,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -5084,16 +5067,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5255,7 +5228,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-PMD_REGISTER_DRIVER(pmd_igb_drv, igb);
+DRIVER_REGISTER_PCI(igb, rte_igb_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf);
+DRIVER_REGISTER_PCI(igbvf, rte_igbvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igbvf, pci_id_igbvf_map);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 9418d50..ee906d4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1689,23 +1689,12 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv, ena);
+DRIVER_REGISTER_PCI(ena, rte_ena_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ena, pci_id_ena_map);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 47b07c9..59812d0 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -616,29 +616,12 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver, enic);
+DRIVER_REGISTER_PCI(enic, rte_enic_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(enic, pci_id_enic_map);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 01f4a72..26cdc10 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3059,30 +3059,13 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver, fm10k);
+DRIVER_REGISTER_PCI(fm10k, rte_pmd_fm10k.pci_drv);
DRIVER_REGISTER_PCI_TABLE(fm10k, pci_id_fm10k_map);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0aeb70..dacaaea 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -667,6 +667,8 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
@@ -701,27 +703,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver, i40e);
+DRIVER_REGISTER_PCI(i40e, rte_i40e_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40e, pci_id_i40e_map);
/*
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a616ae0..4a745f9 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1557,34 +1557,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver, i40evf);
+DRIVER_REGISTER_PCI(i40evf, rte_i40evf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map);
static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb618ef..d2f46bc 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1566,6 +1566,8 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1580,40 +1582,14 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
-
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
@@ -7409,17 +7385,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
ixgbevf_dev_interrupt_action(dev);
}
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver, ixgbe);
+DRIVER_REGISTER_PCI(ixgbe, rte_ixgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbe, pci_id_ixgbe_map);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver, ixgbevf);
+DRIVER_REGISTER_PCI(ixgbevf, rte_ixgbevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 304c846..2bed4de 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5922,12 +5922,10 @@ static struct eth_driver mlx4_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5938,13 +5936,6 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver, mlx4);
DRIVER_REGISTER_PCI_TABLE(mlx4, mlx4_pci_id_map);
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index d96a9af..3658769 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -739,11 +739,10 @@ static struct eth_driver mlx5_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -753,13 +752,6 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver, mlx5);
DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99a258a..cbaf219 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2464,29 +2464,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver, nfp);
+DRIVER_REGISTER_PCI(nfp, rte_nfp_net_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(nfp, pci_id_nfp_net_map);
/*
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 82e44b8..a92dd3b 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1482,7 +1482,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1494,41 +1496,15 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver, qede);
+DRIVER_REGISTER_PCI(qede, rte_qede_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qede, pci_id_qede_map);
-PMD_REGISTER_DRIVER(rte_qedevf_driver, qedevf);
+DRIVER_REGISTER_PCI(qedevf, rte_qedevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qedevf, pci_id_qedevf_map);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 483d789..6d21024 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,13 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME);
+DRIVER_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv);
DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4f875c0..ad7d607 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1762,26 +1762,12 @@ static struct eth_driver rte_nicvf_pmd = {
.name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = nicvf_eth_dev_init,
.dev_private_size = sizeof(struct nicvf),
};
-static int
-rte_nicvf_pmd_init(const char *name __rte_unused, const char *para __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_thunderx nicvf version %s",
- THUNDERX_NICVF_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nicvf_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nicvf_driver = {
- .type = PMD_PDEV,
- .init = rte_nicvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nicvf_driver, thunderx_nicvf);
+DRIVER_REGISTER_PCI(thunderx_nicvf, rte_nicvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(thunderx_nicvf, pci_id_nicvf_map);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 07d6449..5453709 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1307,29 +1307,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1563,10 +1558,4 @@ __rte_unused uint8_t is_rx)
return 0;
}
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver, virtio_net);
DRIVER_REGISTER_PCI_TABLE(virtio_net, pci_id_virtio_map);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 5874215..d732979 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -331,26 +331,14 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .devinit = rte_eth_dev_pci_probe,
+ .devuninit = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
-
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
{
@@ -948,10 +936,5 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver, vmxnet3);
+DRIVER_REGISTER_PCI(vmxnet3, rte_vmxnet3_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(vmxnet3, pci_id_vmxnet3_map);
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 09/25] driver: Remove driver register callbacks for crypto/net
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (7 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 08/25] drivers: convert all pdev drivers as pci drivers Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 10/25] eal/pci: Helpers for device name parsing/update Shreyansh Jain
` (18 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
Now that all pdev are pci drivers, we don't need to register crypto and ethdev
drivers through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 22 -------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
lib/librte_ether/rte_ethdev.c | 22 -------------------
lib/librte_ether/rte_ethdev.h | 12 -----------
lib/librte_ether/rte_ether_version.map | 1 -
6 files changed, 88 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index b1e82b6..2a3b649 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -533,28 +533,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 3fb7c7c..99fd69e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -491,36 +491,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 1fc0d57..9627ac4 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 8825219..3bccf20 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 37d78bf..b005c1b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1871,18 +1871,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 17e7448..72be66d 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -78,7 +78,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 10/25] eal/pci: Helpers for device name parsing/update
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (8 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 09/25] driver: Remove driver register callbacks for crypto/net Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 11/25] ethdev: do not scan all pci devices on attach Shreyansh Jain
` (17 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
- Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common method,
can be used across crypto/net PCI PMDs.
- Remove crypto specific routine and fallback to common name function.
- Introduce a eal private Update function for PCI device naming.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 +++---------------
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 24 ++++++++++++++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
lib/librte_ether/rte_ethdev.c | 24 +++-------------
6 files changed, 107 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 2a3b649..c81e366 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -444,9 +427,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -501,9 +483,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index a73cbb0..1d91c78 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index ca1aec6..431d6c2 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -130,6 +130,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index cf673e4..4ca68a2 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,28 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
+ * BDF helpers.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f0215ee..62da4d4 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 3bccf20..a1bb043 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 11/25] ethdev: do not scan all pci devices on attach
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (9 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 10/25] eal/pci: Helpers for device name parsing/update Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 12/25] eal: add hotplug operations for pci and vdev Shreyansh Jain
` (16 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 11 ++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6a0f6ac..da0038f 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -341,6 +341,11 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -353,9 +358,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a1bb043..fdeac86 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -469,9 +469,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 12/25] eal: add hotplug operations for pci and vdev
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (10 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 11/25] ethdev: do not scan all pci devices on attach Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug Shreyansh Jain
` (15 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
Hotplug invocations, which deals with devices, should come from the layer that
already handles them, i.e. EAL.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 ++++
lib/librte_eal/common/eal_common_dev.c | 48 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 26 ++++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 ++++
4 files changed, 88 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index a335e04..7b3d409 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -162,3 +162,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..88f9d3f 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,51 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", name);
+ return -EINVAL;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device provided.\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 994650b..a4f08b5 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,32 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a device to a registered driver.
+ *
+ * @param name
+ * The device name, that refers to a pci device (or some private
+ * way of designating a vdev device). Based on this device name, eal
+ * will identify a driver capable of handling it and pass it to the
+ * driver probing function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a device from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
#define DRIVER_EXPORT_NAME(name, idx) \
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index db8c984..c0bd391 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -166,3 +166,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (11 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 12/25] eal: add hotplug operations for pci and vdev Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-12 7:16 ` David Marchand
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 14/25] ethdev: get rid of device type Shreyansh Jain
` (14 subsequent siblings)
27 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some mechanism
to inform applications of port creation/removal to substitute for ethdev
hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the following
commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_ether/rte_ethdev.c | 208 +++++++-----------------------------------
1 file changed, 34 insertions(+), 174 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fdeac86..86c9d1a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -216,6 +217,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -347,27 +349,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
@@ -413,34 +394,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t dev_flags;
@@ -465,124 +418,46 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
-{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
-
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
- goto err;
-
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
- goto err;
-
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
- goto err;
-
- /* invoke devuninit func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
- goto err;
-
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
- */
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
/* attach the new device, then store port_id of the device */
int
rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- struct rte_pci_addr addr;
int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
if ((devargs == NULL) || (port_id == NULL)) {
ret = -EINVAL;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
+ goto err;
+
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
+ goto err;
+
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ RTE_LOG(ERR, EAL, "No ports founds for device (%s)\n", name);
+ ret = -1;
+ goto err;
+ }
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port */
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
+ goto err;
}
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -590,7 +465,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -598,33 +472,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 14/25] ethdev: get rid of device type
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (12 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 15/25] eal: extract vdev infra Shreyansh Jain
` (13 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, David Marchand
Now that hotplug has been moved to eal, there is no reason to keep the device
type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
16 files changed, 16 insertions(+), 52 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f795566..d629ee3 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -666,7 +666,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 203ebe9..8514652 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 2bed4de..b333ad6 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5803,7 +5803,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3658769..ebad7cb 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -617,7 +617,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 93f8730..c0d0e3b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 7a24884..ce49945 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -517,7 +517,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7e213eb..7fbc60e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index a7048c7..5690dcd 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7539cd4..2bb761b 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -714,7 +714,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index daef09b..aadfdc0 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -277,7 +277,7 @@ virtio_user_eth_dev_alloc(const char *name)
struct virtio_hw *hw;
struct virtio_user_dev *dev;
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
return NULL;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 99f6cc8..6b15381 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -654,7 +654,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..0dbc332 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 86c9d1a..cf38f32 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -191,7 +191,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -216,7 +216,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -248,7 +247,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b005c1b..2a697ec 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1603,17 +1603,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1643,7 +1632,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
} __rte_cache_aligned;
struct rte_eth_dev_sriov {
@@ -1756,8 +1744,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 15/25] eal: extract vdev infra
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (13 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 14/25] ethdev: get rid of device type Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 16/25] eal: Remove PDEV/VDEV unused code Shreyansh Jain
` (12 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
Move all PMD_VDEV-specific code into a separate module and header
file to not polute the generic code anymore. There is now a list
of virtual devices available.
The rte_vdev_driver integrates the original rte_driver inside
(C inheritance). The rte_driver will be however change in the
future to serve as a common base for all other types of drivers.
The existing PMDs (PMD_VDEV) are to be modified later (there is
no change for them at the moment).
Unlike DRIVER_REGISTER_PCI, DRIVER_EXPORT_NAME is not being called on vdev
registration.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 54 +--------------
lib/librte_eal/common/eal_common_vdev.c | 110 +++++++++++++++++++++++++++++++
lib/librte_eal/common/include/rte_vdev.h | 84 +++++++++++++++++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
6 files changed, 198 insertions(+), 54 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 7a0fea5..5a3fc1d 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -69,6 +69,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index bb9810d..dfd64aa 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -38,7 +38,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_dev.h
+INC += rte_hexdump.h rte_devargs.h rte_dev.h rte_vdev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 88f9d3f..555e0d9 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -64,32 +64,6 @@ rte_eal_driver_unregister(struct rte_driver *driver)
}
int
-rte_eal_vdev_init(const char *name, const char *args)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->init(name, args);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
-int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
@@ -98,7 +72,7 @@ rte_eal_dev_init(void)
/*
* Note that the dev_driver_list is populated here
* from calls made to rte_eal_driver_register from constructor functions
- * embedded into PMD modules via the PMD_REGISTER_DRIVER macro
+ * embedded into PMD modules via the DRIVER_REGISTER_VDEV macro
*/
/* call the init function for each virtual device */
@@ -125,32 +99,6 @@ rte_eal_dev_init(void)
return 0;
}
-int
-rte_eal_vdev_uninit(const char *name)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->uninit(name);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
int rte_eal_dev_attach(const char *name, const char *devargs)
{
struct rte_pci_addr addr;
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
new file mode 100644
index 0000000..d225e86
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -0,0 +1,110 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/queue.h>
+
+#include <rte_vdev.h>
+#include <rte_common.h>
+
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_eal_vdrv_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+int
+rte_eal_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
+ return driver->driver.init(name, args);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
+
+int
+rte_eal_vdev_uninit(const char *name)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
+ return driver->driver.uninit(name);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
new file mode 100644
index 0000000..9a2e2d5
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -0,0 +1,84 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_eal_vdrv_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver);
+
+#define DRIVER_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ rte_eal_vdrv_register(&vdrv);\
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 193957f..4e206f0 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -77,6 +77,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 16/25] eal: Remove PDEV/VDEV unused code
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (14 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 15/25] eal: extract vdev infra Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
` (11 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
- Remove checks for VDEV from rte_eal_vdev_(init/uninint) as all devices are
inherently virtual here.
- PDEVs perform PCI specific inits - rte_eal_dev_init() need not call
rte_driver->init();
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 8 --------
lib/librte_eal/common/eal_common_vdev.c | 6 ------
2 files changed, 14 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 555e0d9..afa33fa 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -67,7 +67,6 @@ int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
- struct rte_driver *driver;
/*
* Note that the dev_driver_list is populated here
@@ -89,13 +88,6 @@ rte_eal_dev_init(void)
}
}
- /* Once the vdevs are initalized, start calling all the pdev drivers */
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_PDEV)
- continue;
- /* PDEV drivers don't get passed any parameters */
- driver->init(NULL, NULL);
- }
return 0;
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index d225e86..e1ca8e0 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -66,9 +66,6 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -92,9 +89,6 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (15 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 16/25] eal: Remove PDEV/VDEV unused code Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-11 11:55 ` Yuanhan Liu
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 18/25] eal: move init/uninit to rte_vdev_driver Shreyansh Jain
` (10 subsequent siblings)
27 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
All PMD_VDEV drivers can now use rte_vdev_driver instead of the
rte_driver (which is embedded in the rte_vdev_driver).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 14 ++++++++------
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 14 ++++++++------
drivers/crypto/kasumi/rte_kasumi_pmd.c | 14 ++++++++------
drivers/crypto/null/null_crypto_pmd.c | 14 ++++++++------
drivers/crypto/snow3g/rte_snow3g_pmd.c | 14 ++++++++------
drivers/net/af_packet/rte_eth_af_packet.c | 14 ++++++++------
drivers/net/bonding/rte_eth_bond_pmd.c | 14 ++++++++------
drivers/net/mpipe/mpipe_tilegx.c | 22 +++++++++++++---------
drivers/net/null/rte_eth_null.c | 14 ++++++++------
drivers/net/pcap/rte_eth_pcap.c | 14 ++++++++------
drivers/net/ring/rte_eth_ring.c | 14 ++++++++------
drivers/net/vhost/rte_eth_vhost.c | 14 ++++++++------
drivers/net/virtio/virtio_user_ethdev.c | 13 ++++++++-----
drivers/net/xenvirt/rte_eth_xenvirt.c | 14 ++++++++------
14 files changed, 117 insertions(+), 86 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dc0b033..e1d5e37 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -37,7 +37,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -514,13 +514,15 @@ aesni_gcm_uninit(const char *name)
return 0;
}
-static struct rte_driver aesni_gcm_pmd_drv = {
- .type = PMD_VDEV,
- .init = aesni_gcm_init,
- .uninit = aesni_gcm_uninit
+static struct rte_vdev_driver aesni_gcm_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = aesni_gcm_init,
+ .uninit = aesni_gcm_uninit
+ },
};
-PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv, CRYPTODEV_NAME_AESNI_GCM_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b2d0c8c..2ba5389 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -714,13 +714,15 @@ cryptodev_aesni_mb_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_aesni_mb_init,
- .uninit = cryptodev_aesni_mb_uninit
+static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_aesni_mb_init,
+ .uninit = cryptodev_aesni_mb_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drv, CRYPTODEV_NAME_AESNI_MB_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_MB_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 4e21743..a30e776 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -650,13 +650,15 @@ cryptodev_kasumi_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_kasumi_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_kasumi_init,
- .uninit = cryptodev_kasumi_uninit
+static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_kasumi_init,
+ .uninit = cryptodev_kasumi_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv, CRYPTODEV_NAME_KASUMI_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 909b04f..8ab34de 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,7 @@
#include <rte_common.h>
#include <rte_config.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include "null_crypto_pmd_private.h"
@@ -268,13 +268,15 @@ cryptodev_null_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_null_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_null_init,
- .uninit = cryptodev_null_uninit
+static struct rte_vdev_driver cryptodev_null_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_null_init,
+ .uninit = cryptodev_null_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv, CRYPTODEV_NAME_NULL_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 87cd070..8b356a3 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -638,13 +638,15 @@ cryptodev_snow3g_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_snow3g_pmd_drv = {
- .type = PMD_VDEV,
- .init = cryptodev_snow3g_init,
- .uninit = cryptodev_snow3g_uninit
+static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = cryptodev_snow3g_init,
+ .uninit = cryptodev_snow3g_uninit
+ },
};
-PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv, CRYPTODEV_NAME_SNOW3G_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, cryptodev_snow3g_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SNOW3G_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index d629ee3..95aa573 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -40,7 +40,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
@@ -889,13 +889,15 @@ rte_pmd_af_packet_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_af_packet_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_af_packet_devinit,
- .uninit = rte_pmd_af_packet_devuninit,
+static struct rte_vdev_driver pmd_af_packet_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_af_packet_devinit,
+ .uninit = rte_pmd_af_packet_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_af_packet_drv, eth_af_packet);
+DRIVER_REGISTER_VDEV(eth_af_packet, pmd_af_packet_drv);
DRIVER_REGISTER_PARAM_STRING(eth_af_packet,
"iface=<string> "
"qpairs=<int> "
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b20a272..3209dbc 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -42,7 +42,7 @@
#include <rte_ip_frag.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_alarm.h>
#include <rte_cycles.h>
@@ -2508,13 +2508,15 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
return 0;
}
-static struct rte_driver bond_drv = {
- .type = PMD_VDEV,
- .init = bond_init,
- .uninit = bond_uninit,
+static struct rte_vdev_driver bond_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = bond_init,
+ .uninit = bond_uninit
+ },
};
-PMD_REGISTER_DRIVER(bond_drv, eth_bond);
+DRIVER_REGISTER_VDEV(eth_bond, bond_drv);
DRIVER_REGISTER_PARAM_STRING(eth_bond,
"slave=<ifc> "
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index c0d0e3b..6d0dc86 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <rte_eal.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_eal_memconfig.h>
#include <rte_ethdev.h>
#include <rte_malloc.h>
@@ -1623,18 +1623,22 @@ rte_pmd_mpipe_devinit(const char *ifname,
return 0;
}
-static struct rte_driver pmd_mpipe_xgbe_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_mpipe_devinit
+ },
};
-static struct rte_driver pmd_mpipe_gbe_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_mpipe_devinit
+ },
};
-PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv, xgbe);
-PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv, gbe);
+DRIVER_REGISTER_VDEV(xgbe, pmd_mpipe_xgbe_drv);
+DRIVER_REGISTER_VDEV(gbe, pmd_mpipe_gbe_drv);
static void __attribute__((constructor, used))
mpipe_init_contexts(void)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index ce49945..75bad6c 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -35,7 +35,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_spinlock.h>
@@ -686,13 +686,15 @@ rte_pmd_null_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_null_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_null_devinit,
- .uninit = rte_pmd_null_devuninit,
+static struct rte_vdev_driver pmd_null_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_null_devinit,
+ .uninit = rte_pmd_null_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_null_drv, eth_null);
+DRIVER_REGISTER_VDEV(eth_null, pmd_null_drv);
DRIVER_REGISTER_PARAM_STRING(eth_null,
"size=<int> "
"copy=<int>");
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7fbc60e..b72d07e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -40,7 +40,7 @@
#include <rte_string_fns.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <net/if.h>
@@ -1083,13 +1083,15 @@ rte_pmd_pcap_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_pcap_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_pcap_devinit,
- .uninit = rte_pmd_pcap_devuninit,
+static struct rte_vdev_driver pmd_pcap_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_pcap_devinit,
+ .uninit = rte_pmd_pcap_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_pcap_drv, eth_pcap);
+DRIVER_REGISTER_VDEV(eth_pcap, pmd_pcap_drv);
DRIVER_REGISTER_PARAM_STRING(eth_pcap,
"rx_pcap=<string> "
"tx_pcap=<string> "
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 5690dcd..67cbee3 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -38,7 +38,7 @@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
@@ -623,12 +623,14 @@ rte_pmd_ring_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_ring_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_ring_devinit,
- .uninit = rte_pmd_ring_devuninit,
+static struct rte_vdev_driver pmd_ring_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_ring_drv, eth_ring);
+DRIVER_REGISTER_VDEV(eth_ring, pmd_ring_drv);
DRIVER_REGISTER_PARAM_STRING(eth_ring,
"nodeaction=[attach|detach]");
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 2bb761b..94577e9 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -41,7 +41,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_virtio_net.h>
#include <rte_spinlock.h>
@@ -924,13 +924,15 @@ rte_pmd_vhost_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_vhost_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_vhost_devinit,
- .uninit = rte_pmd_vhost_devuninit,
+static struct rte_vdev_driver pmd_vhost_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_vhost_devinit,
+ .uninit = rte_pmd_vhost_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_vhost_drv, eth_vhost);
+DRIVER_REGISTER_VDEV(eth_vhost, pmd_vhost_drv);
DRIVER_REGISTER_PARAM_STRING(eth_vhost,
"iface=<ifc> "
"queues=<int>");
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index aadfdc0..08cd4c2 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -37,6 +37,7 @@
#include <rte_malloc.h>
#include <rte_kvargs.h>
+#include <rte_vdev.h>
#include "virtio_ethdev.h"
#include "virtio_logs.h"
@@ -461,13 +462,15 @@ virtio_user_pmd_devuninit(const char *name)
return 0;
}
-static struct rte_driver virtio_user_driver = {
- .type = PMD_VDEV,
- .init = virtio_user_pmd_devinit,
- .uninit = virtio_user_pmd_devuninit,
+static struct rte_vdev_driver virtio_user_driver = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = virtio_user_pmd_devinit,
+ .uninit = virtio_user_pmd_devuninit
+ },
};
-PMD_REGISTER_DRIVER(virtio_user_driver, virtio_user);
+DRIVER_REGISTER_VDEV(virtio_user, virtio_user_driver);
DRIVER_REGISTER_PARAM_STRING(virtio_user,
"path=<path> "
"mac=<mac addr> "
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 6b15381..c5d89fc 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -56,7 +56,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_xenvirt_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_xenvirt_devinit,
- .uninit = rte_pmd_xenvirt_devuninit,
+static struct rte_vdev_driver pmd_xenvirt_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ .init = rte_pmd_xenvirt_devinit,
+ .uninit = rte_pmd_xenvirt_devuninit
+ },
};
-PMD_REGISTER_DRIVER(pmd_xenvirt_drv, eth_xenvirt);
+DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
DRIVER_REGISTER_PARAM_STRING(eth_xenvirt,
"mac=<mac addr>");
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 18/25] eal: move init/uninit to rte_vdev_driver
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (16 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types Shreyansh Jain
` (9 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
These functions are virtual-device specific and they are never called
for any PCI driver (after introducing DRIVER_REGISTER_PCI, there is
no way to do it). All affected drivers are updated.
The prototypes are renamed to rte_vdev_init_t and rte_vdev_uninit_t.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 4 ++--
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 ++--
drivers/crypto/kasumi/rte_kasumi_pmd.c | 4 ++--
drivers/crypto/null/null_crypto_pmd.c | 4 ++--
drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 ++--
drivers/net/af_packet/rte_eth_af_packet.c | 4 ++--
drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++--
drivers/net/mpipe/mpipe_tilegx.c | 4 ++--
drivers/net/null/rte_eth_null.c | 4 ++--
drivers/net/pcap/rte_eth_pcap.c | 4 ++--
drivers/net/ring/rte_eth_ring.c | 4 ++--
drivers/net/vhost/rte_eth_vhost.c | 4 ++--
drivers/net/virtio/virtio_user_ethdev.c | 4 ++--
drivers/net/xenvirt/rte_eth_xenvirt.c | 4 ++--
lib/librte_eal/common/eal_common_vdev.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 12 ------------
lib/librte_eal/common/include/rte_vdev.h | 12 ++++++++++++
17 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index e1d5e37..c93ebfe 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -517,9 +517,9 @@ aesni_gcm_uninit(const char *name)
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = aesni_gcm_init,
- .uninit = aesni_gcm_uninit
},
+ .init = aesni_gcm_init,
+ .uninit = aesni_gcm_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 2ba5389..30c0706 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -717,9 +717,9 @@ cryptodev_aesni_mb_uninit(const char *name)
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_aesni_mb_init,
- .uninit = cryptodev_aesni_mb_uninit
},
+ .init = cryptodev_aesni_mb_init,
+ .uninit = cryptodev_aesni_mb_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index a30e776..ba2829d 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -653,9 +653,9 @@ cryptodev_kasumi_uninit(const char *name)
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_kasumi_init,
- .uninit = cryptodev_kasumi_uninit
},
+ .init = cryptodev_kasumi_init,
+ .uninit = cryptodev_kasumi_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 8ab34de..4c12faa 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -271,9 +271,9 @@ cryptodev_null_uninit(const char *name)
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_null_init,
- .uninit = cryptodev_null_uninit
},
+ .init = cryptodev_null_init,
+ .uninit = cryptodev_null_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv);
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 8b356a3..10c6b83 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -641,9 +641,9 @@ cryptodev_snow3g_uninit(const char *name)
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
.driver = {
.type = PMD_VDEV,
- .init = cryptodev_snow3g_init,
- .uninit = cryptodev_snow3g_uninit
},
+ .init = cryptodev_snow3g_init,
+ .uninit = cryptodev_snow3g_uninit
};
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, cryptodev_snow3g_pmd_drv);
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 95aa573..9a9a2ee 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -892,9 +892,9 @@ rte_pmd_af_packet_devuninit(const char *name)
static struct rte_vdev_driver pmd_af_packet_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_af_packet_devinit,
- .uninit = rte_pmd_af_packet_devuninit
},
+ .init = rte_pmd_af_packet_devinit,
+ .uninit = rte_pmd_af_packet_devuninit
};
DRIVER_REGISTER_VDEV(eth_af_packet, pmd_af_packet_drv);
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 3209dbc..5fa2a93 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2511,9 +2511,9 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
static struct rte_vdev_driver bond_drv = {
.driver = {
.type = PMD_VDEV,
- .init = bond_init,
- .uninit = bond_uninit
},
+ .init = bond_init,
+ .uninit = bond_uninit
};
DRIVER_REGISTER_VDEV(eth_bond, bond_drv);
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 6d0dc86..efb000b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1626,15 +1626,15 @@ rte_pmd_mpipe_devinit(const char *ifname,
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit
},
+ .init = rte_pmd_mpipe_devinit
};
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit
},
+ .init = rte_pmd_mpipe_devinit
};
DRIVER_REGISTER_VDEV(xgbe, pmd_mpipe_xgbe_drv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 75bad6c..be4169e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -689,9 +689,9 @@ rte_pmd_null_devuninit(const char *name)
static struct rte_vdev_driver pmd_null_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_null_devinit,
- .uninit = rte_pmd_null_devuninit
},
+ .init = rte_pmd_null_devinit,
+ .uninit = rte_pmd_null_devuninit
};
DRIVER_REGISTER_VDEV(eth_null, pmd_null_drv);
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index b72d07e..d6718b8 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1086,9 +1086,9 @@ rte_pmd_pcap_devuninit(const char *name)
static struct rte_vdev_driver pmd_pcap_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_pcap_devinit,
- .uninit = rte_pmd_pcap_devuninit
},
+ .init = rte_pmd_pcap_devinit,
+ .uninit = rte_pmd_pcap_devuninit
};
DRIVER_REGISTER_VDEV(eth_pcap, pmd_pcap_drv);
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 67cbee3..77bd664 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -626,9 +626,9 @@ rte_pmd_ring_devuninit(const char *name)
static struct rte_vdev_driver pmd_ring_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_ring_devinit,
- .uninit = rte_pmd_ring_devuninit
},
+ .init = rte_pmd_ring_devinit,
+ .uninit = rte_pmd_ring_devuninit
};
DRIVER_REGISTER_VDEV(eth_ring, pmd_ring_drv);
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 94577e9..e2610b4 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -927,9 +927,9 @@ rte_pmd_vhost_devuninit(const char *name)
static struct rte_vdev_driver pmd_vhost_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_vhost_devinit,
- .uninit = rte_pmd_vhost_devuninit
},
+ .init = rte_pmd_vhost_devinit,
+ .uninit = rte_pmd_vhost_devuninit
};
DRIVER_REGISTER_VDEV(eth_vhost, pmd_vhost_drv);
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 08cd4c2..7975298 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -465,9 +465,9 @@ virtio_user_pmd_devuninit(const char *name)
static struct rte_vdev_driver virtio_user_driver = {
.driver = {
.type = PMD_VDEV,
- .init = virtio_user_pmd_devinit,
- .uninit = virtio_user_pmd_devuninit
},
+ .init = virtio_user_pmd_devinit,
+ .uninit = virtio_user_pmd_devuninit
};
DRIVER_REGISTER_VDEV(virtio_user, virtio_user_driver);
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index c5d89fc..7da0f17 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -762,9 +762,9 @@ rte_pmd_xenvirt_devuninit(const char *name)
static struct rte_vdev_driver pmd_xenvirt_drv = {
.driver = {
.type = PMD_VDEV,
- .init = rte_pmd_xenvirt_devinit,
- .uninit = rte_pmd_xenvirt_devuninit
},
+ .init = rte_pmd_xenvirt_devinit,
+ .uninit = rte_pmd_xenvirt_devuninit
};
DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index e1ca8e0..83f8ea8 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -73,7 +73,7 @@ rte_eal_vdev_init(const char *name, const char *args)
* So use strncmp to compare.
*/
if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
- return driver->driver.init(name, args);
+ return driver->init(name, args);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
@@ -96,7 +96,7 @@ rte_eal_vdev_uninit(const char *name)
* So use strncmp to compare.
*/
if (!strncmp(driver->driver.name, name, strlen(driver->driver.name)))
- return driver->driver.uninit(name);
+ return driver->uninit(name);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index a4f08b5..3097194 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,16 +105,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Initialization function called for each device driver once.
- */
-typedef int (rte_dev_init_t)(const char *name, const char *args);
-
-/**
- * Uninitilization function called for each device driver once.
- */
-typedef int (rte_dev_uninit_t)(const char *name);
-
-/**
* Driver type enumeration
*/
enum pmd_type {
@@ -129,8 +119,6 @@ struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
- rte_dev_init_t *init; /**< Device init. function. */
- rte_dev_uninit_t *uninit; /**< Device uninit. function. */
};
/**
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 9a2e2d5..70a62c0 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -44,11 +44,23 @@ extern "C" {
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
/**
+ * Initialization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_init_t)(const char *name, const char *args);
+
+/**
+ * Uninitilization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_uninit_t)(const char *name);
+
+/**
* A virtual device driver abstraction.
*/
struct rte_vdev_driver {
TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_init_t *init; /**< Virtual device init. function. */
+ rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */
};
/**
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (17 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 18/25] eal: move init/uninit to rte_vdev_driver Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 20/25] eal: rte_pci.h includes rte_dev.h Shreyansh Jain
` (8 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
- All devices register themselfs by calling a kind of DRIVER_REGISTER_XXX.
The PMD_REGISTER_DRIVER is not used anymore.
- PMD_VDEV type is also not being used - can be removed from all VDEVs.
Note: PMD_REGISTER_DRIVER usage by PMDINFO tool and its documentation has not
yet been removed.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ---
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 ---
drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ---
drivers/crypto/null/null_crypto_pmd.c | 3 ---
drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ---
drivers/net/af_packet/rte_eth_af_packet.c | 3 ---
drivers/net/bonding/rte_eth_bond_pmd.c | 3 ---
drivers/net/mpipe/mpipe_tilegx.c | 6 ------
drivers/net/null/rte_eth_null.c | 3 ---
drivers/net/pcap/rte_eth_pcap.c | 3 ---
drivers/net/ring/rte_eth_ring.c | 3 ---
drivers/net/vhost/rte_eth_vhost.c | 3 ---
drivers/net/virtio/virtio_user_ethdev.c | 3 ---
drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ---
lib/librte_eal/common/include/rte_dev.h | 18 ------------------
15 files changed, 63 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index c93ebfe..fc939fa 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -515,9 +515,6 @@ aesni_gcm_uninit(const char *name)
}
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = aesni_gcm_init,
.uninit = aesni_gcm_uninit
};
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 30c0706..2047269 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -715,9 +715,6 @@ cryptodev_aesni_mb_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index ba2829d..d1b0b99 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -651,9 +651,6 @@ cryptodev_kasumi_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_kasumi_init,
.uninit = cryptodev_kasumi_uninit
};
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 4c12faa..bd139b4 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -269,9 +269,6 @@ cryptodev_null_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_null_init,
.uninit = cryptodev_null_uninit
};
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 10c6b83..c46d7e5 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -639,9 +639,6 @@ cryptodev_snow3g_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_snow3g_init,
.uninit = cryptodev_snow3g_uninit
};
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 9a9a2ee..810ec48 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -890,9 +890,6 @@ rte_pmd_af_packet_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_af_packet_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_af_packet_devinit,
.uninit = rte_pmd_af_packet_devuninit
};
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5fa2a93..1496cdf 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2509,9 +2509,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
}
static struct rte_vdev_driver bond_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = bond_init,
.uninit = bond_uninit
};
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index efb000b..9382bcf 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1624,16 +1624,10 @@ rte_pmd_mpipe_devinit(const char *ifname,
}
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit
};
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit
};
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index be4169e..e85c67e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -687,9 +687,6 @@ rte_pmd_null_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_null_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit
};
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index d6718b8..2d76a7e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1084,9 +1084,6 @@ rte_pmd_pcap_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_pcap_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit
};
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 77bd664..d687ed6 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -624,9 +624,6 @@ rte_pmd_ring_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_ring_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit
};
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index e2610b4..ae49f15 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -925,9 +925,6 @@ rte_pmd_vhost_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_vhost_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_vhost_devinit,
.uninit = rte_pmd_vhost_devuninit
};
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 7975298..7c604f9 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -463,9 +463,6 @@ virtio_user_pmd_devuninit(const char *name)
}
static struct rte_vdev_driver virtio_user_driver = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = virtio_user_pmd_devinit,
.uninit = virtio_user_pmd_devuninit
};
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 7da0f17..ea69afc 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -760,9 +760,6 @@ rte_pmd_xenvirt_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_xenvirt_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit
};
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 3097194..3d0d2b8 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,19 +105,10 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Driver type enumeration
- */
-enum pmd_type {
- PMD_VDEV = 0,
- PMD_PDEV = 1,
-};
-
-/**
* A structure describing a device driver.
*/
struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
- enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
};
@@ -198,15 +189,6 @@ int rte_eal_dev_detach(const char *name);
static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
-#define PMD_REGISTER_DRIVER(drv, nm)\
-RTE_INIT(devinitfn_ ##drv);\
-static void devinitfn_ ##drv(void)\
-{\
- (drv).name = RTE_STR(nm);\
- rte_eal_driver_register(&drv);\
-} \
-DRIVER_EXPORT_NAME(nm, __COUNTER__)
-
#define DRV_EXP_TAG(name, tag) __##name##_##tag
#define DRIVER_REGISTER_PCI_TABLE(name, table) \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 20/25] eal: rte_pci.h includes rte_dev.h
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (18 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 21/25] eal: rename and move rte_pci_resource Shreyansh Jain
` (7 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
Further refactoring and generalization of PCI infrastructure will
require access to the rte_dev.h contents.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_pci.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 4ca68a2..e8e05da 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -84,6 +84,7 @@ extern "C" {
#include <rte_debug.h>
#include <rte_interrupts.h>
+#include <rte_dev.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 21/25] eal: rename and move rte_pci_resource
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (19 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 20/25] eal: rte_pci.h includes rte_dev.h Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
` (6 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/net/szedata2/rte_eth_szedata2.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 8 ++++++++
lib/librte_eal/common/include/rte_pci.h | 11 +----------
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 6d21024..1b9e88a 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1416,7 +1416,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
int ret;
uint32_t szedata2_index;
struct rte_pci_addr *pci_addr = &dev->pci_dev->addr;
- struct rte_pci_resource *pci_rsc =
+ struct rte_mem_resource *pci_rsc =
&dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER];
char rsc_filename[PATH_MAX];
void *pci_resource_ptr = NULL;
@@ -1473,7 +1473,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, dev->pci_dev);
- /* mmap pci resource0 file to rte_pci_resource structure */
+ /* mmap pci resource0 file to rte_mem_resource structure */
if (dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].phys_addr ==
0) {
RTE_LOG(ERR, PMD, "Missing resource%u file\n",
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 3d0d2b8..5c314bf 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -100,6 +100,14 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
} \
} while (0)
+/**
+ * A generic memory resource representation.
+ */
+struct rte_mem_resource {
+ uint64_t phys_addr; /**< Physical address, 0 if not resource. */
+ uint64_t len; /**< Length of the resource. */
+ void *addr; /**< Virtual address, NULL when not mapped. */
+};
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index e8e05da..e2d457a 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -108,15 +108,6 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
-/**
- * A structure describing a PCI resource.
- */
-struct rte_pci_resource {
- uint64_t phys_addr; /**< Physical address, 0 if no resource. */
- uint64_t len; /**< Length of the resource. */
- void *addr; /**< Virtual address, NULL when not mapped. */
-};
-
/** Maximum number of PCI resources. */
#define PCI_MAX_RESOURCE 6
@@ -160,7 +151,7 @@ struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
- struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
+ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (20 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 21/25] eal: rename and move rte_pci_resource Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-08 14:25 ` Ferruh Yigit
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 23/25] eal: call rte_eal_driver_register Shreyansh Jain
` (5 subsequent siblings)
27 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
populated into the rte_driver.name member - assignments through eth_driver
has been removed.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/test_pci.c | 10 +++++++---
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
drivers/net/bnx2x/bnx2x_rxtx.c | 3 ++-
drivers/net/bnxt/bnxt_ethdev.c | 1 -
drivers/net/cxgbe/cxgbe_ethdev.c | 1 -
drivers/net/cxgbe/sge.c | 7 ++++---
drivers/net/e1000/em_ethdev.c | 1 -
drivers/net/e1000/igb_ethdev.c | 2 --
drivers/net/ena/ena_ethdev.c | 1 -
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/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 2 --
drivers/net/mlx4/mlx4.c | 4 +++-
drivers/net/mlx5/mlx5.c | 4 +++-
drivers/net/nfp/nfp_net.c | 5 ++---
drivers/net/qede/qede_ethdev.c | 2 --
drivers/net/szedata2/rte_eth_szedata2.c | 1 -
drivers/net/thunderx/nicvf_ethdev.c | 1 -
drivers/net/virtio/virtio_ethdev.c | 3 +--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 ++--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 4 ++--
lib/librte_eal/common/eal_common_pci.c | 4 ++--
lib/librte_eal/common/include/rte_pci.h | 4 ++--
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 +++
lib/librte_ether/rte_ethdev.c | 6 +++---
31 files changed, 40 insertions(+), 47 deletions(-)
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 69f78d9..ae597ab 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -78,14 +78,18 @@ struct rte_pci_id my_driver_id2[] = {
};
struct rte_pci_driver my_driver = {
- .name = "test_driver",
+ .driver = {
+ .name = "test_driver"
+ },
.devinit = my_driver_init,
.id_table = my_driver_id,
.drv_flags = 0,
};
struct rte_pci_driver my_driver2 = {
- .name = "test_driver2",
+ .driver = {
+ .name = "test_driver2"
+ },
.devinit = my_driver_init,
.id_table = my_driver_id2,
.drv_flags = 0,
@@ -95,7 +99,7 @@ static int
my_driver_init(__attribute__((unused)) struct rte_pci_driver *dr,
struct rte_pci_device *dev)
{
- printf("My driver init called in %s\n", dr->name);
+ printf("My driver init called in %s\n", dr->driver.name);
printf("%x:%x:%x.%d", dev->addr.domain, dev->addr.bus,
dev->addr.devid, dev->addr.function);
printf(" - vendor:%x device:%x\n", dev->id.vendor_id, dev->id.device_id);
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 8a1f0d0..56eeb99 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -586,7 +586,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
pci_dev->numa_node = socket_id;
- pci_drv->name = virtual_ethdev_driver_name;
+ pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
if (isr_support)
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index 5de47e3..2e7188b 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -300,7 +300,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
* Allocate a memzone for the queue - create a unique name.
*/
snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d",
- dev->driver->pci_drv.name, "qp_mem", dev->data->dev_id,
+ dev->driver->pci_drv.driver.name, "qp_mem", dev->data->dev_id,
queue->hw_bundle_number, queue->hw_queue_number);
qp_mz = queue_dma_zone_reserve(queue->memz_name, queue_size_bytes,
socket_id);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 214b655..847888e 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -618,7 +618,6 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_bnx2x_pmd = {
.pci_drv = {
- .name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
@@ -633,7 +632,6 @@ static struct eth_driver rte_bnx2x_pmd = {
*/
static struct eth_driver rte_bnx2xvf_pmd = {
.pci_drv = {
- .name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 0ec4f89..7adea99 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -19,7 +19,8 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name, dev->data->port_id, queue_id);
+ dev->driver->pci_drv.driver.name, ring_name,
+ dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
if (mz)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 28eb8b9..d5ca9bf 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1045,7 +1045,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
static struct eth_driver bnxt_rte_pmd = {
.pci_drv = {
- .name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 431b06d..a37b124 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1039,7 +1039,6 @@ out_free_adapter:
static struct eth_driver rte_cxgbe_pmd = {
.pci_drv = {
- .name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index ab5a842..736f08c 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1645,7 +1645,8 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
iq->size = cxgbe_roundup(iq->size, 16);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, fwevtq ? "fwq_ring" : "rx_ring",
+ eth_dev->driver->pci_drv.driver.name,
+ fwevtq ? "fwq_ring" : "rx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1697,7 +1698,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
fl->size = cxgbe_roundup(fl->size, 8);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
fwevtq ? "fwq_ring" : "fl_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1893,7 +1894,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, "tx_ring",
+ eth_dev->driver->pci_drv.driver.name, "tx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 1281c8b..7f8fc21 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -391,7 +391,6 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_em_pmd = {
.pci_drv = {
- .name = "rte_em_pmd",
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 395477e..811d9ae 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1078,7 +1078,6 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_igb_pmd = {
.pci_drv = {
- .name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1095,7 +1094,6 @@ static struct eth_driver rte_igb_pmd = {
*/
static struct eth_driver rte_igbvf_pmd = {
.pci_drv = {
- .name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ee906d4..4d6e83f 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1686,7 +1686,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
static struct eth_driver rte_ena_pmd = {
.pci_drv = {
- .name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 59812d0..c80b8f7 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -613,7 +613,6 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_enic_pmd = {
.pci_drv = {
- .name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 26cdc10..11e4014 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3055,7 +3055,6 @@ static const struct rte_pci_id pci_id_fm10k_map[] = {
static struct eth_driver rte_pmd_fm10k = {
.pci_drv = {
- .name = "rte_pmd_fm10k",
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dacaaea..892a221 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -663,7 +663,6 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
static struct eth_driver rte_i40e_pmd = {
.pci_drv = {
- .name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 4a745f9..952bcd3 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1554,7 +1554,6 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
*/
static struct eth_driver rte_i40evf_pmd = {
.pci_drv = {
- .name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index f65c411..a4efc6d 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -251,7 +251,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
/* reserve memory for the fdir programming packet */
snprintf(z_name, sizeof(z_name), "%s_%s_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
I40E_FDIR_MZ_NAME,
eth_dev->data->port_id);
mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN, SOCKET_ID_ANY);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d2f46bc..65ec846 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1562,7 +1562,6 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_ixgbe_pmd = {
.pci_drv = {
- .name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1579,7 +1578,6 @@ static struct eth_driver rte_ixgbe_pmd = {
*/
static struct eth_driver rte_ixgbevf_pmd = {
.pci_drv = {
- .name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index b333ad6..3d2df9c 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5911,7 +5911,9 @@ static const struct rte_pci_id mlx4_pci_id_map[] = {
static struct eth_driver mlx4_driver = {
.pci_drv = {
- .name = MLX4_DRIVER_NAME,
+ .driver = {
+ .name = MLX4_DRIVER_NAME
+ },
.id_table = mlx4_pci_id_map,
.devinit = mlx4_pci_devinit,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ebad7cb..82c11f3 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -728,7 +728,9 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
static struct eth_driver mlx5_driver = {
.pci_drv = {
- .name = MLX5_DRIVER_NAME,
+ .driver = {
+ .name = MLX5_DRIVER_NAME
+ },
.id_table = mlx5_pci_id_map,
.devinit = mlx5_pci_devinit,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index cbaf219..764d58d 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -214,7 +214,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name,
+ dev->driver->pci_drv.driver.name,
ring_name, dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -1000,7 +1000,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->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
@@ -2460,7 +2460,6 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
static struct eth_driver rte_nfp_net_pmd = {
.pci_drv = {
- .name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a92dd3b..2ef432f 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1478,7 +1478,6 @@ static struct rte_pci_id pci_id_qede_map[] = {
static struct eth_driver rte_qedevf_pmd = {
.pci_drv = {
- .name = "rte_qedevf_pmd",
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
@@ -1492,7 +1491,6 @@ static struct eth_driver rte_qedevf_pmd = {
static struct eth_driver rte_qede_pmd = {
.pci_drv = {
- .name = "rte_qede_pmd",
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 1b9e88a..4e4a318 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1572,7 +1572,6 @@ static const struct rte_pci_id rte_szedata2_pci_id_table[] = {
static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
- .name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
.devinit = rte_eth_dev_pci_probe,
.devuninit = rte_eth_dev_pci_remove,
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index ad7d607..783acbf 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1759,7 +1759,6 @@ static const struct rte_pci_id pci_id_nicvf_map[] = {
static struct eth_driver rte_nicvf_pmd = {
.pci_drv = {
- .name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 5453709..7abacd3 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1304,7 +1304,6 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_virtio_pmd = {
.pci_drv = {
- .name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
@@ -1534,7 +1533,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct virtio_hw *hw = dev->data->dev_private;
if (dev->pci_dev)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
else
dev_info->driver_name = "virtio_user PMD";
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index d732979..857e59a 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -137,7 +137,8 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%d_%s",
- dev->driver->pci_drv.name, dev->data->port_id, post_string);
+ dev->driver->pci_drv.driver.name,
+ dev->data->port_id, post_string);
mz = rte_memzone_lookup(z_name);
if (mz)
@@ -328,7 +329,6 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_vmxnet3_pmd = {
.pci_drv = {
- .name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.devinit = rte_eth_dev_pci_probe,
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index 9deeb3f..e6d93f3 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -774,7 +774,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index c81e366..2e17169 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -459,7 +459,7 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_drv->name,
+ " failed", pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
@@ -870,7 +870,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
dev_info->pci_dev = dev->pci_dev;
if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
}
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index da0038f..308c2a9 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -195,7 +195,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
RTE_LOG(INFO, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
/* map resources for devices that use igb_uio */
@@ -255,7 +255,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
loc->function, dev->numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->devuninit && (dr->devuninit(dev) < 0))
return -1; /* negative value is an error */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index e2d457a..4d8daf7 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -199,7 +199,7 @@ typedef int (pci_devuninit_t)(struct rte_pci_device *);
*/
struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
- const char *name; /**< Driver name. */
+ struct rte_driver driver; /**< Inherit core driver. */
pci_devinit_t *devinit; /**< Device init. function. */
pci_devuninit_t *devuninit; /**< Device uninit function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
@@ -491,7 +491,7 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);
RTE_INIT(pciinitfn_ ##nm); \
static void pciinitfn_ ##nm(void) \
{ \
- (pci_drv).name = RTE_STR(nm);\
+ (pci_drv).driver.name = RTE_STR(nm);\
rte_eal_pci_register(&pci_drv); \
}\
DRIVER_EXPORT_NAME(nm, __COUNTER__)
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index c0bd391..b8bfd4b 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -172,4 +172,7 @@ DPDK_16.11 {
rte_eal_dev_attach;
rte_eal_dev_detach;
+ rte_eal_vdrv_register;
+ rte_eal_vdrv_unregister;
+
} DPDK_16.07;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index cf38f32..d7179e1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -276,7 +276,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
- pci_drv->name,
+ pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
@@ -2566,7 +2566,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -3208,7 +3208,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->kdrv = pci_dev->kdrv;
eth_dev->data->numa_node = pci_dev->numa_node;
- eth_dev->data->drv_name = pci_dev->driver->name;
+ eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
int
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 23/25] eal: call rte_eal_driver_register
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (21 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 24/25] eal: introduce rte_device Shreyansh Jain
` (4 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
To register both vdev and pci drivers into the list of all rte_driver,
we have to call rte_eal_driver_register explicitly.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 2 ++
lib/librte_eal/common/eal_common_vdev.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 308c2a9..2c89530 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -470,11 +470,13 @@ void
rte_eal_pci_register(struct rte_pci_driver *driver)
{
TAILQ_INSERT_TAIL(&pci_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_pci_unregister(struct rte_pci_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&pci_driver_list, driver, next);
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 83f8ea8..9fff0cb 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -48,12 +48,14 @@ void
rte_eal_vdrv_register(struct rte_vdev_driver *driver)
{
TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&vdev_driver_list, driver, next);
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 24/25] eal: introduce rte_device
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (22 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 23/25] eal: call rte_eal_driver_register Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 25/25] eal/pci: Create rte_device list and fallback on its members Shreyansh Jain
` (3 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 13 +++++++++++++
lib/librte_eal/common/include/rte_dev.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index afa33fa..d1f0ad8 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -48,6 +48,9 @@
/** Global list of device drivers. */
static struct rte_driver_list dev_driver_list =
TAILQ_HEAD_INITIALIZER(dev_driver_list);
+/** Global list of device drivers. */
+static struct rte_device_list dev_device_list =
+ TAILQ_HEAD_INITIALIZER(dev_device_list);
/* register a driver */
void
@@ -63,6 +66,16 @@ rte_eal_driver_unregister(struct rte_driver *driver)
TAILQ_REMOVE(&dev_driver_list, driver, next);
}
+void rte_eal_device_insert(struct rte_device *dev)
+{
+ TAILQ_INSERT_TAIL(&dev_device_list, dev, next);
+}
+
+void rte_eal_device_remove(struct rte_device *dev)
+{
+ TAILQ_REMOVE(&dev_device_list, dev, next);
+}
+
int
rte_eal_dev_init(void)
{
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 5c314bf..d159991 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -111,6 +111,37 @@ struct rte_mem_resource {
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
+/** Double linked list of devices. */
+TAILQ_HEAD(rte_device_list, rte_device);
+
+/* Forward declaration */
+struct rte_driver;
+
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+ TAILQ_ENTRY(rte_device) next; /**< Next device */
+ struct rte_driver *driver; /**< Associated driver */
+ int numa_node; /**< NUMA node connection */
+ struct rte_devargs *devargs; /**< Device user arguments */
+};
+
+/**
+ * Insert a device detected by a bus scanning.
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the detected device.
+ */
+void rte_eal_device_insert(struct rte_device *dev);
+
+/**
+ * Remove a device (e.g. when being unplugged).
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the device to be removed.
+ */
+void rte_eal_device_remove(struct rte_device *dev);
/**
* A structure describing a device driver.
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v9 25/25] eal/pci: Create rte_device list and fallback on its members
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (23 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 24/25] eal: introduce rte_device Shreyansh Jain
@ 2016-09-07 14:08 ` Shreyansh Jain
2016-09-07 18:40 ` [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization Stephen Hemminger
` (2 subsequent siblings)
27 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-07 14:08 UTC (permalink / raw)
To: dev; +Cc: hemant.agrawal, Shreyansh Jain, Jan Viktorin
Now that rte_device is available, drivers can start using its members (numa,
name) as well as link themselves into another rte_device list.
As of now no one is using this list, but can be used for moving over all
devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 4 ++--
drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
drivers/net/i40e/i40e_ethdev.c | 6 ++++--
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/virtio/virtio_pci.c | 5 +++--
lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
lib/librte_eal/common/include/rte_pci.h | 3 +--
lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
lib/librte_ether/rte_ethdev.c | 2 +-
10 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 56eeb99..4831113 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -585,7 +585,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
if (eth_dev == NULL)
goto err;
- pci_dev->numa_node = socket_id;
+ pci_dev->device.numa_node = socket_id;
pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
@@ -626,7 +626,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
eth_dev->dev_ops = &dev_private->dev_ops;
eth_dev->pci_dev = pci_dev;
- eth_dev->pci_dev->driver = ð_drv->pci_drv;
+ eth_dev->pci_dev->device.driver = ð_drv->pci_drv.driver;
eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success;
eth_dev->tx_pkt_burst = virtual_ethdev_tx_burst_success;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 11e4014..8d815fd 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -675,7 +675,7 @@ fm10k_dev_tx_init(struct rte_eth_dev *dev)
/* Enable use of FTAG bit in TX descriptor, PFVTCTL
* register is read-only for VF.
*/
- if (fm10k_check_ftag(dev->pci_dev->devargs)) {
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs)) {
if (hw->mac.type == fm10k_mac_pf) {
FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i),
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
@@ -2731,7 +2731,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
int use_sse = 1;
uint16_t tx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
tx_ftag_en = 1;
for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -2762,7 +2762,7 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)
uint16_t i, rx_using_sse;
uint16_t rx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
rx_ftag_en = 1;
/* In order to allow Vector Rx there are a few configuration
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 892a221..6d2f027 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -905,8 +905,10 @@ config_floating_veb(struct rte_eth_dev *dev)
memset(pf->floating_veb_list, 0, sizeof(pf->floating_veb_list));
if (hw->aq.fw_maj_ver >= FLOATING_VEB_SUPPORTED_FW_MAJ) {
- pf->floating_veb = is_floating_veb_supported(pci_dev->devargs);
- config_vf_floating_veb(pci_dev->devargs, pf->floating_veb,
+ pf->floating_veb =
+ is_floating_veb_supported(pci_dev->device.devargs);
+ config_vf_floating_veb(pci_dev->device.devargs,
+ pf->floating_veb,
pf->floating_veb_list);
} else {
pf->floating_veb = false;
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 82c11f3..85d6c1d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -511,7 +511,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
priv->mtu = ETHER_MTU;
priv->mps = mps; /* Enable MPW by default if supported. */
priv->cqe_comp = 1; /* Enable compression by default. */
- err = mlx5_args(priv, pci_dev->devargs);
+ err = mlx5_args(priv, pci_dev->device.devargs);
if (err) {
ERROR("failed to process device arguments: %s",
strerror(err));
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index f1a7ca7..9b47165 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -745,8 +745,9 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
- (!dev->devargs ||
- dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
+ (!dev->device.devargs ||
+ dev->device.devargs->type !=
+ RTE_DEVTYPE_WHITELISTED_PCI)) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
return 1;
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 1d91c78..8b3ed88 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -287,7 +287,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
dev->max_vfs = 0;
/* FreeBSD has no NUMA support (yet) */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
/* FreeBSD has only one pass through driver */
dev->kdrv = RTE_KDRV_NIC_UIO;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 2c89530..96f6db4 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -185,11 +185,12 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
RTE_LOG(INFO, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid, loc->function,
- dev->numa_node);
+ dev->device.numa_node);
/* no initialization when blacklisted, return without error */
- if (dev->devargs != NULL &&
- dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
+ if (dev->device.devargs != NULL &&
+ dev->device.devargs->type ==
+ RTE_DEVTYPE_BLACKLISTED_PCI) {
RTE_LOG(INFO, EAL, " Device is blacklisted, not initializing\n");
return 1;
}
@@ -252,7 +253,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid,
- loc->function, dev->numa_node);
+ loc->function, dev->device.numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->driver.name);
@@ -417,7 +418,7 @@ rte_eal_pci_probe(void)
/* set devargs in PCI structure */
devargs = pci_devargs_lookup(dev);
if (devargs != NULL)
- dev->devargs = devargs;
+ dev->device.devargs = devargs;
/* probe all or only whitelisted devices */
if (probe_all)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 4d8daf7..56ff6f2 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -149,14 +149,13 @@ enum rte_kernel_driver {
*/
struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
+ struct rte_device device; /**< Inherit core device */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
- int numa_node; /**< NUMA node connection */
- struct rte_devargs *devargs; /**< Device user arguments */
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
};
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 62da4d4..876ba38 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -350,13 +350,13 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
dirname);
if (access(filename, R_OK) != 0) {
/* if no NUMA support, set default to 0 */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
} else {
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
free(dev);
return -1;
}
- dev->numa_node = tmp;
+ dev->device.numa_node = tmp;
}
/* parse resources */
@@ -390,6 +390,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
/* device is valid, add in list (sorted) */
if (TAILQ_EMPTY(&pci_device_list)) {
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
} else {
struct rte_pci_device *dev2;
@@ -402,6 +403,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
if (ret < 0) {
TAILQ_INSERT_BEFORE(dev2, dev, next);
+ rte_eal_device_insert(&dev->device);
} else { /* already registered */
dev2->kdrv = dev->kdrv;
dev2->max_vfs = dev->max_vfs;
@@ -411,6 +413,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
return 0;
}
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index d7179e1..d54ec9e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3207,7 +3207,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = pci_dev->kdrv;
- eth_dev->data->numa_node = pci_dev->numa_node;
+ eth_dev->data->numa_node = pci_dev->device.numa_node;
eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (24 preceding siblings ...)
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 25/25] eal/pci: Create rte_device list and fallback on its members Shreyansh Jain
@ 2016-09-07 18:40 ` Stephen Hemminger
2016-09-08 7:10 ` Shreyansh Jain
2016-09-09 16:11 ` Declan Doherty
2016-09-12 7:32 ` David Marchand
27 siblings, 1 reply; 375+ messages in thread
From: Stephen Hemminger @ 2016-09-07 18:40 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
On Wed, 7 Sep 2016 19:37:52 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Based on master (e22856313)
>
> Background:
> ===========
>
> It includes two different patch-sets floated on ML earlier:
> * Original patch series is from David Marchand [1], [2].
> `- This focused mainly on PCI (PDEV) part
> `- v7 of this was posted by me [8] in August/2016
> * Patch series [4] from Jan Viktorin
> `- This focused on VDEV and rte_device integration
>
> Introduction:
> =============
>
> This patch series introduces a generic device model, moving away from PCI
> centric code layout. Key change is to introduce rte_driver/rte_device
> structures at the top level which are inherited by
> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> future),...}.
>
> Key motivation for this series is to move away from PCI centric design of
> EAL to a more hierarchical device model - pivoted around a generic driver
> and device. Each specific driver and device can inherit the common
> properties of the generic set and build upon it through driver/device
> specific functions.
>
> Earlier, the EAL device initialization model was:
> (Refer: [3])
>
> --
> Constructor:
> |- PMD_DRIVER_REGISTER(rte_driver)
> `- insert into dev_driver_list, rte_driver object
>
> rte_eal_init():
> |- rte_eal_pci_init()
> | `- scan and fill pci_device_list from sysfs
> |
> |- rte_eal_dev_init()
> | `- For each rte_driver in dev_driver_list
> | `- call the rte_driver->init() function
> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
> | |- eth_driver have rte_pci_driver embedded in them
> | `- rte_eth_driver_register installs the
> | rte_pci_driver->devinit/devuninit callbacks.
> |
> |- rte_eal_pci_probe()
> | |- For each device detected, dev_driver_list is parsed and matching is
> | | done.
> | |- For each matching device, the rte_pci_driver->devinit() is called.
> | |- Default map is to rte_eth_dev_init() which in turn creates a
> | | new ethernet device (eth_dev)
> | | `- eth_drv->eth_dev_init() is called which is implemented by
> `--| individual PMD drivers.
>
> --
>
> The structure of driver looks something like:
>
> +------------+ ._____.
> | rte_driver <-----| PMD |___
> | .init | `-----` \
> +----.-------+ | \
> `-. | What PMD actually is
> \ | |
> +----------v----+ |
> | eth_driver | |
> | .eth_dev_init | |
> +----.----------+ |
> `-. |
> \ |
> +------------v---+
> | rte_pci_driver |
> | .pci_devinit |
> +----------------+
>
> and all devices are part of a following linked lists:
> - dev_driver_list for all rte_drivers
> - pci_device_list for all devices, whether PCI or VDEV
>
>
> From the above:
> * a PMD initializes a rte_driver, eth_driver even though actually it is a
> pci_driver
> * initialization routines are passed from rte_driver->pci_driver->eth_driver
> even though they should ideally be rte_eal_init()->rte_pci_driver()
> * For a single driver/device type model, this is not necessarily a
> functional issue - but more of a design language.
> * But, when number of driver/device type increase, this would create problem
> in how driver<=>device links are represented.
>
> Proposed Architecture:
> ======================
>
> A nice representation has already been created by David in [3]. Copying that
> here:
>
> +------------------+ +-------------------------------+
> | | | |
> | rte_pci_device | | rte_pci_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> +-------------------------------+
>
> - for ethdev on top of vdev devices
>
> +------------------+ +-------------------------------+
> | | | |
> | drv specific | | rte_vdev_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> | int priv_size |
> | |
> +-------------------------------+
>
> Representing from above, it would be:
>
> +--------------+
> | rte_driver |
> | name |
> | <Future> |
> +------^-------+ pci_driver_list
> | / vdev_driver_list
> `---. <<Inherits>> / /
> |\____________/_______ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_driver | | rte_vdev_driver |
> | pci_devinit() | | vdev_devinit() |
> | pci_devuninit()| | vdev_devuninit()|
> | <more> | | <more> |
> +-----------------+ +------------------+
>
>
> +--------------+
> | rte_device |
> | name |
> | <Future> |
> +------^-------+ pci_device_list
> | / xxx_device_list
> `---. <<Inherits>> / /
> |\____________/________ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_device | | rte_xxx_device |
> | <dev data> | | <dev data> |
> | <flags/intr> | | <flags/intr> |
> | <more> | | <more> |
> +-----------------+ +------------------+
>
> * Each driver type has its own structure which derives from the generic
> rte_driver structure.
> \- Each driver type maintains its own list, at the same time, rte_driver
> list also exists - so that *all* drivers can be looped on, if required.
> * Each device, associated with one or more drivers, has its own type
> derived from rte_device
> \- Each device _may_ maintain its own list (for example, in current
> implementation, vdev is not maintaining it).
>
> ==Introducing a new device/driver type implies==
> - creating their own rte_<xxx>.h file which contains the device/driver
> definitions.
> - defining the DRIVER_REGISTER_XXX helpers
>
> ==Hotplugging Support==
> - devices should be able to support attach/detach operations.
> - Earlier these functions were part of ethdev. They have been moved to eal
> to be more generic.
>
> This patch is part of larger aim to:
>
> --------------------+ <is type of>
> eth_driver (PMD) |-------------> rte_driver
> crypto_driver (PMD) | ^
> <more in future> | |
> --------------------+ | <inherits>
> /
> +-----------------------/+
> | rte_pci_driver |
> | rte_vdev_driver |
> | rte_soc_driver |
> | rte_xxx_driver |
>
> Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
> drivers rather than explicitly inheriting type specific driver (PCI, etc).
>
>
> About the Patches:
> ==================
>
> There are a large number of patches for this - primarily because the changes
> are quite varied and keeping them logically separate yet compilable is
> important. Most of the patches are small and those which are large touch the
> drivers (PMDs) to accommodate the structure changes:
>
> - Patches 0001~0003 are for introducing the container_of function (so that
> rte_device can be obtained from rte_pci_device, for example), and
> removing unused code.
> - Patches 0004~0007 just perform the ground work for enabling change from
> rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
> - In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
> including cryptodev, which is eventually generalized with PCI)
> - Patch 0009~0010 merge the crypto and pci functions for registration and
> naming.
> - Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
> complete bus and has been generalized into EAl from ethdev.
> - Patches 0015 introduces vdev init/uninit into separate C units and
> enables its compilation. Patch 0016~0017 build on it and remove the
> remaining legacy support for vdev/pdev distinctions.
> - Patches 0018~0022 enable the vdev drivers to register using the
> DRIVER_REGISTER_* operations, and remove their rte_driver->init()
> - Patch 0023 enables the rte_driver registration into a common driver
> linked list.
> - Patches 0024~0025 introduce the rte_device, a generalization of
> rte_xxx_device, and associated operation of creating rte_device linked
> list. It also enables the drivers to use rte_device.name/numa_node
> members rather than rte_xxx_device specific members.
>
> Notes:
> ======
>
> * Some sign-off were already provided by Jan on the original v5; But, as a
> large number of merges have been made, I am leaving those out just in case
> it is not sync with initial understanding.
>
> * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
> removed [7].
>
> Future Work/Pending:
> ===================
> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
> rte_device model. eth_driver still is a PCI specific entity. This
> has been highlighted by comments from Ferruh in [9].
> - cryptodev driver too still remains to be normalized over the rte_driver
> model
> - Some variables, like drv_name (as highlighted by Ferruh), are getting
> duplicated across rte_xxx_driver/device and rte_driver/device.
>
> References:
> ===========
>
> [1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
> [2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
> [3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> [4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
> [5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
> [6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
> [7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
> [8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
> [9] http://dpdk.org/ml/archives/dev/2016-August/045947.html
>
> Changes since v8:
> - Some review comments from Ferruh Yigit & Reshma Pattan have been fixed.
> = Though changes in mlx4/mlx5/szedata2 have been done, I am still unable to
> verify those in absence of a proper environment at my end.
> = Comment from Ferruh for eth_driver, drv_name are not fixed yet.
> - Added a 'Future work' section in Covering letter
>
> Changes since v7:
> - Rebase over master (e22856313fff2)
> - Merge the patch series by David [1][2] and Jan [4] into a single set
> hereafter, PCI and VDEV, both are re-factored for rte_device/driver model
>
> Changes since v6:
> - rebase over 16.07 (b0a1419)
> - DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
> - review comments regarding missing information in log messages
> - new API additions to 16.11 map objects
> - review comment in [5] and [7] are not included in this series.
>
> Changes since v5:
> - Rebase over master (11c5e45d8)
> - Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in
> sync
> with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
> - Modifications to bnxt and thunderx driver PMD registration files for
> using the simplified PCI device registration helper macro
>
> Changes since v4:
> - Fix compilation issue after rebase on HEAD (913154e) in previous series
> - Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
> were removed by previous patchset. These are being used by pdump library
>
> Changes since v3:
> - rebase over HEAD (913154e)
> - Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
> - modify qede driver to use RTE_EAL_PCI_REGISTER
> - Argument check in hotplug functions
>
> Changes since v2:
> - rebase over HEAD (d76c193)
> - Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
>
> Changes since v1:
> - rebased on HEAD, new drivers should be okay
> - patches have been split into smaller pieces
> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> - device type has been removed from ethdev, as it was used only by hotplug
> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> dropped for now, we can do this once vdev drivers have been converted
>
>
> Shreyansh Jain (25):
> eal: define macro container_of
> eal: remove duplicate function declaration
> pci: no need for dynamic tailq init
> crypto: no need for a crypto pmd type
> drivers: align pci driver definitions
> eal: introduce init macros
> driver: init/uninit common wrappers for PCI drivers
> drivers: convert all pdev drivers as pci drivers
> driver: Remove driver register callbacks for crypto/net
> eal/pci: Helpers for device name parsing/update
> ethdev: do not scan all pci devices on attach
> eal: add hotplug operations for pci and vdev
> ethdev: convert to eal hotplug
> ethdev: get rid of device type
> eal: extract vdev infra
> eal: Remove PDEV/VDEV unused code
> drivers: convert PMD_VDEV drivers to use rte_vdev_driver
> eal: move init/uninit to rte_vdev_driver
> eal: remove PMD_DRIVER_REGISTER and unused pmd_types
> eal: rte_pci.h includes rte_dev.h
> eal: rename and move rte_pci_resource
> eal/pci: inherit rte_driver by rte_pci_driver
> eal: call rte_eal_driver_register
> eal: introduce rte_device
> eal/pci: Create rte_device list and fallback on its members
>
> app/test/test_pci.c | 10 +-
> app/test/virtual_pmd.c | 8 +-
> drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
> drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
> drivers/crypto/null/null_crypto_pmd.c | 7 +-
> drivers/crypto/qat/qat_qp.c | 2 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
> drivers/net/af_packet/rte_eth_af_packet.c | 11 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
> drivers/net/bnx2x/bnx2x_rxtx.c | 3 +-
> drivers/net/bnxt/bnxt_ethdev.c | 17 +-
> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> drivers/net/bonding/rte_eth_bond_pmd.c | 9 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/cxgbe/sge.c | 7 +-
> drivers/net/e1000/em_ethdev.c | 17 +-
> drivers/net/e1000/igb_ethdev.c | 41 +---
> drivers/net/ena/ena_ethdev.c | 20 +-
> drivers/net/enic/enic_ethdev.c | 24 +-
> drivers/net/fm10k/fm10k_ethdev.c | 30 +--
> drivers/net/i40e/i40e_ethdev.c | 31 +--
> drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
> drivers/net/i40e/i40e_fdir.c | 2 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
> drivers/net/mlx4/mlx4.c | 21 +-
> drivers/net/mlx5/mlx5.c | 22 +-
> drivers/net/mpipe/mpipe_tilegx.c | 18 +-
> drivers/net/nfp/nfp_net.c | 28 +--
> drivers/net/null/rte_eth_null.c | 11 +-
> drivers/net/pcap/rte_eth_pcap.c | 11 +-
> drivers/net/qede/qede_ethdev.c | 42 +---
> drivers/net/ring/rte_eth_ring.c | 11 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 29 +--
> drivers/net/thunderx/nicvf_ethdev.c | 21 +-
> drivers/net/vhost/rte_eth_vhost.c | 11 +-
> drivers/net/virtio/virtio_ethdev.c | 28 +--
> drivers/net/virtio/virtio_pci.c | 5 +-
> drivers/net/virtio/virtio_user_ethdev.c | 10 +-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
> drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
> drivers/net/xenvirt/rte_eth_xenvirt.c | 11 +-
> examples/ip_pipeline/init.c | 22 --
> lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
> lib/librte_cryptodev/rte_cryptodev.h | 2 -
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
> lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
> lib/librte_eal/bsdapp/eal/Makefile | 1 +
> lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
> lib/librte_eal/common/Makefile | 2 +-
> lib/librte_eal/common/eal_common_dev.c | 95 ++++----
> lib/librte_eal/common/eal_common_pci.c | 34 ++-
> lib/librte_eal/common/eal_common_vdev.c | 106 +++++++++
> lib/librte_eal/common/eal_private.h | 20 +-
> lib/librte_eal/common/include/rte_common.h | 21 ++
> lib/librte_eal/common/include/rte_dev.h | 77 +++++--
> lib/librte_eal/common/include/rte_eal.h | 3 +
> lib/librte_eal/common/include/rte_pci.h | 51 +++--
> lib/librte_eal/common/include/rte_tailq.h | 4 +-
> lib/librte_eal/common/include/rte_vdev.h | 96 ++++++++
> lib/librte_eal/linuxapp/eal/Makefile | 1 +
> lib/librte_eal/linuxapp/eal/eal.c | 1 +
> lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
> lib/librte_ether/rte_ethdev.c | 280 +++++-------------------
> lib/librte_ether/rte_ethdev.h | 40 ++--
> lib/librte_ether/rte_ether_version.map | 10 +-
> 70 files changed, 791 insertions(+), 1025 deletions(-)
> create mode 100644 lib/librte_eal/common/eal_common_vdev.c
> create mode 100644 lib/librte_eal/common/include/rte_vdev.h
>
Overall I like to see the clean separation.
Are you sure you removed as much as possible from PCI?
I wonder of global PCI device list is needed at all if you now have list of all devices.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of
2016-08-29 16:43 ` Ferruh Yigit
2016-08-30 4:27 ` Shreyansh Jain
2016-08-30 4:31 ` Shreyansh Jain
@ 2016-09-08 5:45 ` Shreyansh Jain
2 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 5:45 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
On Monday 29 August 2016 10:13 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
>> index 332f2a4..a9b6792 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -322,6 +322,22 @@ rte_bsf32(uint32_t v)
>> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
>> #endif
>>
>> +/**
>> + * Return pointer to the wrapping struct instance.
>> + * Example:
>> + *
>> + * struct wrapper {
>> + * ...
>> + * struct child c;
>> + * ...
>> + * };
>> + *
>> + * struct child *x = obtain(...);
>> + * struct wrapper *w = container_of(x, struct wrapper, c);
>> + */
>> +#define container_of(p, type, member) \
>> + ((type *) (((char *) (p)) - offsetof(type, member)))
>> +
>> #define _RTE_STR(x) #x
>> /** Take a macro value and get a string version of it */
>> #define RTE_STR(x) _RTE_STR(x)
>>
>
> This gives compilation error for mlx5, because the libraries mlx depends
> defines same macro:
> ..../rte_common.h:338:9: error: 'container_of' macro redefined
> /usr/include/infiniband/verbs.h:77:9: note: previous definition is here
I have converted into a conditional macro in v9.
I still couldn't compile and test mlx* - my environment is still not
prepared. Though, I can see that this error is not being reported anymore.
>
> Does it make sense to protect macro with
> #ifndef container_of
> ....
> #endif
>
> OR
>
> add a dpdk prefix?
>
>
> Regards,
> ferruh
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net
2016-08-29 17:20 ` Ferruh Yigit
2016-08-30 4:36 ` Shreyansh Jain
@ 2016-09-08 5:46 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 5:46 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On Monday 29 August 2016 10:50 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> Now that all pdev are pci drivers, we don't need to register crypto and ethdev
>> drivers through a dedicated channel.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> ....
>
>> -void rte_eth_driver_register(struct eth_driver *eth_drv);
>
> Function needs to be removed from .map file
>
>> -
>> -/**
>> * Convert a numerical speed in Mbps to a bitmap flag that can be used in
>> * the bitmap link_speeds of the struct rte_eth_conf
>> *
>>
>
>
Removed in v9 [1].
[1] http://dpdk.org/ml/archives/dev/2016-September/046265.html
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update
2016-08-30 16:34 ` Pattan, Reshma
2016-08-31 4:24 ` Shreyansh Jain
@ 2016-09-08 5:48 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 5:48 UTC (permalink / raw)
To: Pattan, Reshma, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Reshma,
On Tuesday 30 August 2016 10:04 PM, Pattan, Reshma wrote:
> Hi,
>
>> +/**
>> + * Utility function to write a pci device name, this device name can
>> +later be
>> + * used to retrieve the corresponding rte_pci_addr using
>> +eal_parse_pci_*
>> + * BDF helpers.
>> + *
>> + * @param addr
>> + * The PCI Bus-Device-Function address
>> + * @param output
>> + * The output buffer string
>> + * @param size
>> + * The output buffer size
>> + * @return
>> + * 0 on success, negative on error.
>> + */
>
> This function doesn't have any return value. Need to change the @return description.
>
>> +static inline void
>> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
>> + char *output, size_t size)
>> +{
>> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
>> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
>> + addr->domain, addr->bus,
>> + addr->devid, addr->function) >= 0); }
>> +
>
> Thanks,
> Reshma
>
Updated the comment in v9 [1].
[1] http://dpdk.org/ml/archives/dev/2016-September/046266.html
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-08-29 16:57 ` Ferruh Yigit
2016-08-30 4:38 ` Shreyansh Jain
@ 2016-09-08 5:49 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 5:49 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
On Monday 29 August 2016 10:27 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>> All PMD_VDEV drivers can now use rte_vdev_driver instead of the
>> rte_driver (which is embedded in the rte_vdev_driver).
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>
> ....
>
>> diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
>> index 6b15381..fa00e52 100644
>> --- a/drivers/net/xenvirt/rte_eth_xenvirt.c
>> +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
>> @@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
>> return 0;
>> }
>
> xenvirt missing header file rte_vdev.h:
>
> CC rte_eth_xenvirt.o
> ..../drivers/net/xenvirt/rte_eth_xenvirt.c:762:31: error: variable has
> incomplete type 'struct rte_vdev_driver'
> static struct rte_vdev_driver pmd_xenvirt_drv = {
I have updated this in v9. Compilation now seems OK.
(I missed compiling this before v8)
>
>
>>
>> -static struct rte_driver pmd_xenvirt_drv = {
>> - .type = PMD_VDEV,
>> - .init = rte_pmd_xenvirt_devinit,
>> - .uninit = rte_pmd_xenvirt_devuninit,
>> +static struct rte_vdev_driver pmd_xenvirt_drv = {
>> + .driver = {
>> + .type = PMD_VDEV,
>> + .init = rte_pmd_xenvirt_devinit,
>> + .uninit = rte_pmd_xenvirt_devuninit
>> + },
>> };
>>
>> -PMD_REGISTER_DRIVER(pmd_xenvirt_drv, eth_xenvirt);
>> +DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
>> DRIVER_REGISTER_PARAM_STRING(eth_xenvirt,
>> "mac=<mac addr>");
>>
>
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-08-29 16:49 ` Ferruh Yigit
2016-08-30 4:59 ` Shreyansh Jain
@ 2016-09-08 5:51 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 5:51 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
On Monday 29 August 2016 10:19 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
>> Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
>>
>> Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
>> as well as assigning a name to eth_driver.pci_drv.name member.
>> In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
>> populated into the rte_driver.name member - assignments through eth_driver
>> has been removed.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> app/test/test_pci.c | 10 +++++++---
>> app/test/virtual_pmd.c | 2 +-
>> drivers/crypto/qat/qat_qp.c | 2 +-
>> drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
>
> bnx2x_rxtx.c also needs to be updated:
>
> CC bnx2x_rxtx.o
> ..../drivers/net/bnx2x/bnx2x_rxtx.c:22:25: error: no member named 'name'
> in 'struct rte_pci_driver'
> dev->driver->pci_drv.name, ring_name,
> dev->data->port_id, queue_id);
I have updated this in v9. Compilation is OK now.
(I had missed compiling this before sending v8).
>
> ....
>
>
> Also szedata2 driver seems missed:
>
> CC rte_eth_szedata2.o
> ..../drivers/net/szedata2/rte_eth_szedata2.c:1575:4: error: field
> designator 'name' does not refer to any field in type 'struct
> rte_pci_driver'
> .name = RTE_SZEDATA2_PCI_DRIVER_NAME,
> ^
>
>
>
Though I have updated the code here, I have not yet been able to compile
this because of some dependencies. I am still to setup env for szedata2
compilation.
--
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members
2016-08-29 16:53 ` Ferruh Yigit
2016-08-30 4:38 ` Shreyansh Jain
@ 2016-09-08 5:55 ` Shreyansh Jain
2016-09-08 8:33 ` Ferruh Yigit
1 sibling, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 5:55 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On Monday 29 August 2016 10:23 PM, Ferruh Yigit wrote:
> On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
>> Now that rte_device is available, drivers can start using its members (numa,
>> name) as well as link themselves into another rte_device list.
>>
>> As of now no one is using this list, but can be used for moving over all
>> devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> app/test/virtual_pmd.c | 4 ++--
>> drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
>> drivers/net/i40e/i40e_ethdev.c | 6 ++++--
>> drivers/net/virtio/virtio_pci.c | 5 +++--
>> lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
>> lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
>> lib/librte_eal/common/include/rte_pci.h | 3 +--
>> lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
>> lib/librte_ether/rte_ethdev.c | 2 +-
>> 9 files changed, 26 insertions(+), 20 deletions(-)
>
> mlx5.c needs to be updated too:
>
> CC mlx5.o
> ..../drivers/net/mlx5/mlx5.c:514:34: error: no member named 'devargs' in
> 'struct rte_pci_device'
> err = mlx5_args(priv, pci_dev->devargs);
> ~~~~~~~ ^
>
>
Updated in v9 but I haven't yet been able to compile and verify mlx* and
szedata2*.
--
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization
2016-09-01 12:36 ` Shreyansh Jain
@ 2016-09-08 7:03 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 7:03 UTC (permalink / raw)
To: Ferruh Yigit, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
Hi Ferruh,
On Thursday 01 September 2016 06:06 PM, Shreyansh Jain wrote:
> Hi Ferruh,
>
> Sorry for the delay in my reply.
> Please find some comments inline.
>
> On Tuesday 30 August 2016 06:57 PM, Ferruh Yigit wrote:
>> On 8/26/2016 2:56 PM, Shreyansh Jain wrote:
>>> Based on master (e22856313fff2)
>>>
>>> Background:
>>> ===========
>>>
>>> It includes two different patch-sets floated on ML earlier:
>>> * Original patch series is from David Marchand [1], [2].
>>> `- This focused mainly on PCI (PDEV) part
>>> `- v7 of this was posted by me [8] in August/2016
>>> * Patch series [4] from Jan Viktorin
>>> `- This focused on VDEV and rte_device integration
>>>
>>> Introduction:
>>> =============
>>>
>>> This patch series introduces a generic device model, moving away from
>>> PCI
>>> centric code layout. Key change is to introduce rte_driver/rte_device
>>> structures at the top level which are inherited by
>>> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
>>> future),...}.
>>>
>>> Key motivation for this series is to move away from PCI centric
>>> design of
>>> EAL to a more hierarchical device model - pivoted around a generic
>>> driver
>>> and device. Each specific driver and device can inherit the common
>>> properties of the generic set and build upon it through driver/device
>>> specific functions.
>>>
>>> Earlier, the EAL device initialization model was:
>>> (Refer: [3])
>>>
>>> --
>>> Constructor:
>>> |- PMD_DRIVER_REGISTER(rte_driver)
>>> `- insert into dev_driver_list, rte_driver object
>>>
>>> rte_eal_init():
>>> |- rte_eal_pci_init()
>>> | `- scan and fill pci_device_list from sysfs
>>> |
>>> |- rte_eal_dev_init()
>>> | `- For each rte_driver in dev_driver_list
>>> | `- call the rte_driver->init() function
>>> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
>>> | |- eth_driver have rte_pci_driver embedded in them
>>> | `- rte_eth_driver_register installs the
>>> | rte_pci_driver->devinit/devuninit callbacks.
>>> |
>>> |- rte_eal_pci_probe()
>>> | |- For each device detected, dev_driver_list is parsed and
>>> matching is
>>> | | done.
>>> | |- For each matching device, the rte_pci_driver->devinit() is
>>> called.
>>> | |- Default map is to rte_eth_dev_init() which in turn creates a
>>> | | new ethernet device (eth_dev)
>>> | | `- eth_drv->eth_dev_init() is called which is implemented by
>>> `--| individual PMD drivers.
>>>
>>> --
>>>
>>> The structure of driver looks something like:
>>>
>>> +------------+ ._____.
>>> | rte_driver <-----| PMD |___
>>> | .init | `-----` \
>>> +----.-------+ | \
>>> `-. | What PMD actually is
>>> \ | |
>>> +----------v----+ |
>>> | eth_driver | |
>>> | .eth_dev_init | |
>>> +----.----------+ |
>>> `-. |
>>> \ |
>>> +------------v---+
>>> | rte_pci_driver |
>>> | .pci_devinit |
>>> +----------------+
>>>
>>> and all devices are part of a following linked lists:
>>> - dev_driver_list for all rte_drivers
>>> - pci_device_list for all devices, whether PCI or VDEV
>>>
>>>
>>> From the above:
>>> * a PMD initializes a rte_driver, eth_driver even though actually it
>>> is a
>>> pci_driver
>>> * initialization routines are passed from
>>> rte_driver->pci_driver->eth_driver
>>> even though they should ideally be rte_eal_init()->rte_pci_driver()
>>> * For a single driver/device type model, this is not necessarily a
>>> functional issue - but more of a design language.
>>> * But, when number of driver/device type increase, this would create
>>> problem
>>> in how driver<=>device links are represented.
>>>
>>> Proposed Architecture:
>>> ======================
>>>
>>> A nice representation has already been created by David in [3].
>>> Copying that
>>> here:
>>>
>>> +------------------+ +-------------------------------+
>>> | | | |
>>> | rte_pci_device | | rte_pci_driver |
>>> | | | |
>>> +-------------+ | +--------------+ | | +---------------------------+ |
>>> | | | | | | | | | |
>>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>>> | | | | char name[] | | | | char name[] | |
>>> +-------------+ | | | | | | int init(rte_device *) | |
>>> | +--------------+ | | | int uninit(rte_device *) | |
>>> | | | | | |
>>> +------------------+ | +---------------------------+ |
>>> | |
>>> +-------------------------------+
>>>
>>> - for ethdev on top of vdev devices
>>>
>>> +------------------+ +-------------------------------+
>>> | | | |
>>> | drv specific | | rte_vdev_driver |
>>> | | | |
>>> +-------------+ | +--------------+ | | +---------------------------+ |
>>> | | | | | | | | | |
>>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>>> | | | | char name[] | | | | char name[] | |
>>> +-------------+ | | | | | | int init(rte_device *) | |
>>> | +--------------+ | | | int uninit(rte_device *) | |
>>> | | | | | |
>>> +------------------+ | +---------------------------+ |
>>> | |
>>> | int priv_size |
>>> | |
>>> +-------------------------------+
>
> I am in agreement to all the points you have raised below.
> Still, there are some comments:
>
>>
>> There are also "eth_driver" and "rte_cryptodev_driver", which can be
>> represent as:
>> +-----------------------------------+
>> | |
>> | eth_driver / rte_cryptodev_driver |
>> | |
>> | +-------------------------------+ |
>> | | | |
>> | | rte_pci_driver | |
>> | | | |
>> | | +---------------------------+ | |
>> | | | | | |
>> | | | rte_driver | | |
>> | | | char name[] | | |
>> | | | int init(rte_device *) | | |
>> | | | int uninit(rte_device *) | | |
>> | | | | | |
>> | | +---------------------------+ | |
>> | | | |
>> | +-------------------------------+ |
>> | |
>> +-----------------------------------+
>>
>> Is eth_driver really needs to be inherited from rte_pci_driver?
>> It is possible to have ethernet driver, without PCI bus, at least we
>> have virtual driver samples.
>
> I agree with this. There would be cases where even non-PCI devices are
> ethernet devices. As of now, in the proposed patchset, rte_soc_driver
> has been added into this but it is not a scalable solution. We cannot go
> on and add all type of devices into this.
>
> Having said this, back reference to type of ethernet device would be
> important if the ethernet driver needs to refer to some hardware
> specific information as part of rte_xxx_driver.
>
>>
>> How about:
>> +-------------------------------+
>> | |
>> | rte_pci_driver / |
>> | rte_vdev_driver |
>> | +---------------------------+ | +-------------------+
>> | | | | | eth_driver |
>> | | rte_driver |<---------- driver |
>> | | char name[] | | | eth_dev_init |
>> | | int init(rte_device *) | | | eth_dev_uninit |
>> | | int uninit(rte_device *) | | | |
>> | | | | | |
>> | +---------------------------+ | | |
>> | functional_driver ------------------>| |
>> +-------------------------------+ +-------------------+
>
> Even while I was re-creating this patchset I was wondering how to
> realign the eth_driver<=>rte_eth_dev (even naming is inconsistent) with
> rte_*_driver/device and rte_driver/device.
> I agree with you that we should link eth_driver->rte_driver.
>
> My only concern being a case where a PCI (or other) based ethernet
> device needs access to driver structure for some info. Is that even a
> possible usecase?
>
>>
>> Currently there is no way to reference rte_vdev_driver from eth_driver,
>> since it only has pci_drv field.
>
> True.
>
>>
>> With this update, it can be possible to create eth_driver and
>> rte_eth_vdev_probe() for virtual drivers for example. (Although this may
>> not necessary right now, this gives ability to do.)
>>
>
> Agree with you. This change can help various other similar cases.
>
>>
>>
>> Another think, what do you think moving "dev_private_size" from
>> eth_driver and rte_cryptodev_driver to rte_driver, since this looks like
>> generic need for drivers.
>
> I don't see any problem in this as well.
>
>>
>>
>>
>> And last think, what do you think renaming eth_driver to rte_eth_driver
>> to be consistent?
>
> Yes, I think it should have been a most basic patch -
> eth_driver<->rte_eth_dev combination has existed too long.
>
>>
>>
>> Thanks,
>> ferruh
>>
>>
>
> -
> Shreyansh
>
In the v9 that I have posted, above changes have not been incorporated
yet. All the above changes are dependent on one change: to introduce
rte_driver<->eth_driver relationship:
--------------------+ <is type of>
eth_driver (PMD) |-------------> rte_driver
crypto_driver (PMD) | ^
<more in future> | |
--------------------+ | <inherits>
/
+-----------------------/+
| rte_pci_driver |
| rte_vdev_driver |
| rte_soc_driver |
| rte_xxx_driver |
If I go ahead with above model, PMDs would now have to define
rte_driver, rte_pci_driver and eth_driver. As of now, PMDs only define a
eth_driver and embed pci_driver into it. This change makes the current
patch quite large - which is one of the primary reasons I postponed it
for another patchset/phase.
Further, now that eth_driver no longer embeds rte_pci_driver, it becomes
unused in the PMDs - it was only being used to access the init fns. I am
still to find a way around this - whether to completely do away with it
or have some macro attach it to another list.
I will work on this and post another RFC style series based on current
rte_driver/device so as to take more inputs.
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-09-07 18:40 ` [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization Stephen Hemminger
@ 2016-09-08 7:10 ` Shreyansh Jain
2016-09-08 16:49 ` Stephen Hemminger
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-08 7:10 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, hemant.agrawal
Hi Stephen,
On Thursday 08 September 2016 12:10 AM, Stephen Hemminger wrote:
> On Wed, 7 Sep 2016 19:37:52 +0530
> Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
>> Based on master (e22856313)
>>
>> Background:
>> ===========
>>
>> It includes two different patch-sets floated on ML earlier:
>> * Original patch series is from David Marchand [1], [2].
>> `- This focused mainly on PCI (PDEV) part
>> `- v7 of this was posted by me [8] in August/2016
>> * Patch series [4] from Jan Viktorin
>> `- This focused on VDEV and rte_device integration
>>
>> Introduction:
>> =============
>>
>> This patch series introduces a generic device model, moving away from PCI
>> centric code layout. Key change is to introduce rte_driver/rte_device
>> structures at the top level which are inherited by
>> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
>> future),...}.
>>
>> Key motivation for this series is to move away from PCI centric design of
>> EAL to a more hierarchical device model - pivoted around a generic driver
>> and device. Each specific driver and device can inherit the common
>> properties of the generic set and build upon it through driver/device
>> specific functions.
>>
>> Earlier, the EAL device initialization model was:
>> (Refer: [3])
>>
>> --
>> Constructor:
>> |- PMD_DRIVER_REGISTER(rte_driver)
>> `- insert into dev_driver_list, rte_driver object
>>
>> rte_eal_init():
>> |- rte_eal_pci_init()
>> | `- scan and fill pci_device_list from sysfs
>> |
>> |- rte_eal_dev_init()
>> | `- For each rte_driver in dev_driver_list
>> | `- call the rte_driver->init() function
>> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
>> | |- eth_driver have rte_pci_driver embedded in them
>> | `- rte_eth_driver_register installs the
>> | rte_pci_driver->devinit/devuninit callbacks.
>> |
>> |- rte_eal_pci_probe()
>> | |- For each device detected, dev_driver_list is parsed and matching is
>> | | done.
>> | |- For each matching device, the rte_pci_driver->devinit() is called.
>> | |- Default map is to rte_eth_dev_init() which in turn creates a
>> | | new ethernet device (eth_dev)
>> | | `- eth_drv->eth_dev_init() is called which is implemented by
>> `--| individual PMD drivers.
>>
>> --
>>
>> The structure of driver looks something like:
>>
>> +------------+ ._____.
>> | rte_driver <-----| PMD |___
>> | .init | `-----` \
>> +----.-------+ | \
>> `-. | What PMD actually is
>> \ | |
>> +----------v----+ |
>> | eth_driver | |
>> | .eth_dev_init | |
>> +----.----------+ |
>> `-. |
>> \ |
>> +------------v---+
>> | rte_pci_driver |
>> | .pci_devinit |
>> +----------------+
>>
>> and all devices are part of a following linked lists:
>> - dev_driver_list for all rte_drivers
>> - pci_device_list for all devices, whether PCI or VDEV
>>
>>
>> From the above:
>> * a PMD initializes a rte_driver, eth_driver even though actually it is a
>> pci_driver
>> * initialization routines are passed from rte_driver->pci_driver->eth_driver
>> even though they should ideally be rte_eal_init()->rte_pci_driver()
>> * For a single driver/device type model, this is not necessarily a
>> functional issue - but more of a design language.
>> * But, when number of driver/device type increase, this would create problem
>> in how driver<=>device links are represented.
>>
>> Proposed Architecture:
>> ======================
>>
>> A nice representation has already been created by David in [3]. Copying that
>> here:
>>
>> +------------------+ +-------------------------------+
>> | | | |
>> | rte_pci_device | | rte_pci_driver |
>> | | | |
>> +-------------+ | +--------------+ | | +---------------------------+ |
>> | | | | | | | | | |
>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>> | | | | char name[] | | | | char name[] | |
>> +-------------+ | | | | | | int init(rte_device *) | |
>> | +--------------+ | | | int uninit(rte_device *) | |
>> | | | | | |
>> +------------------+ | +---------------------------+ |
>> | |
>> +-------------------------------+
>>
>> - for ethdev on top of vdev devices
>>
>> +------------------+ +-------------------------------+
>> | | | |
>> | drv specific | | rte_vdev_driver |
>> | | | |
>> +-------------+ | +--------------+ | | +---------------------------+ |
>> | | | | | | | | | |
>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>> | | | | char name[] | | | | char name[] | |
>> +-------------+ | | | | | | int init(rte_device *) | |
>> | +--------------+ | | | int uninit(rte_device *) | |
>> | | | | | |
>> +------------------+ | +---------------------------+ |
>> | |
>> | int priv_size |
>> | |
>> +-------------------------------+
>>
>> Representing from above, it would be:
>>
>> +--------------+
>> | rte_driver |
>> | name |
>> | <Future> |
>> +------^-------+ pci_driver_list
>> | / vdev_driver_list
>> `---. <<Inherits>> / /
>> |\____________/_______ /
>> | / \ /
>> +-----------/-----+ +--------/---------+
>> | rte_pci_driver | | rte_vdev_driver |
>> | pci_devinit() | | vdev_devinit() |
>> | pci_devuninit()| | vdev_devuninit()|
>> | <more> | | <more> |
>> +-----------------+ +------------------+
>>
>>
>> +--------------+
>> | rte_device |
>> | name |
>> | <Future> |
>> +------^-------+ pci_device_list
>> | / xxx_device_list
>> `---. <<Inherits>> / /
>> |\____________/________ /
>> | / \ /
>> +-----------/-----+ +--------/---------+
>> | rte_pci_device | | rte_xxx_device |
>> | <dev data> | | <dev data> |
>> | <flags/intr> | | <flags/intr> |
>> | <more> | | <more> |
>> +-----------------+ +------------------+
>>
>> * Each driver type has its own structure which derives from the generic
>> rte_driver structure.
>> \- Each driver type maintains its own list, at the same time, rte_driver
>> list also exists - so that *all* drivers can be looped on, if required.
>> * Each device, associated with one or more drivers, has its own type
>> derived from rte_device
>> \- Each device _may_ maintain its own list (for example, in current
>> implementation, vdev is not maintaining it).
>>
>> ==Introducing a new device/driver type implies==
>> - creating their own rte_<xxx>.h file which contains the device/driver
>> definitions.
>> - defining the DRIVER_REGISTER_XXX helpers
>>
>> ==Hotplugging Support==
>> - devices should be able to support attach/detach operations.
>> - Earlier these functions were part of ethdev. They have been moved to eal
>> to be more generic.
>>
>> This patch is part of larger aim to:
>>
>> --------------------+ <is type of>
>> eth_driver (PMD) |-------------> rte_driver
>> crypto_driver (PMD) | ^
>> <more in future> | |
>> --------------------+ | <inherits>
>> /
>> +-----------------------/+
>> | rte_pci_driver |
>> | rte_vdev_driver |
>> | rte_soc_driver |
>> | rte_xxx_driver |
>>
>> Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
>> drivers rather than explicitly inheriting type specific driver (PCI, etc).
>>
>>
>> About the Patches:
>> ==================
>>
>> There are a large number of patches for this - primarily because the changes
>> are quite varied and keeping them logically separate yet compilable is
>> important. Most of the patches are small and those which are large touch the
>> drivers (PMDs) to accommodate the structure changes:
>>
>> - Patches 0001~0003 are for introducing the container_of function (so that
>> rte_device can be obtained from rte_pci_device, for example), and
>> removing unused code.
>> - Patches 0004~0007 just perform the ground work for enabling change from
>> rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
>> - In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
>> including cryptodev, which is eventually generalized with PCI)
>> - Patch 0009~0010 merge the crypto and pci functions for registration and
>> naming.
>> - Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
>> complete bus and has been generalized into EAl from ethdev.
>> - Patches 0015 introduces vdev init/uninit into separate C units and
>> enables its compilation. Patch 0016~0017 build on it and remove the
>> remaining legacy support for vdev/pdev distinctions.
>> - Patches 0018~0022 enable the vdev drivers to register using the
>> DRIVER_REGISTER_* operations, and remove their rte_driver->init()
>> - Patch 0023 enables the rte_driver registration into a common driver
>> linked list.
>> - Patches 0024~0025 introduce the rte_device, a generalization of
>> rte_xxx_device, and associated operation of creating rte_device linked
>> list. It also enables the drivers to use rte_device.name/numa_node
>> members rather than rte_xxx_device specific members.
>>
>> Notes:
>> ======
>>
>> * Some sign-off were already provided by Jan on the original v5; But, as a
>> large number of merges have been made, I am leaving those out just in case
>> it is not sync with initial understanding.
>>
>> * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
>> removed [7].
>>
>> Future Work/Pending:
>> ===================
>> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
>> rte_device model. eth_driver still is a PCI specific entity. This
>> has been highlighted by comments from Ferruh in [9].
>> - cryptodev driver too still remains to be normalized over the rte_driver
>> model
>> - Some variables, like drv_name (as highlighted by Ferruh), are getting
>> duplicated across rte_xxx_driver/device and rte_driver/device.
>>
>> References:
>> ===========
>>
>> [1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
>> [2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
>> [3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
>> [4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
>> [5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
>> [6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
>> [7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
>> [8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
>> [9] http://dpdk.org/ml/archives/dev/2016-August/045947.html
>>
>> Changes since v8:
>> - Some review comments from Ferruh Yigit & Reshma Pattan have been fixed.
>> = Though changes in mlx4/mlx5/szedata2 have been done, I am still unable to
>> verify those in absence of a proper environment at my end.
>> = Comment from Ferruh for eth_driver, drv_name are not fixed yet.
>> - Added a 'Future work' section in Covering letter
>>
>> Changes since v7:
>> - Rebase over master (e22856313fff2)
>> - Merge the patch series by David [1][2] and Jan [4] into a single set
>> hereafter, PCI and VDEV, both are re-factored for rte_device/driver model
>>
>> Changes since v6:
>> - rebase over 16.07 (b0a1419)
>> - DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
>> - review comments regarding missing information in log messages
>> - new API additions to 16.11 map objects
>> - review comment in [5] and [7] are not included in this series.
>>
>> Changes since v5:
>> - Rebase over master (11c5e45d8)
>> - Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be in
>> sync
>> with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can be merged]
>> - Modifications to bnxt and thunderx driver PMD registration files for
>> using the simplified PCI device registration helper macro
>>
>> Changes since v4:
>> - Fix compilation issue after rebase on HEAD (913154e) in previous series
>> - Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port which
>> were removed by previous patchset. These are being used by pdump library
>>
>> Changes since v3:
>> - rebase over HEAD (913154e)
>> - Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
>> - modify qede driver to use RTE_EAL_PCI_REGISTER
>> - Argument check in hotplug functions
>>
>> Changes since v2:
>> - rebase over HEAD (d76c193)
>> - Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
>>
>> Changes since v1:
>> - rebased on HEAD, new drivers should be okay
>> - patches have been split into smaller pieces
>> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
>> - device type has been removed from ethdev, as it was used only by hotplug
>> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
>> dropped for now, we can do this once vdev drivers have been converted
>>
>>
>> Shreyansh Jain (25):
>> eal: define macro container_of
>> eal: remove duplicate function declaration
>> pci: no need for dynamic tailq init
>> crypto: no need for a crypto pmd type
>> drivers: align pci driver definitions
>> eal: introduce init macros
>> driver: init/uninit common wrappers for PCI drivers
>> drivers: convert all pdev drivers as pci drivers
>> driver: Remove driver register callbacks for crypto/net
>> eal/pci: Helpers for device name parsing/update
>> ethdev: do not scan all pci devices on attach
>> eal: add hotplug operations for pci and vdev
>> ethdev: convert to eal hotplug
>> ethdev: get rid of device type
>> eal: extract vdev infra
>> eal: Remove PDEV/VDEV unused code
>> drivers: convert PMD_VDEV drivers to use rte_vdev_driver
>> eal: move init/uninit to rte_vdev_driver
>> eal: remove PMD_DRIVER_REGISTER and unused pmd_types
>> eal: rte_pci.h includes rte_dev.h
>> eal: rename and move rte_pci_resource
>> eal/pci: inherit rte_driver by rte_pci_driver
>> eal: call rte_eal_driver_register
>> eal: introduce rte_device
>> eal/pci: Create rte_device list and fallback on its members
>>
>> app/test/test_pci.c | 10 +-
>> app/test/virtual_pmd.c | 8 +-
>> drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
>> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
>> drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
>> drivers/crypto/null/null_crypto_pmd.c | 7 +-
>> drivers/crypto/qat/qat_qp.c | 2 +-
>> drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
>> drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
>> drivers/net/af_packet/rte_eth_af_packet.c | 11 +-
>> drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
>> drivers/net/bnx2x/bnx2x_rxtx.c | 3 +-
>> drivers/net/bnxt/bnxt_ethdev.c | 17 +-
>> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
>> drivers/net/bonding/rte_eth_bond_pmd.c | 9 +-
>> drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
>> drivers/net/cxgbe/cxgbe_main.c | 2 +-
>> drivers/net/cxgbe/sge.c | 7 +-
>> drivers/net/e1000/em_ethdev.c | 17 +-
>> drivers/net/e1000/igb_ethdev.c | 41 +---
>> drivers/net/ena/ena_ethdev.c | 20 +-
>> drivers/net/enic/enic_ethdev.c | 24 +-
>> drivers/net/fm10k/fm10k_ethdev.c | 30 +--
>> drivers/net/i40e/i40e_ethdev.c | 31 +--
>> drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
>> drivers/net/i40e/i40e_fdir.c | 2 +-
>> drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
>> drivers/net/mlx4/mlx4.c | 21 +-
>> drivers/net/mlx5/mlx5.c | 22 +-
>> drivers/net/mpipe/mpipe_tilegx.c | 18 +-
>> drivers/net/nfp/nfp_net.c | 28 +--
>> drivers/net/null/rte_eth_null.c | 11 +-
>> drivers/net/pcap/rte_eth_pcap.c | 11 +-
>> drivers/net/qede/qede_ethdev.c | 42 +---
>> drivers/net/ring/rte_eth_ring.c | 11 +-
>> drivers/net/szedata2/rte_eth_szedata2.c | 29 +--
>> drivers/net/thunderx/nicvf_ethdev.c | 21 +-
>> drivers/net/vhost/rte_eth_vhost.c | 11 +-
>> drivers/net/virtio/virtio_ethdev.c | 28 +--
>> drivers/net/virtio/virtio_pci.c | 5 +-
>> drivers/net/virtio/virtio_user_ethdev.c | 10 +-
>> drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
>> drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
>> drivers/net/xenvirt/rte_eth_xenvirt.c | 11 +-
>> examples/ip_pipeline/init.c | 22 --
>> lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
>> lib/librte_cryptodev/rte_cryptodev.h | 2 -
>> lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
>> lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
>> lib/librte_eal/bsdapp/eal/Makefile | 1 +
>> lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
>> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +
>> lib/librte_eal/common/Makefile | 2 +-
>> lib/librte_eal/common/eal_common_dev.c | 95 ++++----
>> lib/librte_eal/common/eal_common_pci.c | 34 ++-
>> lib/librte_eal/common/eal_common_vdev.c | 106 +++++++++
>> lib/librte_eal/common/eal_private.h | 20 +-
>> lib/librte_eal/common/include/rte_common.h | 21 ++
>> lib/librte_eal/common/include/rte_dev.h | 77 +++++--
>> lib/librte_eal/common/include/rte_eal.h | 3 +
>> lib/librte_eal/common/include/rte_pci.h | 51 +++--
>> lib/librte_eal/common/include/rte_tailq.h | 4 +-
>> lib/librte_eal/common/include/rte_vdev.h | 96 ++++++++
>> lib/librte_eal/linuxapp/eal/Makefile | 1 +
>> lib/librte_eal/linuxapp/eal/eal.c | 1 +
>> lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
>> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
>> lib/librte_ether/rte_ethdev.c | 280 +++++-------------------
>> lib/librte_ether/rte_ethdev.h | 40 ++--
>> lib/librte_ether/rte_ether_version.map | 10 +-
>> 70 files changed, 791 insertions(+), 1025 deletions(-)
>> create mode 100644 lib/librte_eal/common/eal_common_vdev.c
>> create mode 100644 lib/librte_eal/common/include/rte_vdev.h
>>
>
> Overall I like to see the clean separation.
> Are you sure you removed as much as possible from PCI?
I am not very sure of what you mean.
If you are referring to whether all PCI PMDs have been taken care of, I
think they are. Only issue being I can't test all of them functionally.
I have some steps provided by Thomas which can help me compile test these.
Or, if you are referring to whether PCI drivers have been completely
disconnected from existing EAL (and converted to above linkage), I think
yes.
Key change that still remains is delinking eth_driver from PCI type and
using a more generic approach where eth_driver (or rte_eth_driver, after
name change) can be of any type - PCI, Virtual, SoC etc.
> I wonder of global PCI device list is needed at all if you now have list of all devices.
>
I think yes. There are separate lists for all device types which helps
keep the EAL code free of type checks. But, functionally it doesn't make
that big a different between a common or specific list.
I am in favor of separate lists of each rte_xxx_device/driver type -
other than a global list (which is not actually being used, for now).
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members
2016-09-08 5:55 ` Shreyansh Jain
@ 2016-09-08 8:33 ` Ferruh Yigit
0 siblings, 0 replies; 375+ messages in thread
From: Ferruh Yigit @ 2016-09-08 8:33 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, david.marchand, thomas.monjalon, hemant.agrawal
On 9/8/2016 6:55 AM, Shreyansh Jain wrote:
> On Monday 29 August 2016 10:23 PM, Ferruh Yigit wrote:
>> On 8/26/2016 2:57 PM, Shreyansh Jain wrote:
>>> Now that rte_device is available, drivers can start using its members (numa,
>>> name) as well as link themselves into another rte_device list.
>>>
>>> As of now no one is using this list, but can be used for moving over all
>>> devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
>>>
>>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>> ---
>>> app/test/virtual_pmd.c | 4 ++--
>>> drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
>>> drivers/net/i40e/i40e_ethdev.c | 6 ++++--
>>> drivers/net/virtio/virtio_pci.c | 5 +++--
>>> lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
>>> lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
>>> lib/librte_eal/common/include/rte_pci.h | 3 +--
>>> lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
>>> lib/librte_ether/rte_ethdev.c | 2 +-
>>> 9 files changed, 26 insertions(+), 20 deletions(-)
>>
>> mlx5.c needs to be updated too:
>>
>> CC mlx5.o
>> ..../drivers/net/mlx5/mlx5.c:514:34: error: no member named 'devargs' in
>> 'struct rte_pci_device'
>> err = mlx5_args(priv, pci_dev->devargs);
>> ~~~~~~~ ^
>>
>>
>
> Updated in v9 but I haven't yet been able to compile and verify mlx* and
> szedata2*.
>
Thanks for the v9, I have my setup and can test compiling them.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of Shreyansh Jain
@ 2016-09-08 14:16 ` Ferruh Yigit
2016-09-09 4:19 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Ferruh Yigit @ 2016-09-08 14:16 UTC (permalink / raw)
To: Shreyansh Jain, dev; +Cc: hemant.agrawal, Jan Viktorin
On 9/7/2016 3:07 PM, Shreyansh Jain wrote:
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_eal/common/include/rte_common.h | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
> index 332f2a4..c5d94f3 100644
> --- a/lib/librte_eal/common/include/rte_common.h
> +++ b/lib/librte_eal/common/include/rte_common.h
> @@ -322,6 +322,27 @@ rte_bsf32(uint32_t v)
> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
> #endif
>
> +/**
> + * Return pointer to the wrapping struct instance.
> + * Example:
> + *
> + * struct wrapper {
> + * ...
> + * struct child c;
> + * ...
> + * };
> + *
> + * struct child *x = obtain(...);
> + * struct wrapper *w = container_of(x, struct wrapper, c);
> + *
> + * Some implementation already have this defined, thus, conditional
> + * declaration.
> + */
> +#ifndef container_of
> +#define container_of(p, type, member) \
> + ((type *) (((char *) (p)) - offsetof(type, member)))
> +#endif
> +
> #define _RTE_STR(x) #x
> /** Take a macro value and get a string version of it */
> #define RTE_STR(x) _RTE_STR(x)
>
Some mlx5 files includes dpdk version of container_of first, they
produce following warning:
In file included from .../dpdk/build/include/rte_mbuf.h:57:0,
from .../dpdk/build/include/rte_ether.h:52,
from .../dpdk/drivers/net/mlx5/mlx5_trigger.c:38:
/usr/include/infiniband/verbs.h: In function ‘verbs_get_device’:
.../dpdk/build/include/rte_common.h:343:14: warning: cast discards
‘const’ qualifier from pointer target type [-Wcast-qual]
((type *) (((char *) (p)) - offsetof(type, member)))
The verbs.h version of container_of is same with dpdk one, I am not able
to find why one gives warning but other not.
Regards,
ferruh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
@ 2016-09-08 14:25 ` Ferruh Yigit
2016-09-16 4:47 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Ferruh Yigit @ 2016-09-08 14:25 UTC (permalink / raw)
To: Shreyansh Jain, dev; +Cc: hemant.agrawal, Jan Viktorin
On 9/7/2016 3:08 PM, Shreyansh Jain wrote:
> Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
>
> Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
> as well as assigning a name to eth_driver.pci_drv.name member.
> In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
> populated into the rte_driver.name member - assignments through eth_driver
> has been removed.
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
...
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index c0bd391..b8bfd4b 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -172,4 +172,7 @@ DPDK_16.11 {
>
> rte_eal_dev_attach;
> rte_eal_dev_detach;
> + rte_eal_vdrv_register;
> + rte_eal_vdrv_unregister;
> +
> } DPDK_16.07;
This needs to be part of patch 15, where these functions implemented.
Missing these in .map files cause patch 17,18,19,20,21 fail to compile
for shared lib config.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-09-08 7:10 ` Shreyansh Jain
@ 2016-09-08 16:49 ` Stephen Hemminger
2016-09-09 11:42 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Stephen Hemminger @ 2016-09-08 16:49 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
On Thu, 8 Sep 2016 12:40:08 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> > Overall I like to see the clean separation.
> > Are you sure you removed as much as possible from PCI?
>
> I am not very sure of what you mean.
>
> If you are referring to whether all PCI PMDs have been taken care of, I
> think they are. Only issue being I can't test all of them functionally.
> I have some steps provided by Thomas which can help me compile test these.
>
> Or, if you are referring to whether PCI drivers have been completely
> disconnected from existing EAL (and converted to above linkage), I think
> yes.
>
> Key change that still remains is delinking eth_driver from PCI type and
> using a more generic approach where eth_driver (or rte_eth_driver, after
> name change) can be of any type - PCI, Virtual, SoC etc.
>
> > I wonder of global PCI device list is needed at all if you now have list of all devices.
> >
>
> I think yes. There are separate lists for all device types which helps
> keep the EAL code free of type checks. But, functionally it doesn't make
> that big a different between a common or specific list.
> I am in favor of separate lists of each rte_xxx_device/driver type -
> other than a global list (which is not actually being used, for now).
I was just concerned that doing bookkeeping on multiple lists creates more possibilities
for bugs where error unwind paths don't match.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of
2016-09-08 14:16 ` Ferruh Yigit
@ 2016-09-09 4:19 ` Shreyansh Jain
2016-09-09 8:55 ` Adrien Mazarguil
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-09 4:19 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: hemant.agrawal, Jan Viktorin
Hi Ferruh,
On Thursday 08 September 2016 07:46 PM, Ferruh Yigit wrote:
> On 9/7/2016 3:07 PM, Shreyansh Jain wrote:
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_eal/common/include/rte_common.h | 21 +++++++++++++++++++++
>> 1 file changed, 21 insertions(+)
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
>> index 332f2a4..c5d94f3 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -322,6 +322,27 @@ rte_bsf32(uint32_t v)
>> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
>> #endif
>>
>> +/**
>> + * Return pointer to the wrapping struct instance.
>> + * Example:
>> + *
>> + * struct wrapper {
>> + * ...
>> + * struct child c;
>> + * ...
>> + * };
>> + *
>> + * struct child *x = obtain(...);
>> + * struct wrapper *w = container_of(x, struct wrapper, c);
>> + *
>> + * Some implementation already have this defined, thus, conditional
>> + * declaration.
>> + */
>> +#ifndef container_of
>> +#define container_of(p, type, member) \
>> + ((type *) (((char *) (p)) - offsetof(type, member)))
>> +#endif
>> +
>> #define _RTE_STR(x) #x
>> /** Take a macro value and get a string version of it */
>> #define RTE_STR(x) _RTE_STR(x)
>>
>
> Some mlx5 files includes dpdk version of container_of first, they
> produce following warning:
>
> In file included from .../dpdk/build/include/rte_mbuf.h:57:0,
> from .../dpdk/build/include/rte_ether.h:52,
> from .../dpdk/drivers/net/mlx5/mlx5_trigger.c:38:
> /usr/include/infiniband/verbs.h: In function ‘verbs_get_device’:
> ..../dpdk/build/include/rte_common.h:343:14: warning: cast discards
> ‘const’ qualifier from pointer target type [-Wcast-qual]
> ((type *) (((char *) (p)) - offsetof(type, member)))
>
> The verbs.h version of container_of is same with dpdk one, I am not able
> to find why one gives warning but other not.
Thanks for highlighting. I am setting up my environment and will have a
look.
>
> Regards,
> ferruh
>
>
--
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of
2016-09-09 4:19 ` Shreyansh Jain
@ 2016-09-09 8:55 ` Adrien Mazarguil
2016-09-09 10:44 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Adrien Mazarguil @ 2016-09-09 8:55 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: Ferruh Yigit, dev, hemant.agrawal, Jan Viktorin
On Fri, Sep 09, 2016 at 09:49:06AM +0530, Shreyansh Jain wrote:
> Hi Ferruh,
>
> On Thursday 08 September 2016 07:46 PM, Ferruh Yigit wrote:
> >On 9/7/2016 3:07 PM, Shreyansh Jain wrote:
> >>Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> >>Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> >>---
> >> lib/librte_eal/common/include/rte_common.h | 21 +++++++++++++++++++++
> >> 1 file changed, 21 insertions(+)
> >>
> >>diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
> >>index 332f2a4..c5d94f3 100644
> >>--- a/lib/librte_eal/common/include/rte_common.h
> >>+++ b/lib/librte_eal/common/include/rte_common.h
> >>@@ -322,6 +322,27 @@ rte_bsf32(uint32_t v)
> >> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
> >> #endif
> >>
> >>+/**
> >>+ * Return pointer to the wrapping struct instance.
> >>+ * Example:
> >>+ *
> >>+ * struct wrapper {
> >>+ * ...
> >>+ * struct child c;
> >>+ * ...
> >>+ * };
> >>+ *
> >>+ * struct child *x = obtain(...);
> >>+ * struct wrapper *w = container_of(x, struct wrapper, c);
> >>+ *
> >>+ * Some implementation already have this defined, thus, conditional
> >>+ * declaration.
> >>+ */
> >>+#ifndef container_of
> >>+#define container_of(p, type, member) \
> >>+ ((type *) (((char *) (p)) - offsetof(type, member)))
> >>+#endif
> >>+
> >> #define _RTE_STR(x) #x
> >> /** Take a macro value and get a string version of it */
> >> #define RTE_STR(x) _RTE_STR(x)
> >>
> >
> >Some mlx5 files includes dpdk version of container_of first, they
> >produce following warning:
> >
> >In file included from .../dpdk/build/include/rte_mbuf.h:57:0,
> > from .../dpdk/build/include/rte_ether.h:52,
> > from .../dpdk/drivers/net/mlx5/mlx5_trigger.c:38:
> >/usr/include/infiniband/verbs.h: In function ‘verbs_get_device’:
> >..../dpdk/build/include/rte_common.h:343:14: warning: cast discards
> >‘const’ qualifier from pointer target type [-Wcast-qual]
> > ((type *) (((char *) (p)) - offsetof(type, member)))
> >
> >The verbs.h version of container_of is same with dpdk one, I am not able
> >to find why one gives warning but other not.
>
> Thanks for highlighting. I am setting up my environment and will have a
> look.
This warning is a known issue in the Verbs header that will be addressed
eventually. It occurs even without Shreyansh's patch (more likely when
CONFIG_RTE_LIBRTE_MLX4_DEBUG and/or CONFIG_RTE_LIBRTE_MLX5_DEBUG are
enabled).
Your container_of() macro is fine, no need to spend time on this.
--
Adrien Mazarguil
6WIND
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of
2016-09-09 8:55 ` Adrien Mazarguil
@ 2016-09-09 10:44 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-09 10:44 UTC (permalink / raw)
To: adrien.mazarguil; +Cc: Ferruh Yigit, dev, hemant.agrawal, Jan Viktorin
Hi Adrien,
On Friday 09 September 2016 02:25 PM, Adrien Mazarguil wrote:
> This warning is a known issue in the Verbs header that will be addressed
> eventually. It occurs even without Shreyansh's patch (more likely when
> CONFIG_RTE_LIBRTE_MLX4_DEBUG and/or CONFIG_RTE_LIBRTE_MLX5_DEBUG are
> enabled).
>
> Your container_of() macro is fine, no need to spend time on this.
>
> --
Thank you very much for clarifying this.
--
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-09-08 16:49 ` Stephen Hemminger
@ 2016-09-09 11:42 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-09 11:42 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, hemant.agrawal
Hi Stephen,
On Thursday 08 September 2016 10:19 PM, Stephen Hemminger wrote:
[...]
>> > I think yes. There are separate lists for all device types which helps
>> > keep the EAL code free of type checks. But, functionally it doesn't make
>> > that big a different between a common or specific list.
>> > I am in favor of separate lists of each rte_xxx_device/driver type -
>> > other than a global list (which is not actually being used, for now).
> I was just concerned that doing bookkeeping on multiple lists creates more possibilities
> for bugs where error unwind paths don't match.
>
That is true.
But in this particular situation (in my opinion), maintaining multiple
lists helps because:
1. Device/Drivers lists are separate and no functionality except setup
and tear-down operation would ever need to parse the common list - at
least not during the application run-to-completion-cycle.
2. Keeping them separate helps make the respective scan/probe code
cleaner. In fact, in absence of checks for device type, I think
debugging would be easier as one would only need to focus on code
related to attached physical/virtual device.
But again, above is just my opinion and preference - if merging the
lists helps, it can be done. In fact, rte_driver/rte_device are already
creating a common list - just that it is not being used right now.
I don't think there is any technical impact of this (except increasing
type validation - but that is only in setup/tear-down path).
--
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (25 preceding siblings ...)
2016-09-07 18:40 ` [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization Stephen Hemminger
@ 2016-09-09 16:11 ` Declan Doherty
2016-09-13 11:15 ` Shreyansh Jain
2016-09-12 7:32 ` David Marchand
27 siblings, 1 reply; 375+ messages in thread
From: Declan Doherty @ 2016-09-09 16:11 UTC (permalink / raw)
To: Shreyansh Jain, dev; +Cc: hemant.agrawal
On 07/09/16 15:07, Shreyansh Jain wrote:
> Based on master (e22856313)
>
> Background:
> ===========
>
> It includes two different patch-sets floated on ML earlier:
> * Original patch series is from David Marchand [1], [2].
> `- This focused mainly on PCI (PDEV) part
> `- v7 of this was posted by me [8] in August/2016
> * Patch series [4] from Jan Viktorin
> `- This focused on VDEV and rte_device integration
>
> Introduction:
> =============
>
> This patch series introduces a generic device model, moving away from PCI
> centric code layout. Key change is to introduce rte_driver/rte_device
> structures at the top level which are inherited by
> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> future),...}.
>
> Key motivation for this series is to move away from PCI centric design of
> EAL to a more hierarchical device model - pivoted around a generic driver
> and device. Each specific driver and device can inherit the common
> properties of the generic set and build upon it through driver/device
> specific functions.
>
> Earlier, the EAL device initialization model was:
> (Refer: [3])
>
> --
> Constructor:
> |- PMD_DRIVER_REGISTER(rte_driver)
> `- insert into dev_driver_list, rte_driver object
>
> rte_eal_init():
> |- rte_eal_pci_init()
> | `- scan and fill pci_device_list from sysfs
> |
> |- rte_eal_dev_init()
> | `- For each rte_driver in dev_driver_list
> | `- call the rte_driver->init() function
> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
> | |- eth_driver have rte_pci_driver embedded in them
> | `- rte_eth_driver_register installs the
> | rte_pci_driver->devinit/devuninit callbacks.
> |
> |- rte_eal_pci_probe()
> | |- For each device detected, dev_driver_list is parsed and matching is
> | | done.
> | |- For each matching device, the rte_pci_driver->devinit() is called.
> | |- Default map is to rte_eth_dev_init() which in turn creates a
> | | new ethernet device (eth_dev)
> | | `- eth_drv->eth_dev_init() is called which is implemented by
> `--| individual PMD drivers.
>
> --
>
> The structure of driver looks something like:
>
> +------------+ ._____.
> | rte_driver <-----| PMD |___
> | .init | `-----` \
> +----.-------+ | \
> `-. | What PMD actually is
> \ | |
> +----------v----+ |
> | eth_driver | |
> | .eth_dev_init | |
> +----.----------+ |
> `-. |
> \ |
> +------------v---+
> | rte_pci_driver |
> | .pci_devinit |
> +----------------+
>
> and all devices are part of a following linked lists:
> - dev_driver_list for all rte_drivers
> - pci_device_list for all devices, whether PCI or VDEV
>
>
> From the above:
> * a PMD initializes a rte_driver, eth_driver even though actually it is a
> pci_driver
> * initialization routines are passed from rte_driver->pci_driver->eth_driver
> even though they should ideally be rte_eal_init()->rte_pci_driver()
> * For a single driver/device type model, this is not necessarily a
> functional issue - but more of a design language.
> * But, when number of driver/device type increase, this would create problem
> in how driver<=>device links are represented.
>
> Proposed Architecture:
> ======================
>
> A nice representation has already been created by David in [3]. Copying that
> here:
>
> +------------------+ +-------------------------------+
> | | | |
> | rte_pci_device | | rte_pci_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> +-------------------------------+
>
> - for ethdev on top of vdev devices
>
> +------------------+ +-------------------------------+
> | | | |
> | drv specific | | rte_vdev_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> | int priv_size |
> | |
> +-------------------------------+
>
> Representing from above, it would be:
>
> +--------------+
> | rte_driver |
> | name |
> | <Future> |
> +------^-------+ pci_driver_list
> | / vdev_driver_list
> `---. <<Inherits>> / /
> |\____________/_______ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_driver | | rte_vdev_driver |
> | pci_devinit() | | vdev_devinit() |
> | pci_devuninit()| | vdev_devuninit()|
> | <more> | | <more> |
> +-----------------+ +------------------+
>
>
> +--------------+
> | rte_device |
> | name |
> | <Future> |
> +------^-------+ pci_device_list
> | / xxx_device_list
> `---. <<Inherits>> / /
> |\____________/________ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_device | | rte_xxx_device |
> | <dev data> | | <dev data> |
> | <flags/intr> | | <flags/intr> |
> | <more> | | <more> |
> +-----------------+ +------------------+
>
> * Each driver type has its own structure which derives from the generic
> rte_driver structure.
> \- Each driver type maintains its own list, at the same time, rte_driver
> list also exists - so that *all* drivers can be looped on, if required.
> * Each device, associated with one or more drivers, has its own type
> derived from rte_device
> \- Each device _may_ maintain its own list (for example, in current
> implementation, vdev is not maintaining it).
>
> ==Introducing a new device/driver type implies==
> - creating their own rte_<xxx>.h file which contains the device/driver
> definitions.
> - defining the DRIVER_REGISTER_XXX helpers
>
> ==Hotplugging Support==
> - devices should be able to support attach/detach operations.
> - Earlier these functions were part of ethdev. They have been moved to eal
> to be more generic.
>
> This patch is part of larger aim to:
>
> --------------------+ <is type of>
> eth_driver (PMD) |-------------> rte_driver
> crypto_driver (PMD) | ^
> <more in future> | |
> --------------------+ | <inherits>
> /
> +-----------------------/+
> | rte_pci_driver |
> | rte_vdev_driver |
> | rte_soc_driver |
> | rte_xxx_driver |
>
> Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
> drivers rather than explicitly inheriting type specific driver (PCI, etc).
>
>
....
>
> Notes:
> ======
>
> * Some sign-off were already provided by Jan on the original v5; But, as a
> large number of merges have been made, I am leaving those out just in case
> it is not sync with initial understanding.
>
> * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
> removed [7].
>
> Future Work/Pending:
> ===================
> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
> rte_device model. eth_driver still is a PCI specific entity. This
> has been highlighted by comments from Ferruh in [9].
> - cryptodev driver too still remains to be normalized over the rte_driver
> model
> - Some variables, like drv_name (as highlighted by Ferruh), are getting
> duplicated across rte_xxx_driver/device and rte_driver/device.
>
....
>
Hey Shreyansh,
I got some time over the last couple of days to got through this
patchset and your soc changes, and it's really a great clean up of the
driver and device infrastructure code.
I guess I'm coming to this party a bit late but I have some thoughts on
the the object model that you've outlined it improves things a huge
amount but I wonder does it go far enough.
I think that currently the coupling of the rte_driver to instances of
rte_pci_driver, rte_vdev_driver etc still really clouds the abstraction.
I think if we introduced a rte_bus and rte_bus_data abstractions with
all rte_drivers having a rte_bus instance then we could further simplify
the driver and device management, I think this would greatly reduce the
number of driver/device APIs in the EAL as I think most bus
functionality could be abstracted into a simpler API. This would also
make it possible to create new driver and device types and allowing them
to be plug-able components into DPDK and which I don't think would work
currently even with the changes included here.
http://imgur.com/a/3b7XM
The link above is to a png of a visio which outlines the object model
that I'm thinking of. The main extension from your current patchset
would be that rte_eth_driver and rte_crypto_driver would now always be
inheriting from rte_driver and not rte_soc_driver/rte_pci_driver, etv
but the rte_driver object would have rte_bus instance which could be of
type rte_bus_pci/ rte_bus_virtual/ rte_bus_soc etc. This I think would
allow the EAL to be written in such a way that it only every operates on
the base object types rte_device/rte_driver directly never the
derivative objects, like the rte_vdev_driver, rte_pci_driver. Also I
prefer the abstraction that a driver has a bus rather than it is the
bus. Also I think would be the devices layer to written driver/bus
agnostic, so the eth_dev layer shouldn't know if and underlying PMD is
PCI/memory based or virtual. Only the poll mode driver itself, and the
part of the EAL which manages driver initialization should have
knowledge of the drivers bus type.
Anyway have a look, and let me know what you think.
Thanks
Declan
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
@ 2016-09-11 11:55 ` Yuanhan Liu
2016-09-12 4:39 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Yuanhan Liu @ 2016-09-11 11:55 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal, Jan Viktorin, Thomas Monjalon
On Wed, Sep 07, 2016 at 07:38:09PM +0530, Shreyansh Jain wrote:
> All PMD_VDEV drivers can now use rte_vdev_driver instead of the
> rte_driver (which is embedded in the rte_vdev_driver).
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Hi,
FYI, my testrobot caught some errors when this patch is applied.
--yliu
i686-native-linuxapp-gcc: config-all-yes-shared
===============================================
rte_eth_af_packet.o: In function `vdrvinitfn_pmd_af_packet_drv':
rte_eth_af_packet.c:(.text.startup+0x23): undefined reference to `rte_eal_vdrv_register'
collect2: error: ld returned 1 exit status
make[6]: *** [librte_pmd_af_packet.so.1.1] Error 1
make[5]: *** [af_packet] Error 2
make[5]: *** Waiting for unfinished jobs....
rte_eth_bond_pmd.o: In function `vdrvinitfn_bond_drv':
rte_eth_bond_pmd.c:(.text.startup+0x23): undefined reference to `rte_eal_vdrv_register'
collect2: error: ld returned 1 exit status
make[6]: *** [librte_pmd_bond.so.1.1] Error 1
make[5]: *** [bonding] Error 2
make[4]: *** [net] Error 2
make[3]: *** [drivers] Error 2
make[2]: *** [all] Error 2
make[1]: *** [pre_install] Error 2
make: *** [install] Error 2
error: build failed
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver
2016-09-11 11:55 ` Yuanhan Liu
@ 2016-09-12 4:39 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-12 4:39 UTC (permalink / raw)
To: Yuanhan Liu; +Cc: dev, hemant.agrawal, Jan Viktorin, Thomas Monjalon
Hi ,
On Sunday 11 September 2016 05:25 PM, Yuanhan Liu wrote:
> On Wed, Sep 07, 2016 at 07:38:09PM +0530, Shreyansh Jain wrote:
>> All PMD_VDEV drivers can now use rte_vdev_driver instead of the
>> rte_driver (which is embedded in the rte_vdev_driver).
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> Hi,
>
> FYI, my testrobot caught some errors when this patch is applied.
>
> --yliu
>
> i686-native-linuxapp-gcc: config-all-yes-shared
> ===============================================
> rte_eth_af_packet.o: In function `vdrvinitfn_pmd_af_packet_drv':
> rte_eth_af_packet.c:(.text.startup+0x23): undefined reference to `rte_eal_vdrv_register'
> collect2: error: ld returned 1 exit status
> make[6]: *** [librte_pmd_af_packet.so.1.1] Error 1
> make[5]: *** [af_packet] Error 2
> make[5]: *** Waiting for unfinished jobs....
> rte_eth_bond_pmd.o: In function `vdrvinitfn_bond_drv':
> rte_eth_bond_pmd.c:(.text.startup+0x23): undefined reference to `rte_eal_vdrv_register'
> collect2: error: ld returned 1 exit status
> make[6]: *** [librte_pmd_bond.so.1.1] Error 1
> make[5]: *** [bonding] Error 2
> make[4]: *** [net] Error 2
> make[3]: *** [drivers] Error 2
> make[2]: *** [all] Error 2
> make[1]: *** [pre_install] Error 2
> make: *** [install] Error 2
> error: build failed
>
Thanks!
I think this is similar to what Ferruh has commented in [1]. I missed
adding these functions to the map file in the 16th patch which is why
shared library is failing. I have noted that for change in v10 as and
when that is ready.
[1] http://dpdk.org/ml/archives/dev/2016-September/046399.html
--
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 06/25] eal: introduce init macros
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 06/25] eal: introduce init macros Shreyansh Jain
@ 2016-09-12 7:15 ` David Marchand
2016-09-15 7:28 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-09-12 7:15 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
On Wed, Sep 7, 2016 at 4:07 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index fa74962..cf673e4 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -470,6 +470,16 @@ void rte_eal_pci_dump(FILE *f);
> */
> void rte_eal_pci_register(struct rte_pci_driver *driver);
>
> +/** Helper for PCI device registeration from driver (eth, crypto) instance */
Typo: registration
> +#define DRIVER_REGISTER_PCI(nm, pci_drv) \
> +RTE_INIT(pciinitfn_ ##nm); \
> +static void pciinitfn_ ##nm(void) \
> +{ \
> + (pci_drv).name = RTE_STR(nm);\
> + rte_eal_pci_register(&pci_drv); \
> +}\
> +DRIVER_EXPORT_NAME(nm, __COUNTER__)
Checkpatch complains about a missing space.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 07/25] driver: init/uninit common wrappers for PCI drivers
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 07/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
@ 2016-09-12 7:16 ` David Marchand
2016-09-12 9:55 ` Thomas Monjalon
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-09-12 7:16 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
On Wed, Sep 7, 2016 at 4:07 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> crypto and ethdev drivers aligned to PCI probe/remove. Existing handlers for
> init/uninit can be easily reused for this.
I would keep in the commit log a mention on the 1 - 1 association
between the ethdev/crypto device and the pci device.
Besides, I kind of remember a suggestion to rename init as probe and
uninit as remove (Thomas ?).
But this can go later in the series.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 08/25] drivers: convert all pdev drivers as pci drivers
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 08/25] drivers: convert all pdev drivers as pci drivers Shreyansh Jain
@ 2016-09-12 7:16 ` David Marchand
2016-09-16 4:49 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-09-12 7:16 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
On Wed, Sep 7, 2016 at 4:08 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Simplify crypto and ethdev pci drivers init by using newly introduced
> init macros and helpers.
> Those drivers then don't need to register as "rte_driver"s anymore.
>
> Exceptions:
> - virtio and mlx* use RTE_INIT directly as they have custom initialization
> steps.
Afaics, we are missing some DRIVER_EXPORT_NAME for those.
> - VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug Shreyansh Jain
@ 2016-09-12 7:16 ` David Marchand
2016-09-15 7:29 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: David Marchand @ 2016-09-12 7:16 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
On Wed, Sep 7, 2016 at 4:08 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
[snip]
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index fdeac86..86c9d1a 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
[snip]
> + ret = rte_eal_dev_attach(name, args);
> + if (ret < 0)
> + goto err;
> +
> + /* no point looking at eth_dev_last_created_port if no port exists */
> + if (!nb_ports) {
> + RTE_LOG(ERR, EAL, "No ports founds for device (%s)\n", name);
No port found ?
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
` (26 preceding siblings ...)
2016-09-09 16:11 ` Declan Doherty
@ 2016-09-12 7:32 ` David Marchand
27 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-09-12 7:32 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
Hello Shreyansh,
On Wed, Sep 7, 2016 at 4:07 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> This patch is part of larger aim to:
>
> --------------------+ <is type of>
> eth_driver (PMD) |-------------> rte_driver
> crypto_driver (PMD) | ^
> <more in future> | |
> --------------------+ | <inherits>
> /
> +-----------------------/+
> | rte_pci_driver |
> | rte_vdev_driver |
> | rte_soc_driver |
> | rte_xxx_driver |
>
> Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
> drivers rather than explicitly inheriting type specific driver (PCI, etc).
>
>
> About the Patches:
> ==================
>
> There are a large number of patches for this - primarily because the changes
> are quite varied and keeping them logically separate yet compilable is
> important. Most of the patches are small and those which are large touch the
> drivers (PMDs) to accommodate the structure changes:
>
> - Patches 0001~0003 are for introducing the container_of function (so that
> rte_device can be obtained from rte_pci_device, for example), and
> removing unused code.
> - Patches 0004~0007 just perform the ground work for enabling change from
> rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
> - In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
> including cryptodev, which is eventually generalized with PCI)
> - Patch 0009~0010 merge the crypto and pci functions for registration and
> naming.
> - Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
> complete bus and has been generalized into EAl from ethdev.
> - Patches 0015 introduces vdev init/uninit into separate C units and
> enables its compilation. Patch 0016~0017 build on it and remove the
> remaining legacy support for vdev/pdev distinctions.
> - Patches 0018~0022 enable the vdev drivers to register using the
> DRIVER_REGISTER_* operations, and remove their rte_driver->init()
> - Patch 0023 enables the rte_driver registration into a common driver
> linked list.
> - Patches 0024~0025 introduce the rte_device, a generalization of
> rte_xxx_device, and associated operation of creating rte_device linked
> list. It also enables the drivers to use rte_device.name/numa_node
> members rather than rte_xxx_device specific members.
>
> Notes:
> ======
>
> * Some sign-off were already provided by Jan on the original v5; But, as a
> large number of merges have been made, I am leaving those out just in case
> it is not sync with initial understanding.
>
> * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
> removed [7].
>
> Future Work/Pending:
> ===================
> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
> rte_device model. eth_driver still is a PCI specific entity. This
> has been highlighted by comments from Ferruh in [9].
> - cryptodev driver too still remains to be normalized over the rte_driver
> model
> - Some variables, like drv_name (as highlighted by Ferruh), are getting
> duplicated across rte_xxx_driver/device and rte_driver/device.
Overall, we are still missing some parts :
- in my initial proposition, the rte_driver would embed the
probe/remove (previsouly init/uninit) functions that would take
rte_device object as arguments (and maybe we should get rid of the
double lists, I am not yet convinced it is easy).
- the pmdinfo stuff is broken and could be implemented for vdev, I did
a quick patch that replaces the "PMD_REGISTER_DRIVER(.*)" regexp as
"DRIVER_REGISTER_.*(.*)" then I added a DRIVER_EXPORT_NAME(nm,
__COUNTER__) in the vdev register macro, it looks to work fine.
pmdinfo is a bit too pci but I think we can go with this.
- the names should go to rte_device/rte_driver objects ?
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 07/25] driver: init/uninit common wrappers for PCI drivers
2016-09-12 7:16 ` David Marchand
@ 2016-09-12 9:55 ` Thomas Monjalon
0 siblings, 0 replies; 375+ messages in thread
From: Thomas Monjalon @ 2016-09-12 9:55 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Shreyansh Jain, hemant.agrawal
2016-09-12 09:16, David Marchand:
> On Wed, Sep 7, 2016 at 4:07 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> > crypto and ethdev drivers aligned to PCI probe/remove. Existing handlers for
> > init/uninit can be easily reused for this.
>
> I would keep in the commit log a mention on the 1 - 1 association
> between the ethdev/crypto device and the pci device.
>
> Besides, I kind of remember a suggestion to rename init as probe and
> uninit as remove (Thomas ?).
Yes, here:
http://dpdk.org/ml/archives/dev/2016-July/044086.html
> But this can go later in the series.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization
2016-09-09 16:11 ` Declan Doherty
@ 2016-09-13 11:15 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-13 11:15 UTC (permalink / raw)
To: Declan Doherty; +Cc: dev, hemant.agrawal
Hi Declan,
Apologies for delayed reply and thank you so much for your inputs.
On Friday 09 September 2016 09:41 PM, Declan Doherty wrote:
> On 07/09/16 15:07, Shreyansh Jain wrote:
>> Based on master (e22856313)
>>
>> Background:
>> ===========
>>
>> It includes two different patch-sets floated on ML earlier:
>> * Original patch series is from David Marchand [1], [2].
>> `- This focused mainly on PCI (PDEV) part
>> `- v7 of this was posted by me [8] in August/2016
>> * Patch series [4] from Jan Viktorin
>> `- This focused on VDEV and rte_device integration
>>
>> Introduction:
>> =============
>>
>> This patch series introduces a generic device model, moving away from PCI
>> centric code layout. Key change is to introduce rte_driver/rte_device
>> structures at the top level which are inherited by
>> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
>> future),...}.
>>
>> Key motivation for this series is to move away from PCI centric design of
>> EAL to a more hierarchical device model - pivoted around a generic driver
>> and device. Each specific driver and device can inherit the common
>> properties of the generic set and build upon it through driver/device
>> specific functions.
>>
>> Earlier, the EAL device initialization model was:
>> (Refer: [3])
>>
>> --
>> Constructor:
>> |- PMD_DRIVER_REGISTER(rte_driver)
>> `- insert into dev_driver_list, rte_driver object
>>
>> rte_eal_init():
>> |- rte_eal_pci_init()
>> | `- scan and fill pci_device_list from sysfs
>> |
>> |- rte_eal_dev_init()
>> | `- For each rte_driver in dev_driver_list
>> | `- call the rte_driver->init() function
>> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
>> | |- eth_driver have rte_pci_driver embedded in them
>> | `- rte_eth_driver_register installs the
>> | rte_pci_driver->devinit/devuninit callbacks.
>> |
>> |- rte_eal_pci_probe()
>> | |- For each device detected, dev_driver_list is parsed and
>> matching is
>> | | done.
>> | |- For each matching device, the rte_pci_driver->devinit() is
>> called.
>> | |- Default map is to rte_eth_dev_init() which in turn creates a
>> | | new ethernet device (eth_dev)
>> | | `- eth_drv->eth_dev_init() is called which is implemented by
>> `--| individual PMD drivers.
>>
>> --
>>
>> The structure of driver looks something like:
>>
>> +------------+ ._____.
>> | rte_driver <-----| PMD |___
>> | .init | `-----` \
>> +----.-------+ | \
>> `-. | What PMD actually is
>> \ | |
>> +----------v----+ |
>> | eth_driver | |
>> | .eth_dev_init | |
>> +----.----------+ |
>> `-. |
>> \ |
>> +------------v---+
>> | rte_pci_driver |
>> | .pci_devinit |
>> +----------------+
>>
>> and all devices are part of a following linked lists:
>> - dev_driver_list for all rte_drivers
>> - pci_device_list for all devices, whether PCI or VDEV
>>
>>
>> From the above:
>> * a PMD initializes a rte_driver, eth_driver even though actually it
>> is a
>> pci_driver
>> * initialization routines are passed from
>> rte_driver->pci_driver->eth_driver
>> even though they should ideally be rte_eal_init()->rte_pci_driver()
>> * For a single driver/device type model, this is not necessarily a
>> functional issue - but more of a design language.
>> * But, when number of driver/device type increase, this would create
>> problem
>> in how driver<=>device links are represented.
>>
>> Proposed Architecture:
>> ======================
>>
>> A nice representation has already been created by David in [3].
>> Copying that
>> here:
>>
>> +------------------+ +-------------------------------+
>> | | | |
>> | rte_pci_device | | rte_pci_driver |
>> | | | |
>> +-------------+ | +--------------+ | | +---------------------------+ |
>> | | | | | | | | | |
>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>> | | | | char name[] | | | | char name[] | |
>> +-------------+ | | | | | | int init(rte_device *) | |
>> | +--------------+ | | | int uninit(rte_device *) | |
>> | | | | | |
>> +------------------+ | +---------------------------+ |
>> | |
>> +-------------------------------+
>>
>> - for ethdev on top of vdev devices
>>
>> +------------------+ +-------------------------------+
>> | | | |
>> | drv specific | | rte_vdev_driver |
>> | | | |
>> +-------------+ | +--------------+ | | +---------------------------+ |
>> | | | | | | | | | |
>> | rte_eth_dev +---> rte_device +-----> rte_driver | |
>> | | | | char name[] | | | | char name[] | |
>> +-------------+ | | | | | | int init(rte_device *) | |
>> | +--------------+ | | | int uninit(rte_device *) | |
>> | | | | | |
>> +------------------+ | +---------------------------+ |
>> | |
>> | int priv_size |
>> | |
>> +-------------------------------+
>>
>> Representing from above, it would be:
>>
>> +--------------+
>> | rte_driver |
>> | name |
>> | <Future> |
>> +------^-------+ pci_driver_list
>> | / vdev_driver_list
>> `---. <<Inherits>> / /
>> |\____________/_______ /
>> | / \ /
>> +-----------/-----+ +--------/---------+
>> | rte_pci_driver | | rte_vdev_driver |
>> | pci_devinit() | | vdev_devinit() |
>> | pci_devuninit()| | vdev_devuninit()|
>> | <more> | | <more> |
>> +-----------------+ +------------------+
>>
>>
>> +--------------+
>> | rte_device |
>> | name |
>> | <Future> |
>> +------^-------+ pci_device_list
>> | / xxx_device_list
>> `---. <<Inherits>> / /
>> |\____________/________ /
>> | / \ /
>> +-----------/-----+ +--------/---------+
>> | rte_pci_device | | rte_xxx_device |
>> | <dev data> | | <dev data> |
>> | <flags/intr> | | <flags/intr> |
>> | <more> | | <more> |
>> +-----------------+ +------------------+
>>
>> * Each driver type has its own structure which derives from the generic
>> rte_driver structure.
>> \- Each driver type maintains its own list, at the same time,
>> rte_driver
>> list also exists - so that *all* drivers can be looped on, if
>> required.
>> * Each device, associated with one or more drivers, has its own type
>> derived from rte_device
>> \- Each device _may_ maintain its own list (for example, in current
>> implementation, vdev is not maintaining it).
>>
>> ==Introducing a new device/driver type implies==
>> - creating their own rte_<xxx>.h file which contains the device/driver
>> definitions.
>> - defining the DRIVER_REGISTER_XXX helpers
>>
>> ==Hotplugging Support==
>> - devices should be able to support attach/detach operations.
>> - Earlier these functions were part of ethdev. They have been moved
>> to eal
>> to be more generic.
>>
>> This patch is part of larger aim to:
>>
>> --------------------+ <is type of>
>> eth_driver (PMD) |-------------> rte_driver
>> crypto_driver (PMD) | ^
>> <more in future> | |
>> --------------------+ | <inherits>
>> /
>> +-----------------------/+
>> | rte_pci_driver |
>> | rte_vdev_driver |
>> | rte_soc_driver |
>> | rte_xxx_driver |
>>
>> Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to
>> their
>> drivers rather than explicitly inheriting type specific driver (PCI,
>> etc).
>>
>>
>
> .....
>
>>
>> Notes:
>> ======
>>
>> * Some sign-off were already provided by Jan on the original v5; But,
>> as a
>> large number of merges have been made, I am leaving those out just
>> in case
>> it is not sync with initial understanding.
>>
>> * This might not be in-sync with pmdinfogen as PMD_REGISTER_DRIVER is
>> removed [7].
>>
>> Future Work/Pending:
>> ===================
>> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
>> rte_device model. eth_driver still is a PCI specific entity. This
>> has been highlighted by comments from Ferruh in [9].
>> - cryptodev driver too still remains to be normalized over the
>> rte_driver
>> model
>> - Some variables, like drv_name (as highlighted by Ferruh), are getting
>> duplicated across rte_xxx_driver/device and rte_driver/device.
>>
>
> ....
>
>>
>
> Hey Shreyansh,
>
> I got some time over the last couple of days to got through this
> patchset and your soc changes, and it's really a great clean up of the
> driver and device infrastructure code.
Thank you.
Honestly speaking, I am more of an intermediate maintainer - most of the
work was already done by David/Jan.
>
> I guess I'm coming to this party a bit late but I have some thoughts on
> the the object model that you've outlined it improves things a huge
> amount but I wonder does it go far enough.
>
> I think that currently the coupling of the rte_driver to instances of
> rte_pci_driver, rte_vdev_driver etc still really clouds the abstraction.
> I think if we introduced a rte_bus and rte_bus_data abstractions with
> all rte_drivers having a rte_bus instance then we could further simplify
> the driver and device management, I think this would greatly reduce the
> number of driver/device APIs in the EAL as I think most bus
This is where I beg to differ. rte_driver is actually a representation
of a generic bus on which devices (PCI/XXX) would be attached.
Creating one more abstraction of rte_bus* would create new boundaries of
what each structure does. At least as of now I couldn't think of why the
functions you have mentioned below cannot be handled by
rte_driver/device - Or, to put it other way, what differentiates an
abstracted rte_driver/device with rte_bus*.
> functionality could be abstracted into a simpler API. This would also
> make it possible to create new driver and device types and allowing them
> to be plug-able components into DPDK and which I don't think would work
> currently even with the changes included here.
>
> http://imgur.com/a/3b7XM
I saw the image. Key difference I see is that now mapping becomes
responsibility of a bus. Other than that, what else do you propose would
a 'rte_bus' equivalent do? Any example from current model or PMDs?
In fact, already rte_driver itself doesn't have much to do except
init/uninit (which too is pending) and some state vars.
>
> The link above is to a png of a visio which outlines the object model
> that I'm thinking of. The main extension from your current patchset
> would be that rte_eth_driver and rte_crypto_driver would now always be
> inheriting from rte_driver and not rte_soc_driver/rte_pci_driver, etv
> but the rte_driver object would have rte_bus instance which could be of
> type rte_bus_pci/ rte_bus_virtual/ rte_bus_soc etc. This I think would
> allow the EAL to be written in such a way that it only every operates on
> the base object types rte_device/rte_driver directly never the
> derivative objects, like the rte_vdev_driver, rte_pci_driver. Also I
> prefer the abstraction that a driver has a bus rather than it is the
> bus. Also I think would be the devices layer to written driver/bus
> agnostic, so the eth_dev layer shouldn't know if and underlying PMD is
> PCI/memory based or virtual. Only the poll mode driver itself, and the
> part of the EAL which manages driver initialization should have
> knowledge of the drivers bus type.
>
> Anyway have a look, and let me know what you think.
I agree to your points that EAL should operate on base class
rte_driver/device. But, I am still not clear how a bus would add value
to this model of rte_device<=>rte_pci_device/rte_driver<=>rte_pci_driver
(PCI as example). Can you explain with some example case where this new
layer would help us?
Overall I feel that we are on same page except the new class for Bus
introduced in your proposal. In my opinion at least as of this first
draft proposal keeping things simpler might be better. We can always
come back and introduce this new abstraction in subsequent versions - it
looks incremental to me.
And, probably other members on list might have a better view of this
abstraction. I am open to discussion.
>
> Thanks
> Declan
>
--
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 06/25] eal: introduce init macros
2016-09-12 7:15 ` David Marchand
@ 2016-09-15 7:28 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-15 7:28 UTC (permalink / raw)
To: David Marchand; +Cc: dev, hemant.agrawal
On Monday 12 September 2016 12:45 PM, David Marchand wrote:
> On Wed, Sep 7, 2016 at 4:07 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>> index fa74962..cf673e4 100644
>> --- a/lib/librte_eal/common/include/rte_pci.h
>> +++ b/lib/librte_eal/common/include/rte_pci.h
>> @@ -470,6 +470,16 @@ void rte_eal_pci_dump(FILE *f);
>> */
>> void rte_eal_pci_register(struct rte_pci_driver *driver);
>>
>> +/** Helper for PCI device registeration from driver (eth, crypto) instance */
>
> Typo: registration
Ok - I will fix this.
>
>> +#define DRIVER_REGISTER_PCI(nm, pci_drv) \
>> +RTE_INIT(pciinitfn_ ##nm); \
>> +static void pciinitfn_ ##nm(void) \
>> +{ \
>> + (pci_drv).name = RTE_STR(nm);\
>> + rte_eal_pci_register(&pci_drv); \
>> +}\
>> +DRIVER_EXPORT_NAME(nm, __COUNTER__)
>
> Checkpatch complains about a missing space.
Yes, '} \' is expected. somehow missed my merges though checkpatch did
complain. Will fix this.
>
>
--
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug
2016-09-12 7:16 ` David Marchand
@ 2016-09-15 7:29 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-15 7:29 UTC (permalink / raw)
To: David Marchand; +Cc: dev, hemant.agrawal
On Monday 12 September 2016 12:46 PM, David Marchand wrote:
> On Wed, Sep 7, 2016 at 4:08 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
> [snip]
>
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index fdeac86..86c9d1a 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>
> [snip]
>
>> + ret = rte_eal_dev_attach(name, args);
>> + if (ret < 0)
>> + goto err;
>> +
>> + /* no point looking at eth_dev_last_created_port if no port exists */
>> + if (!nb_ports) {
>> + RTE_LOG(ERR, EAL, "No ports founds for device (%s)\n", name);
>
> No port found ?
Yes, that will be corrected in next version. Thanks.
>
>
--
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 00/25] Introducing rte_driver/rte_device generalization
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (22 preceding siblings ...)
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 01/25] eal: define container macro Shreyansh Jain
` (25 more replies)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
24 siblings, 26 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
Based on master (58efd680d5e)
Background:
===========
It includes two different patch-sets floated on ML earlier:
* Original patch series is from David Marchand [1], [2].
`- This focused mainly on PCI (PDEV) part
`- v7 of this was posted by me [8] in August/2016
* Patch series [4] from Jan Viktorin
`- This focused on VDEV and rte_device integration
Introduction:
=============
This patch series introduces a generic device model, moving away from PCI
centric code layout. Key change is to introduce rte_driver/rte_device
structures at the top level which are inherited by
rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
future),...}.
Key motivation for this series is to move away from PCI centric design of
EAL to a more hierarchical device model - pivoted around a generic driver
and device. Each specific driver and device can inherit the common
properties of the generic set and build upon it through driver/device
specific functions.
Earlier, the EAL device initialization model was:
(Refer: [3])
--
Constructor:
|- PMD_DRIVER_REGISTER(rte_driver)
`- insert into dev_driver_list, rte_driver object
rte_eal_init():
|- rte_eal_pci_init()
| `- scan and fill pci_device_list from sysfs
|
|- rte_eal_dev_init()
| `- For each rte_driver in dev_driver_list
| `- call the rte_driver->init() function
| |- PMDs designed to call rte_eth_driver_register(eth_driver)
| |- eth_driver have rte_pci_driver embedded in them
| `- rte_eth_driver_register installs the
| rte_pci_driver->devinit/devuninit callbacks.
|
|- rte_eal_pci_probe()
| |- For each device detected, dev_driver_list is parsed and matching is
| | done.
| |- For each matching device, the rte_pci_driver->devinit() is called.
| |- Default map is to rte_eth_dev_init() which in turn creates a
| | new ethernet device (eth_dev)
| | `- eth_drv->eth_dev_init() is called which is implemented by
`--| individual PMD drivers.
--
The structure of driver looks something like:
+------------+ ._____.
| rte_driver <-----| PMD |___
| .init | `-----` \
+----.-------+ | \
`-. | What PMD actually is
\ | |
+----------v----+ |
| eth_driver | |
| .eth_dev_init | |
+----.----------+ |
`-. |
\ |
+------------v---+
| rte_pci_driver |
| .pci_devinit |
+----------------+
and all devices are part of a following linked lists:
- dev_driver_list for all rte_drivers
- pci_device_list for all devices, whether PCI or VDEV
>From the above:
* a PMD initializes a rte_driver, eth_driver even though actually it is a
pci_driver
* initialization routines are passed from rte_driver->pci_driver->eth_driver
even though they should ideally be rte_eal_init()->rte_pci_driver()
* For a single driver/device type model, this is not necessarily a
functional issue - but more of a design language.
* But, when number of driver/device type increase, this would create
problem in how driver<=>device links are represented.
Proposed Architecture:
======================
A nice representation has already been created by David in [3]. Copying that
here:
+------------------+ +-------------------------------+
| | | |
| rte_pci_device | | rte_pci_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
+-------------------------------+
- for ethdev on top of vdev devices
+------------------+ +-------------------------------+
| | | |
| drv specific | | rte_vdev_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
| int priv_size |
| |
+-------------------------------+
Representing from above, it would be:
+--------------+
| rte_driver |
| name |
| <Future> |
+------^-------+ pci_driver_list
| / vdev_driver_list
`---. <<Inherits>> / /
|\____________/_______ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_driver | | rte_vdev_driver |
| pci_probe() | | vdev_devinit() |
| pci_remove() | | vdev_devuninit()|
| <more> | | <more> |
+-----------------+ +------------------+
+--------------+
| rte_device |
| name |
| <Future> |
+------^-------+ pci_device_list
| / xxx_device_list
`---. <<Inherits>> / /
|\____________/________ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_device | | rte_xxx_device |
| <dev data> | | <dev data> |
| <flags/intr> | | <flags/intr> |
| <more> | | <more> |
+-----------------+ +------------------+
* Each driver type has its own structure which derives from the generic
rte_driver structure.
\- Each driver type maintains its own list, at the same time, rte_driver
list also exists - so that *all* drivers can be looped on, if required.
* Each device, associated with one or more drivers, has its own type
derived from rte_device
\- Each device _may_ maintain its own list (for example, in current
implementation, vdev is not maintaining it).
==Introducing a new device/driver type implies==
- creating their own rte_<xxx>.h file which contains the device/driver
definitions.
- defining the DRIVER_REGISTER_XXX helpers
==Hotplugging Support==
- devices should be able to support attach/detach operations.
- Earlier these functions were part of ethdev. They have been moved to eal
to be more generic.
This patch is part of larger aim to:
--------------------+ <is type of>
eth_driver (PMD) |-------------> rte_driver
crypto_driver (PMD) | ^
<more in future> | |
--------------------+ | <inherits>
/
+-----------------------/+
| rte_pci_driver |
| rte_vdev_driver |
| rte_soc_driver |
| rte_xxx_driver |
Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
drivers rather than explicitly inheriting type specific driver (PCI, etc).
About the Patches:
==================
There are a large number of patches for this - primarily because the changes
are quite varied and keeping them logically separate yet compilable is
important. Most of the patches are small and those which are large touch the
drivers (PMDs) to accommodate the structure changes:
- Patches 0001~0003 are for introducing the container_of function (so that
rte_device can be obtained from rte_pci_device, for example), and
removing unused code.
- Patch 0004 converts the PCI devinit/devuninit method names to probe/
remove and correspondingly updates all drivers where impact it. VDEV
based init/uninit have not been modified.
- Patches 0005~0007 just perform the ground work for enabling change from
rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
- In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
including cryptodev, which is eventually generalized with PCI)
- Patch 0009~0010 merge the crypto and pci functions for registration and
naming.
- Patches 0011~0014 deal with hotplugging - hotplug no more invokes scan of
complete bus and has been generalized into EAl from ethdev.
- Patches 0015 introduces vdev init/uninit into separate C units and
enables its compilation. Patch 0016~0017 build on it and remove the
remaining legacy support for vdev/pdev distinctions.
- Patches 0018~0022 enable the vdev drivers to register using the
DRIVER_REGISTER_* operations, and remove their rte_driver->init()
- Patch 0023 enables the rte_driver registration into a common driver
linked list.
- Patches 0024~0025 introduce the rte_device, a generalization of
rte_xxx_device, and associated operation of creating rte_device linked
list. It also enables the drivers to use rte_device.name/numa_node
members rather than rte_xxx_device specific members.
Future Work/Pending:
===================
- Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
rte_device model. eth_driver still is a PCI specific entity. This
has been highlighted by comments from Ferruh in [9].
- Some variables, like drv_name (as highlighted by Ferruh), are getting
duplicated across rte_xxx_driver/device and rte_driver/device.
References:
===========
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
[4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
[5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
[6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
[7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
[8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
[9] http://dpdk.org/ml/archives/dev/2016-August/045947.html
Following are Some Review comments:
[R1] http://dpdk.org/ml/archives/dev/2016-September/046548.html
[R2] http://dpdk.org/ml/archives/dev/2016-September/046549.html
[R3] http://dpdk.org/ml/archives/dev/2016-September/046550.html
[R4] http://dpdk.org/ml/archives/dev/2016-September/046551.html
[R5] http://dpdk.org/ml/archives/dev/2016-September/046399.html
[R6] http://dpdk.org/ml/archives/dev/2016-September/046552.html
Changes since v9:
- Rebased over master (58efd680d5e)
- Fix issues reported by checkpatch and check-git-log, including changing
headline of the patches to adhere to these scripts.
- Corrected the patch author field
- Renamed devinit/devuninit for pci_driver to probe/remove as per
suggestion from David
- Fix for PMD Info gen tool using patch from David
- Fixed review comments [R1], some part of [R2], [R3] using patch from
David, [R4], [R5] and some inputs from [R6].
Changes since v8:
- Some review comments from Ferruh Yigit & Reshma Pattan have been fixed.
= Though changes in mlx4/mlx5/szedata2 have been done, I am still unable
to verify those in absence of a proper environment at my end.
= Comment from Ferruh for eth_driver, drv_name are not fixed yet.
- Added a 'Future work' section in Covering letter
Changes since v7:
- Rebase over master (e22856313fff2)
- Merge the patch series by David [1][2] and Jan [4] into a single set
hereafter, PCI and VDEV, both are re-factored for rte_device/driver
model
Changes since v6:
- rebase over 16.07 (b0a1419)
- DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
- review comments regarding missing information in log messages
- new API additions to 16.11 map objects
- review comment in [5] and [7] are not included in this series.
Changes since v5:
- Rebase over master (11c5e45d8)
- Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be
in sync with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can
be merged]
- Modifications to bnxt and thunderx driver PMD registration files for
using the simplified PCI device registration helper macro
Changes since v4:
- Fix compilation issue after rebase on HEAD (913154e) in previous series
- Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port
which were removed by previous patchset. These are being used by pdump
library
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
David Marchand (13):
eal: remove duplicate function declaration
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align PCI driver definitions
eal: introduce PCI device init macros
driver: init/uninit common wrappers for PCI drivers
drivers: convert all phy drivers as PCI drivers
drivers: remove driver register callbacks for crypto/net
eal/pci: helpers for device name parsing/update
ethdev: do not scan all PCI devices on attach
eal: add hotplug operations for PCI and VDEV
ethdev: convert to EAL hotplug
ethdev: get rid of device type
Jan Viktorin (11):
eal: define container macro
eal: extract vdev infra
eal: remove PDEV/VDEV unused code
drivers: convert VDRV to use RTE VDEV Driver
eal: remove unused PMD types
eal: include dev headers in place of PCI headers
eal: rename and move RTE PCI Resources
eal/pci: inherit RTE driver in PCI driver
eal: register EAL drivers explicitly
eal: introduce generalized RTE device
eal/pci: create RTE device list and fallback on its members
Shreyansh Jain (1):
eal/pci: replace PCI devinit/devuninit with probe/remove
app/test/test_pci.c | 18 +-
app/test/virtual_pmd.c | 8 +-
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
drivers/crypto/null/null_crypto_pmd.c | 7 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
drivers/net/af_packet/rte_eth_af_packet.c | 11 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
drivers/net/bnx2x/bnx2x_rxtx.c | 3 +-
drivers/net/bnxt/bnxt_ethdev.c | 17 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 9 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/cxgbe/sge.c | 7 +-
drivers/net/e1000/em_ethdev.c | 17 +-
drivers/net/e1000/igb_ethdev.c | 41 +---
drivers/net/ena/ena_ethdev.c | 20 +-
drivers/net/enic/enic_ethdev.c | 24 +-
drivers/net/fm10k/fm10k_ethdev.c | 30 +--
drivers/net/i40e/i40e_ethdev.c | 31 +--
drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
drivers/net/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
drivers/net/mlx4/mlx4.c | 26 +--
drivers/net/mlx5/mlx5.c | 27 +--
drivers/net/mpipe/mpipe_tilegx.c | 18 +-
drivers/net/nfp/nfp_net.c | 28 +--
drivers/net/null/rte_eth_null.c | 11 +-
drivers/net/pcap/rte_eth_pcap.c | 11 +-
drivers/net/qede/qede_ethdev.c | 42 +---
drivers/net/ring/rte_eth_ring.c | 11 +-
drivers/net/szedata2/rte_eth_szedata2.c | 29 +--
drivers/net/thunderx/nicvf_ethdev.c | 21 +-
drivers/net/vhost/rte_eth_vhost.c | 11 +-
drivers/net/virtio/virtio_ethdev.c | 29 +--
drivers/net/virtio/virtio_pci.c | 5 +-
drivers/net/virtio/virtio_user_ethdev.c | 10 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 11 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 10 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 95 ++++----
lib/librte_eal/common/eal_common_pci.c | 51 +++--
lib/librte_eal/common/eal_common_vdev.c | 108 +++++++++
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_common.h | 21 ++
lib/librte_eal/common/include/rte_dev.h | 77 +++++--
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 62 ++++--
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/common/include/rte_vdev.h | 97 ++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
lib/librte_eal/linuxapp/eal/eal.c | 1 +
lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
lib/librte_ether/rte_ethdev.c | 279 +++++-------------------
lib/librte_ether/rte_ethdev.h | 40 ++--
lib/librte_ether/rte_ether_version.map | 10 +-
mk/internal/rte.compile-pre.mk | 2 +-
71 files changed, 825 insertions(+), 1045 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 01/25] eal: define container macro
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 02/25] eal: remove duplicate function declaration Shreyansh Jain
` (24 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_common.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index db5ac91..7f9e4dd 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -331,6 +331,27 @@ rte_bsf32(uint32_t v)
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#endif
+/**
+ * Return pointer to the wrapping struct instance.
+ * Example:
+ *
+ * struct wrapper {
+ * ...
+ * struct child c;
+ * ...
+ * };
+ *
+ * struct child *x = obtain(...);
+ * struct wrapper *w = container_of(x, struct wrapper, c);
+ *
+ * Some implementation already have this defined, thus, conditional
+ * declaration.
+ */
+#ifndef container_of
+#define container_of(p, type, member) \
+ ((type *) (((char *) (p)) - offsetof(type, member)))
+#endif
+
#define _RTE_STR(x) #x
/** Take a macro value and get a string version of it */
#define RTE_STR(x) _RTE_STR(x)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 02/25] eal: remove duplicate function declaration
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 01/25] eal: define container macro Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 11:42 ` Jan Viktorin
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 03/25] pci: no need for dynamic tailq init Shreyansh Jain
` (23 subsequent siblings)
25 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 19f7535..ca1aec6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -237,13 +237,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d5b81a3..9412983 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 03/25] pci: no need for dynamic tailq init
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 01/25] eal: define container macro Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 02/25] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 04/25] eal/pci: replace PCI devinit/devuninit with probe/remove Shreyansh Jain
` (22 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 374b68f..a73cbb0 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 7248c38..6a0f6ac 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index cd9de7c..f0215ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 04/25] eal/pci: replace PCI devinit/devuninit with probe/remove
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (2 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 03/25] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 05/25] crypto: no need for a crypto pmd type Shreyansh Jain
` (21 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
Probe and Remove are more appropriate names for PCI init and uninint
operations. This is a cosmetic change.
Only MLX* uses the PCI direct registeration, bypassing PMD_* macro. The
calls backs for this too have been updated.
VDEV are left out. For them, init/uninit are more appropriate.
Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/test_pci.c | 8 ++++----
drivers/net/mlx4/mlx4.c | 4 ++--
drivers/net/mlx5/mlx5.c | 4 ++--
lib/librte_cryptodev/rte_cryptodev.c | 4 ++--
lib/librte_cryptodev/rte_cryptodev_pmd.h | 2 +-
lib/librte_eal/common/eal_common_pci.c | 16 ++++++++--------
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_pci.h | 10 +++++-----
lib/librte_ether/rte_ethdev.c | 8 ++++----
9 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 69f78d9..f1b988a 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -52,11 +52,11 @@
* PCI test
* ========
*
- * - Register a driver with a ``devinit()`` function.
+ * - Register a driver with a ``probe()`` function.
*
* - Dump all PCI devices.
*
- * - Check that the ``devinit()`` function is called at least once.
+ * - Check that the ``probe()`` function is called at least once.
*/
int test_pci_run = 0; /* value checked by the multiprocess test */
@@ -79,14 +79,14 @@ struct rte_pci_id my_driver_id2[] = {
struct rte_pci_driver my_driver = {
.name = "test_driver",
- .devinit = my_driver_init,
+ .probe = my_driver_init,
.id_table = my_driver_id,
.drv_flags = 0,
};
struct rte_pci_driver my_driver2 = {
.name = "test_driver2",
- .devinit = my_driver_init,
+ .probe = my_driver_init,
.id_table = my_driver_id2,
.drv_flags = 0,
};
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 304c846..5c709ee 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5544,7 +5544,7 @@ static struct eth_driver mlx4_driver;
* 0 on success, negative errno value on failure.
*/
static int
-mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
{
struct ibv_device **list;
struct ibv_device *ibv_dev;
@@ -5913,7 +5913,7 @@ static struct eth_driver mlx4_driver = {
.pci_drv = {
.name = MLX4_DRIVER_NAME,
.id_table = mlx4_pci_id_map,
- .devinit = mlx4_pci_devinit,
+ .probe = mlx4_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
},
.dev_private_size = sizeof(struct priv)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index d96a9af..7768231 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -355,7 +355,7 @@ static struct eth_driver mlx5_driver;
* 0 on success, negative errno value on failure.
*/
static int
-mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
{
struct ibv_device **list;
struct ibv_device *ibv_dev;
@@ -730,7 +730,7 @@ static struct eth_driver mlx5_driver = {
.pci_drv = {
.name = MLX5_DRIVER_NAME,
.id_table = mlx5_pci_id_map,
- .devinit = mlx5_pci_devinit,
+ .probe = mlx5_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
},
.dev_private_size = sizeof(struct priv)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index fc4123b..da5ad73 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -548,8 +548,8 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.probe = rte_cryptodev_init;
+ cryptodrv->pci_drv.remove = rte_cryptodev_uninit;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index cd46674..130290e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -505,7 +505,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
* device, by invoking the rte_eal_pci_register() function to
* register the *pci_drv* structure embedded in the *crypto_drv*
* structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
+ * rte_cryptodev_init() function in the *probe* field of the
* *pci_drv* structure.
*
* During the PCI probing phase, the rte_cryptodev_init()
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6a0f6ac..db8cba0 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -153,7 +153,7 @@ pci_unmap_resource(void *requested_addr, size_t size)
}
/*
- * If vendor/device ID match, call the devinit() function of the
+ * If vendor/device ID match, call the probe() function of the
* driver.
*/
static int
@@ -212,15 +212,15 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
/* reference driver structure */
dev->driver = dr;
- /* call the driver devinit() function */
- return dr->devinit(dr, dev);
+ /* call the driver probe() function */
+ return dr->probe(dr, dev);
}
/* return positive value if driver doesn't support this device */
return 1;
}
/*
- * If vendor/device ID match, call the devuninit() function of the
+ * If vendor/device ID match, call the remove() function of the
* driver.
*/
static int
@@ -257,7 +257,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->name);
- if (dr->devuninit && (dr->devuninit(dev) < 0))
+ if (dr->remove && (dr->remove(dev) < 0))
return -1; /* negative value is an error */
/* clear driver structure */
@@ -275,7 +275,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
}
/*
- * If vendor/device ID match, call the devinit() function of all
+ * If vendor/device ID match, call the probe() function of all
* registered driver for the given device. Return -1 if initialization
* failed, return 1 if no driver is found for this device.
*/
@@ -302,7 +302,7 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
}
/*
- * If vendor/device ID match, call the devuninit() function of all
+ * If vendor/device ID match, call the remove() function of all
* registered driver for the given device. Return -1 if initialization
* failed, return 1 if no driver is found for this device.
*/
@@ -392,7 +392,7 @@ err_return:
}
/*
- * Scan the content of the PCI bus, and call the devinit() function for
+ * Scan the content of the PCI bus, and call the probe() function for
* all registered drivers that have a matching entry in its id_table
* for discovered devices.
*/
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 95789f9..8233a2a 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void devinitfn_ ##drv(void);\
-void __attribute__((constructor, used)) devinitfn_ ##drv(void)\
+void probefn_ ##drv(void);\
+void __attribute__((constructor, used)) probefn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..803c78a 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -193,12 +193,12 @@ struct rte_pci_driver;
/**
* Initialisation function for the driver called during PCI probing.
*/
-typedef int (pci_devinit_t)(struct rte_pci_driver *, struct rte_pci_device *);
+typedef int (pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
/**
* Uninitialisation function for the driver called during hotplugging.
*/
-typedef int (pci_devuninit_t)(struct rte_pci_device *);
+typedef int (pci_remove_t)(struct rte_pci_device *);
/**
* A structure describing a PCI driver.
@@ -206,8 +206,8 @@ typedef int (pci_devuninit_t)(struct rte_pci_device *);
struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
const char *name; /**< Driver name. */
- pci_devinit_t *devinit; /**< Device init. function. */
- pci_devuninit_t *devuninit; /**< Device uninit function. */
+ pci_probe_t *probe; /**< Device Probe function. */
+ pci_remove_t *remove; /**< Device Remove function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
uint32_t drv_flags; /**< Flags contolling handling of device. */
};
@@ -442,7 +442,7 @@ int rte_eal_pci_probe_one(const struct rte_pci_addr *addr);
* Close the single PCI device.
*
* Scan the content of the PCI bus, and find the pci device specified by pci
- * address, then call the devuninit() function for registered driver that has a
+ * address, then call the remove() function for registered driver that has a
* matching entry in its id_table for discovered device.
*
* @param addr
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f62a9ec..d07348e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -348,7 +348,7 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
* Poll Mode Driver.
* Invokes the rte_eal_pci_register() function to register the *pci_drv*
* structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
+ * address of the rte_eth_dev_init() function in the *probe* field of
* the *pci_drv* structure.
* During the PCI probing phase, the rte_eth_dev_init() function is
* invoked for each PCI [Ethernet device] matching the embedded PCI
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.probe = rte_eth_dev_init;
+ eth_drv->pci_drv.remove = rte_eth_dev_uninit;
rte_eal_pci_register(ð_drv->pci_drv);
}
@@ -538,7 +538,7 @@ rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
goto err;
- /* invoke devuninit func of the pci driver,
+ /* invoke remove func of the pci driver,
* also remove the device from pci_device_list */
if (rte_eal_pci_detach(&freed_addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 05/25] crypto: no need for a crypto pmd type
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (3 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 04/25] eal/pci: replace PCI devinit/devuninit with probe/remove Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 11:49 ` Jan Viktorin
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 06/25] drivers: align PCI driver definitions Shreyansh Jain
` (20 subsequent siblings)
25 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index da5ad73..dca368d 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -319,7 +319,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -358,7 +358,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -407,7 +406,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -449,8 +448,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index d047ba8..1555678 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -620,8 +620,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 130290e..9a9174f 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -456,13 +456,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 06/25] drivers: align PCI driver definitions
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (4 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 05/25] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 07/25] eal: introduce PCI device init macros Shreyansh Jain
` (19 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 82ab047..1e9e0ba 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,7 +113,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
},
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index ac0803d..9418d50 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1685,7 +1685,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 82e3e4e..99a258a 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2459,7 +2459,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 07/25] eal: introduce PCI device init macros
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (5 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 06/25] drivers: align PCI driver definitions Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 08/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
` (18 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Update PCI Registration macro name]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 10 ++++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 8233a2a..94ae14e 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void probefn_ ##drv(void);\
-void __attribute__((constructor, used)) probefn_ ##drv(void)\
+RTE_INIT(probefn_ ##drv);\
+static void probefn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 98d20db..d150b9d 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -253,6 +253,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 803c78a..cf81898 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,16 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registration from driver (eth, crypto) instance */
+#define DRIVER_REGISTER_PCI(nm, pci_drv) \
+RTE_INIT(pciinitfn_ ##nm); \
+static void pciinitfn_ ##nm(void) \
+{\
+ (pci_drv).name = RTE_STR(nm);\
+ rte_eal_pci_register(&pci_drv); \
+} \
+DRIVER_EXPORT_NAME(nm, __COUNTER__)
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index cc3c0f1..cc386e4 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 08/25] driver: init/uninit common wrappers for PCI drivers
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (6 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 07/25] eal: introduce PCI device init macros Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 09/25] drivers: convert all phy drivers as " Shreyansh Jain
` (17 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
crypto and ethdev drivers aligned to PCI probe/remove. These wrappers are
mapped directly to PCI resources.
Existing handlers for init/uninit can be easily reused for this.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 17 +++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 7 +++++++
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 9 +++++++++
6 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index dca368d..910c841 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -429,9 +429,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -490,8 +490,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -539,15 +539,16 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe(
+ (struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.probe = rte_cryptodev_init;
- cryptodrv->pci_drv.remove = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.probe = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.remove = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 9a9174f..450a376 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -536,6 +536,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .probe function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .remove function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a08fd20..1fc0d57 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -39,3 +39,10 @@ DPDK_16.07 {
rte_cryptodev_parse_vdev_init_params;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+} DPDK_16.07;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index d07348e..f534967 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.probe = rte_eth_dev_init;
- eth_drv->pci_drv.remove = rte_eth_dev_uninit;
+ eth_drv->pci_drv.probe = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.remove = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 96575e8..83079e9 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4372,6 +4372,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .remove function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 45ddf44..17e7448 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -138,4 +138,13 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 09/25] drivers: convert all phy drivers as PCI drivers
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (7 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 08/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 10/25] drivers: remove driver register callbacks for crypto/net Shreyansh Jain
` (16 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
Changes since v9:
- Add DRIVER_EXPORT_NAME to DRIVER_REGISTER_PCI
- For mlx4/mlx5/virtio_ethdev, use DRIVER_EXPORT_NAME directly as they
don't use DRIVER_REGISTER_PCI
- Modify PMDINFO matching from PMD_REGISTER_* to DRIVER_REGISTER_*
All changes above suggested by David Marchand <david.marchand@6wind.com>
- Change PCI devinit/devuninit to prove/remove
---
drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++---------
drivers/net/bnx2x/bnx2x_ethdev.c | 34 +++++-------------------
drivers/net/bnxt/bnxt_ethdev.c | 16 +++---------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++--------------
drivers/net/e1000/em_ethdev.c | 16 +++---------
drivers/net/e1000/igb_ethdev.c | 39 +++++-----------------------
drivers/net/ena/ena_ethdev.c | 17 +++---------
drivers/net/enic/enic_ethdev.c | 23 +++--------------
drivers/net/fm10k/fm10k_ethdev.c | 23 +++--------------
drivers/net/i40e/i40e_ethdev.c | 24 +++--------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 +++---------------
drivers/net/ixgbe/ixgbe_ethdev.c | 46 +++++----------------------------
drivers/net/mlx4/mlx4.c | 16 +++---------
drivers/net/mlx5/mlx5.c | 15 +++--------
drivers/net/nfp/nfp_net.c | 21 +++------------
drivers/net/qede/qede_ethdev.c | 40 ++++++----------------------
drivers/net/szedata2/rte_eth_szedata2.c | 24 +++--------------
drivers/net/thunderx/nicvf_ethdev.c | 20 +++-----------
drivers/net/virtio/virtio_ethdev.c | 26 ++++++-------------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++--------------
mk/internal/rte.compile-pre.mk | 2 +-
21 files changed, 82 insertions(+), 408 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1e9e0ba..170ae78 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,23 +116,13 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_cryptodev_pci_probe,
+ .remove = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv, CRYPTODEV_NAME_QAT_SYM_PMD);
+DRIVER_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index f3ab355..4bd5142 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -621,6 +621,8 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
@@ -634,38 +636,14 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver, bnx2x);
+DRIVER_REGISTER_PCI(bnx2x, rte_bnx2x_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf);
+DRIVER_REGISTER_PCI(bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3795fac..e19868f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1048,23 +1048,13 @@ static struct eth_driver bnxt_rte_pmd = {
.name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = bnxt_dev_init,
.eth_dev_uninit = bnxt_dev_uninit,
.dev_private_size = sizeof(struct bnxt),
};
-static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
-{
- RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
- rte_eth_driver_register(&bnxt_rte_pmd);
- return 0;
-}
-
-static struct rte_driver bnxt_pmd_drv = {
- .type = PMD_PDEV,
- .init = bnxt_rte_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt);
+DRIVER_REGISTER_PCI(bnxt, bnxt_rte_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 9208a61..871103f 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1042,30 +1042,12 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4);
+DRIVER_REGISTER_PCI(cxgb4, rte_cxgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(cxgb4, cxgb4_pci_tbl);
-
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index ad104ed..5761c3c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -395,6 +395,8 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
@@ -402,13 +404,6 @@ static struct eth_driver rte_em_pmd = {
};
static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
-
-static int
em_hw_init(struct e1000_hw *hw)
{
int diag;
@@ -1799,10 +1794,5 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv, em);
+DRIVER_REGISTER_PCI(em, rte_em_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(em, pci_id_em_map);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 4e9e6a3..951f14c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1082,6 +1082,8 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
@@ -1096,19 +1098,14 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
-
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
{
@@ -1120,20 +1117,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -5084,16 +5067,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5255,7 +5228,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-PMD_REGISTER_DRIVER(pmd_igb_drv, igb);
+DRIVER_REGISTER_PCI(igb, rte_igb_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf);
+DRIVER_REGISTER_PCI(igbvf, rte_igbvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(igbvf, pci_id_igbvf_map);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 9418d50..abc5235 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1689,23 +1689,12 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv, ena);
+DRIVER_REGISTER_PCI(ena, rte_ena_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ena, pci_id_ena_map);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 47b07c9..69959c7 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -616,29 +616,12 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver, enic);
+DRIVER_REGISTER_PCI(enic, rte_enic_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(enic, pci_id_enic_map);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 01f4a72..985cd69 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3059,30 +3059,13 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver, fm10k);
+DRIVER_REGISTER_PCI(fm10k, rte_pmd_fm10k.pci_drv);
DRIVER_REGISTER_PCI_TABLE(fm10k, pci_id_fm10k_map);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0aeb70..d9e5988 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -667,6 +667,8 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
@@ -701,27 +703,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver, i40e);
+DRIVER_REGISTER_PCI(i40e, rte_i40e_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40e, pci_id_i40e_map);
/*
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index a616ae0..0852472 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1557,34 +1557,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver, i40evf);
+DRIVER_REGISTER_PCI(i40evf, rte_i40evf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map);
static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb618ef..406302e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1566,6 +1566,8 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1580,40 +1582,14 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
-
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
@@ -7409,17 +7385,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
ixgbevf_dev_interrupt_action(dev);
}
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver, ixgbe);
+DRIVER_REGISTER_PCI(ixgbe, rte_ixgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbe, pci_id_ixgbe_map);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver, ixgbevf);
+DRIVER_REGISTER_PCI(ixgbevf, rte_ixgbevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 5c709ee..ebb55b2 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5922,12 +5922,10 @@ static struct eth_driver mlx4_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5938,13 +5936,7 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver, mlx4);
+DRIVER_EXPORT_NAME(mlx4, __COUNTER__);
DRIVER_REGISTER_PCI_TABLE(mlx4, mlx4_pci_id_map);
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 7768231..42d7fa8 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -739,11 +739,10 @@ static struct eth_driver mlx5_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -753,13 +752,7 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver, mlx5);
+DRIVER_EXPORT_NAME(mlx5, __COUNTER__);
DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99a258a..bc1f8a1 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2464,29 +2464,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver, nfp);
+DRIVER_REGISTER_PCI(nfp, rte_nfp_net_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(nfp, pci_id_nfp_net_map);
/*
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 82e44b8..3403524 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1482,7 +1482,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1494,41 +1496,15 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver, qede);
+DRIVER_REGISTER_PCI(qede, rte_qede_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qede, pci_id_qede_map);
-PMD_REGISTER_DRIVER(rte_qedevf_driver, qedevf);
+DRIVER_REGISTER_PCI(qedevf, rte_qedevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(qedevf, pci_id_qedevf_map);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 483d789..bbf97a2 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,13 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME);
+DRIVER_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv);
DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 4f875c0..ffe305c 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1762,26 +1762,12 @@ static struct eth_driver rte_nicvf_pmd = {
.name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = nicvf_eth_dev_init,
.dev_private_size = sizeof(struct nicvf),
};
-static int
-rte_nicvf_pmd_init(const char *name __rte_unused, const char *para __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_thunderx nicvf version %s",
- THUNDERX_NICVF_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nicvf_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nicvf_driver = {
- .type = PMD_PDEV,
- .init = rte_nicvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nicvf_driver, thunderx_nicvf);
+DRIVER_REGISTER_PCI(thunderx_nicvf, rte_nicvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(thunderx_nicvf, pci_id_nicvf_map);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 07d6449..0ff8724 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1307,29 +1307,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1563,10 +1558,5 @@ __rte_unused uint8_t is_rx)
return 0;
}
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver, virtio_net);
+DRIVER_EXPORT_NAME(virtio_net, __COUNTER__);
DRIVER_REGISTER_PCI_TABLE(virtio_net, pci_id_virtio_map);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 5874215..cec95c4 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -331,26 +331,14 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
-
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
{
@@ -948,10 +936,5 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver, vmxnet3);
+DRIVER_REGISTER_PCI(vmxnet3, rte_vmxnet3_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(vmxnet3, pci_id_vmxnet3_map);
diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
index f740179..c7ee5df 100644
--- a/mk/internal/rte.compile-pre.mk
+++ b/mk/internal/rte.compile-pre.mk
@@ -87,7 +87,7 @@ endif
PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
PMDINFO_CC = $(CC) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
-PMDINFO_TO_O = if grep -q 'PMD_REGISTER_DRIVER(.*)' $<; then \
+PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
echo "$(if $V,$(PMDINFO_GEN), PMDINFO $@.pmd.c)" && \
$(PMDINFO_GEN) && \
echo "$(if $V,$(PMDINFO_CC), CC $@.pmd.o)" && \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 10/25] drivers: remove driver register callbacks for crypto/net
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (8 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 09/25] drivers: convert all phy drivers as " Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update Shreyansh Jain
` (15 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Now that all pdev are pci drivers, we don't need to register crypto and
ethdev drivers through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 23 --------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
lib/librte_ether/rte_ethdev.c | 22 -------------------
lib/librte_ether/rte_ethdev.h | 12 -----------
lib/librte_ether/rte_ether_version.map | 1 -
6 files changed, 89 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 910c841..2a3b649 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -533,29 +533,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe(
- (struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.probe = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.remove = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 450a376..abfe2dc 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -493,36 +493,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *probe* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 1fc0d57..9627ac4 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f534967..11eecaf 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -340,28 +340,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *probe* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.probe = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.remove = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 83079e9..a7ba1f0 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1875,18 +1875,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 17e7448..72be66d 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -78,7 +78,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (9 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 10/25] drivers: remove driver register callbacks for crypto/net Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-10-25 15:49 ` Pattan, Reshma
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 12/25] ethdev: do not scan all PCI devices on attach Shreyansh Jain
` (14 subsequent siblings)
25 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
- Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common
method, can be used across crypto/net PCI PMDs.
- Remove crypto specific routine and fallback to common name function.
- Introduce a eal private Update function for PCI device naming.
Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Merge crypto/pci helper patches]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 +++---------------
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 24 ++++++++++++++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
lib/librte_ether/rte_ethdev.c | 24 +++-------------
6 files changed, 107 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 2a3b649..c81e366 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -444,9 +427,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -501,9 +483,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index a73cbb0..1d91c78 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index ca1aec6..431d6c2 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -130,6 +130,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index cf81898..e1f695f 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,28 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
+ * BDF helpers.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f0215ee..62da4d4 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 11eecaf..e80cab4 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 12/25] ethdev: do not scan all PCI devices on attach
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (10 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 13/25] eal: add hotplug operations for PCI and VDEV Shreyansh Jain
` (13 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 12 +++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index db8cba0..bef7ee8 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -341,6 +341,12 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it.
+ */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -353,9 +359,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e80cab4..3ef5c84 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -469,9 +469,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 13/25] eal: add hotplug operations for PCI and VDEV
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (11 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 12/25] ethdev: do not scan all PCI devices on attach Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 14/25] ethdev: convert to EAL hotplug Shreyansh Jain
` (12 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Hotplug invocations, which deals with devices, should come from the layer
that already handles them, i.e. EAL.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 ++++
lib/librte_eal/common/eal_common_dev.c | 48 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 26 ++++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 ++++
4 files changed, 88 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index a335e04..7b3d409 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -162,3 +162,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..88f9d3f 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,51 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", name);
+ return -EINVAL;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device provided.\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 94ae14e..6cc9b01 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,32 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a device to a registered driver.
+ *
+ * @param name
+ * The device name, that refers to a pci device (or some private
+ * way of designating a vdev device). Based on this device name, eal
+ * will identify a driver capable of handling it and pass it to the
+ * driver probing function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a device from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
#define DRIVER_EXPORT_NAME(name, idx) \
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index db8c984..c0bd391 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -166,3 +166,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 14/25] ethdev: convert to EAL hotplug
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (12 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 13/25] eal: add hotplug operations for PCI and VDEV Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 15/25] ethdev: get rid of device type Shreyansh Jain
` (11 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some
mechanism to inform applications of port creation/removal to substitute
for ethdev hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the
following commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
--
v10:
- Update incorrect language of log message
- Checkpatch issues fixed
---
lib/librte_ether/rte_ethdev.c | 207 +++++++-----------------------------------
1 file changed, 35 insertions(+), 172 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 3ef5c84..bec0c2c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -72,6 +72,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -216,6 +217,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -347,27 +349,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
@@ -413,34 +394,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t dev_flags;
@@ -465,124 +418,49 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
+/* attach the new device, then store port_id of the device */
+int
+rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
+ int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
+ if ((devargs == NULL) || (port_id == NULL)) {
+ ret = -EINVAL;
goto err;
+ }
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
goto err;
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
goto err;
- /* invoke remove func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ RTE_LOG(ERR, EAL, "No ports found for device (%s)\n", name);
+ ret = -1;
goto err;
+ }
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port.
*/
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
-/* attach the new device, then store port_id of the device */
-int
-rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
-{
- struct rte_pci_addr addr;
- int ret = -1;
-
- if ((devargs == NULL) || (port_id == NULL)) {
- ret = -EINVAL;
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
- }
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -590,7 +468,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -598,33 +475,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 15/25] ethdev: get rid of device type
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (13 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 14/25] ethdev: convert to EAL hotplug Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 16/25] eal: extract vdev infra Shreyansh Jain
` (10 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Now that hotplug has been moved to eal, there is no reason to keep the
device type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
16 files changed, 16 insertions(+), 52 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f795566..d629ee3 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -666,7 +666,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 203ebe9..8514652 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index ebb55b2..172ff86 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5803,7 +5803,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 42d7fa8..f1bc7a1 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -617,7 +617,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 93f8730..c0d0e3b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 7a24884..ce49945 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -517,7 +517,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7e213eb..7fbc60e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index a7048c7..5690dcd 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 7539cd4..2bb761b 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -714,7 +714,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index daef09b..aadfdc0 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -277,7 +277,7 @@ virtio_user_eth_dev_alloc(const char *name)
struct virtio_hw *hw;
struct virtio_user_dev *dev;
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
return NULL;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 99f6cc8..6b15381 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -654,7 +654,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..0dbc332 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index bec0c2c..6acd1c7 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -191,7 +191,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -216,7 +216,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -248,7 +247,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index a7ba1f0..e9aca17 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1606,17 +1606,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1646,7 +1635,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
} __rte_cache_aligned;
struct rte_eth_dev_sriov {
@@ -1760,8 +1748,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 16/25] eal: extract vdev infra
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (14 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 15/25] ethdev: get rid of device type Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 17/25] eal: remove PDEV/VDEV unused code Shreyansh Jain
` (9 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Move all PMD_VDEV-specific code into a separate module and header
file to not polute the generic code anymore. There is now a list
of virtual devices available.
The rte_vdev_driver integrates the original rte_driver inside
(C inheritance). The rte_driver will be however change in the
future to serve as a common base for all other types of drivers.
The existing PMDs (PMD_VDEV) are to be modified later (there is
no change for them at the moment).
Unlike DRIVER_REGISTER_PCI, DRIVER_EXPORT_NAME is not being called on vdev
registration.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
Changes since v9:
- Add DRIVER_EXPORT_NAME() to DRIVER_REGISTER_* macro.
Patch for change from David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 3 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 54 +-----------
lib/librte_eal/common/eal_common_vdev.c | 112 ++++++++++++++++++++++++
lib/librte_eal/common/include/rte_vdev.h | 85 ++++++++++++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 +
8 files changed, 207 insertions(+), 54 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 7a0fea5..5a3fc1d 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -69,6 +69,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 7b3d409..ec61017 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -168,4 +168,7 @@ DPDK_16.11 {
rte_eal_dev_attach;
rte_eal_dev_detach;
+ rte_eal_vdrv_register;
+ rte_eal_vdrv_unregister;
+
} DPDK_16.07;
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index bb9810d..dfd64aa 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -38,7 +38,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_dev.h
+INC += rte_hexdump.h rte_devargs.h rte_dev.h rte_vdev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 88f9d3f..555e0d9 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -64,32 +64,6 @@ rte_eal_driver_unregister(struct rte_driver *driver)
}
int
-rte_eal_vdev_init(const char *name, const char *args)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->init(name, args);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
-int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
@@ -98,7 +72,7 @@ rte_eal_dev_init(void)
/*
* Note that the dev_driver_list is populated here
* from calls made to rte_eal_driver_register from constructor functions
- * embedded into PMD modules via the PMD_REGISTER_DRIVER macro
+ * embedded into PMD modules via the DRIVER_REGISTER_VDEV macro
*/
/* call the init function for each virtual device */
@@ -125,32 +99,6 @@ rte_eal_dev_init(void)
return 0;
}
-int
-rte_eal_vdev_uninit(const char *name)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->uninit(name);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
int rte_eal_dev_attach(const char *name, const char *devargs)
{
struct rte_pci_addr addr;
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
new file mode 100644
index 0000000..462517f
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -0,0 +1,112 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/queue.h>
+
+#include <rte_vdev.h>
+#include <rte_common.h>
+
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_eal_vdrv_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+int
+rte_eal_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)))
+ return driver->driver.init(name, args);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
+
+int
+rte_eal_vdev_uninit(const char *name)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)))
+ return driver->driver.uninit(name);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
new file mode 100644
index 0000000..9c5cc54
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -0,0 +1,85 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_eal_vdrv_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver);
+
+#define DRIVER_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ rte_eal_vdrv_register(&vdrv);\
+} \
+DRIVER_EXPORT_NAME(nm, __COUNTER__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 193957f..4e206f0 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -77,6 +77,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index c0bd391..b8bfd4b 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -172,4 +172,7 @@ DPDK_16.11 {
rte_eal_dev_attach;
rte_eal_dev_detach;
+ rte_eal_vdrv_register;
+ rte_eal_vdrv_unregister;
+
} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 17/25] eal: remove PDEV/VDEV unused code
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (15 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 16/25] eal: extract vdev infra Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 18/25] drivers: convert VDRV to use RTE VDEV Driver Shreyansh Jain
` (8 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
- Remove checks for VDEV from rte_eal_vdev_(init/uninint) as all devices
are inherently virtual here.
- PDEVs perform PCI specific inits - rte_eal_dev_init() need not call
rte_driver->init();
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 8 --------
lib/librte_eal/common/eal_common_vdev.c | 6 ------
2 files changed, 14 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 555e0d9..afa33fa 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -67,7 +67,6 @@ int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
- struct rte_driver *driver;
/*
* Note that the dev_driver_list is populated here
@@ -89,13 +88,6 @@ rte_eal_dev_init(void)
}
}
- /* Once the vdevs are initalized, start calling all the pdev drivers */
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_PDEV)
- continue;
- /* PDEV drivers don't get passed any parameters */
- driver->init(NULL, NULL);
- }
return 0;
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 462517f..67cb397 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -66,9 +66,6 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -93,9 +90,6 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 18/25] drivers: convert VDRV to use RTE VDEV Driver
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (16 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 17/25] eal: remove PDEV/VDEV unused code Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 19/25] eal: remove unused PMD types Shreyansh Jain
` (7 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
All PMD_VDEV drivers can now use rte_vdev_driver instead of the
rte_driver (which is embedded in the rte_vdev_driver).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 10 ++++++----
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 10 ++++++----
drivers/crypto/kasumi/rte_kasumi_pmd.c | 10 ++++++----
drivers/crypto/null/null_crypto_pmd.c | 10 ++++++----
drivers/crypto/snow3g/rte_snow3g_pmd.c | 10 ++++++----
drivers/net/af_packet/rte_eth_af_packet.c | 12 +++++++-----
drivers/net/bonding/rte_eth_bond_pmd.c | 12 +++++++-----
drivers/net/mpipe/mpipe_tilegx.c | 22 +++++++++++++---------
drivers/net/null/rte_eth_null.c | 12 +++++++-----
drivers/net/pcap/rte_eth_pcap.c | 12 +++++++-----
drivers/net/ring/rte_eth_ring.c | 12 +++++++-----
drivers/net/vhost/rte_eth_vhost.c | 12 +++++++-----
drivers/net/virtio/virtio_user_ethdev.c | 11 +++++++----
drivers/net/xenvirt/rte_eth_xenvirt.c | 12 +++++++-----
lib/librte_eal/common/eal_common_vdev.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 12 ------------
lib/librte_eal/common/include/rte_vdev.h | 12 ++++++++++++
17 files changed, 113 insertions(+), 82 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dc0b033..c93ebfe 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -37,7 +37,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -514,13 +514,15 @@ aesni_gcm_uninit(const char *name)
return 0;
}
-static struct rte_driver aesni_gcm_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver aesni_gcm_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = aesni_gcm_init,
.uninit = aesni_gcm_uninit
};
-PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv, CRYPTODEV_NAME_AESNI_GCM_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b2d0c8c..30c0706 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -714,13 +714,15 @@ cryptodev_aesni_mb_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drv, CRYPTODEV_NAME_AESNI_MB_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_MB_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 4e21743..ba2829d 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -650,13 +650,15 @@ cryptodev_kasumi_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_kasumi_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_kasumi_init,
.uninit = cryptodev_kasumi_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv, CRYPTODEV_NAME_KASUMI_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 909b04f..4c12faa 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,7 @@
#include <rte_common.h>
#include <rte_config.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include "null_crypto_pmd_private.h"
@@ -268,13 +268,15 @@ cryptodev_null_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_null_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_null_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_null_init,
.uninit = cryptodev_null_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv, CRYPTODEV_NAME_NULL_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 87cd070..10c6b83 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -638,13 +638,15 @@ cryptodev_snow3g_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_snow3g_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_snow3g_init,
.uninit = cryptodev_snow3g_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv, CRYPTODEV_NAME_SNOW3G_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, cryptodev_snow3g_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SNOW3G_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index d629ee3..9a9a2ee 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -40,7 +40,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
@@ -889,13 +889,15 @@ rte_pmd_af_packet_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_af_packet_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_af_packet_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_af_packet_devinit,
- .uninit = rte_pmd_af_packet_devuninit,
+ .uninit = rte_pmd_af_packet_devuninit
};
-PMD_REGISTER_DRIVER(pmd_af_packet_drv, eth_af_packet);
+DRIVER_REGISTER_VDEV(eth_af_packet, pmd_af_packet_drv);
DRIVER_REGISTER_PARAM_STRING(eth_af_packet,
"iface=<string> "
"qpairs=<int> "
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b20a272..5fa2a93 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -42,7 +42,7 @@
#include <rte_ip_frag.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_alarm.h>
#include <rte_cycles.h>
@@ -2508,13 +2508,15 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
return 0;
}
-static struct rte_driver bond_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver bond_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = bond_init,
- .uninit = bond_uninit,
+ .uninit = bond_uninit
};
-PMD_REGISTER_DRIVER(bond_drv, eth_bond);
+DRIVER_REGISTER_VDEV(eth_bond, bond_drv);
DRIVER_REGISTER_PARAM_STRING(eth_bond,
"slave=<ifc> "
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index c0d0e3b..efb000b 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <rte_eal.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_eal_memconfig.h>
#include <rte_ethdev.h>
#include <rte_malloc.h>
@@ -1623,18 +1623,22 @@ rte_pmd_mpipe_devinit(const char *ifname,
return 0;
}
-static struct rte_driver pmd_mpipe_xgbe_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
+ .init = rte_pmd_mpipe_devinit
};
-static struct rte_driver pmd_mpipe_gbe_drv = {
- .type = PMD_VDEV,
- .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
+ .init = rte_pmd_mpipe_devinit
};
-PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv, xgbe);
-PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv, gbe);
+DRIVER_REGISTER_VDEV(xgbe, pmd_mpipe_xgbe_drv);
+DRIVER_REGISTER_VDEV(gbe, pmd_mpipe_gbe_drv);
static void __attribute__((constructor, used))
mpipe_init_contexts(void)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index ce49945..be4169e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -35,7 +35,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_spinlock.h>
@@ -686,13 +686,15 @@ rte_pmd_null_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_null_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_null_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_null_devinit,
- .uninit = rte_pmd_null_devuninit,
+ .uninit = rte_pmd_null_devuninit
};
-PMD_REGISTER_DRIVER(pmd_null_drv, eth_null);
+DRIVER_REGISTER_VDEV(eth_null, pmd_null_drv);
DRIVER_REGISTER_PARAM_STRING(eth_null,
"size=<int> "
"copy=<int>");
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7fbc60e..d6718b8 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -40,7 +40,7 @@
#include <rte_string_fns.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <net/if.h>
@@ -1083,13 +1083,15 @@ rte_pmd_pcap_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_pcap_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_pcap_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_pcap_devinit,
- .uninit = rte_pmd_pcap_devuninit,
+ .uninit = rte_pmd_pcap_devuninit
};
-PMD_REGISTER_DRIVER(pmd_pcap_drv, eth_pcap);
+DRIVER_REGISTER_VDEV(eth_pcap, pmd_pcap_drv);
DRIVER_REGISTER_PARAM_STRING(eth_pcap,
"rx_pcap=<string> "
"tx_pcap=<string> "
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 5690dcd..77bd664 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -38,7 +38,7 @@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
@@ -623,12 +623,14 @@ rte_pmd_ring_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_ring_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_ring_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_ring_devinit,
- .uninit = rte_pmd_ring_devuninit,
+ .uninit = rte_pmd_ring_devuninit
};
-PMD_REGISTER_DRIVER(pmd_ring_drv, eth_ring);
+DRIVER_REGISTER_VDEV(eth_ring, pmd_ring_drv);
DRIVER_REGISTER_PARAM_STRING(eth_ring,
"nodeaction=[attach|detach]");
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 2bb761b..e2610b4 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -41,7 +41,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_virtio_net.h>
#include <rte_spinlock.h>
@@ -924,13 +924,15 @@ rte_pmd_vhost_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_vhost_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_vhost_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_vhost_devinit,
- .uninit = rte_pmd_vhost_devuninit,
+ .uninit = rte_pmd_vhost_devuninit
};
-PMD_REGISTER_DRIVER(pmd_vhost_drv, eth_vhost);
+DRIVER_REGISTER_VDEV(eth_vhost, pmd_vhost_drv);
DRIVER_REGISTER_PARAM_STRING(eth_vhost,
"iface=<ifc> "
"queues=<int>");
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index aadfdc0..7975298 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -37,6 +37,7 @@
#include <rte_malloc.h>
#include <rte_kvargs.h>
+#include <rte_vdev.h>
#include "virtio_ethdev.h"
#include "virtio_logs.h"
@@ -461,13 +462,15 @@ virtio_user_pmd_devuninit(const char *name)
return 0;
}
-static struct rte_driver virtio_user_driver = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver virtio_user_driver = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = virtio_user_pmd_devinit,
- .uninit = virtio_user_pmd_devuninit,
+ .uninit = virtio_user_pmd_devuninit
};
-PMD_REGISTER_DRIVER(virtio_user_driver, virtio_user);
+DRIVER_REGISTER_VDEV(virtio_user, virtio_user_driver);
DRIVER_REGISTER_PARAM_STRING(virtio_user,
"path=<path> "
"mac=<mac addr> "
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 6b15381..7da0f17 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -56,7 +56,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_xenvirt_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_xenvirt_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_xenvirt_devinit,
- .uninit = rte_pmd_xenvirt_devuninit,
+ .uninit = rte_pmd_xenvirt_devuninit
};
-PMD_REGISTER_DRIVER(pmd_xenvirt_drv, eth_xenvirt);
+DRIVER_REGISTER_VDEV(eth_xenvirt, pmd_xenvirt_drv);
DRIVER_REGISTER_PARAM_STRING(eth_xenvirt,
"mac=<mac addr>");
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 67cb397..1a4dec6 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -74,7 +74,7 @@ rte_eal_vdev_init(const char *name, const char *args)
*/
if (!strncmp(driver->driver.name, name,
strlen(driver->driver.name)))
- return driver->driver.init(name, args);
+ return driver->init(name, args);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
@@ -98,7 +98,7 @@ rte_eal_vdev_uninit(const char *name)
*/
if (!strncmp(driver->driver.name, name,
strlen(driver->driver.name)))
- return driver->driver.uninit(name);
+ return driver->uninit(name);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 6cc9b01..8796f97 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,16 +105,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Initialization function called for each device driver once.
- */
-typedef int (rte_dev_init_t)(const char *name, const char *args);
-
-/**
- * Uninitilization function called for each device driver once.
- */
-typedef int (rte_dev_uninit_t)(const char *name);
-
-/**
* Driver type enumeration
*/
enum pmd_type {
@@ -129,8 +119,6 @@ struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
- rte_dev_init_t *init; /**< Device init. function. */
- rte_dev_uninit_t *uninit; /**< Device uninit. function. */
};
/**
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 9c5cc54..1e6b338 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -44,11 +44,23 @@ extern "C" {
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
/**
+ * Initialization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_init_t)(const char *name, const char *args);
+
+/**
+ * Uninitilization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_uninit_t)(const char *name);
+
+/**
* A virtual device driver abstraction.
*/
struct rte_vdev_driver {
TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_init_t *init; /**< Virtual device init. function. */
+ rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */
};
/**
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 19/25] eal: remove unused PMD types
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (17 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 18/25] drivers: convert VDRV to use RTE VDEV Driver Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 20/25] eal: include dev headers in place of PCI headers Shreyansh Jain
` (6 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
- All devices register themselfs by calling a kind of DRIVER_REGISTER_XXX.
The PMD_REGISTER_DRIVER is not used anymore.
- PMD_VDEV type is also not being used - can be removed from all VDEVs.
Note: PMD_REGISTER_DRIVER usage by PMDINFO tool and its documentation has
not yet been removed.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ---
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 ---
drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ---
drivers/crypto/null/null_crypto_pmd.c | 3 ---
drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ---
drivers/net/af_packet/rte_eth_af_packet.c | 3 ---
drivers/net/bonding/rte_eth_bond_pmd.c | 3 ---
drivers/net/mpipe/mpipe_tilegx.c | 6 ------
drivers/net/null/rte_eth_null.c | 3 ---
drivers/net/pcap/rte_eth_pcap.c | 3 ---
drivers/net/ring/rte_eth_ring.c | 3 ---
drivers/net/vhost/rte_eth_vhost.c | 3 ---
drivers/net/virtio/virtio_user_ethdev.c | 3 ---
drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ---
lib/librte_eal/common/include/rte_dev.h | 18 ------------------
15 files changed, 63 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index c93ebfe..fc939fa 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -515,9 +515,6 @@ aesni_gcm_uninit(const char *name)
}
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = aesni_gcm_init,
.uninit = aesni_gcm_uninit
};
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 30c0706..2047269 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -715,9 +715,6 @@ cryptodev_aesni_mb_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index ba2829d..d1b0b99 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -651,9 +651,6 @@ cryptodev_kasumi_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_kasumi_init,
.uninit = cryptodev_kasumi_uninit
};
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 4c12faa..bd139b4 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -269,9 +269,6 @@ cryptodev_null_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_null_init,
.uninit = cryptodev_null_uninit
};
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 10c6b83..c46d7e5 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -639,9 +639,6 @@ cryptodev_snow3g_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_snow3g_init,
.uninit = cryptodev_snow3g_uninit
};
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 9a9a2ee..810ec48 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -890,9 +890,6 @@ rte_pmd_af_packet_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_af_packet_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_af_packet_devinit,
.uninit = rte_pmd_af_packet_devuninit
};
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5fa2a93..1496cdf 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2509,9 +2509,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
}
static struct rte_vdev_driver bond_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = bond_init,
.uninit = bond_uninit
};
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index efb000b..9382bcf 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1624,16 +1624,10 @@ rte_pmd_mpipe_devinit(const char *ifname,
}
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit
};
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit
};
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index be4169e..e85c67e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -687,9 +687,6 @@ rte_pmd_null_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_null_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit
};
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index d6718b8..2d76a7e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1084,9 +1084,6 @@ rte_pmd_pcap_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_pcap_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit
};
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 77bd664..d687ed6 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -624,9 +624,6 @@ rte_pmd_ring_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_ring_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit
};
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index e2610b4..ae49f15 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -925,9 +925,6 @@ rte_pmd_vhost_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_vhost_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_vhost_devinit,
.uninit = rte_pmd_vhost_devuninit
};
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 7975298..7c604f9 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -463,9 +463,6 @@ virtio_user_pmd_devuninit(const char *name)
}
static struct rte_vdev_driver virtio_user_driver = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = virtio_user_pmd_devinit,
.uninit = virtio_user_pmd_devuninit
};
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 7da0f17..ea69afc 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -760,9 +760,6 @@ rte_pmd_xenvirt_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_xenvirt_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit
};
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 8796f97..3d0d2b8 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,19 +105,10 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Driver type enumeration
- */
-enum pmd_type {
- PMD_VDEV = 0,
- PMD_PDEV = 1,
-};
-
-/**
* A structure describing a device driver.
*/
struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
- enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
};
@@ -198,15 +189,6 @@ int rte_eal_dev_detach(const char *name);
static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
-#define PMD_REGISTER_DRIVER(drv, nm)\
-RTE_INIT(probefn_ ##drv);\
-static void probefn_ ##drv(void)\
-{\
- (drv).name = RTE_STR(nm);\
- rte_eal_driver_register(&drv);\
-} \
-DRIVER_EXPORT_NAME(nm, __COUNTER__)
-
#define DRV_EXP_TAG(name, tag) __##name##_##tag
#define DRIVER_REGISTER_PCI_TABLE(name, table) \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 20/25] eal: include dev headers in place of PCI headers
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (18 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 19/25] eal: remove unused PMD types Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 21/25] eal: rename and move RTE PCI Resources Shreyansh Jain
` (5 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Further refactoring and generalization of PCI infrastructure will
require access to the rte_dev.h contents.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_pci.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index e1f695f..bb03d41 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -84,6 +84,7 @@ extern "C" {
#include <rte_debug.h>
#include <rte_interrupts.h>
+#include <rte_dev.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 21/25] eal: rename and move RTE PCI Resources
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (19 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 20/25] eal: include dev headers in place of PCI headers Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 22/25] eal/pci: inherit RTE driver in PCI driver Shreyansh Jain
` (4 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/net/szedata2/rte_eth_szedata2.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 8 ++++++++
lib/librte_eal/common/include/rte_pci.h | 12 ++----------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index bbf97a2..ad5f74c 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1416,7 +1416,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
int ret;
uint32_t szedata2_index;
struct rte_pci_addr *pci_addr = &dev->pci_dev->addr;
- struct rte_pci_resource *pci_rsc =
+ struct rte_mem_resource *pci_rsc =
&dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER];
char rsc_filename[PATH_MAX];
void *pci_resource_ptr = NULL;
@@ -1473,7 +1473,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, dev->pci_dev);
- /* mmap pci resource0 file to rte_pci_resource structure */
+ /* mmap pci resource0 file to rte_mem_resource structure */
if (dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].phys_addr ==
0) {
RTE_LOG(ERR, PMD, "Missing resource%u file\n",
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 3d0d2b8..5c314bf 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -100,6 +100,14 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
} \
} while (0)
+/**
+ * A generic memory resource representation.
+ */
+struct rte_mem_resource {
+ uint64_t phys_addr; /**< Physical address, 0 if not resource. */
+ uint64_t len; /**< Length of the resource. */
+ void *addr; /**< Virtual address, NULL when not mapped. */
+};
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index bb03d41..67f6ee7 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -108,15 +108,6 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
-/**
- * A structure describing a PCI resource.
- */
-struct rte_pci_resource {
- uint64_t phys_addr; /**< Physical address, 0 if no resource. */
- uint64_t len; /**< Length of the resource. */
- void *addr; /**< Virtual address, NULL when not mapped. */
-};
-
/** Maximum number of PCI resources. */
#define PCI_MAX_RESOURCE 6
@@ -160,7 +151,8 @@ struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
- struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
+ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+ /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 22/25] eal/pci: inherit RTE driver in PCI driver
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (20 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 21/25] eal: rename and move RTE PCI Resources Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 23/25] eal: register EAL drivers explicitly Shreyansh Jain
` (3 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Remove the 'name' member from rte_pci_driver and move to generic
rte_driver.
Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has
been populated into the rte_driver.name member - assignments through
eth_driver has been removed.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Rebase and expand changes to newly added files]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/test_pci.c | 10 +++++++---
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
drivers/net/bnx2x/bnx2x_rxtx.c | 3 ++-
drivers/net/bnxt/bnxt_ethdev.c | 1 -
drivers/net/cxgbe/cxgbe_ethdev.c | 1 -
drivers/net/cxgbe/sge.c | 7 ++++---
drivers/net/e1000/em_ethdev.c | 1 -
drivers/net/e1000/igb_ethdev.c | 2 --
drivers/net/ena/ena_ethdev.c | 1 -
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/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 2 --
drivers/net/mlx4/mlx4.c | 4 +++-
drivers/net/mlx5/mlx5.c | 4 +++-
drivers/net/nfp/nfp_net.c | 5 ++---
drivers/net/qede/qede_ethdev.c | 2 --
drivers/net/szedata2/rte_eth_szedata2.c | 1 -
drivers/net/thunderx/nicvf_ethdev.c | 1 -
drivers/net/virtio/virtio_ethdev.c | 3 +--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 ++--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 4 ++--
lib/librte_eal/common/eal_common_pci.c | 4 ++--
lib/librte_eal/common/include/rte_pci.h | 4 ++--
lib/librte_ether/rte_ethdev.c | 6 +++---
30 files changed, 37 insertions(+), 47 deletions(-)
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index f1b988a..cda186d 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -78,14 +78,18 @@ struct rte_pci_id my_driver_id2[] = {
};
struct rte_pci_driver my_driver = {
- .name = "test_driver",
+ .driver = {
+ .name = "test_driver"
+ },
.probe = my_driver_init,
.id_table = my_driver_id,
.drv_flags = 0,
};
struct rte_pci_driver my_driver2 = {
- .name = "test_driver2",
+ .driver = {
+ .name = "test_driver2"
+ },
.probe = my_driver_init,
.id_table = my_driver_id2,
.drv_flags = 0,
@@ -95,7 +99,7 @@ static int
my_driver_init(__attribute__((unused)) struct rte_pci_driver *dr,
struct rte_pci_device *dev)
{
- printf("My driver init called in %s\n", dr->name);
+ printf("My driver init called in %s\n", dr->driver.name);
printf("%x:%x:%x.%d", dev->addr.domain, dev->addr.bus,
dev->addr.devid, dev->addr.function);
printf(" - vendor:%x device:%x\n", dev->id.vendor_id, dev->id.device_id);
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 8a1f0d0..56eeb99 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -586,7 +586,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
pci_dev->numa_node = socket_id;
- pci_drv->name = virtual_ethdev_driver_name;
+ pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
if (isr_support)
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index 5de47e3..2e7188b 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -300,7 +300,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
* Allocate a memzone for the queue - create a unique name.
*/
snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d",
- dev->driver->pci_drv.name, "qp_mem", dev->data->dev_id,
+ dev->driver->pci_drv.driver.name, "qp_mem", dev->data->dev_id,
queue->hw_bundle_number, queue->hw_queue_number);
qp_mz = queue_dma_zone_reserve(queue->memz_name, queue_size_bytes,
socket_id);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 4bd5142..a576ef6 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -618,7 +618,6 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_bnx2x_pmd = {
.pci_drv = {
- .name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.probe = rte_eth_dev_pci_probe,
@@ -633,7 +632,6 @@ static struct eth_driver rte_bnx2x_pmd = {
*/
static struct eth_driver rte_bnx2xvf_pmd = {
.pci_drv = {
- .name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 0ec4f89..7adea99 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -19,7 +19,8 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name, dev->data->port_id, queue_id);
+ dev->driver->pci_drv.driver.name, ring_name,
+ dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
if (mz)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e19868f..249a8f9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1045,7 +1045,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
static struct eth_driver bnxt_rte_pmd = {
.pci_drv = {
- .name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 871103f..0bf4def 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1039,7 +1039,6 @@ out_free_adapter:
static struct eth_driver rte_cxgbe_pmd = {
.pci_drv = {
- .name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index ab5a842..736f08c 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1645,7 +1645,8 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
iq->size = cxgbe_roundup(iq->size, 16);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, fwevtq ? "fwq_ring" : "rx_ring",
+ eth_dev->driver->pci_drv.driver.name,
+ fwevtq ? "fwq_ring" : "rx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1697,7 +1698,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
fl->size = cxgbe_roundup(fl->size, 8);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
fwevtq ? "fwq_ring" : "fl_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1893,7 +1894,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, "tx_ring",
+ eth_dev->driver->pci_drv.driver.name, "tx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 5761c3c..dd4682c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -391,7 +391,6 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_em_pmd = {
.pci_drv = {
- .name = "rte_em_pmd",
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 951f14c..a7c110b 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1078,7 +1078,6 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_igb_pmd = {
.pci_drv = {
- .name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1095,7 +1094,6 @@ static struct eth_driver rte_igb_pmd = {
*/
static struct eth_driver rte_igbvf_pmd = {
.pci_drv = {
- .name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index abc5235..30849a1 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1686,7 +1686,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
static struct eth_driver rte_ena_pmd = {
.pci_drv = {
- .name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 69959c7..0141f33 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -613,7 +613,6 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_enic_pmd = {
.pci_drv = {
- .name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 985cd69..c6b5acd 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3055,7 +3055,6 @@ static const struct rte_pci_id pci_id_fm10k_map[] = {
static struct eth_driver rte_pmd_fm10k = {
.pci_drv = {
- .name = "rte_pmd_fm10k",
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d9e5988..4dfc92a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -663,7 +663,6 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
static struct eth_driver rte_i40e_pmd = {
.pci_drv = {
- .name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 0852472..7d863b3 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1554,7 +1554,6 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
*/
static struct eth_driver rte_i40evf_pmd = {
.pci_drv = {
- .name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index f65c411..a4efc6d 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -251,7 +251,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
/* reserve memory for the fdir programming packet */
snprintf(z_name, sizeof(z_name), "%s_%s_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
I40E_FDIR_MZ_NAME,
eth_dev->data->port_id);
mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN, SOCKET_ID_ANY);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 406302e..ae12adc 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1562,7 +1562,6 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_ixgbe_pmd = {
.pci_drv = {
- .name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1579,7 +1578,6 @@ static struct eth_driver rte_ixgbe_pmd = {
*/
static struct eth_driver rte_ixgbevf_pmd = {
.pci_drv = {
- .name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 172ff86..dcc4266 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5911,7 +5911,9 @@ static const struct rte_pci_id mlx4_pci_id_map[] = {
static struct eth_driver mlx4_driver = {
.pci_drv = {
- .name = MLX4_DRIVER_NAME,
+ .driver = {
+ .name = MLX4_DRIVER_NAME
+ },
.id_table = mlx4_pci_id_map,
.probe = mlx4_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index f1bc7a1..063f1d0 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -728,7 +728,9 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
static struct eth_driver mlx5_driver = {
.pci_drv = {
- .name = MLX5_DRIVER_NAME,
+ .driver = {
+ .name = MLX5_DRIVER_NAME
+ },
.id_table = mlx5_pci_id_map,
.probe = mlx5_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index bc1f8a1..f883a46 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -214,7 +214,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name,
+ dev->driver->pci_drv.driver.name,
ring_name, dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -1000,7 +1000,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->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
@@ -2460,7 +2460,6 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
static struct eth_driver rte_nfp_net_pmd = {
.pci_drv = {
- .name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 3403524..b74fc28 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1478,7 +1478,6 @@ static struct rte_pci_id pci_id_qede_map[] = {
static struct eth_driver rte_qedevf_pmd = {
.pci_drv = {
- .name = "rte_qedevf_pmd",
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
@@ -1492,7 +1491,6 @@ static struct eth_driver rte_qedevf_pmd = {
static struct eth_driver rte_qede_pmd = {
.pci_drv = {
- .name = "rte_qede_pmd",
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index ad5f74c..753004f 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1572,7 +1572,6 @@ static const struct rte_pci_id rte_szedata2_pci_id_table[] = {
static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
- .name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
.probe = rte_eth_dev_pci_probe,
.remove = rte_eth_dev_pci_remove,
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index ffe305c..2a999a9 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1759,7 +1759,6 @@ static const struct rte_pci_id pci_id_nicvf_map[] = {
static struct eth_driver rte_nicvf_pmd = {
.pci_drv = {
- .name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 0ff8724..2934bd4 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1304,7 +1304,6 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_virtio_pmd = {
.pci_drv = {
- .name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
@@ -1534,7 +1533,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct virtio_hw *hw = dev->data->dev_private;
if (dev->pci_dev)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
else
dev_info->driver_name = "virtio_user PMD";
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index cec95c4..93df3db 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -137,7 +137,8 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%d_%s",
- dev->driver->pci_drv.name, dev->data->port_id, post_string);
+ dev->driver->pci_drv.driver.name,
+ dev->data->port_id, post_string);
mz = rte_memzone_lookup(z_name);
if (mz)
@@ -328,7 +329,6 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_vmxnet3_pmd = {
.pci_drv = {
- .name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index 9deeb3f..e6d93f3 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -774,7 +774,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index c81e366..2e17169 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -459,7 +459,7 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_drv->name,
+ " failed", pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
@@ -870,7 +870,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
dev_info->pci_dev = dev->pci_dev;
if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
}
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index bef7ee8..79f5526 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -195,7 +195,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
RTE_LOG(INFO, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
/* map resources for devices that use igb_uio */
@@ -255,7 +255,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
loc->function, dev->numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->remove && (dr->remove(dev) < 0))
return -1; /* negative value is an error */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 67f6ee7..f0a9ea2 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -200,7 +200,7 @@ typedef int (pci_remove_t)(struct rte_pci_device *);
*/
struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
- const char *name; /**< Driver name. */
+ struct rte_driver driver; /**< Inherit core driver. */
pci_probe_t *probe; /**< Device Probe function. */
pci_remove_t *remove; /**< Device Remove function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
@@ -492,7 +492,7 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);
RTE_INIT(pciinitfn_ ##nm); \
static void pciinitfn_ ##nm(void) \
{\
- (pci_drv).name = RTE_STR(nm);\
+ (pci_drv).driver.name = RTE_STR(nm);\
rte_eal_pci_register(&pci_drv); \
} \
DRIVER_EXPORT_NAME(nm, __COUNTER__)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 6acd1c7..3b9917e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -276,7 +276,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
- pci_drv->name,
+ pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
@@ -2569,7 +2569,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -3211,7 +3211,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->kdrv = pci_dev->kdrv;
eth_dev->data->numa_node = pci_dev->numa_node;
- eth_dev->data->drv_name = pci_dev->driver->name;
+ eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
int
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 23/25] eal: register EAL drivers explicitly
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (21 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 22/25] eal/pci: inherit RTE driver in PCI driver Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 24/25] eal: introduce generalized RTE device Shreyansh Jain
` (2 subsequent siblings)
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
To register both vdev and pci drivers into the list of all rte_driver,
we have to call rte_eal_driver_register explicitly.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 2 ++
lib/librte_eal/common/eal_common_vdev.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 79f5526..0b032d6 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -471,11 +471,13 @@ void
rte_eal_pci_register(struct rte_pci_driver *driver)
{
TAILQ_INSERT_TAIL(&pci_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_pci_unregister(struct rte_pci_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&pci_driver_list, driver, next);
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 1a4dec6..6dab782 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -48,12 +48,14 @@ void
rte_eal_vdrv_register(struct rte_vdev_driver *driver)
{
TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&vdev_driver_list, driver, next);
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 24/25] eal: introduce generalized RTE device
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (22 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 23/25] eal: register EAL drivers explicitly Shreyansh Jain
@ 2016-09-16 4:29 ` Shreyansh Jain
2016-09-16 4:30 ` [dpdk-dev] [PATCH v10 25/25] eal/pci: create RTE device list and fallback on its members Shreyansh Jain
[not found] ` <CALwxeUusnzO9daPnHkkf5QhY6_g67f-9oDzKcrhzXj7X3Lm_kQ@mail.gmail.com>
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:29 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 13 +++++++++++++
lib/librte_eal/common/include/rte_dev.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index afa33fa..d1f0ad8 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -48,6 +48,9 @@
/** Global list of device drivers. */
static struct rte_driver_list dev_driver_list =
TAILQ_HEAD_INITIALIZER(dev_driver_list);
+/** Global list of device drivers. */
+static struct rte_device_list dev_device_list =
+ TAILQ_HEAD_INITIALIZER(dev_device_list);
/* register a driver */
void
@@ -63,6 +66,16 @@ rte_eal_driver_unregister(struct rte_driver *driver)
TAILQ_REMOVE(&dev_driver_list, driver, next);
}
+void rte_eal_device_insert(struct rte_device *dev)
+{
+ TAILQ_INSERT_TAIL(&dev_device_list, dev, next);
+}
+
+void rte_eal_device_remove(struct rte_device *dev)
+{
+ TAILQ_REMOVE(&dev_device_list, dev, next);
+}
+
int
rte_eal_dev_init(void)
{
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 5c314bf..d159991 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -111,6 +111,37 @@ struct rte_mem_resource {
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
+/** Double linked list of devices. */
+TAILQ_HEAD(rte_device_list, rte_device);
+
+/* Forward declaration */
+struct rte_driver;
+
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+ TAILQ_ENTRY(rte_device) next; /**< Next device */
+ struct rte_driver *driver; /**< Associated driver */
+ int numa_node; /**< NUMA node connection */
+ struct rte_devargs *devargs; /**< Device user arguments */
+};
+
+/**
+ * Insert a device detected by a bus scanning.
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the detected device.
+ */
+void rte_eal_device_insert(struct rte_device *dev);
+
+/**
+ * Remove a device (e.g. when being unplugged).
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the device to be removed.
+ */
+void rte_eal_device_remove(struct rte_device *dev);
/**
* A structure describing a device driver.
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v10 25/25] eal/pci: create RTE device list and fallback on its members
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
` (23 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 24/25] eal: introduce generalized RTE device Shreyansh Jain
@ 2016-09-16 4:30 ` Shreyansh Jain
[not found] ` <CALwxeUusnzO9daPnHkkf5QhY6_g67f-9oDzKcrhzXj7X3Lm_kQ@mail.gmail.com>
25 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:30 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Now that rte_device is available, drivers can start using its members
(numa, name) as well as link themselves into another rte_device list.
As of now no one is using this list, but can be used for moving over all
devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log for extra rte_device list]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 4 ++--
drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
drivers/net/i40e/i40e_ethdev.c | 6 ++++--
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/virtio/virtio_pci.c | 5 +++--
lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
lib/librte_eal/common/include/rte_pci.h | 3 +--
lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
lib/librte_ether/rte_ethdev.c | 2 +-
10 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 56eeb99..4831113 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -585,7 +585,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
if (eth_dev == NULL)
goto err;
- pci_dev->numa_node = socket_id;
+ pci_dev->device.numa_node = socket_id;
pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
@@ -626,7 +626,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
eth_dev->dev_ops = &dev_private->dev_ops;
eth_dev->pci_dev = pci_dev;
- eth_dev->pci_dev->driver = ð_drv->pci_drv;
+ eth_dev->pci_dev->device.driver = ð_drv->pci_drv.driver;
eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success;
eth_dev->tx_pkt_burst = virtual_ethdev_tx_burst_success;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c6b5acd..645b8cd 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -675,7 +675,7 @@ fm10k_dev_tx_init(struct rte_eth_dev *dev)
/* Enable use of FTAG bit in TX descriptor, PFVTCTL
* register is read-only for VF.
*/
- if (fm10k_check_ftag(dev->pci_dev->devargs)) {
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs)) {
if (hw->mac.type == fm10k_mac_pf) {
FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i),
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
@@ -2731,7 +2731,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
int use_sse = 1;
uint16_t tx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
tx_ftag_en = 1;
for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -2762,7 +2762,7 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)
uint16_t i, rx_using_sse;
uint16_t rx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
rx_ftag_en = 1;
/* In order to allow Vector Rx there are a few configuration
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4dfc92a..e8cf909 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -905,8 +905,10 @@ config_floating_veb(struct rte_eth_dev *dev)
memset(pf->floating_veb_list, 0, sizeof(pf->floating_veb_list));
if (hw->aq.fw_maj_ver >= FLOATING_VEB_SUPPORTED_FW_MAJ) {
- pf->floating_veb = is_floating_veb_supported(pci_dev->devargs);
- config_vf_floating_veb(pci_dev->devargs, pf->floating_veb,
+ pf->floating_veb =
+ is_floating_veb_supported(pci_dev->device.devargs);
+ config_vf_floating_veb(pci_dev->device.devargs,
+ pf->floating_veb,
pf->floating_veb_list);
} else {
pf->floating_veb = false;
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 063f1d0..68bdc46 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -511,7 +511,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
priv->mtu = ETHER_MTU;
priv->mps = mps; /* Enable MPW by default if supported. */
priv->cqe_comp = 1; /* Enable compression by default. */
- err = mlx5_args(priv, pci_dev->devargs);
+ err = mlx5_args(priv, pci_dev->device.devargs);
if (err) {
ERROR("failed to process device arguments: %s",
strerror(err));
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index f1a7ca7..9b47165 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -745,8 +745,9 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
- (!dev->devargs ||
- dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
+ (!dev->device.devargs ||
+ dev->device.devargs->type !=
+ RTE_DEVTYPE_WHITELISTED_PCI)) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
return 1;
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 1d91c78..8b3ed88 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -287,7 +287,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
dev->max_vfs = 0;
/* FreeBSD has no NUMA support (yet) */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
/* FreeBSD has only one pass through driver */
dev->kdrv = RTE_KDRV_NIC_UIO;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 0b032d6..609c424 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -185,11 +185,12 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
RTE_LOG(INFO, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid, loc->function,
- dev->numa_node);
+ dev->device.numa_node);
/* no initialization when blacklisted, return without error */
- if (dev->devargs != NULL &&
- dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
+ if (dev->device.devargs != NULL &&
+ dev->device.devargs->type ==
+ RTE_DEVTYPE_BLACKLISTED_PCI) {
RTE_LOG(INFO, EAL, " Device is blacklisted, not initializing\n");
return 1;
}
@@ -252,7 +253,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid,
- loc->function, dev->numa_node);
+ loc->function, dev->device.numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->driver.name);
@@ -418,7 +419,7 @@ rte_eal_pci_probe(void)
/* set devargs in PCI structure */
devargs = pci_devargs_lookup(dev);
if (devargs != NULL)
- dev->devargs = devargs;
+ dev->device.devargs = devargs;
/* probe all or only whitelisted devices */
if (probe_all)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index f0a9ea2..3a8e8c8 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -149,6 +149,7 @@ enum rte_kernel_driver {
*/
struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
+ struct rte_device device; /**< Inherit core device */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
@@ -156,8 +157,6 @@ struct rte_pci_device {
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
- int numa_node; /**< NUMA node connection */
- struct rte_devargs *devargs; /**< Device user arguments */
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
};
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 62da4d4..876ba38 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -350,13 +350,13 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
dirname);
if (access(filename, R_OK) != 0) {
/* if no NUMA support, set default to 0 */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
} else {
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
free(dev);
return -1;
}
- dev->numa_node = tmp;
+ dev->device.numa_node = tmp;
}
/* parse resources */
@@ -390,6 +390,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
/* device is valid, add in list (sorted) */
if (TAILQ_EMPTY(&pci_device_list)) {
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
} else {
struct rte_pci_device *dev2;
@@ -402,6 +403,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
if (ret < 0) {
TAILQ_INSERT_BEFORE(dev2, dev, next);
+ rte_eal_device_insert(&dev->device);
} else { /* already registered */
dev2->kdrv = dev->kdrv;
dev2->max_vfs = dev->max_vfs;
@@ -411,6 +413,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
return 0;
}
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 3b9917e..fd0fcc5 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3210,7 +3210,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = pci_dev->kdrv;
- eth_dev->data->numa_node = pci_dev->numa_node;
+ eth_dev->data->numa_node = pci_dev->device.numa_node;
eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 22/25] eal/pci: inherit rte_driver by rte_pci_driver
2016-09-08 14:25 ` Ferruh Yigit
@ 2016-09-16 4:47 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:47 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: hemant.agrawal, Jan Viktorin
On Thursday 08 September 2016 07:55 PM, Ferruh Yigit wrote:
> On 9/7/2016 3:08 PM, Shreyansh Jain wrote:
>> Remove the 'name' member from rte_pci_driver and move to generic rte_driver.
>>
>> Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
>> as well as assigning a name to eth_driver.pci_drv.name member.
>> In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has been
>> populated into the rte_driver.name member - assignments through eth_driver
>> has been removed.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> ....
>
>> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> index c0bd391..b8bfd4b 100644
>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> @@ -172,4 +172,7 @@ DPDK_16.11 {
>>
>> rte_eal_dev_attach;
>> rte_eal_dev_detach;
>> + rte_eal_vdrv_register;
>> + rte_eal_vdrv_unregister;
>> +
>> } DPDK_16.07;
>
> This needs to be part of patch 15, where these functions implemented.
>
> Missing these in .map files cause patch 17,18,19,20,21 fail to compile
> for shared lib config.
>
Updated the map file in Patch 16 of v10 posted. Thanks for comment.
--
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v9 08/25] drivers: convert all pdev drivers as pci drivers
2016-09-12 7:16 ` David Marchand
@ 2016-09-16 4:49 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-16 4:49 UTC (permalink / raw)
To: David Marchand; +Cc: dev, hemant.agrawal
Hi David,
On Monday 12 September 2016 12:46 PM, David Marchand wrote:
> On Wed, Sep 7, 2016 at 4:08 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>> Simplify crypto and ethdev pci drivers init by using newly introduced
>> init macros and helpers.
>> Those drivers then don't need to register as "rte_driver"s anymore.
>>
>> Exceptions:
>> - virtio and mlx* use RTE_INIT directly as they have custom initialization
>> steps.
>
> Afaics, we are missing some DRIVER_EXPORT_NAME for those.
I have updated this in v10 based on the patches you sent me.
>
>> - VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v10 02/25] eal: remove duplicate function declaration
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 02/25] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-09-16 11:42 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-09-16 11:42 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, David Marchand, hemant.agrawal, Thomas Monjalon
On Fri, 16 Sep 2016 09:59:37 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> From: David Marchand <david.marchand@6wind.com>
>
> rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
> introduction.
> This function has been exported in ABI, so remove it from eal_private.h
>
> Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v10 05/25] crypto: no need for a crypto pmd type
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 05/25] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-09-16 11:49 ` Jan Viktorin
0 siblings, 0 replies; 375+ messages in thread
From: Jan Viktorin @ 2016-09-16 11:49 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, David Marchand, hemant.agrawal, Thomas Monjalon
On Fri, 16 Sep 2016 09:59:40 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> From: David Marchand <david.marchand@6wind.com>
>
> This information is not used and just adds noise.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v10 00/25] Introducing rte_driver/rte_device generalization
[not found] ` <CALwxeUusnzO9daPnHkkf5QhY6_g67f-9oDzKcrhzXj7X3Lm_kQ@mail.gmail.com>
@ 2016-09-16 14:29 ` David Marchand
2016-09-17 18:50 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-09-16 14:29 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: Thomas Monjalon, Jan Viktorin, dev
Sorry dropped the ml.
On Fri, Sep 16, 2016 at 4:21 PM, David Marchand
<david.marchand@6wind.com> wrote:
> Commenting in the cover letter because these are details and it is
> easier to track down what is missing before push for Thomas.
>
>
>> driver: init/uninit common wrappers for PCI drivers
>
> In this patch subject, init/uninit -> prove/remove.
>
>
>> eal: define container macro
>
> This patch is fine, but not used in the patchset. I would postpone it
> until we actually need it.
>
>
>> eal: extract vdev infra
>
> This patch commit log tells that the vdev register macro does not call
> DRIVER_EXPORT_NAME while it actually does so.
>
>
>> eal: remove unused PMD types
>
> This patch commit log has some outdated note about pmdinfo.
>
> We still have a reference about PMD_REGISTER_DRIVER in the
> documentation that could be replaced with a note on
> DRIVER_REGISTER_PCI()
> But I would do this in "drivers: convert all phy drivers as PCI drivers".
>
>
>> eal/pci: replace PCI devinit/devuninit with probe/remove
>
> This patch only replaces the init/uninit methods with prove/remove for pci.
> I would generalise this to vdev as well.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v10 00/25] Introducing rte_driver/rte_device generalization
[not found] ` <CALwxeUusnzO9daPnHkkf5QhY6_g67f-9oDzKcrhzXj7X3Lm_kQ@mail.gmail.com>
2016-09-16 14:29 ` [dpdk-dev] [PATCH v10 00/25] Introducing rte_driver/rte_device generalization David Marchand
@ 2016-09-17 18:50 ` Shreyansh Jain
1 sibling, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-17 18:50 UTC (permalink / raw)
To: David Marchand; +Cc: Thomas Monjalon, Jan Viktorin, dev
Hi David,
> -----Original Message-----
> From: David Marchand [mailto:david.marchand@6wind.com]
> Sent: Friday, September 16, 2016 7:52 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>; Thomas Monjalon
> <thomas.monjalon@6wind.com>; Jan Viktorin <viktorin@rehivetech.com>
> Subject: Re: [PATCH v10 00/25] Introducing rte_driver/rte_device
> generalization
>
> Commenting in the cover letter because these are details and it is
> easier to track down what is missing before push for Thomas.
OK.
Should I still wait for more patch level comments before releasing v11?
>
>
> > driver: init/uninit common wrappers for PCI drivers
>
> In this patch subject, init/uninit -> prove/remove.
Ok. I will do this.
>
>
> > eal: define container macro
>
> This patch is fine, but not used in the patchset. I would postpone it
> until we actually need it.
I introduced this based on the merging of Jan's series and subsequent use in SoC framework series. But, yes, it is not being used in this series.
I will remove it.
>
>
> > eal: extract vdev infra
>
> This patch commit log tells that the vdev register macro does not call
> DRIVER_EXPORT_NAME while it actually does so.
Yes, I updated the patch based on your suggestion but didn't notice that I had put a counter notice about this in commit log in v9. I will remove this.
>
>
> > eal: remove unused PMD types
>
> This patch commit log has some outdated note about pmdinfo.
Well, this patch didn't update the documentation and I was not sure if the only change for PMD Info tool is in the mk file as per your patch.
I will change the suggested patch and add documentation related note in the commit log.
>
> We still have a reference about PMD_REGISTER_DRIVER in the
> documentation that could be replaced with a note on
> DRIVER_REGISTER_PCI()
Are you suggesting in the code as a comment? If so, I don't think that is good idea.
> But I would do this in "drivers: convert all phy drivers as PCI drivers".
If I have to update, I will use the above patch.
>
>
> > eal/pci: replace PCI devinit/devuninit with probe/remove
>
> This patch only replaces the init/uninit methods with prove/remove for pci.
> I would generalise this to vdev as well.
That is because I didn't like using 'probe/remove' for VDEV. The semantic of probing is not really correct for a virtual device. We 'add' and initialize the virtual device actually.
If you and other still feel that making it analogous with PCI probe/remove, I will update it.
>
>
> --
> David Marchand
Thanks a lot for your time and comments.
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
` (23 preceding siblings ...)
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 01/24] eal: remove duplicate function declaration Shreyansh Jain
` (26 more replies)
24 siblings, 27 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
Based on master (e15922d75)
Background:
===========
It includes two different patch-sets floated on ML earlier:
* Original patch series is from David Marchand [1], [2].
`- This focused mainly on PCI (PDEV) part
`- v7 of this was posted by me [8] in August/2016
* Patch series [4] from Jan Viktorin
`- This focused on VDEV and rte_device integration
Introduction:
=============
This patch series introduces a generic device model, moving away from PCI
centric code layout. Key change is to introduce rte_driver/rte_device
structures at the top level which are inherited by
rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
future),...}.
Key motivation for this series is to move away from PCI centric design of
EAL to a more hierarchical device model - pivoted around a generic driver
and device. Each specific driver and device can inherit the common
properties of the generic set and build upon it through driver/device
specific functions.
Earlier, the EAL device initialization model was:
(Refer: [3])
--
Constructor:
|- PMD_DRIVER_REGISTER(rte_driver)
`- insert into dev_driver_list, rte_driver object
rte_eal_init():
|- rte_eal_pci_init()
| `- scan and fill pci_device_list from sysfs
|
|- rte_eal_dev_init()
| `- For each rte_driver in dev_driver_list
| `- call the rte_driver->init() function
| |- PMDs designed to call rte_eth_driver_register(eth_driver)
| |- eth_driver have rte_pci_driver embedded in them
| `- rte_eth_driver_register installs the
| rte_pci_driver->devinit/devuninit callbacks.
|
|- rte_eal_pci_probe()
| |- For each device detected, dev_driver_list is parsed and matching is
| | done.
| |- For each matching device, the rte_pci_driver->devinit() is called.
| |- Default map is to rte_eth_dev_init() which in turn creates a
| | new ethernet device (eth_dev)
| | `- eth_drv->eth_dev_init() is called which is implemented by
`--| individual PMD drivers.
--
The structure of driver looks something like:
+------------+ ._____.
| rte_driver <-----| PMD |___
| .init | `-----` \
+----.-------+ | \
`-. | What PMD actually is
\ | |
+----------v----+ |
| eth_driver | |
| .eth_dev_init | |
+----.----------+ |
`-. |
\ |
+------------v---+
| rte_pci_driver |
| .pci_devinit |
+----------------+
and all devices are part of a following linked lists:
- dev_driver_list for all rte_drivers
- pci_device_list for all devices, whether PCI or VDEV
>From the above:
* a PMD initializes a rte_driver, eth_driver even though actually it is a
pci_driver
* initialization routines are passed from rte_driver->pci_driver->eth_driver
even though they should ideally be rte_eal_init()->rte_pci_driver()
* For a single driver/device type model, this is not necessarily a
functional issue - but more of a design language.
* But, when number of driver/device type increase, this would create
problem in how driver<=>device links are represented.
Proposed Architecture:
======================
A nice representation has already been created by David in [3]. Copying that
here:
+------------------+ +-------------------------------+
| | | |
| rte_pci_device | | rte_pci_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
+-------------------------------+
- for ethdev on top of vdev devices
+------------------+ +-------------------------------+
| | | |
| drv specific | | rte_vdev_driver |
| | | |
+-------------+ | +--------------+ | | +---------------------------+ |
| | | | | | | | | |
| rte_eth_dev +---> rte_device +-----> rte_driver | |
| | | | char name[] | | | | char name[] | |
+-------------+ | | | | | | int init(rte_device *) | |
| +--------------+ | | | int uninit(rte_device *) | |
| | | | | |
+------------------+ | +---------------------------+ |
| |
| int priv_size |
| |
+-------------------------------+
Representing from above, it would be:
+--------------+
| rte_driver |
| name |
| <Future> |
+------^-------+ pci_driver_list
| / vdev_driver_list
`---. <<Inherits>> / /
|\____________/_______ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_driver | | rte_vdev_driver |
| pci_probe() | | vdev_devinit() |
| pci_remove() | | vdev_devuninit()|
| <more> | | <more> |
+-----------------+ +------------------+
+--------------+
| rte_device |
| name |
| <Future> |
+------^-------+ pci_device_list
| / xxx_device_list
`---. <<Inherits>> / /
|\____________/________ /
| / \ /
+-----------/-----+ +--------/---------+
| rte_pci_device | | rte_xxx_device |
| <dev data> | | <dev data> |
| <flags/intr> | | <flags/intr> |
| <more> | | <more> |
+-----------------+ +------------------+
* Each driver type has its own structure which derives from the generic
rte_driver structure.
\- Each driver type maintains its own list, at the same time, rte_driver
list also exists - so that *all* drivers can be looped on, if required.
* Each device, associated with one or more drivers, has its own type
derived from rte_device
\- Each device _may_ maintain its own list (for example, in current
implementation, vdev is not maintaining it).
==Introducing a new device/driver type implies==
- creating their own rte_<xxx>.h file which contains the device/driver
definitions.
- defining the DRIVER_REGISTER_XXX helpers
==Hotplugging Support==
- devices should be able to support attach/detach operations.
- Earlier these functions were part of ethdev. They have been moved to eal
to be more generic.
This patch is part of larger aim to:
--------------------+ <is type of>
eth_driver (PMD) |-------------> rte_driver
crypto_driver (PMD) | ^
<more in future> | |
--------------------+ | <inherits>
/
+-----------------------/+
| rte_pci_driver |
| rte_vdev_driver |
| rte_soc_driver |
| rte_xxx_driver |
Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
drivers rather than explicitly inheriting type specific driver (PCI, etc).
About the Patches:
==================
There are a large number of patches for this - primarily because the changes
are quite varied and keeping them logically separate yet compilable is
important. Most of the patches are small and those which are large touch the
drivers (PMDs) to accommodate the structure changes:
- Patches 0001~0002 are for introducing the container_of function (so that
rte_device can be obtained from rte_pci_device, for example), and
removing unused code.
- Patch 0003 converts the PCI devinit/devuninit method names to probe/
remove and correspondingly updates all drivers where impact it. VDEV
based init/uninit have not been modified.
- Patches 0004~0007 just perform the ground work for enabling change from
rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
- In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
including cryptodev, which is eventually generalized with PCI)
- Patch 0009~0011 merge the crypto and pci functions for registration and
naming.
- Patches 0011~0013 deal with hotplugging - hotplug no more invokes scan of
complete bus and has been generalized into EAl from ethdev.
- Patches 0014 introduces vdev init/uninit into separate C units and
enables its compilation. Patch 0016~0017 build on it and remove the
remaining legacy support for vdev/pdev distinctions.
- Patches 0017~0021 enable the vdev drivers to register using the
DRIVER_REGISTER_* operations, and remove their rte_driver->init()
- Patch 0022 enables the rte_driver registration into a common driver
linked list.
- Patche 0024 introduce the rte_device, a generalization of
rte_xxx_device, and associated operation of creating rte_device linked
list. It also enables the drivers to use rte_device.name/numa_node
members rather than rte_xxx_device specific members.
Future Work/Pending:
===================
- Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
rte_device model. eth_driver still is a PCI specific entity. This
has been highlighted by comments from Ferruh in [9].
- Some variables, like drv_name (as highlighted by Ferruh), are getting
duplicated across rte_xxx_driver/device and rte_driver/device.
References:
===========
[1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
[2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
[3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
[4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
[5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
[6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
[7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
[8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
[9] http://dpdk.org/ml/archives/dev/2016-August/045947.html
[10] http://dpdk.org/ml/archives/dev/2016-September/046919.html
Following are Some Review comments:
[R1] http://dpdk.org/ml/archives/dev/2016-September/046548.html
[R2] http://dpdk.org/ml/archives/dev/2016-September/046549.html
[R3] http://dpdk.org/ml/archives/dev/2016-September/046550.html
[R4] http://dpdk.org/ml/archives/dev/2016-September/046551.html
[R5] http://dpdk.org/ml/archives/dev/2016-September/046399.html
[R6] http://dpdk.org/ml/archives/dev/2016-September/046552.html
Changes since v10:
- Rebased over master (e15922d75)
- Removed patch for container_of posted in v10 (01/25)
- Fix review comments from David: [10]
Changes since v9:
- Rebased over master (58efd680d5e)
- Fix issues reported by checkpatch and check-git-log, including changing
headline of the patches to adhere to these scripts.
- Corrected the patch author field
- Renamed devinit/devuninit for pci_driver to probe/remove as per
suggestion from David
- Fix for PMD Info gen tool using patch from David
- Fixed review comments [R1], some part of [R2], [R3] using patch from
David, [R4], [R5] and some inputs from [R6].
Changes since v8:
- Some review comments from Ferruh Yigit & Reshma Pattan have been fixed.
= Though changes in mlx4/mlx5/szedata2 have been done, I am still unable
to verify those in absence of a proper environment at my end.
= Comment from Ferruh for eth_driver, drv_name are not fixed yet.
- Added a 'Future work' section in Covering letter
Changes since v7:
- Rebase over master (e22856313fff2)
- Merge the patch series by David [1][2] and Jan [4] into a single set
hereafter, PCI and VDEV, both are re-factored for rte_device/driver
model
Changes since v6:
- rebase over 16.07 (b0a1419)
- DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
- review comments regarding missing information in log messages
- new API additions to 16.11 map objects
- review comment in [5] and [7] are not included in this series.
Changes since v5:
- Rebase over master (11c5e45d8)
- Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be
in sync with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can
be merged]
- Modifications to bnxt and thunderx driver PMD registration files for
using the simplified PCI device registration helper macro
Changes since v4:
- Fix compilation issue after rebase on HEAD (913154e) in previous series
- Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port
which were removed by previous patchset. These are being used by pdump
library
Changes since v3:
- rebase over HEAD (913154e)
- Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
- modify qede driver to use RTE_EAL_PCI_REGISTER
- Argument check in hotplug functions
Changes since v2:
- rebase over HEAD (d76c193)
- Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
Changes since v1:
- rebased on HEAD, new drivers should be okay
- patches have been split into smaller pieces
- RTE_INIT macro has been added, but in the end, I am not sure it is useful
- device type has been removed from ethdev, as it was used only by hotplug
- getting rid of pmd type in eal patch (patch 5 of initial series) has been
dropped for now, we can do this once vdev drivers have been converted
David Marchand (13):
eal: remove duplicate function declaration
pci: no need for dynamic tailq init
crypto: no need for a crypto pmd type
drivers: align PCI driver definitions
eal: introduce PCI device init macros
driver: probe/remove common wrappers for PCI drivers
drivers: convert all phy drivers as PCI drivers
drivers: remove driver register callbacks for crypto/net
eal/pci: helpers for device name parsing/update
ethdev: do not scan all PCI devices on attach
eal: add hotplug operations for PCI and VDEV
ethdev: convert to EAL hotplug
ethdev: get rid of device type
Jan Viktorin (10):
eal: extract vdev infra
eal: remove PDEV/VDEV unused code
drivers: convert VDRV to use RTE VDEV Driver
eal: remove unused PMD types
eal: include dev headers in place of PCI headers
eal: rename and move RTE PCI Resources
eal/pci: inherit RTE driver in PCI driver
eal: register EAL drivers explicitly
eal: introduce generalized RTE device
eal/pci: create RTE device list and fallback on its members
Shreyansh Jain (1):
eal/pci: replace PCI devinit/devuninit with probe/remove
app/test/test_pci.c | 18 +-
app/test/virtual_pmd.c | 8 +-
doc/guides/prog_guide/dev_kit_build_system.rst | 2 +-
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
drivers/crypto/null/null_crypto_pmd.c | 7 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
drivers/net/af_packet/rte_eth_af_packet.c | 9 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
drivers/net/bnx2x/bnx2x_rxtx.c | 3 +-
drivers/net/bnxt/bnxt_ethdev.c | 17 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 7 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/cxgbe/sge.c | 7 +-
drivers/net/e1000/em_ethdev.c | 17 +-
drivers/net/e1000/igb_ethdev.c | 41 +---
drivers/net/ena/ena_ethdev.c | 20 +-
drivers/net/enic/enic_ethdev.c | 24 +-
drivers/net/fm10k/fm10k_ethdev.c | 30 +--
drivers/net/i40e/i40e_ethdev.c | 31 +--
drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
drivers/net/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
drivers/net/mlx4/mlx4.c | 26 +--
drivers/net/mlx5/mlx5.c | 27 +--
drivers/net/mpipe/mpipe_tilegx.c | 14 +-
drivers/net/nfp/nfp_net.c | 28 +--
drivers/net/null/rte_eth_null.c | 9 +-
drivers/net/pcap/rte_eth_pcap.c | 9 +-
drivers/net/qede/qede_ethdev.c | 42 +---
drivers/net/ring/rte_eth_ring.c | 9 +-
drivers/net/szedata2/rte_eth_szedata2.c | 29 +--
drivers/net/thunderx/nicvf_ethdev.c | 21 +-
drivers/net/vhost/rte_eth_vhost.c | 9 +-
drivers/net/virtio/virtio_ethdev.c | 29 +--
drivers/net/virtio/virtio_pci.c | 5 +-
drivers/net/virtio/virtio_user_ethdev.c | 8 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 9 +-
examples/ip_pipeline/init.c | 22 --
lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
lib/librte_cryptodev/rte_cryptodev.h | 2 -
lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 10 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 95 ++++----
lib/librte_eal/common/eal_common_pci.c | 51 +++--
lib/librte_eal/common/eal_common_vdev.c | 108 +++++++++
lib/librte_eal/common/eal_private.h | 20 +-
lib/librte_eal/common/include/rte_dev.h | 77 +++++--
lib/librte_eal/common/include/rte_eal.h | 3 +
lib/librte_eal/common/include/rte_pci.h | 62 ++++--
lib/librte_eal/common/include/rte_tailq.h | 4 +-
lib/librte_eal/common/include/rte_vdev.h | 97 ++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
lib/librte_eal/linuxapp/eal/eal.c | 1 +
lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
lib/librte_ether/rte_ethdev.c | 279 +++++-------------------
lib/librte_ether/rte_ethdev.h | 40 ++--
lib/librte_ether/rte_ether_version.map | 10 +-
mk/internal/rte.compile-pre.mk | 2 +-
71 files changed, 795 insertions(+), 1036 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 01/24] eal: remove duplicate function declaration
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 02/24] pci: no need for dynamic tailq init Shreyansh Jain
` (25 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_eal/common/eal_private.h | 7 -------
lib/librte_eal/linuxapp/eal/eal.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 19f7535..ca1aec6 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -237,13 +237,6 @@ int rte_eal_intr_init(void);
int rte_eal_alarm_init(void);
/**
- * This function initialises any virtual devices
- *
- * This function is private to the EAL.
- */
-int rte_eal_dev_init(void);
-
-/**
* Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
* etc.) loaded.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d5b81a3..9412983 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -70,6 +70,7 @@
#include <rte_cpuflags.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
+#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_common.h>
#include <rte_version.h>
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 02/24] pci: no need for dynamic tailq init
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 01/24] eal: remove duplicate function declaration Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 03/24] eal/pci: replace PCI devinit/devuninit with probe/remove Shreyansh Jain
` (24 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ---
lib/librte_eal/common/eal_common_pci.c | 6 ++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 3 ---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 374b68f..a73cbb0 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -623,9 +623,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 7248c38..6a0f6ac 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -82,8 +82,10 @@
#include "eal_private.h"
-struct pci_driver_list pci_driver_list;
-struct pci_device_list pci_device_list;
+struct pci_driver_list pci_driver_list =
+ TAILQ_HEAD_INITIALIZER(pci_driver_list);
+struct pci_device_list pci_device_list =
+ TAILQ_HEAD_INITIALIZER(pci_device_list);
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index cd9de7c..f0215ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -743,9 +743,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
int
rte_eal_pci_init(void)
{
- TAILQ_INIT(&pci_driver_list);
- TAILQ_INIT(&pci_device_list);
-
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
return 0;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 03/24] eal/pci: replace PCI devinit/devuninit with probe/remove
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 01/24] eal: remove duplicate function declaration Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 02/24] pci: no need for dynamic tailq init Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 04/24] crypto: no need for a crypto pmd type Shreyansh Jain
` (23 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
Probe and Remove are more appropriate names for PCI init and uninint
operations. This is a cosmetic change.
Only MLX* uses the PCI direct registeration, bypassing PMD_* macro. The
calls backs for this too have been updated.
VDEV are left out. For them, init/uninit are more appropriate.
Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/test_pci.c | 8 ++++----
drivers/net/mlx4/mlx4.c | 4 ++--
drivers/net/mlx5/mlx5.c | 4 ++--
lib/librte_cryptodev/rte_cryptodev.c | 4 ++--
lib/librte_cryptodev/rte_cryptodev_pmd.h | 2 +-
lib/librte_eal/common/eal_common_pci.c | 16 ++++++++--------
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_pci.h | 10 +++++-----
lib/librte_ether/rte_ethdev.c | 8 ++++----
9 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 69f78d9..f1b988a 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -52,11 +52,11 @@
* PCI test
* ========
*
- * - Register a driver with a ``devinit()`` function.
+ * - Register a driver with a ``probe()`` function.
*
* - Dump all PCI devices.
*
- * - Check that the ``devinit()`` function is called at least once.
+ * - Check that the ``probe()`` function is called at least once.
*/
int test_pci_run = 0; /* value checked by the multiprocess test */
@@ -79,14 +79,14 @@ struct rte_pci_id my_driver_id2[] = {
struct rte_pci_driver my_driver = {
.name = "test_driver",
- .devinit = my_driver_init,
+ .probe = my_driver_init,
.id_table = my_driver_id,
.drv_flags = 0,
};
struct rte_pci_driver my_driver2 = {
.name = "test_driver2",
- .devinit = my_driver_init,
+ .probe = my_driver_init,
.id_table = my_driver_id2,
.drv_flags = 0,
};
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index efe60cf..ab7ed23 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5544,7 +5544,7 @@ static struct eth_driver mlx4_driver;
* 0 on success, negative errno value on failure.
*/
static int
-mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
{
struct ibv_device **list;
struct ibv_device *ibv_dev;
@@ -5913,7 +5913,7 @@ static struct eth_driver mlx4_driver = {
.pci_drv = {
.name = MLX4_DRIVER_NAME,
.id_table = mlx4_pci_id_map,
- .devinit = mlx4_pci_devinit,
+ .probe = mlx4_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
},
.dev_private_size = sizeof(struct priv)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 7264968..9113121 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -355,7 +355,7 @@ static struct eth_driver mlx5_driver;
* 0 on success, negative errno value on failure.
*/
static int
-mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
{
struct ibv_device **list;
struct ibv_device *ibv_dev;
@@ -730,7 +730,7 @@ static struct eth_driver mlx5_driver = {
.pci_drv = {
.name = MLX5_DRIVER_NAME,
.id_table = mlx5_pci_id_map,
- .devinit = mlx5_pci_devinit,
+ .probe = mlx5_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
},
.dev_private_size = sizeof(struct priv)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 715f93d..ea75562 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -547,8 +547,8 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.devinit = rte_cryptodev_init;
- cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.probe = rte_cryptodev_init;
+ cryptodrv->pci_drv.remove = rte_cryptodev_uninit;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index cd46674..130290e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -505,7 +505,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
* device, by invoking the rte_eal_pci_register() function to
* register the *pci_drv* structure embedded in the *crypto_drv*
* structure, after having stored the address of the
- * rte_cryptodev_init() function in the *devinit* field of the
+ * rte_cryptodev_init() function in the *probe* field of the
* *pci_drv* structure.
*
* During the PCI probing phase, the rte_cryptodev_init()
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6a0f6ac..db8cba0 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -153,7 +153,7 @@ pci_unmap_resource(void *requested_addr, size_t size)
}
/*
- * If vendor/device ID match, call the devinit() function of the
+ * If vendor/device ID match, call the probe() function of the
* driver.
*/
static int
@@ -212,15 +212,15 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
/* reference driver structure */
dev->driver = dr;
- /* call the driver devinit() function */
- return dr->devinit(dr, dev);
+ /* call the driver probe() function */
+ return dr->probe(dr, dev);
}
/* return positive value if driver doesn't support this device */
return 1;
}
/*
- * If vendor/device ID match, call the devuninit() function of the
+ * If vendor/device ID match, call the remove() function of the
* driver.
*/
static int
@@ -257,7 +257,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->name);
- if (dr->devuninit && (dr->devuninit(dev) < 0))
+ if (dr->remove && (dr->remove(dev) < 0))
return -1; /* negative value is an error */
/* clear driver structure */
@@ -275,7 +275,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
}
/*
- * If vendor/device ID match, call the devinit() function of all
+ * If vendor/device ID match, call the probe() function of all
* registered driver for the given device. Return -1 if initialization
* failed, return 1 if no driver is found for this device.
*/
@@ -302,7 +302,7 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
}
/*
- * If vendor/device ID match, call the devuninit() function of all
+ * If vendor/device ID match, call the remove() function of all
* registered driver for the given device. Return -1 if initialization
* failed, return 1 if no driver is found for this device.
*/
@@ -392,7 +392,7 @@ err_return:
}
/*
- * Scan the content of the PCI bus, and call the devinit() function for
+ * Scan the content of the PCI bus, and call the probe() function for
* all registered drivers that have a matching entry in its id_table
* for discovered devices.
*/
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 95789f9..8233a2a 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void devinitfn_ ##drv(void);\
-void __attribute__((constructor, used)) devinitfn_ ##drv(void)\
+void probefn_ ##drv(void);\
+void __attribute__((constructor, used)) probefn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fa74962..803c78a 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -193,12 +193,12 @@ struct rte_pci_driver;
/**
* Initialisation function for the driver called during PCI probing.
*/
-typedef int (pci_devinit_t)(struct rte_pci_driver *, struct rte_pci_device *);
+typedef int (pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
/**
* Uninitialisation function for the driver called during hotplugging.
*/
-typedef int (pci_devuninit_t)(struct rte_pci_device *);
+typedef int (pci_remove_t)(struct rte_pci_device *);
/**
* A structure describing a PCI driver.
@@ -206,8 +206,8 @@ typedef int (pci_devuninit_t)(struct rte_pci_device *);
struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
const char *name; /**< Driver name. */
- pci_devinit_t *devinit; /**< Device init. function. */
- pci_devuninit_t *devuninit; /**< Device uninit function. */
+ pci_probe_t *probe; /**< Device Probe function. */
+ pci_remove_t *remove; /**< Device Remove function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
uint32_t drv_flags; /**< Flags contolling handling of device. */
};
@@ -442,7 +442,7 @@ int rte_eal_pci_probe_one(const struct rte_pci_addr *addr);
* Close the single PCI device.
*
* Scan the content of the PCI bus, and find the pci device specified by pci
- * address, then call the devuninit() function for registered driver that has a
+ * address, then call the remove() function for registered driver that has a
* matching entry in its id_table for discovered device.
*
* @param addr
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 382c959..aa41a0c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -347,7 +347,7 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
* Poll Mode Driver.
* Invokes the rte_eal_pci_register() function to register the *pci_drv*
* structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *devinit* field of
+ * address of the rte_eth_dev_init() function in the *probe* field of
* the *pci_drv* structure.
* During the PCI probing phase, the rte_eth_dev_init() function is
* invoked for each PCI [Ethernet device] matching the embedded PCI
@@ -356,8 +356,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.devinit = rte_eth_dev_init;
- eth_drv->pci_drv.devuninit = rte_eth_dev_uninit;
+ eth_drv->pci_drv.probe = rte_eth_dev_init;
+ eth_drv->pci_drv.remove = rte_eth_dev_uninit;
rte_eal_pci_register(ð_drv->pci_drv);
}
@@ -537,7 +537,7 @@ rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
goto err;
- /* invoke devuninit func of the pci driver,
+ /* invoke remove func of the pci driver,
* also remove the device from pci_device_list */
if (rte_eal_pci_detach(&freed_addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 04/24] crypto: no need for a crypto pmd type
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (2 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 03/24] eal/pci: replace PCI devinit/devuninit with probe/remove Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 05/24] drivers: align PCI driver definitions Shreyansh Jain
` (22 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 8 +++-----
lib/librte_cryptodev/rte_cryptodev.h | 2 --
lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index ea75562..144c205 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -318,7 +318,7 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -357,7 +357,6 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
- cryptodev->pmd_type = type;
cryptodev_globals.nb_devs++;
}
@@ -406,7 +405,7 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
- cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
if (cryptodev == NULL)
return NULL;
@@ -448,8 +447,7 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
- cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
- rte_socket_id());
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
return -ENOMEM;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 7fb5f6e..417e3f9 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -620,8 +620,6 @@ struct rte_cryptodev {
enum rte_cryptodev_type dev_type;
/**< Crypto device type */
- enum pmd_type pmd_type;
- /**< PMD type - PDEV / VDEV */
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 130290e..9a9174f 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -456,13 +456,12 @@ struct rte_cryptodev_ops {
* to that slot for the driver to use.
*
* @param name Unique identifier name for each device
- * @param type Device type of this Crypto device
* @param socket_id Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
-rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
/**
* Creates a new virtual crypto device and returns the pointer
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 05/24] drivers: align PCI driver definitions
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (3 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 04/24] crypto: no need for a crypto pmd type Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 06/24] eal: introduce PCI device init macros Shreyansh Jain
` (21 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/qat/rte_qat_cryptodev.c | 2 +-
drivers/net/ena/ena_ethdev.c | 2 +-
drivers/net/nfp/nfp_net.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 82ab047..1e9e0ba 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -113,7 +113,7 @@ crypto_qat_dev_init(__attribute__((unused)) struct rte_cryptodev_driver *crypto_
}
static struct rte_cryptodev_driver rte_qat_pmd = {
- {
+ .pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
},
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index d106f5f..f2e7c34 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1685,7 +1685,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
static struct eth_driver rte_ena_pmd = {
- {
+ .pci_drv = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 19a5f86..8421925 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2459,7 +2459,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
};
static struct eth_driver rte_nfp_net_pmd = {
- {
+ .pci_drv = {
.name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 06/24] eal: introduce PCI device init macros
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (4 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 05/24] drivers: align PCI driver definitions Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 07/24] driver: probe/remove common wrappers for PCI drivers Shreyansh Jain
` (20 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Update PCI Registration macro name]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_dev.h | 4 ++--
lib/librte_eal/common/include/rte_eal.h | 3 +++
lib/librte_eal/common/include/rte_pci.h | 10 ++++++++++
lib/librte_eal/common/include/rte_tailq.h | 4 ++--
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 8233a2a..94ae14e 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
#define PMD_REGISTER_DRIVER(drv, nm)\
-void probefn_ ##drv(void);\
-void __attribute__((constructor, used)) probefn_ ##drv(void)\
+RTE_INIT(probefn_ ##drv);\
+static void probefn_ ##drv(void)\
{\
(drv).name = RTE_STR(nm);\
rte_eal_driver_register(&drv);\
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 98d20db..d150b9d 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -253,6 +253,9 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
}
+#define RTE_INIT(func) \
+static void __attribute__((constructor, used)) func(void)
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 803c78a..cf81898 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -470,6 +470,16 @@ void rte_eal_pci_dump(FILE *f);
*/
void rte_eal_pci_register(struct rte_pci_driver *driver);
+/** Helper for PCI device registration from driver (eth, crypto) instance */
+#define DRIVER_REGISTER_PCI(nm, pci_drv) \
+RTE_INIT(pciinitfn_ ##nm); \
+static void pciinitfn_ ##nm(void) \
+{\
+ (pci_drv).name = RTE_STR(nm);\
+ rte_eal_pci_register(&pci_drv); \
+} \
+DRIVER_EXPORT_NAME(nm, __COUNTER__)
+
/**
* Unregister a PCI driver.
*
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index cc3c0f1..cc386e4 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
int rte_eal_tailq_register(struct rte_tailq_elem *t);
#define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
{ \
if (rte_eal_tailq_register(&t) < 0) \
rte_panic("Cannot initialize tailq: %s\n", t.name); \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 07/24] driver: probe/remove common wrappers for PCI drivers
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (5 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 06/24] eal: introduce PCI device init macros Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-10-03 14:21 ` Thomas Monjalon
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 08/24] drivers: convert all phy drivers as " Shreyansh Jain
` (19 subsequent siblings)
26 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
crypto and ethdev drivers aligned to PCI probe/remove. These wrappers are
mapped directly to PCI resources.
Existing handlers for init/uninit can be easily reused for this.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 17 +++++++++--------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 7 +++++++
lib/librte_ether/rte_ethdev.c | 14 +++++++-------
lib/librte_ether/rte_ethdev.h | 13 +++++++++++++
lib/librte_ether/rte_ether_version.map | 9 +++++++++
6 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 144c205..caa9db8 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -428,9 +428,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
return cryptodev;
}
-static int
-rte_cryptodev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -489,8 +489,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv,
return -ENXIO;
}
-static int
-rte_cryptodev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct rte_cryptodev_driver *cryptodrv;
struct rte_cryptodev *cryptodev;
@@ -538,15 +538,16 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
{
/* Call crypto device initialization directly if device is virtual */
if (type == PMD_VDEV)
- return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv,
+ return rte_cryptodev_pci_probe(
+ (struct rte_pci_driver *)cryptodrv,
NULL);
/*
* Register PCI driver for physical device intialisation during
* PCI probing
*/
- cryptodrv->pci_drv.probe = rte_cryptodev_init;
- cryptodrv->pci_drv.remove = rte_cryptodev_uninit;
+ cryptodrv->pci_drv.probe = rte_cryptodev_pci_probe;
+ cryptodrv->pci_drv.remove = rte_cryptodev_pci_remove;
rte_eal_pci_register(&cryptodrv->pci_drv);
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 9a9174f..450a376 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -536,6 +536,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
enum rte_cryptodev_event_type event);
+/**
+ * Wrapper for use by pci drivers as a .probe function to attach to a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .remove function to detach a crypto
+ * interface.
+ */
+int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev);
#ifdef __cplusplus
}
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index a08fd20..1fc0d57 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -39,3 +39,10 @@ DPDK_16.07 {
rte_cryptodev_parse_vdev_init_params;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_cryptodev_pci_probe;
+ rte_cryptodev_pci_remove;
+} DPDK_16.07;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index aa41a0c..42d7d5e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -244,9 +244,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return 0;
}
-static int
-rte_eth_dev_init(struct rte_pci_driver *pci_drv,
- struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev)
{
struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -298,8 +298,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
return diag;
}
-static int
-rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
+int
+rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
{
const struct eth_driver *eth_drv;
struct rte_eth_dev *eth_dev;
@@ -356,8 +356,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)
void
rte_eth_driver_register(struct eth_driver *eth_drv)
{
- eth_drv->pci_drv.probe = rte_eth_dev_init;
- eth_drv->pci_drv.remove = rte_eth_dev_uninit;
+ eth_drv->pci_drv.probe = rte_eth_dev_pci_probe;
+ eth_drv->pci_drv.remove = rte_eth_dev_pci_remove;
rte_eal_pci_register(ð_drv->pci_drv);
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 96575e8..83079e9 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4372,6 +4372,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
+ struct rte_pci_device *pci_dev);
+
+/**
+ * Wrapper for use by pci drivers as a .remove function to detach a ethdev
+ * interface.
+ */
+int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 45ddf44..17e7448 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -138,4 +138,13 @@ DPDK_16.07 {
rte_eth_dev_get_name_by_port;
rte_eth_dev_get_port_by_name;
rte_eth_xstats_get_names;
+
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eth_dev_pci_probe;
+ rte_eth_dev_pci_remove;
+
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 08/24] drivers: convert all phy drivers as PCI drivers
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (6 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 07/24] driver: probe/remove common wrappers for PCI drivers Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 09/24] drivers: remove driver register callbacks for crypto/net Shreyansh Jain
` (18 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
Update documentation for replacing an example referring to
PMD_REGISTER_DRIVER.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
doc/guides/prog_guide/dev_kit_build_system.rst | 2 +-
drivers/crypto/qat/rte_qat_cryptodev.c | 16 ++-------
drivers/net/bnx2x/bnx2x_ethdev.c | 34 ++++---------------
drivers/net/bnxt/bnxt_ethdev.c | 16 ++-------
drivers/net/cxgbe/cxgbe_ethdev.c | 24 ++------------
drivers/net/e1000/em_ethdev.c | 16 ++-------
drivers/net/e1000/igb_ethdev.c | 39 ++++------------------
drivers/net/ena/ena_ethdev.c | 17 ++--------
drivers/net/enic/enic_ethdev.c | 23 ++-----------
drivers/net/fm10k/fm10k_ethdev.c | 23 ++-----------
drivers/net/i40e/i40e_ethdev.c | 24 ++------------
drivers/net/i40e/i40e_ethdev_vf.c | 25 ++------------
drivers/net/ixgbe/ixgbe_ethdev.c | 46 ++++----------------------
drivers/net/mlx4/mlx4.c | 16 +++------
drivers/net/mlx5/mlx5.c | 15 +++------
drivers/net/nfp/nfp_net.c | 21 ++----------
drivers/net/qede/qede_ethdev.c | 40 +++++-----------------
drivers/net/szedata2/rte_eth_szedata2.c | 24 ++------------
drivers/net/thunderx/nicvf_ethdev.c | 20 ++---------
drivers/net/virtio/virtio_ethdev.c | 26 +++++----------
drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 ++-----------
mk/internal/rte.compile-pre.mk | 2 +-
22 files changed, 83 insertions(+), 409 deletions(-)
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst b/doc/guides/prog_guide/dev_kit_build_system.rst
index 952146e..05358d0 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -264,7 +264,7 @@ instance the macro:
.. code-block:: c
- PMD_REGISTER_DRIVER(drv, name)
+ DRIVER_REGISTER_PCI(name, drv)
Creates the following symbol:
diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c
index 1e9e0ba..170ae78 100644
--- a/drivers/crypto/qat/rte_qat_cryptodev.c
+++ b/drivers/crypto/qat/rte_qat_cryptodev.c
@@ -116,23 +116,13 @@ static struct rte_cryptodev_driver rte_qat_pmd = {
.pci_drv = {
.id_table = pci_id_qat_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_cryptodev_pci_probe,
+ .remove = rte_cryptodev_pci_remove,
},
.cryptodev_init = crypto_qat_dev_init,
.dev_private_size = sizeof(struct qat_pmd_private),
};
-static int
-rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV);
-}
-
-static struct rte_driver pmd_qat_drv = {
- .type = PMD_PDEV,
- .init = rte_qat_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(pmd_qat_drv, CRYPTODEV_NAME_QAT_SYM_PMD);
+DRIVER_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index dcd2d77..7d9ecdf 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -621,6 +621,8 @@ static struct eth_driver rte_bnx2x_pmd = {
.name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2x_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
@@ -634,38 +636,14 @@ static struct eth_driver rte_bnx2xvf_pmd = {
.name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_bnx2xvf_dev_init,
.dev_private_size = sizeof(struct bnx2x_softc),
};
-static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2x_pmd);
-
- return 0;
-}
-
-static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_bnx2xvf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_bnx2x_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2x_pmd_init,
-};
-
-static struct rte_driver rte_bnx2xvf_driver = {
- .type = PMD_PDEV,
- .init = rte_bnx2xvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_bnx2x_driver, net_bnx2x);
+DRIVER_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_bnx2x, pci_id_bnx2x_map);
-PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, net_bnx2xvf);
+DRIVER_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index f4eedfd..d389fc8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1048,23 +1048,13 @@ static struct eth_driver bnxt_rte_pmd = {
.name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove
},
.eth_dev_init = bnxt_dev_init,
.eth_dev_uninit = bnxt_dev_uninit,
.dev_private_size = sizeof(struct bnxt),
};
-static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
-{
- RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
- rte_eth_driver_register(&bnxt_rte_pmd);
- return 0;
-}
-
-static struct rte_driver bnxt_pmd_drv = {
- .type = PMD_PDEV,
- .init = bnxt_rte_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(bnxt_pmd_drv, net_bnxt);
+DRIVER_REGISTER_PCI(net_bnxt, bnxt_rte_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 7b7bfdf..bb929a9 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1042,30 +1042,12 @@ static struct eth_driver rte_cxgbe_pmd = {
.name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_cxgbe_dev_init,
.dev_private_size = sizeof(struct port_info),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI CXGBE devices.
- */
-static int rte_cxgbe_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- CXGBE_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_cxgbe_pmd);
- return 0;
-}
-
-static struct rte_driver rte_cxgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_cxgbe_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_cxgbe_driver, net_cxgbe);
+DRIVER_REGISTER_PCI(net_cxgbe, rte_cxgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_cxgbe, cxgb4_pci_tbl);
-
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index c5bf294..d4914a5 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -395,6 +395,8 @@ static struct eth_driver rte_em_pmd = {
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_em_dev_init,
.eth_dev_uninit = eth_em_dev_uninit,
@@ -402,13 +404,6 @@ static struct eth_driver rte_em_pmd = {
};
static int
-rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_em_pmd);
- return 0;
-}
-
-static int
em_hw_init(struct e1000_hw *hw)
{
int diag;
@@ -1799,10 +1794,5 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
-struct rte_driver em_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_em_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(em_pmd_drv, net_e1000_em);
+DRIVER_REGISTER_PCI(net_e1000_em, rte_em_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index f7cfa18..c54c8e8 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1082,6 +1082,8 @@ static struct eth_driver rte_igb_pmd = {
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igb_dev_init,
.eth_dev_uninit = eth_igb_dev_uninit,
@@ -1096,19 +1098,14 @@ static struct eth_driver rte_igbvf_pmd = {
.name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_igbvf_dev_init,
.eth_dev_uninit = eth_igbvf_dev_uninit,
.dev_private_size = sizeof(struct e1000_adapter),
};
-static int
-rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_igb_pmd);
- return 0;
-}
-
static void
igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
{
@@ -1120,20 +1117,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
}
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices.
- */
-static int
-rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_igbvf_pmd);
- return 0;
-}
-
static int
igb_check_mq_mode(struct rte_eth_dev *dev)
{
@@ -5084,16 +5067,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev,
return nvm->ops.write(hw, first, length, data);
}
-static struct rte_driver pmd_igb_drv = {
- .type = PMD_PDEV,
- .init = rte_igb_pmd_init,
-};
-
-static struct rte_driver pmd_igbvf_drv = {
- .type = PMD_PDEV,
- .init = rte_igbvf_pmd_init,
-};
-
static int
eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
@@ -5255,7 +5228,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)
E1000_WRITE_FLUSH(hw);
}
-PMD_REGISTER_DRIVER(pmd_igb_drv, net_e1000_igb);
+DRIVER_REGISTER_PCI(net_e1000_igb, rte_igb_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_e1000_igb, pci_id_igb_map);
-PMD_REGISTER_DRIVER(pmd_igbvf_drv, net_e1000_igb_vf);
+DRIVER_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index f2e7c34..85c5086 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1689,23 +1689,12 @@ static struct eth_driver rte_ena_pmd = {
.name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ena_dev_init,
.dev_private_size = sizeof(struct ena_adapter),
};
-static int
-rte_ena_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_ena_pmd);
- return 0;
-};
-
-struct rte_driver ena_pmd_drv = {
- .type = PMD_PDEV,
- .init = rte_ena_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(ena_pmd_drv, net_ena);
+DRIVER_REGISTER_PCI(net_ena, rte_ena_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_ena, pci_id_ena_map);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6cbecb1..9006197 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -616,29 +616,12 @@ static struct eth_driver rte_enic_pmd = {
.name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_enicpmd_dev_init,
.dev_private_size = sizeof(struct enic),
};
-/* Driver initialization routine.
- * Invoked once at EAL init time.
- * Register as the [Poll Mode] Driver of Cisco ENIC device.
- */
-static int
-rte_enic_pmd_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- ENICPMD_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_enic_pmd);
- return 0;
-}
-
-static struct rte_driver rte_enic_driver = {
- .type = PMD_PDEV,
- .init = rte_enic_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_enic_driver, net_enic);
+DRIVER_REGISTER_PCI(net_enic, rte_enic_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_enic, pci_id_enic_map);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 0ecc167..8d55c43 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3059,30 +3059,13 @@ static struct eth_driver rte_pmd_fm10k = {
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_fm10k_dev_init,
.eth_dev_uninit = eth_fm10k_dev_uninit,
.dev_private_size = sizeof(struct fm10k_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI FM10K devices.
- */
-static int
-rte_pmd_fm10k_init(__rte_unused const char *name,
- __rte_unused const char *params)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_pmd_fm10k);
- return 0;
-}
-
-static struct rte_driver rte_fm10k_driver = {
- .type = PMD_PDEV,
- .init = rte_pmd_fm10k_init,
-};
-
-PMD_REGISTER_DRIVER(rte_fm10k_driver, net_fm10k);
+DRIVER_REGISTER_PCI(net_fm10k, rte_pmd_fm10k.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_fm10k, pci_id_fm10k_map);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b04c833..56bd2c6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -667,6 +667,8 @@ static struct eth_driver rte_i40e_pmd = {
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_i40e_dev_init,
.eth_dev_uninit = eth_i40e_dev_uninit,
@@ -701,27 +703,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,
return 0;
}
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_i40e_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- rte_eth_driver_register(&rte_i40e_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40e_driver = {
- .type = PMD_PDEV,
- .init = rte_i40e_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40e_driver, net_i40e);
+DRIVER_REGISTER_PCI(net_i40e, rte_i40e_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_i40e, pci_id_i40e_map);
/*
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 2e1c64a..8177626 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1557,34 +1557,15 @@ static struct eth_driver rte_i40evf_pmd = {
.name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = i40evf_dev_init,
.eth_dev_uninit = i40evf_dev_uninit,
.dev_private_size = sizeof(struct i40e_adapter),
};
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices.
- */
-static int
-rte_i40evf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_i40evf_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_i40evf_driver = {
- .type = PMD_PDEV,
- .init = rte_i40evf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_i40evf_driver, net_i40e_vf);
+DRIVER_REGISTER_PCI(net_i40e_vf, rte_i40evf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_i40e_vf, pci_id_i40evf_map);
static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 73a406b..4b9e3d4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1566,6 +1566,8 @@ static struct eth_driver rte_ixgbe_pmd = {
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbe_dev_init,
.eth_dev_uninit = eth_ixgbe_dev_uninit,
@@ -1580,40 +1582,14 @@ static struct eth_driver rte_ixgbevf_pmd = {
.name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_ixgbevf_dev_init,
.eth_dev_uninit = eth_ixgbevf_dev_uninit,
.dev_private_size = sizeof(struct ixgbe_adapter),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
- */
-static int
-rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbe_pmd);
- return 0;
-}
-
-/*
- * VF Driver initialization routine.
- * Invoked one at EAL init time.
- * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices.
- */
-static int
-rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_ixgbevf_pmd);
- return 0;
-}
-
static int
ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
@@ -7409,17 +7385,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
ixgbevf_dev_interrupt_action(dev);
}
-static struct rte_driver rte_ixgbe_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbe_pmd_init,
-};
-
-static struct rte_driver rte_ixgbevf_driver = {
- .type = PMD_PDEV,
- .init = rte_ixgbevf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_ixgbe_driver, net_ixgbe);
+DRIVER_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_ixgbe, pci_id_ixgbe_map);
-PMD_REGISTER_DRIVER(rte_ixgbevf_driver, net_ixgbe_vf);
+DRIVER_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_ixgbe_vf, pci_id_ixgbevf_map);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index ab7ed23..18da84a 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5922,12 +5922,10 @@ static struct eth_driver mlx4_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx4_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx4_pmd_init);
+static void
+rte_mlx4_pmd_init(void)
{
- (void)name;
- (void)args;
-
RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
@@ -5938,13 +5936,7 @@ rte_mlx4_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx4_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx4_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx4_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx4_driver, net_mlx4);
+DRIVER_EXPORT_NAME(net_mlx4, __COUNTER__);
DRIVER_REGISTER_PCI_TABLE(net_mlx4, mlx4_pci_id_map);
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 9113121..4eaabcd 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -739,11 +739,10 @@ static struct eth_driver mlx5_driver = {
/**
* Driver initialization routine.
*/
-static int
-rte_mlx5_pmd_init(const char *name, const char *args)
+RTE_INIT(rte_mlx5_pmd_init);
+static void
+rte_mlx5_pmd_init(void)
{
- (void)name;
- (void)args;
/*
* RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
* huge pages. Calling ibv_fork_init() during init allows
@@ -753,13 +752,7 @@ rte_mlx5_pmd_init(const char *name, const char *args)
setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
ibv_fork_init();
rte_eal_pci_register(&mlx5_driver.pci_drv);
- return 0;
}
-static struct rte_driver rte_mlx5_driver = {
- .type = PMD_PDEV,
- .init = rte_mlx5_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_mlx5_driver, net_mlx5);
+DRIVER_EXPORT_NAME(net_mlx5, __COUNTER__);
DRIVER_REGISTER_PCI_TABLE(net_mlx5, mlx5_pci_id_map);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8421925..e140074 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2464,29 +2464,14 @@ static struct eth_driver rte_nfp_net_pmd = {
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = nfp_net_init,
.dev_private_size = sizeof(struct nfp_net_adapter),
};
-static int
-nfp_net_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n",
- NFP_NET_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nfp_net_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nfp_net_driver = {
- .type = PMD_PDEV,
- .init = nfp_net_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nfp_net_driver, net_nfp);
+DRIVER_REGISTER_PCI(net_nfp, rte_nfp_net_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_nfp, pci_id_nfp_net_map);
/*
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 3b2d8ea..696a32b 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1482,7 +1482,9 @@ static struct eth_driver rte_qedevf_pmd = {
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qedevf_eth_dev_init,
.eth_dev_uninit = qedevf_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
@@ -1494,41 +1496,15 @@ static struct eth_driver rte_qede_pmd = {
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
- },
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
+ },
.eth_dev_init = qede_eth_dev_init,
.eth_dev_uninit = qede_eth_dev_uninit,
.dev_private_size = sizeof(struct qede_dev),
};
-static int
-rte_qedevf_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qedevf_pmd);
-
- return 0;
-}
-
-static int
-rte_qede_pmd_init(const char *name __rte_unused,
- const char *params __rte_unused)
-{
- rte_eth_driver_register(&rte_qede_pmd);
-
- return 0;
-}
-
-static struct rte_driver rte_qedevf_driver = {
- .type = PMD_PDEV,
- .init = rte_qede_pmd_init
-};
-
-static struct rte_driver rte_qede_driver = {
- .type = PMD_PDEV,
- .init = rte_qedevf_pmd_init
-};
-
-PMD_REGISTER_DRIVER(rte_qede_driver, net_qede);
+DRIVER_REGISTER_PCI(net_qede, rte_qede_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_qede, pci_id_qede_map);
-PMD_REGISTER_DRIVER(rte_qedevf_driver, net_qede_vf);
+DRIVER_REGISTER_PCI(net_qede_vf, rte_qedevf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_qede_vf, pci_id_qedevf_map);
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index f665248..9302200 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1574,31 +1574,13 @@ static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
.name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = rte_szedata2_eth_dev_init,
.eth_dev_uninit = rte_szedata2_eth_dev_uninit,
.dev_private_size = sizeof(struct pmd_internals),
};
-static int
-rte_szedata2_init(const char *name __rte_unused,
- const char *args __rte_unused)
-{
- rte_eth_driver_register(&szedata2_eth_driver);
- return 0;
-}
-
-static int
-rte_szedata2_uninit(const char *name __rte_unused)
-{
- return 0;
-}
-
-static struct rte_driver rte_szedata2_driver = {
- .type = PMD_PDEV,
- .init = rte_szedata2_init,
- .uninit = rte_szedata2_uninit,
-};
-
-PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME);
+DRIVER_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv);
DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 637794c..9ccf59e 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1762,26 +1762,12 @@ static struct eth_driver rte_nicvf_pmd = {
.name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = nicvf_eth_dev_init,
.dev_private_size = sizeof(struct nicvf),
};
-static int
-rte_nicvf_pmd_init(const char *name __rte_unused, const char *para __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
- PMD_INIT_LOG(INFO, "librte_pmd_thunderx nicvf version %s",
- THUNDERX_NICVF_PMD_VERSION);
-
- rte_eth_driver_register(&rte_nicvf_pmd);
- return 0;
-}
-
-static struct rte_driver rte_nicvf_driver = {
- .type = PMD_PDEV,
- .init = rte_nicvf_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_nicvf_driver, net_thunderx);
+DRIVER_REGISTER_PCI(net_thunderx, rte_nicvf_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_thunderx, pci_id_nicvf_map);
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index ef0d6ee..1c2bf01 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1307,29 +1307,24 @@ static struct eth_driver rte_virtio_pmd = {
.name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_virtio_dev_init,
.eth_dev_uninit = eth_virtio_dev_uninit,
.dev_private_size = sizeof(struct virtio_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of PCI virtio devices.
- * Returns 0 on success.
- */
-static int
-rte_virtio_pmd_init(const char *name __rte_unused,
- const char *param __rte_unused)
+RTE_INIT(rte_virtio_pmd_init);
+static void
+rte_virtio_pmd_init(void)
{
if (rte_eal_iopl_init() != 0) {
PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
- return -1;
+ return;
}
- rte_eth_driver_register(&rte_virtio_pmd);
- return 0;
+ rte_eal_pci_register(&rte_virtio_pmd.pci_drv);
}
/*
@@ -1563,10 +1558,5 @@ __rte_unused uint8_t is_rx)
return 0;
}
-static struct rte_driver rte_virtio_driver = {
- .type = PMD_PDEV,
- .init = rte_virtio_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_virtio_driver, net_virtio);
+DRIVER_EXPORT_NAME(net_virtio, __COUNTER__);
DRIVER_REGISTER_PCI_TABLE(net_virtio, pci_id_virtio_map);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index e6873aa..f15cda5 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -331,26 +331,14 @@ static struct eth_driver rte_vmxnet3_pmd = {
.name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
+ .probe = rte_eth_dev_pci_probe,
+ .remove = rte_eth_dev_pci_remove,
},
.eth_dev_init = eth_vmxnet3_dev_init,
.eth_dev_uninit = eth_vmxnet3_dev_uninit,
.dev_private_size = sizeof(struct vmxnet3_hw),
};
-/*
- * Driver initialization routine.
- * Invoked once at EAL init time.
- * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices.
- */
-static int
-rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused)
-{
- PMD_INIT_FUNC_TRACE();
-
- rte_eth_driver_register(&rte_vmxnet3_pmd);
- return 0;
-}
-
static int
vmxnet3_dev_configure(struct rte_eth_dev *dev)
{
@@ -948,10 +936,5 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
}
#endif
-static struct rte_driver rte_vmxnet3_driver = {
- .type = PMD_PDEV,
- .init = rte_vmxnet3_pmd_init,
-};
-
-PMD_REGISTER_DRIVER(rte_vmxnet3_driver, net_vmxnet3);
+DRIVER_REGISTER_PCI(net_vmxnet3, rte_vmxnet3_pmd.pci_drv);
DRIVER_REGISTER_PCI_TABLE(net_vmxnet3, pci_id_vmxnet3_map);
diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
index f740179..c7ee5df 100644
--- a/mk/internal/rte.compile-pre.mk
+++ b/mk/internal/rte.compile-pre.mk
@@ -87,7 +87,7 @@ endif
PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
PMDINFO_CC = $(CC) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
-PMDINFO_TO_O = if grep -q 'PMD_REGISTER_DRIVER(.*)' $<; then \
+PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
echo "$(if $V,$(PMDINFO_GEN), PMDINFO $@.pmd.c)" && \
$(PMDINFO_GEN) && \
echo "$(if $V,$(PMDINFO_CC), CC $@.pmd.o)" && \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 09/24] drivers: remove driver register callbacks for crypto/net
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (7 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 08/24] drivers: convert all phy drivers as " Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 10/24] eal/pci: helpers for device name parsing/update Shreyansh Jain
` (17 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Now that all pdev are pci drivers, we don't need to register crypto and
ethdev drivers through a dedicated channel.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 23 --------------------
lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 --------------------------
lib/librte_cryptodev/rte_cryptodev_version.map | 1 -
lib/librte_ether/rte_ethdev.c | 22 -------------------
lib/librte_ether/rte_ethdev.h | 12 -----------
lib/librte_ether/rte_ether_version.map | 1 -
6 files changed, 89 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index caa9db8..f591711 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -532,29 +532,6 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv,
- enum pmd_type type)
-{
- /* Call crypto device initialization directly if device is virtual */
- if (type == PMD_VDEV)
- return rte_cryptodev_pci_probe(
- (struct rte_pci_driver *)cryptodrv,
- NULL);
-
- /*
- * Register PCI driver for physical device intialisation during
- * PCI probing
- */
- cryptodrv->pci_drv.probe = rte_cryptodev_pci_probe;
- cryptodrv->pci_drv.remove = rte_cryptodev_pci_remove;
-
- rte_eal_pci_register(&cryptodrv->pci_drv);
-
- return 0;
-}
-
-
uint16_t
rte_cryptodev_queue_pair_count(uint8_t dev_id)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 450a376..abfe2dc 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -493,36 +493,6 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
extern int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
-
-/**
- * Register a Crypto [Poll Mode] driver.
- *
- * Function invoked by the initialization function of a Crypto driver
- * to simultaneously register itself as Crypto Poll Mode Driver and to either:
- *
- * a - register itself as PCI driver if the crypto device is a physical
- * device, by invoking the rte_eal_pci_register() function to
- * register the *pci_drv* structure embedded in the *crypto_drv*
- * structure, after having stored the address of the
- * rte_cryptodev_init() function in the *probe* field of the
- * *pci_drv* structure.
- *
- * During the PCI probing phase, the rte_cryptodev_init()
- * function is invoked for each PCI [device] matching the
- * embedded PCI identifiers provided by the driver.
- *
- * b, complete the initialization sequence if the device is a virtual
- * device by calling the rte_cryptodev_init() directly passing a
- * NULL parameter for the rte_pci_device structure.
- *
- * @param crypto_drv crypto_driver structure associated with the crypto
- * driver.
- * @param type pmd type
- */
-extern int
-rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv,
- enum pmd_type type);
-
/**
* Executes all the user application registered callbacks for the specific
* device.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 1fc0d57..9627ac4 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -14,7 +14,6 @@ DPDK_16.04 {
rte_cryptodev_info_get;
rte_cryptodev_pmd_allocate;
rte_cryptodev_pmd_callback_process;
- rte_cryptodev_pmd_driver_register;
rte_cryptodev_pmd_release_device;
rte_cryptodev_pmd_virtual_dev_init;
rte_cryptodev_sym_session_create;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 42d7d5e..0b9f701 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -339,28 +339,6 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
return 0;
}
-/**
- * Register an Ethernet [Poll Mode] driver.
- *
- * Function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver.
- * Invokes the rte_eal_pci_register() function to register the *pci_drv*
- * structure embedded in the *eth_drv* structure, after having stored the
- * address of the rte_eth_dev_init() function in the *probe* field of
- * the *pci_drv* structure.
- * During the PCI probing phase, the rte_eth_dev_init() function is
- * invoked for each PCI [Ethernet device] matching the embedded PCI
- * identifiers provided by the driver.
- */
-void
-rte_eth_driver_register(struct eth_driver *eth_drv)
-{
- eth_drv->pci_drv.probe = rte_eth_dev_pci_probe;
- eth_drv->pci_drv.remove = rte_eth_dev_pci_remove;
- rte_eal_pci_register(ð_drv->pci_drv);
-}
-
int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 83079e9..a7ba1f0 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1875,18 +1875,6 @@ struct eth_driver {
};
/**
- * @internal
- * A function invoked by the initialization function of an Ethernet driver
- * to simultaneously register itself as a PCI driver and as an Ethernet
- * Poll Mode Driver (PMD).
- *
- * @param eth_drv
- * The pointer to the *eth_driver* structure associated with
- * the Ethernet driver.
- */
-void rte_eth_driver_register(struct eth_driver *eth_drv);
-
-/**
* Convert a numerical speed in Mbps to a bitmap flag that can be used in
* the bitmap link_speeds of the struct rte_eth_conf
*
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 17e7448..72be66d 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -78,7 +78,6 @@ DPDK_2.2 {
rte_eth_dev_vlan_filter;
rte_eth_dev_wd_timeout_store;
rte_eth_dma_zone_reserve;
- rte_eth_driver_register;
rte_eth_led_off;
rte_eth_led_on;
rte_eth_link;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 10/24] eal/pci: helpers for device name parsing/update
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (8 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 09/24] drivers: remove driver register callbacks for crypto/net Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 11/24] ethdev: do not scan all PCI devices on attach Shreyansh Jain
` (16 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
- Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common
method, can be used across crypto/net PCI PMDs.
- Remove crypto specific routine and fallback to common name function.
- Introduce a eal private Update function for PCI device naming.
Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Merge crypto/pci helper patches]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 27 +++---------------
lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_private.h | 13 +++++++++
lib/librte_eal/common/include/rte_pci.h | 24 ++++++++++++++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
lib/librte_ether/rte_ethdev.c | 24 +++-------------
6 files changed, 107 insertions(+), 43 deletions(-)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index f591711..17e4502 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -364,23 +364,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
return cryptodev;
}
-static inline int
-rte_cryptodev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- if ((name == NULL) || (pci_dev == NULL))
- return -EINVAL;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
@@ -443,9 +426,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
if (cryptodrv == NULL)
return -ENODEV;
- /* Create unique Crypto device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
if (cryptodev == NULL)
@@ -500,9 +482,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique device name using PCI address */
- rte_cryptodev_create_unique_device_name(cryptodev_name,
- sizeof(cryptodev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name,
+ sizeof(cryptodev_name));
cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
if (cryptodev == NULL)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index a73cbb0..1d91c78 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -406,6 +406,55 @@ error:
return -1;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ int fd;
+ struct pci_conf matches[2];
+ struct pci_match_conf match = {
+ .pc_sel = {
+ .pc_domain = addr->domain,
+ .pc_bus = addr->bus,
+ .pc_dev = addr->devid,
+ .pc_func = addr->function,
+ },
+ };
+ struct pci_conf_io conf_io = {
+ .pat_buf_len = 0,
+ .num_patterns = 1,
+ .patterns = &match,
+ .match_buf_len = sizeof(matches),
+ .matches = &matches[0],
+ };
+
+ fd = open("/dev/pci", O_RDONLY);
+ if (fd < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+ goto error;
+ }
+
+ if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
+ RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
+ __func__, strerror(errno));
+ goto error;
+ }
+
+ if (conf_io.num_matches != 1)
+ goto error;
+
+ if (pci_scan_one(fd, &matches[0]) < 0)
+ goto error;
+
+ close(fd);
+
+ return 0;
+
+error:
+ if (fd >= 0)
+ close(fd);
+ return -1;
+}
+
/* Read PCI config space. */
int rte_eal_pci_read_config(const struct rte_pci_device *dev,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index ca1aec6..431d6c2 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -130,6 +130,19 @@ struct rte_pci_driver;
struct rte_pci_device;
/**
+ * Update a pci device object by asking the kernel for the latest information.
+ *
+ * This function is private to EAL.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to look for
+ * @return
+ * - 0 on success.
+ * - negative on error.
+ */
+int pci_update_device(const struct rte_pci_addr *addr);
+
+/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index cf81898..e1f695f 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -82,6 +82,7 @@ extern "C" {
#include <stdint.h>
#include <inttypes.h>
+#include <rte_debug.h>
#include <rte_interrupts.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
@@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
@@ -308,6 +310,28 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
}
#undef GET_PCIADDR_FIELD
+/**
+ * Utility function to write a pci device name, this device name can later be
+ * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
+ * BDF helpers.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address
+ * @param output
+ * The output buffer string
+ * @param size
+ * The output buffer size
+ */
+static inline void
+rte_eal_pci_device_name(const struct rte_pci_addr *addr,
+ char *output, size_t size)
+{
+ RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
+ RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
+ addr->domain, addr->bus,
+ addr->devid, addr->function) >= 0);
+}
+
/* Compare two PCI device addresses. */
/**
* Utility function to compare two PCI device addresses.
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f0215ee..62da4d4 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
return 0;
}
+int
+pci_update_device(const struct rte_pci_addr *addr)
+{
+ char filename[PATH_MAX];
+
+ snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
+ pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
+ addr->function);
+
+ return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
+ addr->function);
+}
+
/*
* split up a pci address into its constituent parts.
*/
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0b9f701..0753b42 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -219,20 +219,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
return eth_dev;
}
-static int
-rte_eth_dev_create_unique_device_name(char *name, size_t size,
- struct rte_pci_device *pci_dev)
-{
- int ret;
-
- ret = snprintf(name, size, "%d:%d.%d",
- pci_dev->addr.bus, pci_dev->addr.devid,
- pci_dev->addr.function);
- if (ret < 0)
- return ret;
- return 0;
-}
-
int
rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
{
@@ -256,9 +242,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
eth_drv = (struct eth_driver *)pci_drv;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
if (eth_dev == NULL)
@@ -309,9 +294,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
if (pci_dev == NULL)
return -EINVAL;
- /* Create unique Ethernet device name using PCI address */
- rte_eth_dev_create_unique_device_name(ethdev_name,
- sizeof(ethdev_name), pci_dev);
+ rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
+ sizeof(ethdev_name));
eth_dev = rte_eth_dev_allocated(ethdev_name);
if (eth_dev == NULL)
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 11/24] ethdev: do not scan all PCI devices on attach
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (9 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 10/24] eal/pci: helpers for device name parsing/update Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 12/24] eal: add hotplug operations for PCI and VDEV Shreyansh Jain
` (15 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 12 +++++++++---
lib/librte_ether/rte_ethdev.c | 3 ---
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index db8cba0..bef7ee8 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -341,6 +341,12 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
if (addr == NULL)
return -1;
+ /* update current pci device in global list, kernel bindings might have
+ * changed since last time we looked at it.
+ */
+ if (pci_update_device(addr) < 0)
+ goto err_return;
+
TAILQ_FOREACH(dev, &pci_device_list, next) {
if (rte_eal_compare_pci_addr(&dev->addr, addr))
continue;
@@ -353,9 +359,9 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
return -1;
err_return:
- RTE_LOG(WARNING, EAL, "Requested device " PCI_PRI_FMT
- " cannot be used\n", dev->addr.domain, dev->addr.bus,
- dev->addr.devid, dev->addr.function);
+ RTE_LOG(WARNING, EAL,
+ "Requested device " PCI_PRI_FMT " cannot be used\n",
+ addr->domain, addr->bus, addr->devid, addr->function);
return -1;
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0753b42..11329cf 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -468,9 +468,6 @@ rte_eth_dev_is_detachable(uint8_t port_id)
static int
rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
{
- /* re-construct pci_device_list */
- if (rte_eal_pci_scan())
- goto err;
/* Invoke probe func of the driver can handle the new device. */
if (rte_eal_pci_probe_one(addr))
goto err;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 12/24] eal: add hotplug operations for PCI and VDEV
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (10 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 11/24] ethdev: do not scan all PCI devices on attach Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 13/24] ethdev: convert to EAL hotplug Shreyansh Jain
` (14 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Hotplug invocations, which deals with devices, should come from the layer
that already handles them, i.e. EAL.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 ++++
lib/librte_eal/common/eal_common_dev.c | 48 +++++++++++++++++++++++++
lib/librte_eal/common/include/rte_dev.h | 26 ++++++++++++++
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 ++++
4 files changed, 88 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index a335e04..7b3d409 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -162,3 +162,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index a8a4146..88f9d3f 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -150,3 +150,51 @@ rte_eal_vdev_uninit(const char *name)
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
return -EINVAL;
}
+
+int rte_eal_dev_attach(const char *name, const char *devargs)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL || devargs == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_probe_one(&addr) < 0)
+ goto err;
+
+ } else {
+ if (rte_eal_vdev_init(name, devargs))
+ goto err;
+ }
+
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", name);
+ return -EINVAL;
+}
+
+int rte_eal_dev_detach(const char *name)
+{
+ struct rte_pci_addr addr;
+
+ if (name == NULL) {
+ RTE_LOG(ERR, EAL, "Invalid device provided.\n");
+ return -EINVAL;
+ }
+
+ if (eal_parse_pci_DomBDF(name, &addr) == 0) {
+ if (rte_eal_pci_detach(&addr) < 0)
+ goto err;
+ } else {
+ if (rte_eal_vdev_uninit(name))
+ goto err;
+ }
+ return 0;
+
+err:
+ RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 94ae14e..6cc9b01 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -178,6 +178,32 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+/**
+ * Attach a device to a registered driver.
+ *
+ * @param name
+ * The device name, that refers to a pci device (or some private
+ * way of designating a vdev device). Based on this device name, eal
+ * will identify a driver capable of handling it and pass it to the
+ * driver probing function.
+ * @param devargs
+ * Device arguments to be passed to the driver.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_attach(const char *name, const char *devargs);
+
+/**
+ * Detach a device from its driver.
+ *
+ * @param name
+ * Same description as for rte_eal_dev_attach().
+ * Here, eal will call the driver detaching function.
+ * @return
+ * 0 on success, negative on error.
+ */
+int rte_eal_dev_detach(const char *name);
+
#define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[]
#define DRIVER_EXPORT_NAME(name, idx) \
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index db8c984..c0bd391 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -166,3 +166,10 @@ DPDK_16.07 {
rte_thread_setname;
} DPDK_16.04;
+
+DPDK_16.11 {
+ global:
+
+ rte_eal_dev_attach;
+ rte_eal_dev_detach;
+} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 13/24] ethdev: convert to EAL hotplug
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (11 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 12/24] eal: add hotplug operations for PCI and VDEV Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 14/24] ethdev: get rid of device type Shreyansh Jain
` (13 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some
mechanism to inform applications of port creation/removal to substitute
for ethdev hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the
following commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
--
v10:
- Update incorrect language of log message
- Checkpatch issues fixed
---
lib/librte_ether/rte_ethdev.c | 207 +++++++-----------------------------------
1 file changed, 35 insertions(+), 172 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 11329cf..4f54952 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -71,6 +71,7 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
static struct rte_eth_dev_data *rte_eth_dev_data;
+static uint8_t eth_dev_last_created_port;
static uint8_t nb_ports;
/* spinlock for eth device callbacks */
@@ -215,6 +216,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
eth_dev->dev_type = type;
+ eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
}
@@ -346,27 +348,6 @@ rte_eth_dev_count(void)
return nb_ports;
}
-static enum rte_eth_dev_type
-rte_eth_dev_get_device_type(uint8_t port_id)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, RTE_ETH_DEV_UNKNOWN);
- return rte_eth_devices[port_id].dev_type;
-}
-
-static int
-rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
-{
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *addr = rte_eth_devices[port_id].pci_dev->addr;
- return 0;
-}
-
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
{
@@ -412,34 +393,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
}
static int
-rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
-{
- int i;
- struct rte_pci_device *pci_dev = NULL;
-
- if (addr == NULL) {
- RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
- return -EINVAL;
- }
-
- *port_id = RTE_MAX_ETHPORTS;
-
- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-
- pci_dev = rte_eth_devices[i].pci_dev;
-
- if (pci_dev &&
- !rte_eal_compare_pci_addr(&pci_dev->addr, addr)) {
-
- *port_id = i;
-
- return 0;
- }
- }
- return -ENODEV;
-}
-
-static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
uint32_t dev_flags;
@@ -464,124 +417,49 @@ rte_eth_dev_is_detachable(uint8_t port_id)
return 1;
}
-/* attach the new physical device, then store port_id of the device */
-static int
-rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
+/* attach the new device, then store port_id of the device */
+int
+rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
{
- /* Invoke probe func of the driver can handle the new device. */
- if (rte_eal_pci_probe_one(addr))
- goto err;
+ int ret = -1;
+ int current = eth_dev_last_created_port;
+ char *name = NULL;
+ char *args = NULL;
- if (rte_eth_dev_get_port_by_addr(addr, port_id))
+ if ((devargs == NULL) || (port_id == NULL)) {
+ ret = -EINVAL;
goto err;
+ }
- return 0;
-err:
- return -1;
-}
-
-/* detach the new physical device, then store pci_addr of the device */
-static int
-rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
-{
- struct rte_pci_addr freed_addr;
- struct rte_pci_addr vp;
-
- /* get pci address by port id */
- if (rte_eth_dev_get_addr_by_port(port_id, &freed_addr))
+ /* parse devargs, then retrieve device name and args */
+ if (rte_eal_parse_devargs_str(devargs, &name, &args))
goto err;
- /* Zeroed pci addr means the port comes from virtual device */
- vp.domain = vp.bus = vp.devid = vp.function = 0;
- if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0)
+ ret = rte_eal_dev_attach(name, args);
+ if (ret < 0)
goto err;
- /* invoke remove func of the pci driver,
- * also remove the device from pci_device_list */
- if (rte_eal_pci_detach(&freed_addr))
+ /* no point looking at eth_dev_last_created_port if no port exists */
+ if (!nb_ports) {
+ RTE_LOG(ERR, EAL, "No ports found for device (%s)\n", name);
+ ret = -1;
goto err;
+ }
- *addr = freed_addr;
- return 0;
-err:
- return -1;
-}
-
-/* attach the new virtual device, then store port_id of the device */
-static int
-rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id)
-{
- char *name = NULL, *args = NULL;
- int ret = -1;
-
- /* parse vdevargs, then retrieve device name and args */
- if (rte_eal_parse_devargs_str(vdevargs, &name, &args))
- goto end;
-
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke probe function of the driver.
- * rte_eal_vdev_init() updates port_id allocated after
- * initialization.
+ /* if nothing happened, there is a bug here, since some driver told us
+ * it did attach a device, but did not create a port.
*/
- if (rte_eal_vdev_init(name, args))
- goto end;
-
- if (rte_eth_dev_get_port_by_name(name, port_id))
- goto end;
-
- ret = 0;
-end:
- free(name);
- free(args);
-
- return ret;
-}
-
-/* detach the new virtual device, then store the name of the device */
-static int
-rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
-{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- /* get device name by port id */
- if (rte_eth_dev_get_name_by_port(port_id, name))
- goto err;
- /* walk around dev_driver_list to find the driver of the device,
- * then invoke uninit function of the driver */
- if (rte_eal_vdev_uninit(name))
- goto err;
-
- strncpy(vdevname, name, sizeof(name));
- return 0;
-err:
- return -1;
-}
-
-/* attach the new device, then store port_id of the device */
-int
-rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
-{
- struct rte_pci_addr addr;
- int ret = -1;
-
- if ((devargs == NULL) || (port_id == NULL)) {
- ret = -EINVAL;
+ if (current == eth_dev_last_created_port) {
+ ret = -1;
goto err;
}
- if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
- ret = rte_eth_dev_attach_pdev(&addr, port_id);
- if (ret < 0)
- goto err;
- } else {
- ret = rte_eth_dev_attach_vdev(devargs, port_id);
- if (ret < 0)
- goto err;
- }
+ *port_id = eth_dev_last_created_port;
+ ret = 0;
- return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
+ free(name);
+ free(args);
return ret;
}
@@ -589,7 +467,6 @@ err:
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- struct rte_pci_addr addr;
int ret = -1;
if (name == NULL) {
@@ -597,33 +474,19 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
goto err;
}
- /* check whether the driver supports detach feature, or not */
+ /* FIXME: move this to eal, once device flags are relocated there */
if (rte_eth_dev_is_detachable(port_id))
goto err;
- if (rte_eth_dev_get_device_type(port_id) == RTE_ETH_DEV_PCI) {
- ret = rte_eth_dev_get_addr_by_port(port_id, &addr);
- if (ret < 0)
- goto err;
-
- ret = rte_eth_dev_detach_pdev(port_id, &addr);
- if (ret < 0)
- goto err;
-
- snprintf(name, RTE_ETH_NAME_MAX_LEN,
- "%04x:%02x:%02x.%d",
- addr.domain, addr.bus,
- addr.devid, addr.function);
- } else {
- ret = rte_eth_dev_detach_vdev(port_id, name);
- if (ret < 0)
- goto err;
- }
+ snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
+ "%s", rte_eth_devices[port_id].data->name);
+ ret = rte_eal_dev_detach(name);
+ if (ret < 0)
+ goto err;
return 0;
err:
- RTE_LOG(ERR, EAL, "Driver, cannot detach the device\n");
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 14/24] ethdev: get rid of device type
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (12 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 13/24] ethdev: convert to EAL hotplug Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 15/24] eal: extract vdev infra Shreyansh Jain
` (12 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: David Marchand <david.marchand@6wind.com>
Now that hotplug has been moved to eal, there is no reason to keep the
device type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 2 +-
drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
drivers/net/bonding/rte_eth_bond_api.c | 2 +-
drivers/net/cxgbe/cxgbe_main.c | 2 +-
drivers/net/mlx4/mlx4.c | 2 +-
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/mpipe/mpipe_tilegx.c | 2 +-
drivers/net/null/rte_eth_null.c | 2 +-
drivers/net/pcap/rte_eth_pcap.c | 2 +-
drivers/net/ring/rte_eth_ring.c | 2 +-
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user_ethdev.c | 2 +-
drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +-
examples/ip_pipeline/init.c | 22 ----------------------
lib/librte_ether/rte_ethdev.c | 5 ++---
lib/librte_ether/rte_ethdev.h | 15 +--------------
16 files changed, 16 insertions(+), 52 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index b4bd2f2..8a1f0d0 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -581,7 +581,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index efc5db6..93ae2d7 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -666,7 +666,7 @@ rte_pmd_init_internals(const char *name,
}
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 203ebe9..8514652 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -189,7 +189,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
goto err;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index ceaf5ab..922155b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1150,7 +1150,7 @@ int cxgbe_probe(struct adapter *adapter)
*/
/* reserve an ethdev entry */
- pi->eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ pi->eth_dev = rte_eth_dev_allocate(name);
if (!pi->eth_dev)
goto out_free;
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 18da84a..6efea24 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5803,7 +5803,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 4eaabcd..f1de40a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -617,7 +617,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
snprintf(name, sizeof(name), "%s port %u",
ibv_get_device_name(ibv_dev), port);
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(name);
}
if (eth_dev == NULL) {
ERROR("can not allocate rte ethdev");
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 6fe1c55..66b43ec 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1587,7 +1587,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
return -ENODEV;
}
- eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(ifname);
if (!eth_dev) {
RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
rte_free(priv);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 29e5954..42ec107 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -517,7 +517,7 @@ eth_dev_null_create(const char *name,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index b7a3b03..418fc52 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -822,7 +822,7 @@ rte_pmd_init_internals(const char *name, const unsigned nb_rx_queues,
goto error;
/* reserve an ethdev entry */
- *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ *eth_dev = rte_eth_dev_allocate(name);
if (*eth_dev == NULL)
goto error;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 5d2580a..b90684c 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -303,7 +303,7 @@ do_eth_dev_ring_create(const char *name,
}
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL) {
rte_errno = ENOSPC;
goto error;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 80c3f4c..d0bffbd 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -714,7 +714,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
goto error;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto error;
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 8077f2e..c682d8f 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -277,7 +277,7 @@ virtio_user_eth_dev_alloc(const char *name)
struct virtio_hw *hw;
struct virtio_user_dev *dev;
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (!eth_dev) {
PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev");
return NULL;
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 8cb26ce..2ffa54c 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -654,7 +654,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
goto err;
/* reserve an ethdev entry */
- eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+ eth_dev = rte_eth_dev_allocate(name);
if (eth_dev == NULL)
goto err;
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f6..0dbc332 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -606,29 +606,12 @@ app_link_set_tcp_syn_filter(struct app_params *app, struct app_link_params *cp)
}
}
-static int
-app_link_is_virtual(struct app_link_params *p)
-{
- uint32_t pmd_id = p->pmd_id;
- struct rte_eth_dev *dev = &rte_eth_devices[pmd_id];
-
- if (dev->dev_type == RTE_ETH_DEV_VIRTUAL)
- return 1;
-
- return 0;
-}
-
void
app_link_up_internal(struct app_params *app, struct app_link_params *cp)
{
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 1;
- return;
- }
-
/* For each link, add filters for IP of current link */
if (cp->ip != 0) {
for (i = 0; i < app->n_links; i++) {
@@ -736,11 +719,6 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp)
uint32_t i;
int status;
- if (app_link_is_virtual(cp)) {
- cp->state = 0;
- return;
- }
-
/* PMD link down */
status = rte_eth_dev_set_link_down(cp->pmd_id);
if (status < 0)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 4f54952..cc2f921 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -190,7 +190,7 @@ rte_eth_dev_find_free_port(void)
}
struct rte_eth_dev *
-rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
+rte_eth_dev_allocate(const char *name)
{
uint8_t port_id;
struct rte_eth_dev *eth_dev;
@@ -215,7 +215,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->attached = DEV_ATTACHED;
- eth_dev->dev_type = type;
eth_dev_last_created_port = port_id;
nb_ports++;
return eth_dev;
@@ -247,7 +246,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
rte_eal_pci_device_name(&pci_dev->addr, ethdev_name,
sizeof(ethdev_name));
- eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI);
+ eth_dev = rte_eth_dev_allocate(ethdev_name);
if (eth_dev == NULL)
return -ENOMEM;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index a7ba1f0..e9aca17 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1606,17 +1606,6 @@ struct rte_eth_rxtx_callback {
};
/**
- * The eth device type.
- */
-enum rte_eth_dev_type {
- RTE_ETH_DEV_UNKNOWN, /**< unknown device type */
- RTE_ETH_DEV_PCI,
- /**< Physical function and Virtual function of PCI devices */
- RTE_ETH_DEV_VIRTUAL, /**< non hardware device */
- RTE_ETH_DEV_MAX /**< max value of this enum */
-};
-
-/**
* @internal
* The generic data structure associated with each ethernet device.
*
@@ -1646,7 +1635,6 @@ struct rte_eth_dev {
*/
struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
uint8_t attached; /**< Flag indicating the port is attached */
- enum rte_eth_dev_type dev_type; /**< Flag indicating the device type */
} __rte_cache_aligned;
struct rte_eth_dev_sriov {
@@ -1760,8 +1748,7 @@ struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
-struct rte_eth_dev *rte_eth_dev_allocate(const char *name,
- enum rte_eth_dev_type type);
+struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
/**
* @internal
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 15/24] eal: extract vdev infra
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (13 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 14/24] ethdev: get rid of device type Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 16/24] eal: remove PDEV/VDEV unused code Shreyansh Jain
` (11 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Move all PMD_VDEV-specific code into a separate module and header
file to not polute the generic code anymore. There is now a list
of virtual devices available.
The rte_vdev_driver integrates the original rte_driver inside
(C inheritance). The rte_driver will be however change in the
future to serve as a common base for all other types of drivers.
The existing PMDs (PMD_VDEV) are to be modified later (there is
no change for them at the moment).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/bsdapp/eal/rte_eal_version.map | 3 +
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/common/eal_common_dev.c | 54 +-----------
lib/librte_eal/common/eal_common_vdev.c | 112 ++++++++++++++++++++++++
lib/librte_eal/common/include/rte_vdev.h | 85 ++++++++++++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 +
8 files changed, 207 insertions(+), 54 deletions(-)
create mode 100644 lib/librte_eal/common/eal_common_vdev.c
create mode 100644 lib/librte_eal/common/include/rte_vdev.h
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 7a0fea5..5a3fc1d 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -69,6 +69,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 7b3d409..ec61017 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -168,4 +168,7 @@ DPDK_16.11 {
rte_eal_dev_attach;
rte_eal_dev_detach;
+ rte_eal_vdrv_register;
+ rte_eal_vdrv_unregister;
+
} DPDK_16.07;
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index bb9810d..dfd64aa 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -38,7 +38,7 @@ INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h
INC += rte_eal_memconfig.h rte_malloc_heap.h
-INC += rte_hexdump.h rte_devargs.h rte_dev.h
+INC += rte_hexdump.h rte_devargs.h rte_dev.h rte_vdev.h
INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
INC += rte_malloc.h rte_keepalive.h rte_time.h
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 88f9d3f..555e0d9 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -64,32 +64,6 @@ rte_eal_driver_unregister(struct rte_driver *driver)
}
int
-rte_eal_vdev_init(const char *name, const char *args)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->init(name, args);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
-int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
@@ -98,7 +72,7 @@ rte_eal_dev_init(void)
/*
* Note that the dev_driver_list is populated here
* from calls made to rte_eal_driver_register from constructor functions
- * embedded into PMD modules via the PMD_REGISTER_DRIVER macro
+ * embedded into PMD modules via the DRIVER_REGISTER_VDEV macro
*/
/* call the init function for each virtual device */
@@ -125,32 +99,6 @@ rte_eal_dev_init(void)
return 0;
}
-int
-rte_eal_vdev_uninit(const char *name)
-{
- struct rte_driver *driver;
-
- if (name == NULL)
- return -EINVAL;
-
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_VDEV)
- continue;
-
- /*
- * search a driver prefix in virtual device name.
- * For example, if the driver is pcap PMD, driver->name
- * will be "eth_pcap", but "name" will be "eth_pcapN".
- * So use strncmp to compare.
- */
- if (!strncmp(driver->name, name, strlen(driver->name)))
- return driver->uninit(name);
- }
-
- RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
- return -EINVAL;
-}
-
int rte_eal_dev_attach(const char *name, const char *devargs)
{
struct rte_pci_addr addr;
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
new file mode 100644
index 0000000..462517f
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -0,0 +1,112 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/queue.h>
+
+#include <rte_vdev.h>
+#include <rte_common.h>
+
+struct vdev_driver_list vdev_driver_list =
+ TAILQ_HEAD_INITIALIZER(vdev_driver_list);
+
+/* register a driver */
+void
+rte_eal_vdrv_register(struct rte_vdev_driver *driver)
+{
+ TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+}
+
+/* unregister a driver */
+void
+rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
+{
+ TAILQ_REMOVE(&vdev_driver_list, driver, next);
+}
+
+int
+rte_eal_vdev_init(const char *name, const char *args)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)))
+ return driver->driver.init(name, args);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
+
+int
+rte_eal_vdev_uninit(const char *name)
+{
+ struct rte_vdev_driver *driver;
+
+ if (name == NULL)
+ return -EINVAL;
+
+ TAILQ_FOREACH(driver, &vdev_driver_list, next) {
+ if (driver->driver.type != PMD_VDEV)
+ continue;
+
+ /*
+ * search a driver prefix in virtual device name.
+ * For example, if the driver is pcap PMD, driver->name
+ * will be "eth_pcap", but "name" will be "eth_pcapN".
+ * So use strncmp to compare.
+ */
+ if (!strncmp(driver->driver.name, name,
+ strlen(driver->driver.name)))
+ return driver->driver.uninit(name);
+ }
+
+ RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
+ return -EINVAL;
+}
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
new file mode 100644
index 0000000..9c5cc54
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -0,0 +1,85 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 RehiveTech. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of RehiveTech nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTE_VDEV_H
+#define RTE_VDEV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/queue.h>
+#include <rte_dev.h>
+
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
+
+/**
+ * A virtual device driver abstraction.
+ */
+struct rte_vdev_driver {
+ TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
+ struct rte_driver driver; /**< Inherited general driver. */
+};
+
+/**
+ * Register a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be registered.
+ */
+void rte_eal_vdrv_register(struct rte_vdev_driver *driver);
+
+/**
+ * Unregister a virtual device driver.
+ *
+ * @param driver
+ * A pointer to a rte_vdev_driver structure describing the driver
+ * to be unregistered.
+ */
+void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver);
+
+#define DRIVER_REGISTER_VDEV(nm, vdrv)\
+RTE_INIT(vdrvinitfn_ ##vdrv);\
+static void vdrvinitfn_ ##vdrv(void)\
+{\
+ (vdrv).driver.name = RTE_STR(nm);\
+ rte_eal_vdrv_register(&vdrv);\
+} \
+DRIVER_EXPORT_NAME(nm, __COUNTER__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 193957f..4e206f0 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -77,6 +77,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index c0bd391..b8bfd4b 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -172,4 +172,7 @@ DPDK_16.11 {
rte_eal_dev_attach;
rte_eal_dev_detach;
+ rte_eal_vdrv_register;
+ rte_eal_vdrv_unregister;
+
} DPDK_16.07;
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 16/24] eal: remove PDEV/VDEV unused code
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (14 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 15/24] eal: extract vdev infra Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 17/24] drivers: convert VDRV to use RTE VDEV Driver Shreyansh Jain
` (10 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
- Remove checks for VDEV from rte_eal_vdev_(init/uninint) as all devices
are inherently virtual here.
- PDEVs perform PCI specific inits - rte_eal_dev_init() need not call
rte_driver->init();
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 8 --------
lib/librte_eal/common/eal_common_vdev.c | 6 ------
2 files changed, 14 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 555e0d9..afa33fa 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -67,7 +67,6 @@ int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
- struct rte_driver *driver;
/*
* Note that the dev_driver_list is populated here
@@ -89,13 +88,6 @@ rte_eal_dev_init(void)
}
}
- /* Once the vdevs are initalized, start calling all the pdev drivers */
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_PDEV)
- continue;
- /* PDEV drivers don't get passed any parameters */
- driver->init(NULL, NULL);
- }
return 0;
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 462517f..67cb397 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -66,9 +66,6 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -93,9 +90,6 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &vdev_driver_list, next) {
- if (driver->driver.type != PMD_VDEV)
- continue;
-
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 17/24] drivers: convert VDRV to use RTE VDEV Driver
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (15 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 16/24] eal: remove PDEV/VDEV unused code Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 18/24] eal: remove unused PMD types Shreyansh Jain
` (9 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
All PMD_VDEV drivers can now use rte_vdev_driver instead of the
rte_driver (which is embedded in the rte_vdev_driver).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 10 ++++++----
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 10 ++++++----
drivers/crypto/kasumi/rte_kasumi_pmd.c | 10 ++++++----
drivers/crypto/null/null_crypto_pmd.c | 10 ++++++----
drivers/crypto/snow3g/rte_snow3g_pmd.c | 10 ++++++----
drivers/net/af_packet/rte_eth_af_packet.c | 10 ++++++----
drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++++++----
drivers/net/mpipe/mpipe_tilegx.c | 18 +++++++++++-------
drivers/net/null/rte_eth_null.c | 10 ++++++----
drivers/net/pcap/rte_eth_pcap.c | 10 ++++++----
drivers/net/ring/rte_eth_ring.c | 10 ++++++----
drivers/net/vhost/rte_eth_vhost.c | 10 ++++++----
drivers/net/virtio/virtio_user_ethdev.c | 9 ++++++---
drivers/net/xenvirt/rte_eth_xenvirt.c | 10 ++++++----
lib/librte_eal/common/eal_common_vdev.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 12 ------------
lib/librte_eal/common/include/rte_vdev.h | 12 ++++++++++++
17 files changed, 103 insertions(+), 72 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dc0b033..c93ebfe 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -37,7 +37,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -514,13 +514,15 @@ aesni_gcm_uninit(const char *name)
return 0;
}
-static struct rte_driver aesni_gcm_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver aesni_gcm_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = aesni_gcm_init,
.uninit = aesni_gcm_uninit
};
-PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv, CRYPTODEV_NAME_AESNI_GCM_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b2d0c8c..30c0706 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -34,7 +34,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -714,13 +714,15 @@ cryptodev_aesni_mb_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drv, CRYPTODEV_NAME_AESNI_MB_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_MB_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 4e21743..ba2829d 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -650,13 +650,15 @@ cryptodev_kasumi_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_kasumi_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_kasumi_init,
.uninit = cryptodev_kasumi_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv, CRYPTODEV_NAME_KASUMI_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 909b04f..4c12faa 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -33,7 +33,7 @@
#include <rte_common.h>
#include <rte_config.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include "null_crypto_pmd_private.h"
@@ -268,13 +268,15 @@ cryptodev_null_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_null_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_null_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_null_init,
.uninit = cryptodev_null_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv, CRYPTODEV_NAME_NULL_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 87cd070..10c6b83 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -35,7 +35,7 @@
#include <rte_hexdump.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
@@ -638,13 +638,15 @@ cryptodev_snow3g_uninit(const char *name)
return 0;
}
-static struct rte_driver cryptodev_snow3g_pmd_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = cryptodev_snow3g_init,
.uninit = cryptodev_snow3g_uninit
};
-PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv, CRYPTODEV_NAME_SNOW3G_PMD);
+DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, cryptodev_snow3g_pmd_drv);
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SNOW3G_PMD,
"max_nb_queue_pairs=<int> "
"max_nb_sessions=<int> "
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 93ae2d7..050f8fc 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -40,7 +40,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
@@ -889,13 +889,15 @@ rte_pmd_af_packet_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_af_packet_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_af_packet_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_af_packet_devinit,
.uninit = rte_pmd_af_packet_devuninit,
};
-PMD_REGISTER_DRIVER(pmd_af_packet_drv, net_af_packet);
+DRIVER_REGISTER_VDEV(net_af_packet, pmd_af_packet_drv);
DRIVER_REGISTER_PARAM_STRING(net_af_packet,
"iface=<string> "
"qpairs=<int> "
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 09ce7bf..e19fc5e 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -42,7 +42,7 @@
#include <rte_ip_frag.h>
#include <rte_devargs.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_alarm.h>
#include <rte_cycles.h>
@@ -2508,13 +2508,15 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
return 0;
}
-static struct rte_driver bond_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver bond_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = bond_init,
.uninit = bond_uninit,
};
-PMD_REGISTER_DRIVER(bond_drv, net_bonding);
+DRIVER_REGISTER_VDEV(net_bonding, bond_drv);
DRIVER_REGISTER_PARAM_STRING(net_bonding,
"slave=<ifc> "
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 66b43ec..135b78f 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <rte_eal.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_eal_memconfig.h>
#include <rte_ethdev.h>
#include <rte_malloc.h>
@@ -1623,18 +1623,22 @@ rte_pmd_mpipe_devinit(const char *ifname,
return 0;
}
-static struct rte_driver pmd_mpipe_xgbe_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_mpipe_devinit,
};
-static struct rte_driver pmd_mpipe_gbe_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_mpipe_devinit,
};
-PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv, net_mpipe_xgbe);
-PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv, net_mpipe_gbe);
+DRIVER_REGISTER_VDEV(net_mpipe_xgbe, pmd_mpipe_xgbe_drv);
+DRIVER_REGISTER_VDEV(net_mpipe_gbe, pmd_mpipe_gbe_drv);
static void __attribute__((constructor, used))
mpipe_init_contexts(void)
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 42ec107..c83b62b 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -35,7 +35,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_spinlock.h>
@@ -686,13 +686,15 @@ rte_pmd_null_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_null_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_null_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit,
};
-PMD_REGISTER_DRIVER(pmd_null_drv, net_null);
+DRIVER_REGISTER_VDEV(net_null, pmd_null_drv);
DRIVER_REGISTER_PARAM_STRING(net_null,
"size=<int> "
"copy=<int>");
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 418fc52..8c7f6eb 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -40,7 +40,7 @@
#include <rte_string_fns.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <net/if.h>
@@ -1083,13 +1083,15 @@ rte_pmd_pcap_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_pcap_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_pcap_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit,
};
-PMD_REGISTER_DRIVER(pmd_pcap_drv, net_pcap);
+DRIVER_REGISTER_VDEV(net_pcap, pmd_pcap_drv);
DRIVER_REGISTER_PARAM_STRING(net_pcap,
"rx_pcap=<string> "
"tx_pcap=<string> "
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index b90684c..9cdeb51 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -38,7 +38,7 @@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_errno.h>
@@ -623,12 +623,14 @@ rte_pmd_ring_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_ring_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_ring_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit,
};
-PMD_REGISTER_DRIVER(pmd_ring_drv, net_ring);
+DRIVER_REGISTER_VDEV(net_ring, pmd_ring_drv);
DRIVER_REGISTER_PARAM_STRING(net_ring,
"nodeaction=[attach|detach]");
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index d0bffbd..01a1f18 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -41,7 +41,7 @@
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_virtio_net.h>
#include <rte_spinlock.h>
@@ -924,13 +924,15 @@ rte_pmd_vhost_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_vhost_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_vhost_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_vhost_devinit,
.uninit = rte_pmd_vhost_devuninit,
};
-PMD_REGISTER_DRIVER(pmd_vhost_drv, net_vhost);
+DRIVER_REGISTER_VDEV(net_vhost, pmd_vhost_drv);
DRIVER_REGISTER_PARAM_STRING(net_vhost,
"iface=<ifc> "
"queues=<int>");
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index c682d8f..50de484 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -37,6 +37,7 @@
#include <rte_malloc.h>
#include <rte_kvargs.h>
+#include <rte_vdev.h>
#include "virtio_ethdev.h"
#include "virtio_logs.h"
@@ -461,13 +462,15 @@ virtio_user_pmd_devuninit(const char *name)
return 0;
}
-static struct rte_driver virtio_user_driver = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver virtio_user_driver = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = virtio_user_pmd_devinit,
.uninit = virtio_user_pmd_devuninit,
};
-PMD_REGISTER_DRIVER(virtio_user_driver, net_virtio_user);
+DRIVER_REGISTER_VDEV(net_virtio_user, virtio_user_driver);
DRIVER_REGISTER_PARAM_STRING(net_virtio_user,
"path=<path> "
"mac=<mac addr> "
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 2ffa54c..605aba9 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -56,7 +56,7 @@
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
#include <cmdline_parse.h>
#include <cmdline_parse_etheraddr.h>
@@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
return 0;
}
-static struct rte_driver pmd_xenvirt_drv = {
- .type = PMD_VDEV,
+static struct rte_vdev_driver pmd_xenvirt_drv = {
+ .driver = {
+ .type = PMD_VDEV,
+ },
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit,
};
-PMD_REGISTER_DRIVER(pmd_xenvirt_drv, net_xenvirt);
+DRIVER_REGISTER_VDEV(net_xenvirt, pmd_xenvirt_drv);
DRIVER_REGISTER_PARAM_STRING(net_xenvirt,
"mac=<mac addr>");
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 67cb397..1a4dec6 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -74,7 +74,7 @@ rte_eal_vdev_init(const char *name, const char *args)
*/
if (!strncmp(driver->driver.name, name,
strlen(driver->driver.name)))
- return driver->driver.init(name, args);
+ return driver->init(name, args);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
@@ -98,7 +98,7 @@ rte_eal_vdev_uninit(const char *name)
*/
if (!strncmp(driver->driver.name, name,
strlen(driver->driver.name)))
- return driver->driver.uninit(name);
+ return driver->uninit(name);
}
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 6cc9b01..8796f97 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,16 +105,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Initialization function called for each device driver once.
- */
-typedef int (rte_dev_init_t)(const char *name, const char *args);
-
-/**
- * Uninitilization function called for each device driver once.
- */
-typedef int (rte_dev_uninit_t)(const char *name);
-
-/**
* Driver type enumeration
*/
enum pmd_type {
@@ -129,8 +119,6 @@ struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
- rte_dev_init_t *init; /**< Device init. function. */
- rte_dev_uninit_t *uninit; /**< Device uninit. function. */
};
/**
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 9c5cc54..1e6b338 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -44,11 +44,23 @@ extern "C" {
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
/**
+ * Initialization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_init_t)(const char *name, const char *args);
+
+/**
+ * Uninitilization function called for each virtual device driver once.
+ */
+typedef int (rte_vdev_uninit_t)(const char *name);
+
+/**
* A virtual device driver abstraction.
*/
struct rte_vdev_driver {
TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
struct rte_driver driver; /**< Inherited general driver. */
+ rte_vdev_init_t *init; /**< Virtual device init. function. */
+ rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */
};
/**
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 18/24] eal: remove unused PMD types
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (16 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 17/24] drivers: convert VDRV to use RTE VDEV Driver Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 19/24] eal: include dev headers in place of PCI headers Shreyansh Jain
` (8 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
- All devices register themselfs by calling a kind of DRIVER_REGISTER_XXX.
The PMD_REGISTER_DRIVER is not used anymore.
- PMD_VDEV type is also not being used - can be removed from all VDEVs.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ---
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 ---
drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ---
drivers/crypto/null/null_crypto_pmd.c | 3 ---
drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ---
drivers/net/af_packet/rte_eth_af_packet.c | 3 ---
drivers/net/bonding/rte_eth_bond_pmd.c | 3 ---
drivers/net/mpipe/mpipe_tilegx.c | 6 ------
drivers/net/null/rte_eth_null.c | 3 ---
drivers/net/pcap/rte_eth_pcap.c | 3 ---
drivers/net/ring/rte_eth_ring.c | 3 ---
drivers/net/vhost/rte_eth_vhost.c | 3 ---
drivers/net/virtio/virtio_user_ethdev.c | 3 ---
drivers/net/xenvirt/rte_eth_xenvirt.c | 3 ---
lib/librte_eal/common/include/rte_dev.h | 18 ------------------
15 files changed, 63 deletions(-)
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index c93ebfe..fc939fa 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -515,9 +515,6 @@ aesni_gcm_uninit(const char *name)
}
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = aesni_gcm_init,
.uninit = aesni_gcm_uninit
};
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 30c0706..2047269 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -715,9 +715,6 @@ cryptodev_aesni_mb_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index ba2829d..d1b0b99 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -651,9 +651,6 @@ cryptodev_kasumi_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_kasumi_init,
.uninit = cryptodev_kasumi_uninit
};
diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c
index 4c12faa..bd139b4 100644
--- a/drivers/crypto/null/null_crypto_pmd.c
+++ b/drivers/crypto/null/null_crypto_pmd.c
@@ -269,9 +269,6 @@ cryptodev_null_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_null_init,
.uninit = cryptodev_null_uninit
};
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 10c6b83..c46d7e5 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -639,9 +639,6 @@ cryptodev_snow3g_uninit(const char *name)
}
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = cryptodev_snow3g_init,
.uninit = cryptodev_snow3g_uninit
};
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 050f8fc..5f48ead 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -890,9 +890,6 @@ rte_pmd_af_packet_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_af_packet_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_af_packet_devinit,
.uninit = rte_pmd_af_packet_devuninit,
};
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index e19fc5e..9202481 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2509,9 +2509,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
}
static struct rte_vdev_driver bond_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = bond_init,
.uninit = bond_uninit,
};
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 135b78f..5b2e8cd 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -1624,16 +1624,10 @@ rte_pmd_mpipe_devinit(const char *ifname,
}
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit,
};
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_mpipe_devinit,
};
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index c83b62b..2adc43e 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -687,9 +687,6 @@ rte_pmd_null_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_null_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit,
};
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 8c7f6eb..29cc54b 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -1084,9 +1084,6 @@ rte_pmd_pcap_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_pcap_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit,
};
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 9cdeb51..ee435c1 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -624,9 +624,6 @@ rte_pmd_ring_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_ring_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit,
};
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 01a1f18..1c41613 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -925,9 +925,6 @@ rte_pmd_vhost_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_vhost_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_vhost_devinit,
.uninit = rte_pmd_vhost_devuninit,
};
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 50de484..6afbf39 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -463,9 +463,6 @@ virtio_user_pmd_devuninit(const char *name)
}
static struct rte_vdev_driver virtio_user_driver = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = virtio_user_pmd_devinit,
.uninit = virtio_user_pmd_devuninit,
};
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 605aba9..4ade78c 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -760,9 +760,6 @@ rte_pmd_xenvirt_devuninit(const char *name)
}
static struct rte_vdev_driver pmd_xenvirt_drv = {
- .driver = {
- .type = PMD_VDEV,
- },
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit,
};
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 8796f97..3d0d2b8 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -105,19 +105,10 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
TAILQ_HEAD(rte_driver_list, rte_driver);
/**
- * Driver type enumeration
- */
-enum pmd_type {
- PMD_VDEV = 0,
- PMD_PDEV = 1,
-};
-
-/**
* A structure describing a device driver.
*/
struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
- enum pmd_type type; /**< PMD Driver type */
const char *name; /**< Driver name. */
};
@@ -198,15 +189,6 @@ int rte_eal_dev_detach(const char *name);
static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
__attribute__((used)) = RTE_STR(name)
-#define PMD_REGISTER_DRIVER(drv, nm)\
-RTE_INIT(probefn_ ##drv);\
-static void probefn_ ##drv(void)\
-{\
- (drv).name = RTE_STR(nm);\
- rte_eal_driver_register(&drv);\
-} \
-DRIVER_EXPORT_NAME(nm, __COUNTER__)
-
#define DRV_EXP_TAG(name, tag) __##name##_##tag
#define DRIVER_REGISTER_PCI_TABLE(name, table) \
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 19/24] eal: include dev headers in place of PCI headers
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (17 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 18/24] eal: remove unused PMD types Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 20/24] eal: rename and move RTE PCI Resources Shreyansh Jain
` (7 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Further refactoring and generalization of PCI infrastructure will
require access to the rte_dev.h contents.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/include/rte_pci.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index e1f695f..bb03d41 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -84,6 +84,7 @@ extern "C" {
#include <rte_debug.h>
#include <rte_interrupts.h>
+#include <rte_dev.h>
TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 20/24] eal: rename and move RTE PCI Resources
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (18 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 19/24] eal: include dev headers in place of PCI headers Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 21/24] eal/pci: inherit RTE driver in PCI driver Shreyansh Jain
` (6 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/net/szedata2/rte_eth_szedata2.c | 4 ++--
lib/librte_eal/common/include/rte_dev.h | 8 ++++++++
lib/librte_eal/common/include/rte_pci.h | 12 ++----------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 9302200..f117220 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1416,7 +1416,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
int ret;
uint32_t szedata2_index;
struct rte_pci_addr *pci_addr = &dev->pci_dev->addr;
- struct rte_pci_resource *pci_rsc =
+ struct rte_mem_resource *pci_rsc =
&dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER];
char rsc_filename[PATH_MAX];
void *pci_resource_ptr = NULL;
@@ -1473,7 +1473,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
rte_eth_copy_pci_info(dev, dev->pci_dev);
- /* mmap pci resource0 file to rte_pci_resource structure */
+ /* mmap pci resource0 file to rte_mem_resource structure */
if (dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].phys_addr ==
0) {
RTE_LOG(ERR, PMD, "Missing resource%u file\n",
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 3d0d2b8..5c314bf 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -100,6 +100,14 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
} \
} while (0)
+/**
+ * A generic memory resource representation.
+ */
+struct rte_mem_resource {
+ uint64_t phys_addr; /**< Physical address, 0 if not resource. */
+ uint64_t len; /**< Length of the resource. */
+ void *addr; /**< Virtual address, NULL when not mapped. */
+};
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index bb03d41..67f6ee7 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -108,15 +108,6 @@ const char *pci_get_sysfs_path(void);
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
-/**
- * A structure describing a PCI resource.
- */
-struct rte_pci_resource {
- uint64_t phys_addr; /**< Physical address, 0 if no resource. */
- uint64_t len; /**< Length of the resource. */
- void *addr; /**< Virtual address, NULL when not mapped. */
-};
-
/** Maximum number of PCI resources. */
#define PCI_MAX_RESOURCE 6
@@ -160,7 +151,8 @@ struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
- struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */
+ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+ /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 21/24] eal/pci: inherit RTE driver in PCI driver
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (19 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 20/24] eal: rename and move RTE PCI Resources Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 22/24] eal: register EAL drivers explicitly Shreyansh Jain
` (5 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Remove the 'name' member from rte_pci_driver and move to generic
rte_driver.
Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has
been populated into the rte_driver.name member - assignments through
eth_driver has been removed.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Rebase and expand changes to newly added files]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/test_pci.c | 10 +++++++---
app/test/virtual_pmd.c | 2 +-
drivers/crypto/qat/qat_qp.c | 2 +-
drivers/net/bnx2x/bnx2x_ethdev.c | 2 --
drivers/net/bnx2x/bnx2x_rxtx.c | 3 ++-
drivers/net/bnxt/bnxt_ethdev.c | 1 -
drivers/net/cxgbe/cxgbe_ethdev.c | 1 -
drivers/net/cxgbe/sge.c | 7 ++++---
drivers/net/e1000/em_ethdev.c | 1 -
drivers/net/e1000/igb_ethdev.c | 2 --
drivers/net/ena/ena_ethdev.c | 1 -
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/i40e/i40e_fdir.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 2 --
drivers/net/mlx4/mlx4.c | 4 +++-
drivers/net/mlx5/mlx5.c | 4 +++-
drivers/net/nfp/nfp_net.c | 5 ++---
drivers/net/qede/qede_ethdev.c | 2 --
drivers/net/szedata2/rte_eth_szedata2.c | 1 -
drivers/net/thunderx/nicvf_ethdev.c | 1 -
drivers/net/virtio/virtio_ethdev.c | 3 +--
drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 ++--
drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
lib/librte_cryptodev/rte_cryptodev.c | 4 ++--
lib/librte_eal/common/eal_common_pci.c | 4 ++--
lib/librte_eal/common/include/rte_pci.h | 4 ++--
lib/librte_ether/rte_ethdev.c | 6 +++---
30 files changed, 37 insertions(+), 47 deletions(-)
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index f1b988a..cda186d 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -78,14 +78,18 @@ struct rte_pci_id my_driver_id2[] = {
};
struct rte_pci_driver my_driver = {
- .name = "test_driver",
+ .driver = {
+ .name = "test_driver"
+ },
.probe = my_driver_init,
.id_table = my_driver_id,
.drv_flags = 0,
};
struct rte_pci_driver my_driver2 = {
- .name = "test_driver2",
+ .driver = {
+ .name = "test_driver2"
+ },
.probe = my_driver_init,
.id_table = my_driver_id2,
.drv_flags = 0,
@@ -95,7 +99,7 @@ static int
my_driver_init(__attribute__((unused)) struct rte_pci_driver *dr,
struct rte_pci_device *dev)
{
- printf("My driver init called in %s\n", dr->name);
+ printf("My driver init called in %s\n", dr->driver.name);
printf("%x:%x:%x.%d", dev->addr.domain, dev->addr.bus,
dev->addr.devid, dev->addr.function);
printf(" - vendor:%x device:%x\n", dev->id.vendor_id, dev->id.device_id);
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 8a1f0d0..56eeb99 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -586,7 +586,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
goto err;
pci_dev->numa_node = socket_id;
- pci_drv->name = virtual_ethdev_driver_name;
+ pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
if (isr_support)
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index 5de47e3..2e7188b 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -300,7 +300,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,
* Allocate a memzone for the queue - create a unique name.
*/
snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d",
- dev->driver->pci_drv.name, "qp_mem", dev->data->dev_id,
+ dev->driver->pci_drv.driver.name, "qp_mem", dev->data->dev_id,
queue->hw_bundle_number, queue->hw_queue_number);
qp_mz = queue_dma_zone_reserve(queue->memz_name, queue_size_bytes,
socket_id);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 7d9ecdf..e38c238 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -618,7 +618,6 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_bnx2x_pmd = {
.pci_drv = {
- .name = "rte_bnx2x_pmd",
.id_table = pci_id_bnx2x_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.probe = rte_eth_dev_pci_probe,
@@ -633,7 +632,6 @@ static struct eth_driver rte_bnx2x_pmd = {
*/
static struct eth_driver rte_bnx2xvf_pmd = {
.pci_drv = {
- .name = "rte_bnx2xvf_pmd",
.id_table = pci_id_bnx2xvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 0ec4f89..7adea99 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -19,7 +19,8 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name, dev->data->port_id, queue_id);
+ dev->driver->pci_drv.driver.name, ring_name,
+ dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
if (mz)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d389fc8..aee2db8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1045,7 +1045,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
static struct eth_driver bnxt_rte_pmd = {
.pci_drv = {
- .name = "rte_" DRV_MODULE_NAME "_pmd",
.id_table = bnxt_pci_id_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index bb929a9..d3ff94a 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1039,7 +1039,6 @@ out_free_adapter:
static struct eth_driver rte_cxgbe_pmd = {
.pci_drv = {
- .name = "rte_cxgbe_pmd",
.id_table = cxgb4_pci_tbl,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index ab5a842..736f08c 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1645,7 +1645,8 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
iq->size = cxgbe_roundup(iq->size, 16);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, fwevtq ? "fwq_ring" : "rx_ring",
+ eth_dev->driver->pci_drv.driver.name,
+ fwevtq ? "fwq_ring" : "rx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1697,7 +1698,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
fl->size = cxgbe_roundup(fl->size, 8);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
fwevtq ? "fwq_ring" : "fl_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
@@ -1893,7 +1894,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- eth_dev->driver->pci_drv.name, "tx_ring",
+ eth_dev->driver->pci_drv.driver.name, "tx_ring",
eth_dev->data->port_id, queue_id);
snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index d4914a5..f767e1c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -391,7 +391,6 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_em_pmd = {
.pci_drv = {
- .name = "rte_em_pmd",
.id_table = pci_id_em_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index c54c8e8..5a1a83e 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1078,7 +1078,6 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_igb_pmd = {
.pci_drv = {
- .name = "rte_igb_pmd",
.id_table = pci_id_igb_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1095,7 +1094,6 @@ static struct eth_driver rte_igb_pmd = {
*/
static struct eth_driver rte_igbvf_pmd = {
.pci_drv = {
- .name = "rte_igbvf_pmd",
.id_table = pci_id_igbvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 85c5086..6efd801 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1686,7 +1686,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
static struct eth_driver rte_ena_pmd = {
.pci_drv = {
- .name = "rte_ena_pmd",
.id_table = pci_id_ena_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 9006197..2ac0476 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -613,7 +613,6 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_enic_pmd = {
.pci_drv = {
- .name = "rte_enic_pmd",
.id_table = pci_id_enic_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8d55c43..71d35f7 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3055,7 +3055,6 @@ static const struct rte_pci_id pci_id_fm10k_map[] = {
static struct eth_driver rte_pmd_fm10k = {
.pci_drv = {
- .name = "rte_pmd_fm10k",
.id_table = pci_id_fm10k_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 56bd2c6..5564e82 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -663,7 +663,6 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
static struct eth_driver rte_i40e_pmd = {
.pci_drv = {
- .name = "rte_i40e_pmd",
.id_table = pci_id_i40e_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 8177626..34eb274 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1554,7 +1554,6 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
*/
static struct eth_driver rte_i40evf_pmd = {
.pci_drv = {
- .name = "rte_i40evf_pmd",
.id_table = pci_id_i40evf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index f65c411..a4efc6d 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -251,7 +251,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
/* reserve memory for the fdir programming packet */
snprintf(z_name, sizeof(z_name), "%s_%s_%d",
- eth_dev->driver->pci_drv.name,
+ eth_dev->driver->pci_drv.driver.name,
I40E_FDIR_MZ_NAME,
eth_dev->data->port_id);
mz = i40e_memzone_reserve(z_name, I40E_FDIR_PKT_LEN, SOCKET_ID_ANY);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4b9e3d4..fbe1756 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1562,7 +1562,6 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_ixgbe_pmd = {
.pci_drv = {
- .name = "rte_ixgbe_pmd",
.id_table = pci_id_ixgbe_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
@@ -1579,7 +1578,6 @@ static struct eth_driver rte_ixgbe_pmd = {
*/
static struct eth_driver rte_ixgbevf_pmd = {
.pci_drv = {
- .name = "rte_ixgbevf_pmd",
.id_table = pci_id_ixgbevf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 6efea24..e952bd8 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5911,7 +5911,9 @@ static const struct rte_pci_id mlx4_pci_id_map[] = {
static struct eth_driver mlx4_driver = {
.pci_drv = {
- .name = MLX4_DRIVER_NAME,
+ .driver = {
+ .name = MLX4_DRIVER_NAME
+ },
.id_table = mlx4_pci_id_map,
.probe = mlx4_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index f1de40a..16f9891 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -728,7 +728,9 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
static struct eth_driver mlx5_driver = {
.pci_drv = {
- .name = MLX5_DRIVER_NAME,
+ .driver = {
+ .name = MLX5_DRIVER_NAME
+ },
.id_table = mlx5_pci_id_map,
.probe = mlx5_pci_probe,
.drv_flags = RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index e140074..d43db47 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -214,7 +214,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name,
+ dev->driver->pci_drv.driver.name,
ring_name, dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -1000,7 +1000,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->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
dev_info->min_rx_bufsize = ETHER_MIN_MTU;
@@ -2460,7 +2460,6 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
static struct eth_driver rte_nfp_net_pmd = {
.pci_drv = {
- .name = "rte_nfp_net_pmd",
.id_table = pci_id_nfp_net_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
RTE_PCI_DRV_DETACHABLE,
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 696a32b..d00c1d9 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1478,7 +1478,6 @@ static struct rte_pci_id pci_id_qede_map[] = {
static struct eth_driver rte_qedevf_pmd = {
.pci_drv = {
- .name = "rte_qedevf_pmd",
.id_table = pci_id_qedevf_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
@@ -1492,7 +1491,6 @@ static struct eth_driver rte_qedevf_pmd = {
static struct eth_driver rte_qede_pmd = {
.pci_drv = {
- .name = "rte_qede_pmd",
.id_table = pci_id_qede_map,
.drv_flags =
RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index f117220..f4ec5ea 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1572,7 +1572,6 @@ static const struct rte_pci_id rte_szedata2_pci_id_table[] = {
static struct eth_driver szedata2_eth_driver = {
.pci_drv = {
- .name = RTE_SZEDATA2_PCI_DRIVER_NAME,
.id_table = rte_szedata2_pci_id_table,
.probe = rte_eth_dev_pci_probe,
.remove = rte_eth_dev_pci_remove,
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 9ccf59e..d98a537 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1759,7 +1759,6 @@ static const struct rte_pci_id pci_id_nicvf_map[] = {
static struct eth_driver rte_nicvf_pmd = {
.pci_drv = {
- .name = "rte_nicvf_pmd",
.id_table = pci_id_nicvf_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 1c2bf01..b05bb40 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1304,7 +1304,6 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_virtio_pmd = {
.pci_drv = {
- .name = "rte_virtio_pmd",
.id_table = pci_id_virtio_map,
.drv_flags = RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
@@ -1534,7 +1533,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct virtio_hw *hw = dev->data->dev_private;
if (dev->pci_dev)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
else
dev_info->driver_name = "virtio_user PMD";
dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index f15cda5..fa49759 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -137,7 +137,8 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%d_%s",
- dev->driver->pci_drv.name, dev->data->port_id, post_string);
+ dev->driver->pci_drv.driver.name,
+ dev->data->port_id, post_string);
mz = rte_memzone_lookup(z_name);
if (mz)
@@ -328,7 +329,6 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
static struct eth_driver rte_vmxnet3_pmd = {
.pci_drv = {
- .name = "rte_vmxnet3_pmd",
.id_table = pci_id_vmxnet3_map,
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
.probe = rte_eth_dev_pci_probe,
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index f97f4d0..42c9d95 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -773,7 +773,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 17e4502..127e8d0 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -458,7 +458,7 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
CDEV_LOG_ERR("driver %s: crypto_dev_init(vendor_id=0x%x device_id=0x%x)"
- " failed", pci_drv->name,
+ " failed", pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
@@ -869,7 +869,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
dev_info->pci_dev = dev->pci_dev;
if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->driver->pci_drv.driver.name;
}
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index bef7ee8..79f5526 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -195,7 +195,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
}
RTE_LOG(INFO, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
/* map resources for devices that use igb_uio */
@@ -255,7 +255,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
loc->function, dev->numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
- dev->id.device_id, dr->name);
+ dev->id.device_id, dr->driver.name);
if (dr->remove && (dr->remove(dev) < 0))
return -1; /* negative value is an error */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 67f6ee7..f0a9ea2 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -200,7 +200,7 @@ typedef int (pci_remove_t)(struct rte_pci_device *);
*/
struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
- const char *name; /**< Driver name. */
+ struct rte_driver driver; /**< Inherit core driver. */
pci_probe_t *probe; /**< Device Probe function. */
pci_remove_t *remove; /**< Device Remove function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
@@ -492,7 +492,7 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);
RTE_INIT(pciinitfn_ ##nm); \
static void pciinitfn_ ##nm(void) \
{\
- (pci_drv).name = RTE_STR(nm);\
+ (pci_drv).driver.name = RTE_STR(nm);\
rte_eal_pci_register(&pci_drv); \
} \
DRIVER_EXPORT_NAME(nm, __COUNTER__)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index cc2f921..a88a05d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -275,7 +275,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
return 0;
RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
- pci_drv->name,
+ pci_drv->driver.name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
@@ -2568,7 +2568,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
const struct rte_memzone *mz;
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
- dev->driver->pci_drv.name, ring_name,
+ dev->driver->pci_drv.driver.name, ring_name,
dev->data->port_id, queue_id);
mz = rte_memzone_lookup(z_name);
@@ -3210,7 +3210,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->kdrv = pci_dev->kdrv;
eth_dev->data->numa_node = pci_dev->numa_node;
- eth_dev->data->drv_name = pci_dev->driver->name;
+ eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
int
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 22/24] eal: register EAL drivers explicitly
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (20 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 21/24] eal/pci: inherit RTE driver in PCI driver Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 23/24] eal: introduce generalized RTE device Shreyansh Jain
` (4 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
To register both vdev and pci drivers into the list of all rte_driver,
we have to call rte_eal_driver_register explicitly.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_pci.c | 2 ++
lib/librte_eal/common/eal_common_vdev.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 79f5526..0b032d6 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -471,11 +471,13 @@ void
rte_eal_pci_register(struct rte_pci_driver *driver)
{
TAILQ_INSERT_TAIL(&pci_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_pci_unregister(struct rte_pci_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&pci_driver_list, driver, next);
}
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 1a4dec6..6dab782 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -48,12 +48,14 @@ void
rte_eal_vdrv_register(struct rte_vdev_driver *driver)
{
TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next);
+ rte_eal_driver_register(&driver->driver);
}
/* unregister a driver */
void
rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
{
+ rte_eal_driver_unregister(&driver->driver);
TAILQ_REMOVE(&vdev_driver_list, driver, next);
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 23/24] eal: introduce generalized RTE device
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (21 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 22/24] eal: register EAL drivers explicitly Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 24/24] eal/pci: create RTE device list and fallback on its members Shreyansh Jain
` (3 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
lib/librte_eal/common/eal_common_dev.c | 13 +++++++++++++
lib/librte_eal/common/include/rte_dev.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index afa33fa..d1f0ad8 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -48,6 +48,9 @@
/** Global list of device drivers. */
static struct rte_driver_list dev_driver_list =
TAILQ_HEAD_INITIALIZER(dev_driver_list);
+/** Global list of device drivers. */
+static struct rte_device_list dev_device_list =
+ TAILQ_HEAD_INITIALIZER(dev_device_list);
/* register a driver */
void
@@ -63,6 +66,16 @@ rte_eal_driver_unregister(struct rte_driver *driver)
TAILQ_REMOVE(&dev_driver_list, driver, next);
}
+void rte_eal_device_insert(struct rte_device *dev)
+{
+ TAILQ_INSERT_TAIL(&dev_device_list, dev, next);
+}
+
+void rte_eal_device_remove(struct rte_device *dev)
+{
+ TAILQ_REMOVE(&dev_device_list, dev, next);
+}
+
int
rte_eal_dev_init(void)
{
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 5c314bf..d159991 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -111,6 +111,37 @@ struct rte_mem_resource {
/** Double linked list of device drivers. */
TAILQ_HEAD(rte_driver_list, rte_driver);
+/** Double linked list of devices. */
+TAILQ_HEAD(rte_device_list, rte_device);
+
+/* Forward declaration */
+struct rte_driver;
+
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+ TAILQ_ENTRY(rte_device) next; /**< Next device */
+ struct rte_driver *driver; /**< Associated driver */
+ int numa_node; /**< NUMA node connection */
+ struct rte_devargs *devargs; /**< Device user arguments */
+};
+
+/**
+ * Insert a device detected by a bus scanning.
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the detected device.
+ */
+void rte_eal_device_insert(struct rte_device *dev);
+
+/**
+ * Remove a device (e.g. when being unplugged).
+ *
+ * @param dev
+ * A pointer to a rte_device structure describing the device to be removed.
+ */
+void rte_eal_device_remove(struct rte_device *dev);
/**
* A structure describing a device driver.
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* [dpdk-dev] [PATCH v11 24/24] eal/pci: create RTE device list and fallback on its members
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (22 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 23/24] eal: introduce generalized RTE device Shreyansh Jain
@ 2016-09-20 12:41 ` Shreyansh Jain
2016-09-21 19:03 ` [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization Matej Vido
` (2 subsequent siblings)
26 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-20 12:41 UTC (permalink / raw)
To: dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon,
Shreyansh Jain
From: Jan Viktorin <viktorin@rehivetech.com>
Now that rte_device is available, drivers can start using its members
(numa, name) as well as link themselves into another rte_device list.
As of now no one is using this list, but can be used for moving over all
devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log for extra rte_device list]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
app/test/virtual_pmd.c | 4 ++--
drivers/net/fm10k/fm10k_ethdev.c | 6 +++---
drivers/net/i40e/i40e_ethdev.c | 6 ++++--
drivers/net/mlx5/mlx5.c | 2 +-
drivers/net/virtio/virtio_pci.c | 5 +++--
lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +-
lib/librte_eal/common/eal_common_pci.c | 11 ++++++-----
lib/librte_eal/common/include/rte_pci.h | 3 +--
lib/librte_eal/linuxapp/eal/eal_pci.c | 7 +++++--
lib/librte_ether/rte_ethdev.c | 2 +-
10 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 56eeb99..4831113 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -585,7 +585,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
if (eth_dev == NULL)
goto err;
- pci_dev->numa_node = socket_id;
+ pci_dev->device.numa_node = socket_id;
pci_drv->driver.name = virtual_ethdev_driver_name;
pci_drv->id_table = id_table;
@@ -626,7 +626,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
eth_dev->dev_ops = &dev_private->dev_ops;
eth_dev->pci_dev = pci_dev;
- eth_dev->pci_dev->driver = ð_drv->pci_drv;
+ eth_dev->pci_dev->device.driver = ð_drv->pci_drv.driver;
eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success;
eth_dev->tx_pkt_burst = virtual_ethdev_tx_burst_success;
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 71d35f7..ed666c1 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -675,7 +675,7 @@ fm10k_dev_tx_init(struct rte_eth_dev *dev)
/* Enable use of FTAG bit in TX descriptor, PFVTCTL
* register is read-only for VF.
*/
- if (fm10k_check_ftag(dev->pci_dev->devargs)) {
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs)) {
if (hw->mac.type == fm10k_mac_pf) {
FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i),
FM10K_PFVTCTL_FTAG_DESC_ENABLE);
@@ -2731,7 +2731,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
int use_sse = 1;
uint16_t tx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
tx_ftag_en = 1;
for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -2762,7 +2762,7 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)
uint16_t i, rx_using_sse;
uint16_t rx_ftag_en = 0;
- if (fm10k_check_ftag(dev->pci_dev->devargs))
+ if (fm10k_check_ftag(dev->pci_dev->device.devargs))
rx_ftag_en = 1;
/* In order to allow Vector Rx there are a few configuration
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5564e82..cfea11f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -905,8 +905,10 @@ config_floating_veb(struct rte_eth_dev *dev)
memset(pf->floating_veb_list, 0, sizeof(pf->floating_veb_list));
if (hw->aq.fw_maj_ver >= FLOATING_VEB_SUPPORTED_FW_MAJ) {
- pf->floating_veb = is_floating_veb_supported(pci_dev->devargs);
- config_vf_floating_veb(pci_dev->devargs, pf->floating_veb,
+ pf->floating_veb =
+ is_floating_veb_supported(pci_dev->device.devargs);
+ config_vf_floating_veb(pci_dev->device.devargs,
+ pf->floating_veb,
pf->floating_veb_list);
} else {
pf->floating_veb = false;
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 16f9891..a0b7e15 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -511,7 +511,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
priv->mtu = ETHER_MTU;
priv->mps = mps; /* Enable MPW by default if supported. */
priv->cqe_comp = 1; /* Enable compression by default. */
- err = mlx5_args(priv, pci_dev->devargs);
+ err = mlx5_args(priv, pci_dev->device.devargs);
if (err) {
ERROR("failed to process device arguments: %s",
strerror(err));
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index f1a7ca7..9b47165 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -745,8 +745,9 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
- (!dev->devargs ||
- dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
+ (!dev->device.devargs ||
+ dev->device.devargs->type !=
+ RTE_DEVTYPE_WHITELISTED_PCI)) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
return 1;
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 1d91c78..8b3ed88 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -287,7 +287,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
dev->max_vfs = 0;
/* FreeBSD has no NUMA support (yet) */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
/* FreeBSD has only one pass through driver */
dev->kdrv = RTE_KDRV_NIC_UIO;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 0b032d6..609c424 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -185,11 +185,12 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
RTE_LOG(INFO, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid, loc->function,
- dev->numa_node);
+ dev->device.numa_node);
/* no initialization when blacklisted, return without error */
- if (dev->devargs != NULL &&
- dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {
+ if (dev->device.devargs != NULL &&
+ dev->device.devargs->type ==
+ RTE_DEVTYPE_BLACKLISTED_PCI) {
RTE_LOG(INFO, EAL, " Device is blacklisted, not initializing\n");
return 1;
}
@@ -252,7 +253,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
loc->domain, loc->bus, loc->devid,
- loc->function, dev->numa_node);
+ loc->function, dev->device.numa_node);
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->driver.name);
@@ -418,7 +419,7 @@ rte_eal_pci_probe(void)
/* set devargs in PCI structure */
devargs = pci_devargs_lookup(dev);
if (devargs != NULL)
- dev->devargs = devargs;
+ dev->device.devargs = devargs;
/* probe all or only whitelisted devices */
if (probe_all)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index f0a9ea2..3a8e8c8 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -149,6 +149,7 @@ enum rte_kernel_driver {
*/
struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
+ struct rte_device device; /**< Inherit core device */
struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
@@ -156,8 +157,6 @@ struct rte_pci_device {
struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */
- int numa_node; /**< NUMA node connection */
- struct rte_devargs *devargs; /**< Device user arguments */
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
};
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 62da4d4..876ba38 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -350,13 +350,13 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
dirname);
if (access(filename, R_OK) != 0) {
/* if no NUMA support, set default to 0 */
- dev->numa_node = 0;
+ dev->device.numa_node = 0;
} else {
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
free(dev);
return -1;
}
- dev->numa_node = tmp;
+ dev->device.numa_node = tmp;
}
/* parse resources */
@@ -390,6 +390,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
/* device is valid, add in list (sorted) */
if (TAILQ_EMPTY(&pci_device_list)) {
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
} else {
struct rte_pci_device *dev2;
@@ -402,6 +403,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
if (ret < 0) {
TAILQ_INSERT_BEFORE(dev2, dev, next);
+ rte_eal_device_insert(&dev->device);
} else { /* already registered */
dev2->kdrv = dev->kdrv;
dev2->max_vfs = dev->max_vfs;
@@ -411,6 +413,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
return 0;
}
+ rte_eal_device_insert(&dev->device);
TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
}
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a88a05d..c517e88 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3209,7 +3209,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
eth_dev->data->kdrv = pci_dev->kdrv;
- eth_dev->data->numa_node = pci_dev->numa_node;
+ eth_dev->data->numa_node = pci_dev->device.numa_node;
eth_dev->data->drv_name = pci_dev->driver->driver.name;
}
--
2.7.4
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (23 preceding siblings ...)
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 24/24] eal/pci: create RTE device list and fallback on its members Shreyansh Jain
@ 2016-09-21 19:03 ` Matej Vido
2016-09-22 4:25 ` Shreyansh Jain
2016-09-30 10:22 ` David Marchand
2016-10-03 14:28 ` Thomas Monjalon
26 siblings, 1 reply; 375+ messages in thread
From: Matej Vido @ 2016-09-21 19:03 UTC (permalink / raw)
To: Shreyansh Jain
Cc: dev, viktorin, David Marchand, hemant.agrawal, Thomas Monjalon
Hi Shreyansh,
I have tested this patch-set with szedata2 driver and it works fine.
Regards,
Matej
On 20.09.2016 14:41, Shreyansh Jain wrote:
> Based on master (e15922d75)
>
> Background:
> ===========
>
> It includes two different patch-sets floated on ML earlier:
> * Original patch series is from David Marchand [1], [2].
> `- This focused mainly on PCI (PDEV) part
> `- v7 of this was posted by me [8] in August/2016
> * Patch series [4] from Jan Viktorin
> `- This focused on VDEV and rte_device integration
>
> Introduction:
> =============
>
> This patch series introduces a generic device model, moving away from PCI
> centric code layout. Key change is to introduce rte_driver/rte_device
> structures at the top level which are inherited by
> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> future),...}.
>
> Key motivation for this series is to move away from PCI centric design of
> EAL to a more hierarchical device model - pivoted around a generic driver
> and device. Each specific driver and device can inherit the common
> properties of the generic set and build upon it through driver/device
> specific functions.
>
> Earlier, the EAL device initialization model was:
> (Refer: [3])
>
> --
> Constructor:
> |- PMD_DRIVER_REGISTER(rte_driver)
> `- insert into dev_driver_list, rte_driver object
>
> rte_eal_init():
> |- rte_eal_pci_init()
> | `- scan and fill pci_device_list from sysfs
> |
> |- rte_eal_dev_init()
> | `- For each rte_driver in dev_driver_list
> | `- call the rte_driver->init() function
> | |- PMDs designed to call rte_eth_driver_register(eth_driver)
> | |- eth_driver have rte_pci_driver embedded in them
> | `- rte_eth_driver_register installs the
> | rte_pci_driver->devinit/devuninit callbacks.
> |
> |- rte_eal_pci_probe()
> | |- For each device detected, dev_driver_list is parsed and matching is
> | | done.
> | |- For each matching device, the rte_pci_driver->devinit() is called.
> | |- Default map is to rte_eth_dev_init() which in turn creates a
> | | new ethernet device (eth_dev)
> | | `- eth_drv->eth_dev_init() is called which is implemented by
> `--| individual PMD drivers.
>
> --
>
> The structure of driver looks something like:
>
> +------------+ ._____.
> | rte_driver <-----| PMD |___
> | .init | `-----` \
> +----.-------+ | \
> `-. | What PMD actually is
> \ | |
> +----------v----+ |
> | eth_driver | |
> | .eth_dev_init | |
> +----.----------+ |
> `-. |
> \ |
> +------------v---+
> | rte_pci_driver |
> | .pci_devinit |
> +----------------+
>
> and all devices are part of a following linked lists:
> - dev_driver_list for all rte_drivers
> - pci_device_list for all devices, whether PCI or VDEV
>
>
> >From the above:
> * a PMD initializes a rte_driver, eth_driver even though actually it is a
> pci_driver
> * initialization routines are passed from rte_driver->pci_driver->eth_driver
> even though they should ideally be rte_eal_init()->rte_pci_driver()
> * For a single driver/device type model, this is not necessarily a
> functional issue - but more of a design language.
> * But, when number of driver/device type increase, this would create
> problem in how driver<=>device links are represented.
>
> Proposed Architecture:
> ======================
>
> A nice representation has already been created by David in [3]. Copying that
> here:
>
> +------------------+ +-------------------------------+
> | | | |
> | rte_pci_device | | rte_pci_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> +-------------------------------+
>
> - for ethdev on top of vdev devices
>
> +------------------+ +-------------------------------+
> | | | |
> | drv specific | | rte_vdev_driver |
> | | | |
> +-------------+ | +--------------+ | | +---------------------------+ |
> | | | | | | | | | |
> | rte_eth_dev +---> rte_device +-----> rte_driver | |
> | | | | char name[] | | | | char name[] | |
> +-------------+ | | | | | | int init(rte_device *) | |
> | +--------------+ | | | int uninit(rte_device *) | |
> | | | | | |
> +------------------+ | +---------------------------+ |
> | |
> | int priv_size |
> | |
> +-------------------------------+
>
> Representing from above, it would be:
>
> +--------------+
> | rte_driver |
> | name |
> | <Future> |
> +------^-------+ pci_driver_list
> | / vdev_driver_list
> `---. <<Inherits>> / /
> |\____________/_______ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_driver | | rte_vdev_driver |
> | pci_probe() | | vdev_devinit() |
> | pci_remove() | | vdev_devuninit()|
> | <more> | | <more> |
> +-----------------+ +------------------+
>
>
> +--------------+
> | rte_device |
> | name |
> | <Future> |
> +------^-------+ pci_device_list
> | / xxx_device_list
> `---. <<Inherits>> / /
> |\____________/________ /
> | / \ /
> +-----------/-----+ +--------/---------+
> | rte_pci_device | | rte_xxx_device |
> | <dev data> | | <dev data> |
> | <flags/intr> | | <flags/intr> |
> | <more> | | <more> |
> +-----------------+ +------------------+
>
> * Each driver type has its own structure which derives from the generic
> rte_driver structure.
> \- Each driver type maintains its own list, at the same time, rte_driver
> list also exists - so that *all* drivers can be looped on, if required.
> * Each device, associated with one or more drivers, has its own type
> derived from rte_device
> \- Each device _may_ maintain its own list (for example, in current
> implementation, vdev is not maintaining it).
>
> ==Introducing a new device/driver type implies==
> - creating their own rte_<xxx>.h file which contains the device/driver
> definitions.
> - defining the DRIVER_REGISTER_XXX helpers
>
> ==Hotplugging Support==
> - devices should be able to support attach/detach operations.
> - Earlier these functions were part of ethdev. They have been moved to eal
> to be more generic.
>
> This patch is part of larger aim to:
>
> --------------------+ <is type of>
> eth_driver (PMD) |-------------> rte_driver
> crypto_driver (PMD) | ^
> <more in future> | |
> --------------------+ | <inherits>
> /
> +-----------------------/+
> | rte_pci_driver |
> | rte_vdev_driver |
> | rte_soc_driver |
> | rte_xxx_driver |
>
> Where PMD devices (rte_eth_dev, rte_cryptodev_dev) are connected to their
> drivers rather than explicitly inheriting type specific driver (PCI, etc).
>
>
> About the Patches:
> ==================
>
> There are a large number of patches for this - primarily because the changes
> are quite varied and keeping them logically separate yet compilable is
> important. Most of the patches are small and those which are large touch the
> drivers (PMDs) to accommodate the structure changes:
>
> - Patches 0001~0002 are for introducing the container_of function (so that
> rte_device can be obtained from rte_pci_device, for example), and
> removing unused code.
> - Patch 0003 converts the PCI devinit/devuninit method names to probe/
> remove and correspondingly updates all drivers where impact it. VDEV
> based init/uninit have not been modified.
> - Patches 0004~0007 just perform the ground work for enabling change from
> rte_driver/eth_driver based PMDs to rte_xxx_driver based PMDs
> - In patch 0008, all the pdev PMDs are changed to support rte_pci_driver (
> including cryptodev, which is eventually generalized with PCI)
> - Patch 0009~0011 merge the crypto and pci functions for registration and
> naming.
> - Patches 0011~0013 deal with hotplugging - hotplug no more invokes scan of
> complete bus and has been generalized into EAl from ethdev.
> - Patches 0014 introduces vdev init/uninit into separate C units and
> enables its compilation. Patch 0016~0017 build on it and remove the
> remaining legacy support for vdev/pdev distinctions.
> - Patches 0017~0021 enable the vdev drivers to register using the
> DRIVER_REGISTER_* operations, and remove their rte_driver->init()
> - Patch 0022 enables the rte_driver registration into a common driver
> linked list.
> - Patche 0024 introduce the rte_device, a generalization of
> rte_xxx_device, and associated operation of creating rte_device linked
> list. It also enables the drivers to use rte_device.name/numa_node
> members rather than rte_xxx_device specific members.
>
> Future Work/Pending:
> ===================
> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
> rte_device model. eth_driver still is a PCI specific entity. This
> has been highlighted by comments from Ferruh in [9].
> - Some variables, like drv_name (as highlighted by Ferruh), are getting
> duplicated across rte_xxx_driver/device and rte_driver/device.
>
> References:
> ===========
>
> [1] http://dpdk.org/ml/archives/dev/2016-January/032387.html
> [2] http://dpdk.org/ml/archives/dev/2016-April/037686.html
> [3] http://dpdk.org/ml/archives/dev/2016-January/031390.html
> [4] http://dpdk.org/ml/archives/dev/2016-July/043645.html
> [5] http://dpdk.org/ml/archives/dev/2016-June/042439.html
> [6] http://dpdk.org/ml/archives/dev/2016-June/042444.html
> [7] http://dpdk.org/ml/archives/dev/2016-July/043172.html
> [8] http://dpdk.org/ml/archives/dev/2016-August/044941.html
> [9] http://dpdk.org/ml/archives/dev/2016-August/045947.html
> [10] http://dpdk.org/ml/archives/dev/2016-September/046919.html
> Following are Some Review comments:
> [R1] http://dpdk.org/ml/archives/dev/2016-September/046548.html
> [R2] http://dpdk.org/ml/archives/dev/2016-September/046549.html
> [R3] http://dpdk.org/ml/archives/dev/2016-September/046550.html
> [R4] http://dpdk.org/ml/archives/dev/2016-September/046551.html
> [R5] http://dpdk.org/ml/archives/dev/2016-September/046399.html
> [R6] http://dpdk.org/ml/archives/dev/2016-September/046552.html
>
> Changes since v10:
> - Rebased over master (e15922d75)
> - Removed patch for container_of posted in v10 (01/25)
> - Fix review comments from David: [10]
>
> Changes since v9:
> - Rebased over master (58efd680d5e)
> - Fix issues reported by checkpatch and check-git-log, including changing
> headline of the patches to adhere to these scripts.
> - Corrected the patch author field
> - Renamed devinit/devuninit for pci_driver to probe/remove as per
> suggestion from David
> - Fix for PMD Info gen tool using patch from David
> - Fixed review comments [R1], some part of [R2], [R3] using patch from
> David, [R4], [R5] and some inputs from [R6].
>
> Changes since v8:
> - Some review comments from Ferruh Yigit & Reshma Pattan have been fixed.
> = Though changes in mlx4/mlx5/szedata2 have been done, I am still unable
> to verify those in absence of a proper environment at my end.
> = Comment from Ferruh for eth_driver, drv_name are not fixed yet.
> - Added a 'Future work' section in Covering letter
>
> Changes since v7:
> - Rebase over master (e22856313fff2)
> - Merge the patch series by David [1][2] and Jan [4] into a single set
> hereafter, PCI and VDEV, both are re-factored for rte_device/driver
> model
>
> Changes since v6:
> - rebase over 16.07 (b0a1419)
> - DRIVER_REGISTER_PCI macro is now passed pci_drv rather than drv
> - review comments regarding missing information in log messages
> - new API additions to 16.11 map objects
> - review comment in [5] and [7] are not included in this series.
>
> Changes since v5:
> - Rebase over master (11c5e45d8)
> - Rename RTE_EAL_PCI_REGISTER helper macro to DRIVER_REGISTER_PCI to be
> in sync with DRIVER_REGISTER_PCI_TABLE. [Probably, in future, both can
> be merged]
> - Modifications to bnxt and thunderx driver PMD registration files for
> using the simplified PCI device registration helper macro
>
> Changes since v4:
> - Fix compilation issue after rebase on HEAD (913154e) in previous series
> - Retain rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port
> which were removed by previous patchset. These are being used by pdump
> library
>
> Changes since v3:
> - rebase over HEAD (913154e)
> - Update arguments to RTE_EAL_PCI_REGISTER macro as per Jan's suggestion
> - modify qede driver to use RTE_EAL_PCI_REGISTER
> - Argument check in hotplug functions
>
> Changes since v2:
> - rebase over HEAD (d76c193)
> - Move SYSFS_PCI_DRIVERS macro to rte_pci.h to avoid compilation issue
>
> Changes since v1:
> - rebased on HEAD, new drivers should be okay
> - patches have been split into smaller pieces
> - RTE_INIT macro has been added, but in the end, I am not sure it is useful
> - device type has been removed from ethdev, as it was used only by hotplug
> - getting rid of pmd type in eal patch (patch 5 of initial series) has been
> dropped for now, we can do this once vdev drivers have been converted
>
> David Marchand (13):
> eal: remove duplicate function declaration
> pci: no need for dynamic tailq init
> crypto: no need for a crypto pmd type
> drivers: align PCI driver definitions
> eal: introduce PCI device init macros
> driver: probe/remove common wrappers for PCI drivers
> drivers: convert all phy drivers as PCI drivers
> drivers: remove driver register callbacks for crypto/net
> eal/pci: helpers for device name parsing/update
> ethdev: do not scan all PCI devices on attach
> eal: add hotplug operations for PCI and VDEV
> ethdev: convert to EAL hotplug
> ethdev: get rid of device type
>
> Jan Viktorin (10):
> eal: extract vdev infra
> eal: remove PDEV/VDEV unused code
> drivers: convert VDRV to use RTE VDEV Driver
> eal: remove unused PMD types
> eal: include dev headers in place of PCI headers
> eal: rename and move RTE PCI Resources
> eal/pci: inherit RTE driver in PCI driver
> eal: register EAL drivers explicitly
> eal: introduce generalized RTE device
> eal/pci: create RTE device list and fallback on its members
>
> Shreyansh Jain (1):
> eal/pci: replace PCI devinit/devuninit with probe/remove
>
> app/test/test_pci.c | 18 +-
> app/test/virtual_pmd.c | 8 +-
> doc/guides/prog_guide/dev_kit_build_system.rst | 2 +-
> drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 +-
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 +-
> drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 +-
> drivers/crypto/null/null_crypto_pmd.c | 7 +-
> drivers/crypto/qat/qat_qp.c | 2 +-
> drivers/crypto/qat/rte_qat_cryptodev.c | 18 +-
> drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 +-
> drivers/net/af_packet/rte_eth_af_packet.c | 9 +-
> drivers/net/bnx2x/bnx2x_ethdev.c | 36 +--
> drivers/net/bnx2x/bnx2x_rxtx.c | 3 +-
> drivers/net/bnxt/bnxt_ethdev.c | 17 +-
> drivers/net/bonding/rte_eth_bond_api.c | 2 +-
> drivers/net/bonding/rte_eth_bond_pmd.c | 7 +-
> drivers/net/cxgbe/cxgbe_ethdev.c | 25 +--
> drivers/net/cxgbe/cxgbe_main.c | 2 +-
> drivers/net/cxgbe/sge.c | 7 +-
> drivers/net/e1000/em_ethdev.c | 17 +-
> drivers/net/e1000/igb_ethdev.c | 41 +---
> drivers/net/ena/ena_ethdev.c | 20 +-
> drivers/net/enic/enic_ethdev.c | 24 +-
> drivers/net/fm10k/fm10k_ethdev.c | 30 +--
> drivers/net/i40e/i40e_ethdev.c | 31 +--
> drivers/net/i40e/i40e_ethdev_vf.c | 26 +--
> drivers/net/i40e/i40e_fdir.c | 2 +-
> drivers/net/ixgbe/ixgbe_ethdev.c | 48 +---
> drivers/net/mlx4/mlx4.c | 26 +--
> drivers/net/mlx5/mlx5.c | 27 +--
> drivers/net/mpipe/mpipe_tilegx.c | 14 +-
> drivers/net/nfp/nfp_net.c | 28 +--
> drivers/net/null/rte_eth_null.c | 9 +-
> drivers/net/pcap/rte_eth_pcap.c | 9 +-
> drivers/net/qede/qede_ethdev.c | 42 +---
> drivers/net/ring/rte_eth_ring.c | 9 +-
> drivers/net/szedata2/rte_eth_szedata2.c | 29 +--
> drivers/net/thunderx/nicvf_ethdev.c | 21 +-
> drivers/net/vhost/rte_eth_vhost.c | 9 +-
> drivers/net/virtio/virtio_ethdev.c | 29 +--
> drivers/net/virtio/virtio_pci.c | 5 +-
> drivers/net/virtio/virtio_user_ethdev.c | 8 +-
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 27 +--
> drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +-
> drivers/net/xenvirt/rte_eth_xenvirt.c | 9 +-
> examples/ip_pipeline/init.c | 22 --
> lib/librte_cryptodev/rte_cryptodev.c | 71 ++----
> lib/librte_cryptodev/rte_cryptodev.h | 2 -
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 45 ++--
> lib/librte_cryptodev/rte_cryptodev_version.map | 8 +-
> lib/librte_eal/bsdapp/eal/Makefile | 1 +
> lib/librte_eal/bsdapp/eal/eal_pci.c | 54 ++++-
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 10 +
> lib/librte_eal/common/Makefile | 2 +-
> lib/librte_eal/common/eal_common_dev.c | 95 ++++----
> lib/librte_eal/common/eal_common_pci.c | 51 +++--
> lib/librte_eal/common/eal_common_vdev.c | 108 +++++++++
> lib/librte_eal/common/eal_private.h | 20 +-
> lib/librte_eal/common/include/rte_dev.h | 77 +++++--
> lib/librte_eal/common/include/rte_eal.h | 3 +
> lib/librte_eal/common/include/rte_pci.h | 62 ++++--
> lib/librte_eal/common/include/rte_tailq.h | 4 +-
> lib/librte_eal/common/include/rte_vdev.h | 97 ++++++++
> lib/librte_eal/linuxapp/eal/Makefile | 1 +
> lib/librte_eal/linuxapp/eal/eal.c | 1 +
> lib/librte_eal/linuxapp/eal/eal_pci.c | 23 +-
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 10 +
> lib/librte_ether/rte_ethdev.c | 279 +++++-------------------
> lib/librte_ether/rte_ethdev.h | 40 ++--
> lib/librte_ether/rte_ether_version.map | 10 +-
> mk/internal/rte.compile-pre.mk | 2 +-
> 71 files changed, 795 insertions(+), 1036 deletions(-)
> create mode 100644 lib/librte_eal/common/eal_common_vdev.c
> create mode 100644 lib/librte_eal/common/include/rte_vdev.h
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-09-21 19:03 ` [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization Matej Vido
@ 2016-09-22 4:25 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-09-22 4:25 UTC (permalink / raw)
To: Matej Vido; +Cc: dev, viktorin, David Marchand, hemant.agrawal, Thomas Monjalon
Hi Matej,
On Thursday 22 September 2016 12:33 AM, Matej Vido wrote:
> Hi Shreyansh,
>
> I have tested this patch-set with szedata2 driver and it works fine.
>
> Regards,
>
> Matej
Thanks a lot for this.
--
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (24 preceding siblings ...)
2016-09-21 19:03 ` [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization Matej Vido
@ 2016-09-30 10:22 ` David Marchand
2016-10-03 14:28 ` Thomas Monjalon
26 siblings, 0 replies; 375+ messages in thread
From: David Marchand @ 2016-09-30 10:22 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Jan Viktorin, hemant.agrawal, Thomas Monjalon
Hello,
On Tue, Sep 20, 2016 at 2:41 PM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Based on master (e15922d75)
>
> Background:
> ===========
>
> It includes two different patch-sets floated on ML earlier:
> * Original patch series is from David Marchand [1], [2].
> `- This focused mainly on PCI (PDEV) part
> `- v7 of this was posted by me [8] in August/2016
> * Patch series [4] from Jan Viktorin
> `- This focused on VDEV and rte_device integration
>
> Introduction:
> =============
>
> This patch series introduces a generic device model, moving away from PCI
> centric code layout. Key change is to introduce rte_driver/rte_device
> structures at the top level which are inherited by
> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> future),...}.
>
> Key motivation for this series is to move away from PCI centric design of
> EAL to a more hierarchical device model - pivoted around a generic driver
> and device. Each specific driver and device can inherit the common
> properties of the generic set and build upon it through driver/device
> specific functions.
[snip]
> Changes since v10:
> - Rebased over master (e15922d75)
> - Removed patch for container_of posted in v10 (01/25)
> - Fix review comments from David: [10]
For the series.
Acked-by: David Marchand <david.marchand@6wind.com>
Thanks Shreyansh.
--
David Marchand
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 07/24] driver: probe/remove common wrappers for PCI drivers
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 07/24] driver: probe/remove common wrappers for PCI drivers Shreyansh Jain
@ 2016-10-03 14:21 ` Thomas Monjalon
2016-10-04 6:16 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-10-03 14:21 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, viktorin, David Marchand, hemant.agrawal
2016-09-20 18:11, Shreyansh Jain:
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -4372,6 +4372,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
> int
> rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
>
> +/**
> + * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
> + * interface.
> + */
> +int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
> + struct rte_pci_device *pci_dev);
> +
> +/**
> + * Wrapper for use by pci drivers as a .remove function to detach a ethdev
> + * interface.
> + */
> +int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
These functions are used by the drivers only (as helpers).
So they should be marked @internal (added after applying the patch).
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
` (25 preceding siblings ...)
2016-09-30 10:22 ` David Marchand
@ 2016-10-03 14:28 ` Thomas Monjalon
2016-10-04 6:51 ` Shreyansh Jain
26 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-10-03 14:28 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, viktorin, David Marchand, hemant.agrawal
Applied, thanks everybody for the great (re)work!
2016-09-20 18:11, Shreyansh Jain:
> Future Work/Pending:
> ===================
> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
> rte_device model. eth_driver still is a PCI specific entity. This
> has been highlighted by comments from Ferruh in [9].
> - Some variables, like drv_name (as highlighted by Ferruh), are getting
> duplicated across rte_xxx_driver/device and rte_driver/device.
What about those pending work?
I would add more remaining issues:
- probe/remove naming could be applied to vdev for consistency
- rte_eal_device_insert must be called in vdev
- REGISTER macros should be prefixed with RTE_
- Some functions in EAL does not need eal_ in their prefix:
rte_eal_pci_ -> rte_pci_
rte_eal_dev_ -> rte_dev_
rte_eal_vdev_ -> rte_vdev_
rte_eal_driver -> rte_drv_
rte_eal_vdrv -> rte_vdrv_
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 07/24] driver: probe/remove common wrappers for PCI drivers
2016-10-03 14:21 ` Thomas Monjalon
@ 2016-10-04 6:16 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-10-04 6:16 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, viktorin, David Marchand, hemant.agrawal
On Monday 03 October 2016 07:51 PM, Thomas Monjalon wrote:
> 2016-09-20 18:11, Shreyansh Jain:
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> @@ -4372,6 +4372,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
>> int
>> rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
>>
>> +/**
>> + * Wrapper for use by pci drivers as a .probe function to attach to a ethdev
>> + * interface.
>> + */
>> +int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
>> + struct rte_pci_device *pci_dev);
>> +
>> +/**
>> + * Wrapper for use by pci drivers as a .remove function to detach a ethdev
>> + * interface.
>> + */
>> +int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
>
> These functions are used by the drivers only (as helpers).
> So they should be marked @internal (added after applying the patch).
>
Ok.
Thanks!
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-03 14:28 ` Thomas Monjalon
@ 2016-10-04 6:51 ` Shreyansh Jain
2016-10-04 7:42 ` Thomas Monjalon
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-10-04 6:51 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, viktorin, David Marchand, hemant.agrawal
Hi Thomas,
On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
> Applied, thanks everybody for the great (re)work!
Thanks!
>
> 2016-09-20 18:11, Shreyansh Jain:
>> Future Work/Pending:
>> ===================
>> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
>> rte_device model. eth_driver still is a PCI specific entity. This
>> has been highlighted by comments from Ferruh in [9].
>> - Some variables, like drv_name (as highlighted by Ferruh), are getting
>> duplicated across rte_xxx_driver/device and rte_driver/device.
Both the above are already part of my todo list.
>
> What about those pending work?
>
> I would add more remaining issues:
> - probe/remove naming could be applied to vdev for consistency
Is that for uniformity reasons? I still feel 'probe/remove' are not
appropriate for a virtual device. init/deinit are more appropriate. As
for PCI, probe/remove are standard parlance and hence suit it better
than init/deinit.
Nevertheless, uniform naming convention can have its benefits - ease of
code understanding being one.
Change is simple once we come to a conclusion.
> - rte_eal_device_insert must be called in vdev
Ok.
> - REGISTER macros should be prefixed with RTE_
That would include:
DRIVER_REGISTER_VDEV
DRIVER_REGISTER_PCI_TABLE
DRIVER_REGISTER_PCI
I will publish a patch soon. This would be fairly straightforward change.
> - Some functions in EAL does not need eal_ in their prefix:
> rte_eal_pci_ -> rte_pci_
> rte_eal_dev_ -> rte_dev_
> rte_eal_vdev_ -> rte_vdev_
> rte_eal_driver -> rte_drv_
> rte_eal_vdrv -> rte_vdrv_
>
>
It can be merged with changes for:
- drv_name
- EAL_ before _REGISTER_ macros
- eth_driver => rte_driver naming
--
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-04 6:51 ` Shreyansh Jain
@ 2016-10-04 7:42 ` Thomas Monjalon
2016-10-05 11:57 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Thomas Monjalon @ 2016-10-04 7:42 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, viktorin, David Marchand, hemant.agrawal
2016-10-04 12:21, Shreyansh Jain:
> Hi Thomas,
>
> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
> > Applied, thanks everybody for the great (re)work!
>
> Thanks!
>
> >
> > 2016-09-20 18:11, Shreyansh Jain:
> >> Future Work/Pending:
> >> ===================
> >> - Presently eth_driver, rte_eth_dev are not aligned to the rte_driver/
> >> rte_device model. eth_driver still is a PCI specific entity. This
> >> has been highlighted by comments from Ferruh in [9].
> >> - Some variables, like drv_name (as highlighted by Ferruh), are getting
> >> duplicated across rte_xxx_driver/device and rte_driver/device.
>
> Both the above are already part of my todo list.
>
> > What about those pending work?
> >
> > I would add more remaining issues:
> > - probe/remove naming could be applied to vdev for consistency
>
> Is that for uniformity reasons? I still feel 'probe/remove' are not
> appropriate for a virtual device. init/deinit are more appropriate. As
> for PCI, probe/remove are standard parlance and hence suit it better
> than init/deinit.
PCI probe is "scan + checks + init".
The vdev requires "args parsing + checks + init".
The device will not be initialized if checks fail,
e.g. missing support or name conflict.
I think it could fit in "probe" rather than "init".
The remove word looks appropriate in both cases.
> Nevertheless, uniform naming convention can have its benefits - ease of
> code understanding being one.
Yes that's the other pro for "probe/remove".
> Change is simple once we come to a conclusion.
>
> > - rte_eal_device_insert must be called in vdev
>
> Ok.
>
> > - REGISTER macros should be prefixed with RTE_
>
> That would include:
> DRIVER_REGISTER_VDEV
> DRIVER_REGISTER_PCI_TABLE
> DRIVER_REGISTER_PCI
>
> I will publish a patch soon. This would be fairly straightforward change.
>
> > - Some functions in EAL does not need eal_ in their prefix:
> > rte_eal_pci_ -> rte_pci_
> > rte_eal_dev_ -> rte_dev_
> > rte_eal_vdev_ -> rte_vdev_
> > rte_eal_driver -> rte_drv_
> > rte_eal_vdrv -> rte_vdrv_
> >
> >
>
> It can be merged with changes for:
> - drv_name
> - EAL_ before _REGISTER_ macros
> - eth_driver => rte_driver naming
Good.
Could you make it this week, please?
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-04 7:42 ` Thomas Monjalon
@ 2016-10-05 11:57 ` Shreyansh Jain
2016-10-17 13:43 ` Ferruh Yigit
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-10-05 11:57 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, viktorin, David Marchand, hemant.agrawal
Hi Thomas,
On Tuesday 04 October 2016 01:12 PM, Thomas Monjalon wrote:
> 2016-10-04 12:21, Shreyansh Jain:
>> Hi Thomas,
>>
>> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
>>> Applied, thanks everybody for the great (re)work!
>>
>> Thanks!
>>
[...]
[...]
>>
>> It can be merged with changes for:
>> - drv_name
>> - EAL_ before _REGISTER_ macros
>> - eth_driver => rte_driver naming
>
> Good.
> Could you make it this week, please?
>
Certainly. At least some of those I can send within this week :)
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-05 11:57 ` Shreyansh Jain
@ 2016-10-17 13:43 ` Ferruh Yigit
2016-10-17 17:29 ` Shreyansh Jain
2016-10-18 13:04 ` Neil Horman
0 siblings, 2 replies; 375+ messages in thread
From: Ferruh Yigit @ 2016-10-17 13:43 UTC (permalink / raw)
To: Shreyansh Jain, Thomas Monjalon
Cc: dev, viktorin, David Marchand, hemant.agrawal
On 10/5/2016 12:57 PM, Shreyansh Jain wrote:
> Hi Thomas,
>
> On Tuesday 04 October 2016 01:12 PM, Thomas Monjalon wrote:
>> 2016-10-04 12:21, Shreyansh Jain:
>>> Hi Thomas,
>>>
>>> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
>>>> Applied, thanks everybody for the great (re)work!
>>>
>>> Thanks!
>>>
> [...]
> [...]
>>>
>>> It can be merged with changes for:
>>> - drv_name
>>> - EAL_ before _REGISTER_ macros
>>> - eth_driver => rte_driver naming
>>
>> Good.
>> Could you make it this week, please?
>>
>
> Certainly. At least some of those I can send within this week :)
>
I caught while running ABI validation script today, I think this patch
should increase LIBABIVER of:
- lib/librte_cryptodev
- lib/librte_eal
- lib/librte_ether
Thanks,
ferruh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-17 13:43 ` Ferruh Yigit
@ 2016-10-17 17:29 ` Shreyansh Jain
2016-10-18 9:23 ` Ferruh Yigit
2016-10-18 13:04 ` Neil Horman
1 sibling, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-10-17 17:29 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon
Cc: dev, viktorin, David Marchand, Hemant Agrawal
Hi Ferruh,
> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Monday, October 17, 2016 7:13 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>; Thomas Monjalon
> <thomas.monjalon@6wind.com>
> Cc: dev@dpdk.org; viktorin@rehivetech.com; David Marchand
> <david.marchand@6wind.com>; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device
> generalization
>
> On 10/5/2016 12:57 PM, Shreyansh Jain wrote:
> > Hi Thomas,
> >
> > On Tuesday 04 October 2016 01:12 PM, Thomas Monjalon wrote:
> >> 2016-10-04 12:21, Shreyansh Jain:
> >>> Hi Thomas,
> >>>
> >>> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
> >>>> Applied, thanks everybody for the great (re)work!
> >>>
> >>> Thanks!
> >>>
> > [...]
> > [...]
> >>>
> >>> It can be merged with changes for:
> >>> - drv_name
> >>> - EAL_ before _REGISTER_ macros
> >>> - eth_driver => rte_driver naming
> >>
> >> Good.
> >> Could you make it this week, please?
> >>
> >
> > Certainly. At least some of those I can send within this week :)
> >
>
>
> I caught while running ABI validation script today, I think this patch
> should increase LIBABIVER of:
> - lib/librte_cryptodev
> - lib/librte_eal
> - lib/librte_ether
Should I be referring to [1] for understanding how/when to change the LIBABIVER?
[1] http://dpdk.org/doc/guides/contributing/versioning.html
>
> Thanks,
> ferruh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-17 17:29 ` Shreyansh Jain
@ 2016-10-18 9:23 ` Ferruh Yigit
2016-10-19 11:13 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Ferruh Yigit @ 2016-10-18 9:23 UTC (permalink / raw)
To: Shreyansh Jain, Thomas Monjalon
Cc: dev, viktorin, David Marchand, Hemant Agrawal
On 10/17/2016 6:29 PM, Shreyansh Jain wrote:
> Hi Ferruh,
>
>> -----Original Message-----
>> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
>> Sent: Monday, October 17, 2016 7:13 PM
>> To: Shreyansh Jain <shreyansh.jain@nxp.com>; Thomas Monjalon
>> <thomas.monjalon@6wind.com>
>> Cc: dev@dpdk.org; viktorin@rehivetech.com; David Marchand
>> <david.marchand@6wind.com>; Hemant Agrawal <hemant.agrawal@nxp.com>
>> Subject: Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device
>> generalization
>>
>> On 10/5/2016 12:57 PM, Shreyansh Jain wrote:
>>> Hi Thomas,
>>>
>>> On Tuesday 04 October 2016 01:12 PM, Thomas Monjalon wrote:
>>>> 2016-10-04 12:21, Shreyansh Jain:
>>>>> Hi Thomas,
>>>>>
>>>>> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
>>>>>> Applied, thanks everybody for the great (re)work!
>>>>>
>>>>> Thanks!
>>>>>
>>> [...]
>>> [...]
>>>>>
>>>>> It can be merged with changes for:
>>>>> - drv_name
>>>>> - EAL_ before _REGISTER_ macros
>>>>> - eth_driver => rte_driver naming
>>>>
>>>> Good.
>>>> Could you make it this week, please?
>>>>
>>>
>>> Certainly. At least some of those I can send within this week :)
>>>
>>
>>
>> I caught while running ABI validation script today, I think this patch
>> should increase LIBABIVER of:
>> - lib/librte_cryptodev
>> - lib/librte_eal
>> - lib/librte_ether
>
> Should I be referring to [1] for understanding how/when to change the LIBABIVER?
>
> [1] http://dpdk.org/doc/guides/contributing/versioning.html
Yes, this is the document.
Briefly, if library becomes incompatible with existing applications,
LIBABIVER needs to be increased to indicate this.
Increasing LIBABIVER changes dynamic library name and so_name, and this
cause existing application do not work with this new library. Not
increasing the LIBABIVER, app may start running but can have segfault or
can generate wrong values. So increasing LIBABIVER is to inform user and
prevent surprises.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-17 13:43 ` Ferruh Yigit
2016-10-17 17:29 ` Shreyansh Jain
@ 2016-10-18 13:04 ` Neil Horman
2016-10-18 13:47 ` Thomas Monjalon
1 sibling, 1 reply; 375+ messages in thread
From: Neil Horman @ 2016-10-18 13:04 UTC (permalink / raw)
To: Ferruh Yigit
Cc: Shreyansh Jain, Thomas Monjalon, dev, viktorin, David Marchand,
hemant.agrawal
On Mon, Oct 17, 2016 at 02:43:12PM +0100, Ferruh Yigit wrote:
> On 10/5/2016 12:57 PM, Shreyansh Jain wrote:
> > Hi Thomas,
> >
> > On Tuesday 04 October 2016 01:12 PM, Thomas Monjalon wrote:
> >> 2016-10-04 12:21, Shreyansh Jain:
> >>> Hi Thomas,
> >>>
> >>> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
> >>>> Applied, thanks everybody for the great (re)work!
> >>>
> >>> Thanks!
> >>>
> > [...]
> > [...]
> >>>
> >>> It can be merged with changes for:
> >>> - drv_name
> >>> - EAL_ before _REGISTER_ macros
> >>> - eth_driver => rte_driver naming
> >>
> >> Good.
> >> Could you make it this week, please?
> >>
> >
> > Certainly. At least some of those I can send within this week :)
> >
>
>
> I caught while running ABI validation script today, I think this patch
> should increase LIBABIVER of:
> - lib/librte_cryptodev
> - lib/librte_eal
> - lib/librte_ether
>
It should, and it in fact should wait a release if it hadn't been documented as
a comming change.
Neil
> Thanks,
> ferruh
>
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-18 13:04 ` Neil Horman
@ 2016-10-18 13:47 ` Thomas Monjalon
0 siblings, 0 replies; 375+ messages in thread
From: Thomas Monjalon @ 2016-10-18 13:47 UTC (permalink / raw)
To: Neil Horman, Ferruh Yigit, Shreyansh Jain
Cc: dev, viktorin, David Marchand, hemant.agrawal
2016-10-18 09:04, Neil Horman:
> On Mon, Oct 17, 2016 at 02:43:12PM +0100, Ferruh Yigit wrote:
> > I caught while running ABI validation script today, I think this patch
> > should increase LIBABIVER of:
> > - lib/librte_cryptodev
> > - lib/librte_eal
> > - lib/librte_ether
> >
> It should, and it in fact should wait a release if it hadn't been documented as
> a comming change.
It was announced in release 16.04:
http://dpdk.org/commit/c7970af
While bumping LIBABIVER, the deprecation notices must be removed,
and the API/ABI changes noted in the release notes, please.
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization
2016-10-18 9:23 ` Ferruh Yigit
@ 2016-10-19 11:13 ` Shreyansh Jain
0 siblings, 0 replies; 375+ messages in thread
From: Shreyansh Jain @ 2016-10-19 11:13 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon
Cc: dev, viktorin, David Marchand, Hemant Agrawal
Hi Ferruh,
> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Tuesday, October 18, 2016 2:53 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>; Thomas Monjalon
> <thomas.monjalon@6wind.com>
> Cc: dev@dpdk.org; viktorin@rehivetech.com; David Marchand
> <david.marchand@6wind.com>; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: Re: [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device
> generalization
>
> On 10/17/2016 6:29 PM, Shreyansh Jain wrote:
> > Hi Ferruh,
> >
> >> -----Original Message-----
> >> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> >> Sent: Monday, October 17, 2016 7:13 PM
> >> To: Shreyansh Jain <shreyansh.jain@nxp.com>; Thomas Monjalon
> >> <thomas.monjalon@6wind.com>
> >> Cc: dev@dpdk.org; viktorin@rehivetech.com; David Marchand
> >> <david.marchand@6wind.com>; Hemant Agrawal <hemant.agrawal@nxp.com>
> >> Subject: Re: [dpdk-dev] [PATCH v11 00/24] Introducing
> rte_driver/rte_device
> >> generalization
> >>
> >> On 10/5/2016 12:57 PM, Shreyansh Jain wrote:
> >>> Hi Thomas,
> >>>
> >>> On Tuesday 04 October 2016 01:12 PM, Thomas Monjalon wrote:
> >>>> 2016-10-04 12:21, Shreyansh Jain:
> >>>>> Hi Thomas,
> >>>>>
> >>>>> On Monday 03 October 2016 07:58 PM, Thomas Monjalon wrote:
> >>>>>> Applied, thanks everybody for the great (re)work!
> >>>>>
> >>>>> Thanks!
> >>>>>
> >>> [...]
> >>> [...]
> >>>>>
> >>>>> It can be merged with changes for:
> >>>>> - drv_name
> >>>>> - EAL_ before _REGISTER_ macros
> >>>>> - eth_driver => rte_driver naming
> >>>>
> >>>> Good.
> >>>> Could you make it this week, please?
> >>>>
> >>>
> >>> Certainly. At least some of those I can send within this week :)
> >>>
> >>
> >>
> >> I caught while running ABI validation script today, I think this patch
> >> should increase LIBABIVER of:
> >> - lib/librte_cryptodev
> >> - lib/librte_eal
> >> - lib/librte_ether
> >
> > Should I be referring to [1] for understanding how/when to change the
> LIBABIVER?
> >
> > [1] http://dpdk.org/doc/guides/contributing/versioning.html
>
> Yes, this is the document.
>
> Briefly, if library becomes incompatible with existing applications,
> LIBABIVER needs to be increased to indicate this.
>
> Increasing LIBABIVER changes dynamic library name and so_name, and this
> cause existing application do not work with this new library. Not
> increasing the LIBABIVER, app may start running but can have segfault or
> can generate wrong values. So increasing LIBABIVER is to inform user and
> prevent surprises.
Thanks for explanation. I understand.
I will send across another patch for this.
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update Shreyansh Jain
@ 2016-10-25 15:49 ` Pattan, Reshma
2016-10-26 6:23 ` Shreyansh Jain
0 siblings, 1 reply; 375+ messages in thread
From: Pattan, Reshma @ 2016-10-25 15:49 UTC (permalink / raw)
To: Shreyansh Jain, dev
Cc: viktorin, David Marchand, hemant.agrawal, Thomas Monjalon
Hi Shreyansh,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shreyansh Jain
> Sent: Friday, September 16, 2016 5:30 AM
> To: dev@dpdk.org
> Cc: viktorin@rehivetech.com; David Marchand <david.marchand@6wind.com>;
> hemant.agrawal@nxp.com; Thomas Monjalon
> <thomas.monjalon@6wind.com>; Shreyansh Jain <shreyansh.jain@nxp.com>
> Subject: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name
> parsing/update
>
> From: David Marchand <david.marchand@6wind.com>
>
> - Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
> common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common
> method, can be used across crypto/net PCI PMDs.
> - Remove crypto specific routine and fallback to common name function.
> - Introduce a eal private Update function for PCI device naming.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> [Shreyansh: Merge crypto/pci helper patches]
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> lib/librte_cryptodev/rte_cryptodev.c | 27 +++---------------
> lib/librte_eal/bsdapp/eal/eal_pci.c | 49
> +++++++++++++++++++++++++++++++++
> lib/librte_eal/common/eal_private.h | 13 +++++++++
> lib/librte_eal/common/include/rte_pci.h | 24 ++++++++++++++++
> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
> lib/librte_ether/rte_ethdev.c | 24 +++-------------
> 6 files changed, 107 insertions(+), 43 deletions(-)
>
> diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> b/lib/librte_cryptodev/rte_cryptodev.c
> index 2a3b649..c81e366 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.c
> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> @@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int
> socket_id)
> return cryptodev;
> }
>
> *
> * This function is private to EAL.
> diff --git a/lib/librte_eal/common/include/rte_pci.h
> b/lib/librte_eal/common/include/rte_pci.h
> index cf81898..e1f695f 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -82,6 +82,7 @@ extern "C" {
> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */ #define
> PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
>
> /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
> #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 @@ -308,6
>
> +static inline void
> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
> + char *output, size_t size)
> +{
> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
> + addr->domain, addr->bus,
> + addr->devid, addr->function) >= 0); }
> +
>
> +int
> +pci_update_device(const struct rte_pci_addr *addr) {
> + char filename[PATH_MAX];
> +
> + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
> + pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
> + addr->function);
> +
> + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
> + addr->function);
> +}
> +
Earlier device names were created in the format "bus:deviceid.function" as per the below ethdev API.
Now after above new eal API the name format is "domain:bus:deviceid.func" was that intentional and why is that so.
> -static int
> -rte_eth_dev_create_unique_device_name(char *name, size_t size,
> - struct rte_pci_device *pci_dev)
> -{
> - int ret;
> -
> - ret = snprintf(name, size, "%d:%d.%d",
> - pci_dev->addr.bus, pci_dev->addr.devid,
> - pci_dev->addr.function);
> - if (ret < 0)
> - return ret;
> - return 0;
> -}
> -
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update
2016-10-25 15:49 ` Pattan, Reshma
@ 2016-10-26 6:23 ` Shreyansh Jain
2016-10-26 9:12 ` Pattan, Reshma
0 siblings, 1 reply; 375+ messages in thread
From: Shreyansh Jain @ 2016-10-26 6:23 UTC (permalink / raw)
To: Pattan, Reshma; +Cc: dev, Thomas Monjalon, viktorin
Hello Reshma,
On Tuesday 25 October 2016 09:19 PM, Pattan, Reshma wrote:
> Hi Shreyansh,
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shreyansh Jain
>> Sent: Friday, September 16, 2016 5:30 AM
>> To: dev@dpdk.org
>> Cc: viktorin@rehivetech.com; David Marchand <david.marchand@6wind.com>;
>> hemant.agrawal@nxp.com; Thomas Monjalon
>> <thomas.monjalon@6wind.com>; Shreyansh Jain <shreyansh.jain@nxp.com>
>> Subject: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name
>> parsing/update
>>
>> From: David Marchand <david.marchand@6wind.com>
>>
>> - Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
>> common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common
>> method, can be used across crypto/net PCI PMDs.
>> - Remove crypto specific routine and fallback to common name function.
>> - Introduce a eal private Update function for PCI device naming.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> [Shreyansh: Merge crypto/pci helper patches]
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> lib/librte_cryptodev/rte_cryptodev.c | 27 +++---------------
>> lib/librte_eal/bsdapp/eal/eal_pci.c | 49
>> +++++++++++++++++++++++++++++++++
>> lib/librte_eal/common/eal_private.h | 13 +++++++++
>> lib/librte_eal/common/include/rte_pci.h | 24 ++++++++++++++++
>> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
>> lib/librte_ether/rte_ethdev.c | 24 +++-------------
>> 6 files changed, 107 insertions(+), 43 deletions(-)
>>
>> diff --git a/lib/librte_cryptodev/rte_cryptodev.c
>> b/lib/librte_cryptodev/rte_cryptodev.c
>> index 2a3b649..c81e366 100644
>> --- a/lib/librte_cryptodev/rte_cryptodev.c
>> +++ b/lib/librte_cryptodev/rte_cryptodev.c
>> @@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int
>> socket_id)
>> return cryptodev;
>> }
>>
>> *
>> * This function is private to EAL.
>> diff --git a/lib/librte_eal/common/include/rte_pci.h
>> b/lib/librte_eal/common/include/rte_pci.h
>> index cf81898..e1f695f 100644
>> --- a/lib/librte_eal/common/include/rte_pci.h
>> +++ b/lib/librte_eal/common/include/rte_pci.h
>> @@ -82,6 +82,7 @@ extern "C" {
>> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */ #define
>> PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
>> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
>>
>> /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
>> #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 @@ -308,6
>>
>> +static inline void
>> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
>> + char *output, size_t size)
>> +{
>> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
>> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
>> + addr->domain, addr->bus,
>> + addr->devid, addr->function) >= 0); }
>> +
>>
>> +int
>> +pci_update_device(const struct rte_pci_addr *addr) {
>> + char filename[PATH_MAX];
>> +
>> + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
>> + pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
>> + addr->function);
>> +
>> + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
>> + addr->function);
>> +}
>> +
>
>
> Earlier device names were created in the format "bus:deviceid.function" as per the below ethdev API.
> Now after above new eal API the name format is "domain:bus:deviceid.func" was that intentional and why is that so.
Yes, this is intentional.
It is to bring the naming in sync with the device name being used for
scanning on the bus (/sys/bus/pci/devices/AAAA:BB:CC.D/).
Also, it was proposed in a separate patch [1] but merged in this series.
[1] http://dpdk.org/ml/archives/dev/2016-July/044614.html
(Just as a note: I am not the original author of this patch but above is
what I understood and acked it).
>
>> -static int
>> -rte_eth_dev_create_unique_device_name(char *name, size_t size,
>> - struct rte_pci_device *pci_dev)
>> -{
>> - int ret;
>> -
>> - ret = snprintf(name, size, "%d:%d.%d",
>> - pci_dev->addr.bus, pci_dev->addr.devid,
>> - pci_dev->addr.function);
>> - if (ret < 0)
>> - return ret;
>> - return 0;
>> -}
>> -
>
-
Shreyansh
^ permalink raw reply [flat|nested] 375+ messages in thread
* Re: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update
2016-10-26 6:23 ` Shreyansh Jain
@ 2016-10-26 9:12 ` Pattan, Reshma
0 siblings, 0 replies; 375+ messages in thread
From: Pattan, Reshma @ 2016-10-26 9:12 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Thomas Monjalon, viktorin
Hi,
> -----Original Message-----
> From: Shreyansh Jain [mailto:shreyansh.jain@nxp.com]
> Sent: Wednesday, October 26, 2016 7:23 AM
> To: Pattan, Reshma <reshma.pattan@intel.com>
> Cc: dev@dpdk.org; viktorin@rehivetech.com; David Marchand
> <david.marchand@6wind.com>; hemant.agrawal@nxp.com; Thomas Monjalon
> <thomas.monjalon@6wind.com>
> Subject: Re: [PATCH v10 11/25] eal/pci: helpers for device name parsing/update
>
> Hello Reshma,
>
> On Tuesday 25 October 2016 09:19 PM, Pattan, Reshma wrote:
> > Hi Shreyansh,
> >
> >> -----Original Message-----
> >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shreyansh Jain
> >> Sent: Friday, September 16, 2016 5:30 AM
> >> To: dev@dpdk.org
> >> Cc: viktorin@rehivetech.com; David Marchand
> >> <david.marchand@6wind.com>; hemant.agrawal@nxp.com; Thomas
> Monjalon
> >> <thomas.monjalon@6wind.com>; Shreyansh Jain <shreyansh.jain@nxp.com>
> >> Subject: [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device
> >> name parsing/update
> >>
> >> From: David Marchand <david.marchand@6wind.com>
> >>
> >> - Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c
> to
> >> common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common
> >> method, can be used across crypto/net PCI PMDs.
> >> - Remove crypto specific routine and fallback to common name function.
> >> - Introduce a eal private Update function for PCI device naming.
> >>
> >> Signed-off-by: David Marchand <david.marchand@6wind.com>
> >> [Shreyansh: Merge crypto/pci helper patches]
> >> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> >> ---
> >> lib/librte_cryptodev/rte_cryptodev.c | 27 +++---------------
> >> lib/librte_eal/bsdapp/eal/eal_pci.c | 49
> >> +++++++++++++++++++++++++++++++++
> >> lib/librte_eal/common/eal_private.h | 13 +++++++++
> >> lib/librte_eal/common/include/rte_pci.h | 24 ++++++++++++++++
> >> lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++
> >> lib/librte_ether/rte_ethdev.c | 24 +++-------------
> >> 6 files changed, 107 insertions(+), 43 deletions(-)
> >>
> >> diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> >> b/lib/librte_cryptodev/rte_cryptodev.c
> >> index 2a3b649..c81e366 100644
> >> --- a/lib/librte_cryptodev/rte_cryptodev.c
> >> +++ b/lib/librte_cryptodev/rte_cryptodev.c
> >> @@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int
> >> socket_id)
> >> return cryptodev;
> >> }
> >>
> >> *
> >> * This function is private to EAL.
> >> diff --git a/lib/librte_eal/common/include/rte_pci.h
> >> b/lib/librte_eal/common/include/rte_pci.h
> >> index cf81898..e1f695f 100644
> >> --- a/lib/librte_eal/common/include/rte_pci.h
> >> +++ b/lib/librte_eal/common/include/rte_pci.h
> >> @@ -82,6 +82,7 @@ extern "C" {
> >> /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
> >> #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> >> +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
> >>
> >> /** Short formatting string, without domain, for PCI device: Ex:
> >> 00:01.0 */ #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%"
> >> PRIx8 @@ -308,6
> >>
> >> +static inline void
> >> +rte_eal_pci_device_name(const struct rte_pci_addr *addr,
> >> + char *output, size_t size)
> >> +{
> >> + RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
> >> + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
> >> + addr->domain, addr->bus,
> >> + addr->devid, addr->function) >= 0); }
> >> +
> >>
> >> +int
> >> +pci_update_device(const struct rte_pci_addr *addr) {
> >> + char filename[PATH_MAX];
> >> +
> >> + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT,
> >> + pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
> >> + addr->function);
> >> +
> >> + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid,
> >> + addr->function);
> >> +}
> >> +
> >
> >
> > Earlier device names were created in the format "bus:deviceid.function" as per
> the below ethdev API.
> > Now after above new eal API the name format is "domain:bus:deviceid.func"
> was that intentional and why is that so.
>
> Yes, this is intentional.
> It is to bring the naming in sync with the device name being used for scanning on
> the bus (/sys/bus/pci/devices/AAAA:BB:CC.D/).
Fair enough and thanks for clarification.
Thanks,
Reshma
^ permalink raw reply [flat|nested] 375+ messages in thread
end of thread, other threads:[~2016-10-26 9:12 UTC | newest]
Thread overview: 375+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-29 14:08 [dpdk-dev] [PATCH 0/9] prepare for rte_device / rte_driver David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 1/9] pci: no need for dynamic tailq init David Marchand
2016-02-08 10:32 ` viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 2/9] pci: register all pdev as pci drivers David Marchand
2016-02-08 11:03 ` Jan Viktorin
2016-02-09 8:55 ` David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers David Marchand
2016-02-09 17:05 ` Jan Viktorin
2016-02-10 8:51 ` David Marchand
2016-02-10 9:27 ` David Marchand
2016-02-10 10:20 ` Jan Viktorin
2016-02-10 11:38 ` David Marchand
2016-02-10 12:29 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 4/9] eal/linux: move back interrupt thread init before setting affinity David Marchand
2016-02-02 7:02 ` Rahul Lakkireddy
2016-02-02 7:13 ` David Marchand
2016-02-02 7:43 ` Rahul Lakkireddy
2016-01-29 14:08 ` [dpdk-dev] [PATCH 5/9] eal: get rid of pmd type David Marchand
2016-02-09 17:15 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 6/9] eal: initialize vdevs right next to pci devices David Marchand
2016-02-10 11:05 ` Jan Viktorin
2016-02-10 11:43 ` David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 7/9] pci: add a helper for device name David Marchand
2016-02-10 11:10 ` Jan Viktorin
2016-02-10 12:04 ` David Marchand
2016-01-29 14:08 ` [dpdk-dev] [PATCH 8/9] pci: add a helper to refresh a device David Marchand
2016-02-10 11:23 ` Jan Viktorin
2016-02-10 12:00 ` David Marchand
2016-02-10 12:20 ` Jan Viktorin
2016-01-29 14:08 ` [dpdk-dev] [PATCH 9/9] eal: relocate hotplug code from ethdev David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 01/17] pci: no need for dynamic tailq init David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 02/17] crypto: no need for a crypto pmd type David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 03/17] drivers: align pci driver definitions David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 04/17] eal: remove duplicate function declaration David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 05/17] eal: introduce init macros David Marchand
2016-04-20 12:33 ` Jan Viktorin
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 06/17] crypto: export init/uninit common wrappers for pci drivers David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 07/17] ethdev: " David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 08/17] drivers: convert all pdev drivers as " David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 09/17] crypto: get rid of crypto driver register callback David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 10/17] ethdev: get rid of eth " David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 11/17] eal/linux: move back interrupt thread init before setting affinity David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 12/17] pci: add a helper for device name David Marchand
2016-05-04 15:25 ` Bruce Richardson
2016-05-04 16:26 ` Thomas Monjalon
2016-05-04 16:36 ` Bruce Richardson
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 13/17] pci: add a helper to update a device David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 14/17] ethdev: do not scan all pci devices on attach David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 15/17] eal: add hotplug operations for pci and vdev David Marchand
2016-05-27 10:39 ` Iremonger, Bernard
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 16/17] ethdev: convert to eal hotplug David Marchand
2016-04-20 11:44 ` [dpdk-dev] [PATCH v2 17/17] ethdev: get rid of device type David Marchand
2016-04-20 12:05 ` [dpdk-dev] [PATCH v2 00/17] prepare for rte_device / rte_driver Bruce Richardson
2016-04-20 12:41 ` Jan Viktorin
2016-04-22 10:18 ` Jan Viktorin
2016-05-06 9:26 ` Declan Doherty
2016-05-06 11:46 ` Jan Viktorin
2016-05-27 10:23 ` Iremonger, Bernard
2016-06-16 6:32 ` Shreyansh Jain
2016-06-16 7:34 ` Thomas Monjalon
2016-06-16 8:23 ` Jan Viktorin
2016-06-16 9:19 ` Thomas Monjalon
2016-06-16 10:45 ` Jan Viktorin
2016-06-16 8:42 ` Shreyansh Jain
2016-06-16 10:48 ` Jan Viktorin
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 03/17] drivers: align pci driver definitions Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 04/17] eal: remove duplicate function declaration Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 05/17] eal: introduce init macros Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 07/17] ethdev: " Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 10/17] ethdev: get rid of eth " Shreyansh Jain
2016-06-20 6:16 ` Shreyansh jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 12/17] pci: add a helper for device name Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 13/17] pci: add a helper to update a device Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-06-16 14:06 ` [dpdk-dev] [PATCH v3 17/17] ethdev: get rid of device type Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 03/17] drivers: align pci driver definitions Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 04/17] eal: remove duplicate function declaration Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 05/17] eal: introduce init macros Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 07/17] ethdev: " Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 10/17] ethdev: get rid of eth " Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 12/17] pci: add a helper for device name Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 13/17] pci: add a helper to update a device Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-06-21 12:02 ` [dpdk-dev] [PATCH v4 17/17] ethdev: get rid of device type Shreyansh Jain
2016-06-21 12:31 ` [dpdk-dev] [PATCH v4 00/17] prepare for rte_device / rte_driver Shreyansh jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 00/17] Prepare " Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 03/17] drivers: align pci driver definitions Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 04/17] eal: remove duplicate function declaration Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 05/17] eal: introduce init macros Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 07/17] ethdev: " Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
2016-06-22 13:27 ` Neil Horman
2016-06-22 13:43 ` Shreyansh jain
2016-06-22 13:44 ` Thomas Monjalon
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 10/17] ethdev: get rid of eth " Shreyansh Jain
2016-06-22 13:28 ` Neil Horman
2016-06-22 13:44 ` Shreyansh jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 12/17] pci: add a helper for device name Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 13/17] pci: add a helper to update a device Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-06-22 9:06 ` [dpdk-dev] [PATCH v5 17/17] ethdev: get rid of device type Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-07-14 17:11 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
2016-07-14 17:14 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 03/17] drivers: align pci driver definitions Shreyansh Jain
2016-07-14 17:12 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 04/17] eal: remove duplicate function declaration Shreyansh Jain
2016-07-14 17:13 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros Shreyansh Jain
2016-07-13 9:20 ` Jan Viktorin
2016-07-13 17:34 ` Jan Viktorin
2016-07-14 5:27 ` Shreyansh jain
2016-07-14 15:57 ` Jan Viktorin
2016-07-15 10:48 ` Shreyansh jain
2016-07-15 12:38 ` Thomas Monjalon
2016-07-28 9:36 ` Shreyansh Jain
2016-07-30 8:14 ` Jan Viktorin
2016-08-01 11:00 ` Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
2016-07-14 17:06 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 07/17] ethdev: " Shreyansh Jain
2016-07-14 17:06 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
2016-07-14 17:10 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 10/17] ethdev: get rid of eth " Shreyansh Jain
2016-07-14 17:09 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
2016-07-14 17:09 ` viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 12/17] pci: add a helper for device name Shreyansh Jain
2016-07-14 16:55 ` Jan Viktorin
2016-07-15 9:39 ` Shreyansh jain
2016-07-15 9:56 ` Thomas Monjalon
2016-07-15 11:32 ` Jan Viktorin
2016-07-15 9:56 ` Jan Viktorin
2016-07-15 13:14 ` Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 13/17] pci: add a helper to update a device Shreyansh Jain
2016-07-14 17:01 ` Jan Viktorin
2016-07-15 9:44 ` Shreyansh jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
2016-07-14 16:50 ` Jan Viktorin
2016-07-15 9:52 ` Shreyansh jain
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-07-14 16:51 ` Jan Viktorin
2016-07-15 10:36 ` Shreyansh jain
2016-07-15 11:27 ` Jan Viktorin
2016-07-12 6:01 ` [dpdk-dev] [PATCH v6 17/17] ethdev: get rid of device type Shreyansh Jain
2016-07-14 16:33 ` Jan Viktorin
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 01/17] pci: no need for dynamic tailq init Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 02/17] crypto: no need for a crypto pmd type Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 03/17] drivers: align pci driver definitions Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 04/17] eal: remove duplicate function declaration Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 05/17] eal: introduce init macros Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 06/17] crypto: export init/uninit common wrappers for pci drivers Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 07/17] ethdev: " Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 08/17] drivers: convert all pdev drivers as " Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 09/17] crypto: get rid of crypto driver register callback Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 10/17] ethdev: get rid of eth " Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 11/17] eal/linux: move back interrupt thread init before setting affinity Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 12/17] pci: add a helper for device name Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 13/17] pci: add a helper to update a device Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 14/17] ethdev: do not scan all pci devices on attach Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 15/17] eal: add hotplug operations for pci and vdev Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 16/17] ethdev: convert to eal hotplug Shreyansh Jain
2016-08-01 10:45 ` [dpdk-dev] [PATCH v7 17/17] ethdev: get rid of device type Shreyansh Jain
2016-08-01 15:43 ` [dpdk-dev] [PATCH v7 00/17] Prepare for rte_device / rte_driver Jan Viktorin
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of Shreyansh Jain
2016-08-29 16:43 ` Ferruh Yigit
2016-08-30 4:27 ` Shreyansh Jain
2016-08-30 10:30 ` Thomas Monjalon
2016-08-30 11:59 ` Shreyansh Jain
2016-08-30 13:42 ` Thomas Monjalon
2016-08-31 4:26 ` Shreyansh Jain
2016-08-30 4:31 ` Shreyansh Jain
2016-09-08 5:45 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 02/25] eal: remove duplicate function declaration Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 03/25] pci: no need for dynamic tailq init Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 04/25] crypto: no need for a crypto pmd type Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 05/25] drivers: align pci driver definitions Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 06/25] eal: introduce init macros Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 07/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 08/25] drivers: convert all pdev drivers as pci drivers Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 09/25] driver: Remove driver register callbacks for crypto/net Shreyansh Jain
2016-08-29 17:20 ` Ferruh Yigit
2016-08-30 4:36 ` Shreyansh Jain
2016-09-08 5:46 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update Shreyansh Jain
2016-08-30 16:34 ` Pattan, Reshma
2016-08-31 4:24 ` Shreyansh Jain
2016-09-08 5:48 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 11/25] ethdev: do not scan all pci devices on attach Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 12/25] eal: add hotplug operations for pci and vdev Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 13/25] ethdev: convert to eal hotplug Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 14/25] ethdev: get rid of device type Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 15/25] eal: extract vdev infra Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 16/25] eal: Remove PDEV/VDEV unused code Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
2016-08-29 16:57 ` Ferruh Yigit
2016-08-30 4:38 ` Shreyansh Jain
2016-09-08 5:49 ` Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 18/25] eal: move init/uninit to rte_vdev_driver Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 20/25] eal: rte_pci.h includes rte_dev.h Shreyansh Jain
2016-08-26 13:56 ` [dpdk-dev] [PATCH v8 21/25] eal: rename and move rte_pci_resource Shreyansh Jain
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
2016-08-29 16:49 ` Ferruh Yigit
2016-08-30 4:59 ` Shreyansh Jain
2016-09-08 5:51 ` Shreyansh Jain
2016-08-30 15:47 ` Ferruh Yigit
2016-09-01 13:54 ` Shreyansh Jain
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 23/25] eal: call rte_eal_driver_register Shreyansh Jain
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 24/25] eal: introduce rte_device Shreyansh Jain
2016-08-26 13:57 ` [dpdk-dev] [PATCH v8 25/25] eal/pci: Create rte_device list and fallback on its members Shreyansh Jain
2016-08-29 16:53 ` Ferruh Yigit
2016-08-30 4:38 ` Shreyansh Jain
2016-09-08 5:55 ` Shreyansh Jain
2016-09-08 8:33 ` Ferruh Yigit
2016-08-30 13:27 ` [dpdk-dev] [PATCH v8 00/25] Introducing rte_driver/rte_device generalization Ferruh Yigit
2016-09-01 12:36 ` Shreyansh Jain
2016-09-08 7:03 ` Shreyansh Jain
2016-09-01 18:29 ` Jan Viktorin
2016-09-02 5:32 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 " Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 01/25] eal: define macro container_of Shreyansh Jain
2016-09-08 14:16 ` Ferruh Yigit
2016-09-09 4:19 ` Shreyansh Jain
2016-09-09 8:55 ` Adrien Mazarguil
2016-09-09 10:44 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 02/25] eal: remove duplicate function declaration Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 03/25] pci: no need for dynamic tailq init Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 04/25] crypto: no need for a crypto pmd type Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 05/25] drivers: align pci driver definitions Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 06/25] eal: introduce init macros Shreyansh Jain
2016-09-12 7:15 ` David Marchand
2016-09-15 7:28 ` Shreyansh Jain
2016-09-07 14:07 ` [dpdk-dev] [PATCH v9 07/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
2016-09-12 7:16 ` David Marchand
2016-09-12 9:55 ` Thomas Monjalon
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 08/25] drivers: convert all pdev drivers as pci drivers Shreyansh Jain
2016-09-12 7:16 ` David Marchand
2016-09-16 4:49 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 09/25] driver: Remove driver register callbacks for crypto/net Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 10/25] eal/pci: Helpers for device name parsing/update Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 11/25] ethdev: do not scan all pci devices on attach Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 12/25] eal: add hotplug operations for pci and vdev Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug Shreyansh Jain
2016-09-12 7:16 ` David Marchand
2016-09-15 7:29 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 14/25] ethdev: get rid of device type Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 15/25] eal: extract vdev infra Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 16/25] eal: Remove PDEV/VDEV unused code Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 17/25] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Shreyansh Jain
2016-09-11 11:55 ` Yuanhan Liu
2016-09-12 4:39 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 18/25] eal: move init/uninit to rte_vdev_driver Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 19/25] eal: remove PMD_DRIVER_REGISTER and unused pmd_types Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 20/25] eal: rte_pci.h includes rte_dev.h Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 21/25] eal: rename and move rte_pci_resource Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 22/25] eal/pci: inherit rte_driver by rte_pci_driver Shreyansh Jain
2016-09-08 14:25 ` Ferruh Yigit
2016-09-16 4:47 ` Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 23/25] eal: call rte_eal_driver_register Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 24/25] eal: introduce rte_device Shreyansh Jain
2016-09-07 14:08 ` [dpdk-dev] [PATCH v9 25/25] eal/pci: Create rte_device list and fallback on its members Shreyansh Jain
2016-09-07 18:40 ` [dpdk-dev] [PATCH v9 00/25] Introducing rte_driver/rte_device generalization Stephen Hemminger
2016-09-08 7:10 ` Shreyansh Jain
2016-09-08 16:49 ` Stephen Hemminger
2016-09-09 11:42 ` Shreyansh Jain
2016-09-09 16:11 ` Declan Doherty
2016-09-13 11:15 ` Shreyansh Jain
2016-09-12 7:32 ` David Marchand
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 " Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 01/25] eal: define container macro Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 02/25] eal: remove duplicate function declaration Shreyansh Jain
2016-09-16 11:42 ` Jan Viktorin
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 03/25] pci: no need for dynamic tailq init Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 04/25] eal/pci: replace PCI devinit/devuninit with probe/remove Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 05/25] crypto: no need for a crypto pmd type Shreyansh Jain
2016-09-16 11:49 ` Jan Viktorin
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 06/25] drivers: align PCI driver definitions Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 07/25] eal: introduce PCI device init macros Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 08/25] driver: init/uninit common wrappers for PCI drivers Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 09/25] drivers: convert all phy drivers as " Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 10/25] drivers: remove driver register callbacks for crypto/net Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 11/25] eal/pci: helpers for device name parsing/update Shreyansh Jain
2016-10-25 15:49 ` Pattan, Reshma
2016-10-26 6:23 ` Shreyansh Jain
2016-10-26 9:12 ` Pattan, Reshma
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 12/25] ethdev: do not scan all PCI devices on attach Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 13/25] eal: add hotplug operations for PCI and VDEV Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 14/25] ethdev: convert to EAL hotplug Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 15/25] ethdev: get rid of device type Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 16/25] eal: extract vdev infra Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 17/25] eal: remove PDEV/VDEV unused code Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 18/25] drivers: convert VDRV to use RTE VDEV Driver Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 19/25] eal: remove unused PMD types Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 20/25] eal: include dev headers in place of PCI headers Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 21/25] eal: rename and move RTE PCI Resources Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 22/25] eal/pci: inherit RTE driver in PCI driver Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 23/25] eal: register EAL drivers explicitly Shreyansh Jain
2016-09-16 4:29 ` [dpdk-dev] [PATCH v10 24/25] eal: introduce generalized RTE device Shreyansh Jain
2016-09-16 4:30 ` [dpdk-dev] [PATCH v10 25/25] eal/pci: create RTE device list and fallback on its members Shreyansh Jain
[not found] ` <CALwxeUusnzO9daPnHkkf5QhY6_g67f-9oDzKcrhzXj7X3Lm_kQ@mail.gmail.com>
2016-09-16 14:29 ` [dpdk-dev] [PATCH v10 00/25] Introducing rte_driver/rte_device generalization David Marchand
2016-09-17 18:50 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 00/24] " Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 01/24] eal: remove duplicate function declaration Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 02/24] pci: no need for dynamic tailq init Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 03/24] eal/pci: replace PCI devinit/devuninit with probe/remove Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 04/24] crypto: no need for a crypto pmd type Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 05/24] drivers: align PCI driver definitions Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 06/24] eal: introduce PCI device init macros Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 07/24] driver: probe/remove common wrappers for PCI drivers Shreyansh Jain
2016-10-03 14:21 ` Thomas Monjalon
2016-10-04 6:16 ` Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 08/24] drivers: convert all phy drivers as " Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 09/24] drivers: remove driver register callbacks for crypto/net Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 10/24] eal/pci: helpers for device name parsing/update Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 11/24] ethdev: do not scan all PCI devices on attach Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 12/24] eal: add hotplug operations for PCI and VDEV Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 13/24] ethdev: convert to EAL hotplug Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 14/24] ethdev: get rid of device type Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 15/24] eal: extract vdev infra Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 16/24] eal: remove PDEV/VDEV unused code Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 17/24] drivers: convert VDRV to use RTE VDEV Driver Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 18/24] eal: remove unused PMD types Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 19/24] eal: include dev headers in place of PCI headers Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 20/24] eal: rename and move RTE PCI Resources Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 21/24] eal/pci: inherit RTE driver in PCI driver Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 22/24] eal: register EAL drivers explicitly Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 23/24] eal: introduce generalized RTE device Shreyansh Jain
2016-09-20 12:41 ` [dpdk-dev] [PATCH v11 24/24] eal/pci: create RTE device list and fallback on its members Shreyansh Jain
2016-09-21 19:03 ` [dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization Matej Vido
2016-09-22 4:25 ` Shreyansh Jain
2016-09-30 10:22 ` David Marchand
2016-10-03 14:28 ` Thomas Monjalon
2016-10-04 6:51 ` Shreyansh Jain
2016-10-04 7:42 ` Thomas Monjalon
2016-10-05 11:57 ` Shreyansh Jain
2016-10-17 13:43 ` Ferruh Yigit
2016-10-17 17:29 ` Shreyansh Jain
2016-10-18 9:23 ` Ferruh Yigit
2016-10-19 11:13 ` Shreyansh Jain
2016-10-18 13:04 ` Neil Horman
2016-10-18 13:47 ` Thomas Monjalon
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).