Skip to contentSkip to conversation

eal: fix device iterator issue to find device for class type

PATCH In review Vijay Srivastava 3 participants 3 messages Oct 29, 2021 – Nov 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: fix device iterator issue to find device for class type

devarg parser rte_devargs_layers_parse() does not configures devargs->bus_str for class type. rte_dev_iterator_init is not setting devargs->bus_str to NULL before passing it to devarg parser. It results junk value for bus_str and due to this device iterator is unable to find device for class type.

Bugzilla ID: 862

Fixes 9a1a9e4a2ddd (devargs: support path value with global device syntax)
---
 lib/eal/common/eal_common_dev.c | 2 ++
 1 file changed, 2 insertions(+)
lib/eal/common/eal_common_dev.c +2 -0
index 148a238..4efdd8e 100644
@@ -577,6 +577,8 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name)
 	struct rte_class *cls = NULL;
 	struct rte_bus *bus = NULL;
 
+	memset(&devargs, 0, sizeof(devargs));
+
 	/* Having both bus_str and cls_str NULL is illegal,
 	 * marking this iterator as invalid unless
 	 * everything goes well.
Signature · 1 line
1.8.3.1
#1 lore raw

On Fri, 2021-10-29 at 16:23 +0530, Vijay Srivastava wrote:

devarg parser rte_devargs_layers_parse() does not configures

devargs->bus_str for class type. rte_dev_iterator_init is not

setting devargs->bus_str to NULL before passing it to devarg parser.

It results junk value for bus_str and due to this device

iterator is unable to find device for class type.

Bugzilla ID: 862

Fixes 9a1a9e4a2ddd (devargs: support path value with global device syntax)

---

 lib/eal/common/eal_common_dev.c | 2 ++
 1 file changed, 2 insertions(+)
lib/eal/common/eal_common_dev.c +0 -0

index 148a238..4efdd8e 100644

--- a/lib/eal/common/eal_common_dev.c

+++ b/lib/eal/common/eal_common_dev.c

@@ -577,6 +577,8 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name)

        struct rte_class *cls = NULL;

        struct rte_bus *bus = NULL;

+ memset(&devargs, 0, sizeof(devargs));

+

/* Having both bus_str and cls_str NULL is illegal,

* marking this iterator as invalid unless

* everything goes well.

Thanks for the fix, I sent a fix earlier for same issue:

https://patches.dpdk.org/project/dpdk/patch/[email protected]/

#2 lore raw
Quoted 30 lines · Xueming(Steven) Li

On Fri, 2021-10-29 at 16:23 +0530, Vijay Srivastava wrote:

devarg parser rte_devargs_layers_parse() does not configures devargs->bus_str for class type. rte_dev_iterator_init is not setting devargs->bus_str to NULL before passing it to devarg parser. It results junk value for bus_str and due to this device iterator is unable to find device for class type.

Bugzilla ID: 862

Fixes 9a1a9e4a2ddd (devargs: support path value with global device syntax)
---
 lib/eal/common/eal_common_dev.c | 2 ++
 1 file changed, 2 insertions(+)
lib/eal/common/eal_common_dev.c +2 -0
index 148a238..4efdd8e 100644
@@ -577,6 +577,8 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name)
        struct rte_class *cls = NULL;
        struct rte_bus *bus = NULL;
 
+       memset(&devargs, 0, sizeof(devargs));
+
        /* Having both bus_str and cls_str NULL is illegal,
         * marking this iterator as invalid unless
         * everything goes well.
Quoted 2 lines

Thanks for the fix, I sent a fix earlier for same issue:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

I'll go with Xueming fix, referencing the opened bz. Thanks.

Signature · 1 line
David Marchand