From cb6696d22023efad238709239792ec66b0920017 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Fri, 17 Jun 2016 14:46:21 -0400 Subject: [PATCH] drivers: update registration macro usage Modify the PMD_REGISTER_DRIVER macro, adding a name argument to it. The addition of a name argument creates a token that can be used for subsequent macros in the creation of unique symbol names to export additional bits of information for use by the pmdinfogen tool. For example: PMD_REGISTER_DRIVER(ena_driver, ena); registers the ena_driver struct as it always did, and creates a symbol const char this_pmd_name0[] __attribute__((used)) = "ena"; which pmdinfogen can search for and extract. The subsequent macro DRIVER_REGISTER_PCI_TABLE(ena, ena_pci_id_map); creates a symbol const char ena_pci_tbl_export[] __attribute__((used)) = "ena_pci_id_map"; Which allows pmdinfogen to find the pci table of this driver Using this pattern, we can export arbitrary bits of information. pmdinfo uses this information to extract hardware support from an object file and create a json string to make hardware support info discoverable later. Signed-off-by: Neil Horman Acked-by: Panu Matilainen Acked-by: Remy Horton --- drivers/Makefile | 2 ++ 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/qat/rte_qat_cryptodev.c | 4 ++- drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 ++- drivers/net/af_packet/rte_eth_af_packet.c | 4 ++- drivers/net/bnx2x/bnx2x_ethdev.c | 6 +++-- drivers/net/bnxt/bnxt_ethdev.c | 3 ++- drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++- drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++- drivers/net/e1000/em_ethdev.c | 3 ++- drivers/net/e1000/igb_ethdev.c | 6 +++-- drivers/net/ena/ena_ethdev.c | 3 ++- drivers/net/enic/enic_ethdev.c | 3 ++- drivers/net/fm10k/fm10k_ethdev.c | 3 ++- drivers/net/i40e/i40e_ethdev.c | 3 ++- drivers/net/i40e/i40e_ethdev_vf.c | 3 ++- drivers/net/ixgbe/ixgbe_ethdev.c | 6 +++-- drivers/net/mlx4/mlx4.c | 3 ++- drivers/net/mlx5/mlx5.c | 3 ++- drivers/net/mpipe/mpipe_tilegx.c | 4 +-- drivers/net/nfp/nfp_net.c | 3 ++- drivers/net/null/rte_eth_null.c | 3 ++- drivers/net/pcap/rte_eth_pcap.c | 4 ++- drivers/net/qede/qede_ethdev.c | 6 +++-- drivers/net/ring/rte_eth_ring.c | 3 ++- drivers/net/szedata2/rte_eth_szedata2.c | 3 ++- drivers/net/thunderx/nicvf_ethdev.c | 3 ++- drivers/net/vhost/rte_eth_vhost.c | 3 ++- drivers/net/virtio/virtio_ethdev.c | 3 ++- drivers/net/virtio/virtio_user_ethdev.c | 2 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 3 ++- drivers/net/xenvirt/rte_eth_xenvirt.c | 2 +- lib/librte_eal/common/include/rte_dev.h | 30 +++++++++++++++++----- 36 files changed, 113 insertions(+), 45 deletions(-) diff --git a/drivers/Makefile b/drivers/Makefile index 81c03a8598..75a316827a 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -34,4 +34,6 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-y += net DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto +DEPDIRS-y += buildtools/pmdinfo + include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index 2987ef6b60..f43e407191 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -521,4 +521,6 @@ static struct rte_driver aesni_gcm_pmd_drv = { .uninit = aesni_gcm_uninit }; -PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv); +PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv, aesni_gcm); +DRIVER_REGISTER_PARAM_STRING(aesni_gcm, "max_nb_queue_pairs= " +"max_nb_sessions= socket_id="); diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index 6554fc4e44..db3e5624ae 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -721,4 +721,6 @@ static struct rte_driver cryptodev_aesni_mb_pmd_drv = { .uninit = cryptodev_aesni_mb_uninit }; -PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drv); +PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drvi, aesni_mb); +DRIVER_REGISTER_PARAM_STRING(aesni_gcm, "max_nb_queue_pairs= " +"max_nb_sessions= socket_id="); diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 5f8c7a2e82..1d5af4676e 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -654,4 +654,6 @@ static struct rte_driver cryptodev_kasumi_pmd_drv = { .uninit = cryptodev_kasumi_uninit }; -PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv); +PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv, kasumi); +DRIVER_REGISTER_PARAM_STRING(kasumi, "max_nb_queue_pairs= " +"max_nb_sessions= socket_id="); diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index bdaf13ca56..0a195ed57e 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -275,4 +275,6 @@ static struct rte_driver cryptodev_null_pmd_drv = { .uninit = cryptodev_null_uninit }; -PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv); +PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv, cryptodev_null_pmd); +DRIVER_REGISTER_PARAM_STRING(aesni_gcm, "max_nb_queue_pairs= " +"max_nb_sessions= socket_id="); diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c index f46ec85750..b35267e66d 100644 --- a/drivers/crypto/qat/rte_qat_cryptodev.c +++ b/drivers/crypto/qat/rte_qat_cryptodev.c @@ -134,4 +134,6 @@ static struct rte_driver pmd_qat_drv = { .init = rte_qat_pmd_init, }; -PMD_REGISTER_DRIVER(pmd_qat_drv); +PMD_REGISTER_DRIVER(pmd_qat_drv, qat); +DRIVER_REGISTER_PCI_TABLE(qat, pci_id_qat_map); + diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index dc8de6bda3..ddb724c73b 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -645,4 +645,6 @@ static struct rte_driver cryptodev_snow3g_pmd_drv = { .uninit = cryptodev_snow3g_uninit }; -PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv); +PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv, snow3g); +DRIVER_REGISTER_PARAM_STRING(aesni_gcm, "max_nb_queue_pairs= " +"max_nb_sessions= socket_id="); diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 2d7f34481b..1d48e971c3 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -896,4 +896,6 @@ static struct rte_driver pmd_af_packet_drv = { .uninit = rte_pmd_af_packet_devuninit, }; -PMD_REGISTER_DRIVER(pmd_af_packet_drv); +PMD_REGISTER_DRIVER(pmd_af_packet_drv, eth_af_packet); +DRIVER_REGISTER_PARAM_STRING(eth_af_packet, "iface= " +"qpairs= blocksz= framesz= framecnt="); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 3ff57c420f..65b99a06d1 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -566,5 +566,7 @@ static struct rte_driver rte_bnx2xvf_driver = { .init = rte_bnx2xvf_pmd_init, }; -PMD_REGISTER_DRIVER(rte_bnx2x_driver); -PMD_REGISTER_DRIVER(rte_bnx2xvf_driver); +PMD_REGISTER_DRIVER(rte_bnx2x_driver, bnx2x); +DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map); +PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf); +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 406e38a6b1..9531abf8f8 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1046,4 +1046,5 @@ static struct rte_driver bnxt_pmd_drv = { .init = bnxt_rte_pmd_init, }; -PMD_REGISTER_DRIVER(bnxt_pmd_drv); +PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt); +DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 9a2518fb44..e2890bebb0 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2515,4 +2515,9 @@ static struct rte_driver bond_drv = { .uninit = bond_uninit, }; -PMD_REGISTER_DRIVER(bond_drv); +PMD_REGISTER_DRIVER(bond_drv, bonding); + +DRIVER_REGISTER_PARAM_STRING(bonding, "slave= primary= mode=[0-4] " +"xmit_policy=[l2 | l23 | l34] socket_id= mac= " +"lsc_poll_period_ms= up_delay= down_delay="); + diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 6c130ed2e2..7e0e819e28 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1061,4 +1061,6 @@ static struct rte_driver rte_cxgbe_driver = { .init = rte_cxgbe_pmd_init, }; -PMD_REGISTER_DRIVER(rte_cxgbe_driver); +PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4); +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 653be09234..4de5eb2fc6 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1777,4 +1777,5 @@ struct rte_driver em_pmd_drv = { .init = rte_em_pmd_init, }; -PMD_REGISTER_DRIVER(em_pmd_drv); +PMD_REGISTER_DRIVER(em_pmd_drv, em); +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 5067d208a6..76d9f5307a 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -5210,5 +5210,7 @@ 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); +PMD_REGISTER_DRIVER(pmd_igb_drv, igb); +DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map); +PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf); +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 e157587b1d..702289b803 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1450,4 +1450,5 @@ struct rte_driver ena_pmd_drv = { .init = rte_ena_pmd_init, }; -PMD_REGISTER_DRIVER(ena_pmd_drv); +PMD_REGISTER_DRIVER(ena_pmd_drv, ena); +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 a7ce064fd9..0929c3f906 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -636,4 +636,5 @@ static struct rte_driver rte_enic_driver = { .init = rte_enic_pmd_init, }; -PMD_REGISTER_DRIVER(rte_enic_driver); +PMD_REGISTER_DRIVER(rte_enic_driver, enic); +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 eb77705e3b..66be9c6bef 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3086,4 +3086,5 @@ static struct rte_driver rte_fm10k_driver = { .init = rte_pmd_fm10k_init, }; -PMD_REGISTER_DRIVER(rte_fm10k_driver); +PMD_REGISTER_DRIVER(rte_fm10k_driver, 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 f414d9386b..47b9b6b2e3 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -705,7 +705,8 @@ static struct rte_driver rte_i40e_driver = { .init = rte_i40e_pmd_init, }; -PMD_REGISTER_DRIVER(rte_i40e_driver); +PMD_REGISTER_DRIVER(rte_i40e_driver, i40e); +DRIVER_REGISTER_PCI_TABLE(i40e, pci_id_i40e_map); /* * Initialize registers for flexible payload, which should be set by NVM. diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 7b6df1d846..1a04c7446e 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1581,7 +1581,8 @@ static struct rte_driver rte_i40evf_driver = { .init = rte_i40evf_pmd_init, }; -PMD_REGISTER_DRIVER(rte_i40evf_driver); +PMD_REGISTER_DRIVER(rte_i40evf_driver, i40evf); +DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map); 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 0629b426e6..3daa070d0e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -7352,5 +7352,7 @@ static struct rte_driver rte_ixgbevf_driver = { .init = rte_ixgbevf_pmd_init, }; -PMD_REGISTER_DRIVER(rte_ixgbe_driver); -PMD_REGISTER_DRIVER(rte_ixgbevf_driver); +PMD_REGISTER_DRIVER(rte_ixgbe_driver, ixgbe); +DRIVER_REGISTER_PCI_TABLE(ixgbe, pci_id_ixgbe_map); +PMD_REGISTER_DRIVER(rte_ixgbevf_driver, ixgbevf); +DRIVER_REGISTER_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index f8ed42b83a..8758eac97c 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5861,4 +5861,5 @@ static struct rte_driver rte_mlx4_driver = { .init = rte_mlx4_pmd_init, }; -PMD_REGISTER_DRIVER(rte_mlx4_driver) +PMD_REGISTER_DRIVER(rte_mlx4_driveri, 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 5aa4adc696..358e9b49c1 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -762,4 +762,5 @@ static struct rte_driver rte_mlx5_driver = { .init = rte_mlx5_pmd_init, }; -PMD_REGISTER_DRIVER(rte_mlx5_driver) +PMD_REGISTER_DRIVER(rte_mlx5_driveri, mlx5) +DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map); diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index 26e14248ca..4a2a9052a8 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -1635,8 +1635,8 @@ static struct rte_driver pmd_mpipe_gbe_drv = { .init = rte_pmd_mpipe_devinit, }; -PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv); -PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv); +PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv, mpipe_xgbe); +PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv, mpipe_gbe); static void __attribute__((constructor, used)) mpipe_init_contexts(void) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 6afd49b13b..82e3e4e19f 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2486,7 +2486,8 @@ static struct rte_driver rte_nfp_net_driver = { .init = nfp_net_pmd_init, }; -PMD_REGISTER_DRIVER(rte_nfp_net_driver); +PMD_REGISTER_DRIVER(rte_nfp_net_driver, nfp); +DRIVER_REGISTER_PCI_TABLE(nfp, pci_id_nfp_net_map); /* * Local variables: diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index ab440f3b1d..ae0ff777e6 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -693,4 +693,5 @@ static struct rte_driver pmd_null_drv = { .uninit = rte_pmd_null_devuninit, }; -PMD_REGISTER_DRIVER(pmd_null_drv); +PMD_REGISTER_DRIVER(pmd_null_drv, eth_null); +DRIVER_REGISTER_PARAM_STRING(eth_null, "size= copy="); diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index c86f17b64d..b341f93a38 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -1090,4 +1090,6 @@ static struct rte_driver pmd_pcap_drv = { .uninit = rte_pmd_pcap_devuninit, }; -PMD_REGISTER_DRIVER(pmd_pcap_drv); +PMD_REGISTER_DRIVER(pmd_pcap_drv, pcap); +DRIVER_REGISTER_PARAM_STRING(pcap, "rx_pcap= tx_pcap= " +"rx_iface= tx_iface= iface="); diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index bb531be5a9..837f410442 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1340,5 +1340,7 @@ static struct rte_driver rte_qede_driver = { .init = rte_qedevf_pmd_init }; -PMD_REGISTER_DRIVER(rte_qede_driver); -PMD_REGISTER_DRIVER(rte_qedevf_driver); +PMD_REGISTER_DRIVER(rte_qede_driver, qede); +DRIVER_REGISTER_PCI_TABLE(qede, pci_id_qede_map); +PMD_REGISTER_DRIVER(rte_qedevf_driver, qedevf); +DRIVER_REGISTER_PCI_TABLE(qedevf, pci_id_qedevf_map); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index b1783c3e3a..f2f5217144 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -630,4 +630,5 @@ static struct rte_driver pmd_ring_drv = { .uninit = rte_pmd_ring_devuninit, }; -PMD_REGISTER_DRIVER(pmd_ring_drv); +PMD_REGISTER_DRIVER(pmd_ring_drv, eth_ring); +DRIVER_REGISTER_PARAM_STRING(eth_ring, "nodeaction=[attach|detach]"); diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 985a8d6014..e71bce51bc 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1601,4 +1601,5 @@ static struct rte_driver rte_szedata2_driver = { .uninit = rte_szedata2_uninit, }; -PMD_REGISTER_DRIVER(rte_szedata2_driver); +PMD_REGISTER_DRIVER(rte_szedata2_driver, rte_szedata2_pmd); +DRIVER_REGISTER_PCI_TABLE(rte_szedata2_pmd, rte_szedata2_pci_id_table); diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 48ed3812fe..03bf458ad9 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -1788,4 +1788,5 @@ static struct rte_driver rte_nicvf_driver = { .init = rte_nicvf_pmd_init, }; -PMD_REGISTER_DRIVER(rte_nicvf_driver); +PMD_REGISTER_DRIVER(rte_nicvf_driver, thunderx_nicvf); +DRIVER_REGISTER_PCI_TABLE(thunderx_nicvf, pci_id_nicvf_map); diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 3b5094653f..a02dd552d8 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -921,4 +921,5 @@ static struct rte_driver pmd_vhost_drv = { .uninit = rte_pmd_vhost_devuninit, }; -PMD_REGISTER_DRIVER(pmd_vhost_drv); +PMD_REGISTER_DRIVER(pmd_vhost_drv, eth_vhost); +DRIVER_REGISTER_PARAM_STRING(eth_vhost, "iface= queues="); diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 480daa37b6..e6c2ac2110 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1571,4 +1571,5 @@ static struct rte_driver rte_virtio_driver = { .init = rte_virtio_pmd_init, }; -PMD_REGISTER_DRIVER(rte_virtio_driver); +PMD_REGISTER_DRIVER(rte_virtio_driver, virtio_net); +DRIVER_REGISTER_PCI_TABLE(virtio_net, pci_id_virtio_map); diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 5ab2471195..2ed43803d5 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -437,4 +437,4 @@ static struct rte_driver virtio_user_driver = { .uninit = virtio_user_pmd_devuninit, }; -PMD_REGISTER_DRIVER(virtio_user_driver); +PMD_REGISTER_DRIVER(virtio_user_driver, virtio_user); diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 29b469cc9c..8da4449895 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -954,4 +954,5 @@ static struct rte_driver rte_vmxnet3_driver = { .init = rte_vmxnet3_pmd_init, }; -PMD_REGISTER_DRIVER(rte_vmxnet3_driver); +PMD_REGISTER_DRIVER(rte_vmxnet3_driver, vmxnet3); +DRIVER_REGISTER_PCI_TABLE(vmxnet3, pci_id_vmxnet3_map); diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c index 3e45808f8c..47e329990a 100644 --- a/drivers/net/xenvirt/rte_eth_xenvirt.c +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c @@ -766,4 +766,4 @@ static struct rte_driver pmd_xenvirt_drv = { .uninit = rte_pmd_xenvirt_devuninit, }; -PMD_REGISTER_DRIVER(pmd_xenvirt_drv); +PMD_REGISTER_DRIVER(pmd_xenvirt_drv, xenvirt); diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index f1b5507940..e6f0d4c34f 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -48,7 +48,7 @@ extern "C" { #include #include - +#include #include __attribute__((format(printf, 2, 0))) @@ -178,12 +178,30 @@ 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)\ +#define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[] + +#define DRIVER_EXPORT_NAME(name, idx) \ +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_eal_driver_register(&d);\ -} + (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) \ +static const char DRV_EXP_TAG(name, pci_tbl_export)[] __attribute__((used)) = \ +RTE_STR(table) + +#define DRIVER_REGISTER_PARAM_STRING(name, str) \ +static const char DRV_EXP_TAG(name, param_string_export)[] \ +__attribute__((used)) = str #ifdef __cplusplus } -- 2.20.1