DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] kvargs: fix device iterator match from arguments
@ 2021-11-22  6:12 Xueming Li
  2021-11-23 10:25 ` Olivier Matz
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Xueming Li @ 2021-11-22  6:12 UTC (permalink / raw)
  To: dev
  Cc: xuemingl, Lior Margalit, olivier.matz, Parav Pandit,
	Ray Kinsella, David Marchand

Device iterator RTE_DEV_FOREACH() failed to return devices from
classifier like "class=vdpa", because matching name from empty kvargs
returns no result. If device name not specified in kvargs, the function
should iterate all devices.

This patch allows empty devargs or devargs without name specified.

Fixes: 6aebb942907d ("kvargs: add function to get from key and value")
Cc: olivier.matz@6wind.com

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
21.11 specific bug, no copy to stable.org
---
 drivers/bus/auxiliary/auxiliary_params.c | 3 +++
 drivers/bus/vdev/vdev_params.c           | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
index a9c7853ed1d..6a6382961ea 100644
--- a/drivers/bus/auxiliary/auxiliary_params.c
+++ b/drivers/bus/auxiliary/auxiliary_params.c
@@ -27,6 +27,9 @@ auxiliary_dev_match(const struct rte_device *dev,
 	const struct rte_kvargs *kvlist = _kvlist;
 	const char *key = auxiliary_params_keys[RTE_AUXILIARY_PARAM_NAME];
 
+	/* Iterate all devices if name not specified. */
+	if (kvlist == NULL || rte_kvargs_get(kvlist, key) == NULL)
+		return 0;
 	if (rte_kvargs_get_with_value(kvlist, key, dev->name) == NULL)
 		return -1;
 
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 37d95395e7a..bab4c0d1d08 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -29,6 +29,9 @@ vdev_dev_match(const struct rte_device *dev,
 	const struct rte_kvargs *kvlist = _kvlist;
 	const char *key = vdev_params_keys[RTE_VDEV_PARAM_NAME];
 
+	/* Iterate all devices if name not specified. */
+	if (kvlist == NULL || rte_kvargs_get(kvlist, key) == NULL)
+		return 0;
 	if (rte_kvargs_get_with_value(kvlist, key, dev->name) == NULL)
 		return -1;
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-11-24 13:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22  6:12 [PATCH] kvargs: fix device iterator match from arguments Xueming Li
2021-11-23 10:25 ` Olivier Matz
2021-11-23 11:25   ` Xueming(Steven) Li
2021-11-23 12:31     ` Olivier Matz
2021-11-23 12:49       ` Xueming(Steven) Li
2021-11-23 20:02         ` Olivier Matz
2021-11-24 10:21           ` Xueming(Steven) Li
2021-11-24 10:17 ` [PATCH v2] " Xueming Li
2021-11-24 11:07   ` Olivier Matz
2021-11-24 11:19     ` Xueming(Steven) Li
2021-11-24 11:02 ` [PATCH v3] bus: " Olivier Matz
2021-11-24 11:31   ` Xueming(Steven) Li
2021-11-24 11:43     ` Xueming(Steven) Li
2021-11-24 12:14       ` Olivier Matz
2021-11-24 12:45 ` [PATCH v4] " Olivier Matz
2021-11-24 13:00   ` Xueming(Steven) Li
2021-11-24 13:44     ` David Marchand

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).