From: Ivan Dyukov <i.dyukov@samsung.com>
To: dev@dpdk.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com,
amorenoz@redhat.com, zhihong.wang@intel.com,
xiaolong.ye@intel.com
Cc: Ivan Dyukov <i.dyukov@samsung.com>
Subject: [dpdk-dev] [PATCH v5 1/4] net/virtio: refactor devargs parsing
Date: Thu, 27 Feb 2020 17:16:13 +0300 [thread overview]
Message-ID: <20200227141840.15835-2-i.dyukov@samsung.com> (raw)
In-Reply-To: <20200227141840.15835-1-i.dyukov@samsung.com>
refactor vdpa specific devargs parsing to more generic way
Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
drivers/net/virtio/virtio_ethdev.c | 34 +++++++++++++++++++++---------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 044eb10a7..d2c7f8c61 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1955,16 +1955,18 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
}
static int vdpa_check_handler(__rte_unused const char *key,
- const char *value, __rte_unused void *opaque)
+ const char *value, void *ret_val)
{
- if (strcmp(value, "1"))
- return -1;
+ if (strcmp(value, "1") == 0)
+ *(int *)ret_val = 1;
+ else
+ *(int *)ret_val = 0;
return 0;
}
static int
-vdpa_mode_selected(struct rte_devargs *devargs)
+virtio_dev_devargs_parse(struct rte_devargs *devargs, int *vdpa)
{
struct rte_kvargs *kvlist;
const char *key = "vdpa";
@@ -1980,12 +1982,16 @@ vdpa_mode_selected(struct rte_devargs *devargs)
if (!rte_kvargs_count(kvlist, key))
goto exit;
- /* vdpa mode selected when there's a key-value pair: vdpa=1 */
- if (rte_kvargs_process(kvlist, key,
- vdpa_check_handler, NULL) < 0) {
- goto exit;
+ if (vdpa) {
+ /* vdpa mode selected when there's a key-value pair:
+ * vdpa=1
+ */
+ ret = rte_kvargs_process(kvlist, key,
+ vdpa_check_handler, vdpa);
+ if (ret < 0)
+ goto exit;
}
- ret = 1;
+
exit:
rte_kvargs_free(kvlist);
@@ -1995,8 +2001,16 @@ vdpa_mode_selected(struct rte_devargs *devargs)
static int eth_virtio_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
struct rte_pci_device *pci_dev)
{
+ int vdpa = 0;
+ int ret = 0;
+
+ ret = virtio_dev_devargs_parse(pci_dev->device.devargs, &vdpa);
+ if (ret < 0) {
+ PMD_INIG_LOG(ERR, "devargs parsing is failed");
+ return ret;
+ }
/* virtio pmd skips probe if device needs to work in vdpa mode */
- if (vdpa_mode_selected(pci_dev->device.devargs))
+ if (vdpa == 1)
return 1;
return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct virtio_hw),
--
2.17.1
next prev parent reply other threads:[~2020-02-27 14:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200207112535eucas1p2e333a3f5788b70f6de679332eff266e0@eucas1p2.samsung.com>
2020-02-07 11:25 ` [dpdk-dev] [PATCH v3 1/2] " Ivan Dyukov
[not found] ` <CGME20200207112542eucas1p149c88c52b887aab888351eab73fe7639@eucas1p1.samsung.com>
2020-02-07 11:25 ` [dpdk-dev] [PATCH v3 2/2] net/virtio: add link speed devarg Ivan Dyukov
2020-02-12 10:00 ` Maxime Coquelin
2020-02-12 10:35 ` Tiwei Bie
2020-02-12 10:40 ` Maxime Coquelin
2020-02-12 10:47 ` Tiwei Bie
2020-02-13 13:54 ` Maxime Coquelin
2020-02-14 7:59 ` Ivan Dyukov
2020-02-14 12:32 ` Maxime Coquelin
[not found] ` <CGME20200225073054eucas1p26665d3b2fde29eedd264e905ffc643bb@eucas1p2.samsung.com>
2020-02-25 7:28 ` [dpdk-dev] speed devarg for virtio driver Ivan Dyukov
[not found] ` <CGME20200225073100eucas1p19097473ba40bb36c69b42e0479e42a00@eucas1p1.samsung.com>
2020-02-25 7:28 ` [dpdk-dev] [PATCH v4 1/4] net/virtio: refactor devargs parsing Ivan Dyukov
2020-02-26 7:16 ` Ye Xiaolong
[not found] ` <CGME20200225073107eucas1p2255c2df9fb15b1e17b8447b7d88dbf2d@eucas1p2.samsung.com>
2020-02-25 7:28 ` [dpdk-dev] [PATCH v4 2/4] net/virtio: add link speed devarg Ivan Dyukov
2020-02-26 7:55 ` Ye Xiaolong
[not found] ` <CGME20200227142004eucas1p29809efb73784d660f57613374cfdbb55@eucas1p2.samsung.com>
2020-02-27 14:16 ` [dpdk-dev] [PATCH v5 0/4] " Ivan Dyukov
[not found] ` <CGME20200227142018eucas1p1fd60eac2a28295736ee07a3730cb5a53@eucas1p1.samsung.com>
2020-02-27 14:16 ` Ivan Dyukov [this message]
2020-03-03 8:42 ` [dpdk-dev] [PATCH v5 1/4] net/virtio: refactor devargs parsing David Marchand
[not found] ` <CGME20200303182901eucas1p2cd9ec41b46d898afdaae50c6a4546785@eucas1p2.samsung.com>
2020-03-03 18:27 ` [dpdk-dev] [PATCH v6 0/4] net/virtio: add link speed devarg Ivan Dyukov
[not found] ` <CGME20200303182903eucas1p2f46d594c58b9add3aa09fa05a7aa037c@eucas1p2.samsung.com>
2020-03-03 18:27 ` [dpdk-dev] [PATCH v6 1/4] net/virtio: refactor devargs parsing Ivan Dyukov
[not found] ` <CGME20200303182905eucas1p2a39607c525e04492db830062b28cedd2@eucas1p2.samsung.com>
2020-03-03 18:27 ` [dpdk-dev] [PATCH v6 2/4] net/virtio: add link speed devarg Ivan Dyukov
[not found] ` <CGME20200303182906eucas1p2a80e3e02c52746e750c743accda56d34@eucas1p2.samsung.com>
2020-03-03 18:27 ` [dpdk-dev] [PATCH v6 3/4] net/virtio-user: fix devargs parsing Ivan Dyukov
[not found] ` <CGME20200303182908eucas1p13a1c21150d9548cf62e3ed7079689270@eucas1p1.samsung.com>
2020-03-03 18:27 ` [dpdk-dev] [PATCH v6 4/4] net/virtio-user: adding link speed devarg Ivan Dyukov
2020-03-04 3:43 ` [dpdk-dev] [PATCH v6 0/4] net/virtio: add " Ye Xiaolong
[not found] ` <CGME20200227142022eucas1p2b3cebb5af8470f715bffe20367226bff@eucas1p2.samsung.com>
2020-02-27 14:16 ` [dpdk-dev] [PATCH v5 2/4] " Ivan Dyukov
[not found] ` <CGME20200227142024eucas1p1e356ee11b8eda65208682b1591e3cc00@eucas1p1.samsung.com>
2020-02-27 14:16 ` [dpdk-dev] [PATCH v5 3/4] net/virtio-user: fix devargs parsing Ivan Dyukov
[not found] ` <CGME20200227142026eucas1p2101b3ca97559c155fc34cfbdec8cbdbc@eucas1p2.samsung.com>
2020-02-27 14:16 ` [dpdk-dev] [PATCH v5 4/4] net/virtio-user: adding link speed devarg Ivan Dyukov
[not found] ` <CGME20200225073110eucas1p2919a401942e01f3710de17730b16d400@eucas1p2.samsung.com>
2020-02-25 7:28 ` [dpdk-dev] [PATCH v4 3/4] net/virtio-user: fix devargs parsing Ivan Dyukov
[not found] ` <CGME20200225073112eucas1p2eb93d3723d3c417f82a2e8e230f79a9a@eucas1p2.samsung.com>
2020-02-25 7:28 ` [dpdk-dev] [PATCH v4 4/4] net/virtio-user: adding link speed devarg Ivan Dyukov
2020-02-12 18:25 ` [dpdk-dev] [PATCH v3 2/2] net/virtio: add " Ivan Dyukov
2020-02-12 9:01 ` [dpdk-dev] [PATCH v3 1/2] net/virtio: refactor devargs parsing Maxime Coquelin
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=20200227141840.15835-2-i.dyukov@samsung.com \
--to=i.dyukov@samsung.com \
--cc=amorenoz@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=tiwei.bie@intel.com \
--cc=xiaolong.ye@intel.com \
--cc=zhihong.wang@intel.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).