DPDK patches and discussions
 help / color / mirror / Atom feed
From: Timothy McDaniel <timothy.mcdaniel@intel.com>
To: Jerin Jacob <jerinj@marvell.com>, Ray Kinsella <mdr@ashroe.eu>,
	Neil Horman <nhorman@tuxdriver.com>
Cc: dev@dpdk.org, erik.g.carrillo@intel.com, gage.eads@intel.com,
	harry.van.haaren@intel.com
Subject: [dpdk-dev] [PATCH v5] eventdev: add PCI probe named convenience function
Date: Wed, 14 Oct 2020 16:41:17 -0500	[thread overview]
Message-ID: <1602711677-11123-1-git-send-email-timothy.mcdaniel@intel.com> (raw)
In-Reply-To: <1599843867-28048-1-git-send-email-timothy.mcdaniel@intel.com>

Add new internal wrapper function for use by pci drivers as a
.probe function to attach to an event interface.  Same as
rte_event_pmd_pci_probe, except the caller can specify the name.

Updated rte_event_pmd_pci_probe so as to not duplicate
code.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
Reviewed-by: Gage Eads <gage.eads@intel.com>
---
 lib/librte_eventdev/rte_eventdev_pmd_pci.h   | 46 ++++++++++++++++++++--------
 lib/librte_eventdev/rte_eventdev_version.map |  2 ++
 2 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev_pmd_pci.h b/lib/librte_eventdev/rte_eventdev_pmd_pci.h
index a3f9244..5f238bf 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd_pci.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd_pci.h
@@ -32,28 +32,25 @@ typedef int (*eventdev_pmd_pci_callback_t)(struct rte_eventdev *dev);
 
 /**
  * @internal
- * Wrapper for use by pci drivers as a .probe function to attach to a event
- * interface.
+ * Wrapper for use by pci drivers as a .probe function to attach to an event
+ * interface.  Same as rte_event_pmd_pci_probe, except caller can specify
+ * the name.
  */
+__rte_experimental
 static inline int
-rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
-			    struct rte_pci_device *pci_dev,
-			    size_t private_data_size,
-			    eventdev_pmd_pci_callback_t devinit)
+rte_event_pmd_pci_probe_named(struct rte_pci_driver *pci_drv,
+			      struct rte_pci_device *pci_dev,
+			      size_t private_data_size,
+			      eventdev_pmd_pci_callback_t devinit,
+			      const char *name)
 {
 	struct rte_eventdev *eventdev;
-
-	char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN];
-
 	int retval;
 
 	if (devinit == NULL)
 		return -EINVAL;
 
-	rte_pci_device_name(&pci_dev->addr, eventdev_name,
-			sizeof(eventdev_name));
-
-	eventdev = rte_event_pmd_allocate(eventdev_name,
+	eventdev = rte_event_pmd_allocate(name,
 			 pci_dev->device.numa_node);
 	if (eventdev == NULL)
 		return -ENOMEM;
@@ -90,6 +87,29 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
 
 /**
  * @internal
+ * Wrapper for use by pci drivers as a .probe function to attach to a event
+ * interface.
+ */
+static inline int
+rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
+			    struct rte_pci_device *pci_dev,
+			    size_t private_data_size,
+			    eventdev_pmd_pci_callback_t devinit)
+{
+	char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN];
+
+	rte_pci_device_name(&pci_dev->addr, eventdev_name,
+			sizeof(eventdev_name));
+
+	return rte_event_pmd_pci_probe_named(pci_drv,
+					     pci_dev,
+					     private_data_size,
+					     devinit,
+					     eventdev_name);
+}
+
+/**
+ * @internal
  * Wrapper for use by pci drivers as a .remove function to detach a event
  * interface.
  */
diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map
index 2846d04..8ae8420 100644
--- a/lib/librte_eventdev/rte_eventdev_version.map
+++ b/lib/librte_eventdev/rte_eventdev_version.map
@@ -136,4 +136,6 @@ EXPERIMENTAL {
 
 	# changed in 20.11
 	__rte_eventdev_trace_port_setup;
+	# added in 20.11
+	rte_event_pmd_pci_probe_named;
 };
-- 
2.6.4


  parent reply	other threads:[~2020-10-14 21:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 17:04 [dpdk-dev] [PATCH] " Timothy McDaniel
2020-09-14 20:22 ` Eads, Gage
2020-09-16 18:39   ` McDaniel, Timothy
2020-10-12 18:42 ` Timothy McDaniel
2020-10-14  9:31   ` Kinsella, Ray
2020-10-14 15:37     ` Eads, Gage
2020-10-16 11:26       ` Kinsella, Ray
2020-10-12 19:01 ` Timothy McDaniel
2020-10-13 18:47   ` Jerin Jacob
2020-10-14 17:35 ` [dpdk-dev] [PATCH v4] " Timothy McDaniel
2020-10-14 21:41 ` Timothy McDaniel [this message]
2020-10-15 14:16 ` [dpdk-dev] [PATCH v6] " Timothy McDaniel
2020-10-15 18:49   ` Jerin Jacob

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=1602711677-11123-1-git-send-email-timothy.mcdaniel@intel.com \
    --to=timothy.mcdaniel@intel.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=jerinj@marvell.com \
    --cc=mdr@ashroe.eu \
    --cc=nhorman@tuxdriver.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).