From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/3] net/ring: create vdev from PMD specific API
Date: Fri, 9 Jun 2017 18:51:19 +0100 [thread overview]
Message-ID: <20170609175120.77652-2-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20170609175120.77652-1-ferruh.yigit@intel.com>
When ring PMD created via PMD specific API instead of EAL abstraction
it is missing the virtual device creation done by EAL vdev.
And this makes eth_dev unusable exact same as other PMDs used, because
of some missing fields, like rte_device->name.
Now API creates a virtual device and sets proper fields, not all, and it
still won't be linked in the virtual device list eal keeps track. But
makes PMD usable in usual manner.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/ring/rte_eth_ring.c | 49 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 6feb137..a9355ff 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -365,6 +365,41 @@ do_eth_dev_ring_create(const char *name,
return -1;
}
+static struct rte_vdev_device *
+alloc_vdev(const char *name)
+{
+ struct rte_devargs *devargs = NULL;
+ struct rte_vdev_device *vdev = NULL;
+ int ret;
+
+ devargs = calloc(1, sizeof(*devargs));
+ if (!devargs)
+ goto out_free;
+
+ vdev = calloc(1, sizeof(*vdev));
+ if (!vdev)
+ goto out_free;
+
+ devargs->type = RTE_DEVTYPE_VIRTUAL;
+ ret = snprintf(devargs->virt.drv_name, sizeof(devargs->virt.drv_name),
+ "%s", name);
+ if (ret < 0)
+ goto out_free;
+
+ vdev->device.devargs = devargs;
+ vdev->device.numa_node = SOCKET_ID_ANY;
+ vdev->device.name = devargs->virt.drv_name;
+
+ vdev->device.driver = &pmd_ring_drv.driver;
+
+ return vdev;
+
+out_free:
+ free(devargs);
+ free(vdev);
+ return NULL;
+}
+
int
rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned nb_rx_queues,
@@ -373,6 +408,8 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
const unsigned numa_node)
{
struct rte_eth_dev *eth_dev = NULL;
+ struct rte_vdev_device *vdev;
+ int ret;
/* do some parameter checking */
if (rx_queues == NULL && nb_rx_queues > 0) {
@@ -388,9 +425,19 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
return -1;
}
- return do_eth_dev_ring_create(name, rx_queues, nb_rx_queues,
+ vdev = alloc_vdev(name);
+ if (!vdev) {
+ rte_errno = EINVAL;
+ return -1;
+ }
+
+ ret = do_eth_dev_ring_create(name, rx_queues, nb_rx_queues,
tx_queues, nb_tx_queues, numa_node, DEV_ATTACH,
ð_dev);
+
+ eth_dev->device = &vdev->device;
+
+ return ret;
}
int
--
2.9.4
next prev parent reply other threads:[~2017-06-09 17:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 11:15 [dpdk-dev] [PATCH] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-06 15:10 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2017-06-06 15:31 ` Gaëtan Rivet
2017-06-07 4:52 ` Shreyansh Jain
2017-06-07 16:11 ` Jan Blunck
2017-06-09 14:22 ` Ferruh Yigit
2017-06-09 15:49 ` Ferruh Yigit
2017-06-08 20:58 ` Thomas Monjalon
2017-06-09 10:51 ` Ferruh Yigit
2017-06-09 17:51 ` [dpdk-dev] [PATCH v3 1/3] net/ring: set ethernet device field Ferruh Yigit
2017-06-09 17:51 ` Ferruh Yigit [this message]
2017-06-12 13:25 ` [dpdk-dev] [PATCH v3 2/3] net/ring: create vdev from PMD specific API Bruce Richardson
2017-06-12 14:08 ` Ferruh Yigit
2017-06-12 14:19 ` Bruce Richardson
2017-06-12 14:38 ` Ferruh Yigit
2017-06-09 17:51 ` [dpdk-dev] [PATCH v3 3/3] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-12 14:13 ` [dpdk-dev] [PATCH v4 1/3] net/ring: set ethernet device field Ferruh Yigit
2017-06-12 14:13 ` [dpdk-dev] [PATCH v4 2/3] net/ring: use EAL APIs in PMD specific API Ferruh Yigit
2017-06-12 14:20 ` Bruce Richardson
2017-06-12 14:13 ` [dpdk-dev] [PATCH v4 3/3] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-12 15:25 ` [dpdk-dev] [PATCH v5 1/3] net/ring: set ethernet device field Ferruh Yigit
2017-06-12 15:25 ` [dpdk-dev] [PATCH v5 2/3] net/ring: use EAL APIs in PMD specific API Ferruh Yigit
2017-06-12 15:25 ` [dpdk-dev] [PATCH v5 3/3] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-12 15:37 ` [dpdk-dev] [PATCH v5 1/3] net/ring: set ethernet device field Ferruh Yigit
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=20170609175120.77652-2-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/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).