From: Neil Horman <nhorman@tuxdriver.com>
To: dev@dpdk.org
Cc: David Marchand <david.marchand@6wind.com>,
Stephen Hemminger <stephen@networkplumber.org>,
bruce.richardson@intel.com, Panu Matilainen <pmatilai@redhat.com>,
Thomas Monjalon <thomas.monjalon@6wind.com>,
Neil Horman <nhorman@tuxdriver.com>
Subject: [dpdk-dev] [RFC PATCH 1/4] pmd: Modify PMD_REGISTER_DRIVER to emit a marker symbol
Date: Tue, 26 Apr 2016 13:39:48 -0400 [thread overview]
Message-ID: <1461692391-30093-2-git-send-email-nhorman@tuxdriver.com> (raw)
In-Reply-To: <1461692391-30093-1-git-send-email-nhorman@tuxdriver.com>
modify PMD_REGISTER_DRIVER so that, when building as a DSO, PMD's emit an
additional set of symbols named this_pmd_driver<n>, where <n> is an incrementing
counter. This gives well known symbol names that external apps can search for
when looking up PMD information. These new symbols are aliased to the passed in
rte_driver_struct, which future apps can use to interrogate the PMD's for useful
information
Also modify the rte_driver struct to add a union that can hold pmd type specific
information. Currently, only PMD_PDEV uses this to store a pointer to the PMD's
pci id table.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: David Marchand <david.marchand@6wind.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
CC: "Richardson, Bruce" <bruce.richardson@intel.com>
CC: Panu Matilainen <pmatilai@redhat.com>
CC: Thomas Monjalon <thomas.monjalon@6wind.com>
---
lib/librte_eal/common/include/rte_dev.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index f1b5507..a81d901 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -50,6 +50,9 @@ extern "C" {
#include <sys/queue.h>
#include <rte_log.h>
+#include <rte_config.h>
+#include <rte_common.h>
+#include <rte_pci.h>
__attribute__((format(printf, 2, 0)))
static inline void
@@ -131,6 +134,9 @@ struct rte_driver {
const char *name; /**< Driver name. */
rte_dev_init_t *init; /**< Device init. function. */
rte_dev_uninit_t *uninit; /**< Device uninit. function. */
+ union {
+ const struct rte_pci_id *pci_table;
+ };
};
/**
@@ -178,12 +184,27 @@ int rte_eal_vdev_init(const char *name, const char *args);
*/
int rte_eal_vdev_uninit(const char *name);
+#ifdef RTE_BUILD_SHARED_LIB
+#define DRIVER_EXPORT_NAME(name, idx) name##idx
+#define DECLARE_DRIVER_EXPORT(src, idx)\
+extern struct rte_driver DRIVER_EXPORT_NAME(this_pmd_driver, idx)\
+ __attribute__((alias(RTE_STR(src))))
+
+#define PMD_REGISTER_DRIVER(d)\
+void devinitfn_ ##d(void);\
+void __attribute__((constructor, used)) devinitfn_ ##d(void)\
+{\
+ rte_eal_driver_register(&d);\
+}\
+DECLARE_DRIVER_EXPORT(d, __COUNTER__)
+#else
#define PMD_REGISTER_DRIVER(d)\
void devinitfn_ ##d(void);\
void __attribute__((constructor, used)) devinitfn_ ##d(void)\
{\
rte_eal_driver_register(&d);\
}
+#endif
#ifdef __cplusplus
}
--
2.5.5
next prev parent reply other threads:[~2016-04-26 17:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 17:39 [dpdk-dev] [RFC PATCH 0/4]: Implement module information export Neil Horman
2016-04-26 17:39 ` Neil Horman [this message]
2016-04-26 17:39 ` [dpdk-dev] [RFC PATCH 2/4] pmds: export this_pmd_driver* symbols Neil Horman
2016-04-26 17:39 ` [dpdk-dev] [RFC PATCH 3/4] pmd: Modify drivers to export appropriate information Neil Horman
2016-04-26 17:39 ` [dpdk-dev] [RFC PATCH 4/4] pmdinfo: Add application to extract pmd driver info Neil Horman
2016-05-03 11:57 ` [dpdk-dev] [RFC PATCH 0/4]: Implement module information export Neil Horman
2016-05-04 8:24 ` David Marchand
2016-05-04 11:43 ` Neil Horman
2016-05-04 21:16 ` Thomas Monjalon
2016-05-05 9:42 ` Bruce Richardson
2016-05-05 11:38 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461692391-30093-2-git-send-email-nhorman@tuxdriver.com \
--to=nhorman@tuxdriver.com \
--cc=bruce.richardson@intel.com \
--cc=david.marchand@6wind.com \
--cc=dev@dpdk.org \
--cc=pmatilai@redhat.com \
--cc=stephen@networkplumber.org \
--cc=thomas.monjalon@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).