From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id D37992B93 for ; Mon, 4 Jul 2016 03:14:14 +0200 (CEST) Received: by mail-wm0-f54.google.com with SMTP id f126so85734877wma.1 for ; Sun, 03 Jul 2016 18:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wNjxrdv1FgI2tojXEppAGj0LfiIdh3G0acwK1nDj3TU=; b=lq0OlUB7NwQtFXdoHCU68L80RiDozlY8ADsjMSFgcUcmESr6hmtNB1xN8qY2XeaSly mrUDdC0aCFHkhSw8fpQL4OQhDYFBsfCsHfqHlRqN1+m4+VLrelaK+m5Rb2BZDaYERZY3 8FrQTEkN2KzH7yZZdtslB98Nc50BEzFd8P7c4INdscGxgsouAUnEZVOVpjYud7L1oJbA afWiFo/gA3A+4zgA4SOhkrRMpZxV3zA9JABPIKwb/1dnALpqzOnWVH7xdc24ox5TjE6e 9YuoezAmcQ9QRk7SLRZ9roe7tuWsc3MB3BeFvJwA9wBvq1KL5e4E3LP5xRNNb7VDlXRV v6Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wNjxrdv1FgI2tojXEppAGj0LfiIdh3G0acwK1nDj3TU=; b=gW6o9SOFSPJzORS0YvDZbKduFCVHMAcRUTOKoIwBxaGFHp3KWTYvOlKQNUeVPZ4vZj bBql1TMd/45+kAC7tdxa1Sg8cBvtbRoDkTUyrbRbxJdIxQqDpKw0zGe/80EWCPneMXtj 1yMrd7uOTAUBgrUEF00A7+DehPkWVJakaQ6GJF6SrAe9grETd+FGAmrcM7mp9ebOWFTp fNiDFIIbLB9CtIFCDV8S9wgE2OacOw11gwt7ARXN/ZzoL/PVGhOfaLGXm6AXC71slj7X S03pnU0+N+ZR12yRm7Cm76A8T5DXECrmvEvj6tg2mcyxmpRJ2bHSs4yPnibF9jlqZoo9 oIcw== X-Gm-Message-State: ALyK8tJy9RwcrOyPpOczSX+s2FNTATuLnTqYwxXFrmHQT4P4b7I3FnASWeRwAPLINbEKSJ05 X-Received: by 10.194.9.38 with SMTP id w6mr7660961wja.62.1467594854400; Sun, 03 Jul 2016 18:14:14 -0700 (PDT) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id l4sm5527127wjk.18.2016.07.03.18.14.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Jul 2016 18:14:13 -0700 (PDT) From: Thomas Monjalon To: Neil Horman Cc: dev@dpdk.org, Panu Matilainen Date: Mon, 4 Jul 2016 03:13:59 +0200 Message-Id: <1467594845-3487-2-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1467594845-3487-1-git-send-email-thomas.monjalon@6wind.com> References: <1466189185-21952-1-git-send-email-nhorman@tuxdriver.com> <1467594845-3487-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [PATCH v9 1/7] drivers: export infos as string symbols X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2016 01:14:15 -0000 From: Neil Horman 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 dpdk-pmdinfogen tool. For example: RTE_REGISTER_DRIVER(ena, ena_driver); registers the ena_driver struct as PMD_REGISTER_DRIVER did, and creates a symbol const char rte_pmd_name0[] __attribute__((used)) = "ena"; which dpdk-pmdinfogen can search for and extract. The subsequent macro RTE_EXPORT_PCI_TABLE(ena, ena_pci_id_map); creates a symbol const char ena_pci_table_export[] __attribute__((used)) = "ena_pci_id_map"; Which allows dpdk-pmdinfogen to find the pci table of this driver. Using this pattern, we can export arbitrary bits of information. dpdk-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 Signed-off-by: Thomas Monjalon --- doc/guides/prog_guide/dev_kit_build_system.rst | 19 ++++++++++++++++ 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 | 3 ++- 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 | 5 ++++- drivers/net/cxgbe/cxgbe_ethdev.c | 3 ++- 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/eal_common_dev.c | 2 +- lib/librte_eal/common/include/rte_dev.h | 30 ++++++++++++++++++++------ 37 files changed, 127 insertions(+), 46 deletions(-) diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst b/doc/guides/prog_guide/dev_kit_build_system.rst index 3e89eae..f3a4bff 100644 --- a/doc/guides/prog_guide/dev_kit_build_system.rst +++ b/doc/guides/prog_guide/dev_kit_build_system.rst @@ -304,6 +304,25 @@ Misc * rte.subdir.mk: Build several directories in the development kit framework. +.. _Internally_Generated_Build_Tools: + +Internally Generated Build Tools +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These well known symbol names are defined by various macros and used to export +important information about hardware support and usage for PMD files. For +instance the macro: + +.. code-block:: c + + RTE_REGISTER_DRIVER(drv, name) + +Creates the following symbol: + +.. code-block:: c + + static char rte_pmd_name0[] __attribute__((used)) = ""; + .. _Useful_Variables_Provided_by_the_Build_System: Useful Variables Provided by the Build System diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index 2987ef6..3e13eae 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); +RTE_REGISTER_DRIVER(aesni_gcm, aesni_gcm_pmd_drv); +RTE_EXPORT_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 6554fc4..2afc2bb 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); +RTE_REGISTER_DRIVER(aesni_mb, cryptodev_aesni_mb_pmd_drv); +RTE_EXPORT_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 5f8c7a2..3dda257 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); +RTE_REGISTER_DRIVER(kasumi, cryptodev_kasumi_pmd_drv); +RTE_EXPORT_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 bdaf13c..003dce7 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); +RTE_REGISTER_DRIVER(cryptodev_null_pmd, cryptodev_null_pmd_drv); +RTE_EXPORT_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 f46ec85..d9cd10a 100644 --- a/drivers/crypto/qat/rte_qat_cryptodev.c +++ b/drivers/crypto/qat/rte_qat_cryptodev.c @@ -134,4 +134,5 @@ static struct rte_driver pmd_qat_drv = { .init = rte_qat_pmd_init, }; -PMD_REGISTER_DRIVER(pmd_qat_drv); +RTE_REGISTER_DRIVER(qat, pmd_qat_drv); +RTE_EXPORT_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 dc8de6b..e531408 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); +RTE_REGISTER_DRIVER(snow3g, cryptodev_snow3g_pmd_drv); +RTE_EXPORT_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 2d7f344..9a9547c 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); +RTE_REGISTER_DRIVER(eth_af_packet, pmd_af_packet_drv); +RTE_EXPORT_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 3ff57c4..ec0d88d 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); +RTE_REGISTER_DRIVER(bnx2x,rte_bnx2x_driver); +RTE_EXPORT_PCI_TABLE(bnx2x, pci_id_bnx2x_map); +RTE_REGISTER_DRIVER(bnx2xvf, rte_bnx2xvf_driver); +RTE_EXPORT_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 406e38a..2e0801f 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); +RTE_REGISTER_DRIVER(bnxt, bnxt_pmd_drv); +RTE_EXPORT_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 9a2518f..579e67e 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2515,4 +2515,7 @@ static struct rte_driver bond_drv = { .uninit = bond_uninit, }; -PMD_REGISTER_DRIVER(bond_drv); +RTE_REGISTER_DRIVER(bonding, bond_drv); +RTE_EXPORT_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 6c130ed..7e12617 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1061,4 +1061,5 @@ static struct rte_driver rte_cxgbe_driver = { .init = rte_cxgbe_pmd_init, }; -PMD_REGISTER_DRIVER(rte_cxgbe_driver); +RTE_REGISTER_DRIVER(cxgb4, rte_cxgbe_driver); +RTE_EXPORT_PCI_TABLE(cxgb4, cxgb4_pci_tbl); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 653be09..d0a104e 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); +RTE_REGISTER_DRIVER(em, em_pmd_drv); +RTE_EXPORT_PCI_TABLE(em, pci_id_em_map); diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 5067d20..164aae5 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); +RTE_REGISTER_DRIVER(igb, pmd_igb_drv); +RTE_EXPORT_PCI_TABLE(igb, pci_id_igb_map); +RTE_REGISTER_DRIVER(igbvf, pmd_igbvf_drv); +RTE_EXPORT_PCI_TABLE(igbvf, pci_id_igbvf_map); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index e157587..82ade83 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); +RTE_REGISTER_DRIVER(ena, ena_pmd_drv); +RTE_EXPORT_PCI_TABLE(ena, pci_id_ena_map); diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index a7ce064..4e62282 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); +RTE_REGISTER_DRIVER(enic, rte_enic_driver); +RTE_EXPORT_PCI_TABLE(enic, pci_id_enic_map); diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index eb77705..62f7d41 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); +RTE_REGISTER_DRIVER(fm10k, rte_fm10k_driver); +RTE_EXPORT_PCI_TABLE(fm10k, pci_id_fm10k_map); diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f414d93..8fc0852 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); +RTE_REGISTER_DRIVER(i40e, rte_i40e_driver); +RTE_EXPORT_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 7b6df1d..27b7b57 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); +RTE_REGISTER_DRIVER(i40evf, rte_i40evf_driver); +RTE_EXPORT_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 0629b42..014b972 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); +RTE_REGISTER_DRIVER(ixgbe, rte_ixgbe_driver); +RTE_EXPORT_PCI_TABLE(ixgbe, pci_id_ixgbe_map); +RTE_REGISTER_DRIVER(ixgbevf, rte_ixgbevf_driver); +RTE_EXPORT_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index f8ed42b..1681fc3 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) +RTE_REGISTER_DRIVER(mlx4, rte_mlx4_driver); +RTE_EXPORT_PCI_TABLE(mlx4, mlx4_pci_id_map); diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 5aa4adc..5f4186a 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) +RTE_REGISTER_DRIVER(mlx5, rte_mlx5_driver); +RTE_EXPORT_PCI_TABLE(mlx5, mlx5_pci_id_map); diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index 26e1424..94f71ad 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); +RTE_REGISTER_DRIVER(mpipe_xgbe, pmd_mpipe_xgbe_drv); +RTE_REGISTER_DRIVER(mpipe_gbe, pmd_mpipe_gbe_drv); 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 6afd49b..de0f961 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); +RTE_REGISTER_DRIVER(nfp, rte_nfp_net_driver); +RTE_EXPORT_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 ab440f3..e22b5c3 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); +RTE_REGISTER_DRIVER(eth_null, pmd_null_drv); +RTE_EXPORT_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 c86f17b..2dd536e 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); +RTE_REGISTER_DRIVER(pcap, pmd_pcap_drv); +RTE_EXPORT_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 bb531be..bc07b99 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); +RTE_REGISTER_DRIVER(qede, rte_qede_driver); +RTE_EXPORT_PCI_TABLE(qede, pci_id_qede_map); +RTE_REGISTER_DRIVER(qedevf, rte_qedevf_driver); +RTE_EXPORT_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 b1783c3..7a11d78 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); +RTE_REGISTER_DRIVER(eth_ring, pmd_ring_drv); +RTE_EXPORT_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 985a8d6..d8564d9 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); +RTE_REGISTER_DRIVER(rte_szedata2_pmd, rte_szedata2_driver); +RTE_EXPORT_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 48ed381..4593251 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); +RTE_REGISTER_DRIVER(thunderx_nicvf, rte_nicvf_driver); +RTE_EXPORT_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 c5bbb87..ea3a248 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); +RTE_REGISTER_DRIVER(eth_vhost, pmd_vhost_drv); +RTE_EXPORT_PARAM_STRING(eth_vhost, "iface= queues="); diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 480daa3..a884d77 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); +RTE_REGISTER_DRIVER(virtio_net, rte_virtio_driver); +RTE_EXPORT_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 5ab2471..587de75 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); +RTE_REGISTER_DRIVER(virtio_user, virtio_user_driver); diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 29b469c..be4c404 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); +RTE_REGISTER_DRIVER(vmxnet3, rte_vmxnet3_driver); +RTE_EXPORT_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 3e45808..f28f5f0 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); +RTE_REGISTER_DRIVER(xenvirt, pmd_xenvirt_drv); diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index a8a4146..707e875 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -98,7 +98,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 RTE_REGISTER_DRIVER macro */ /* call the init function for each virtual device */ diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index f1b5507..1aa7656 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 _RTE_EXPORT_DRIVER_NAME(name, index) name##index[] + +#define RTE_EXPORT_DRIVER_NAME(name, index) \ +static const char _RTE_EXPORT_DRIVER_NAME(rte_pmd_name, index) \ +__attribute__((used)) = RTE_STR(name) + +#define RTE_REGISTER_DRIVER(_name, driver)\ +void devinitfn_ ##driver(void);\ +void __attribute__((constructor, used)) devinitfn_ ##driver(void)\ {\ - rte_eal_driver_register(&d);\ -} + (driver).name = RTE_STR(_name);\ + rte_eal_driver_register(&driver);\ +} \ +RTE_EXPORT_DRIVER_NAME(_name, __COUNTER__) + +#define _RTE_EXPORT_TAG(name, tag) __##name##_##tag + +#define RTE_EXPORT_PCI_TABLE(name, table) \ +static const char _RTE_EXPORT_TAG(name, pci_table_export)[] \ +__attribute__((used)) = RTE_STR(table) + +#define RTE_EXPORT_PARAM_STRING(name, str) \ +static const char _RTE_EXPORT_TAG(name, param_string_export)[] \ +__attribute__((used)) = str #ifdef __cplusplus } -- 2.7.0