DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: remove vdev probe by dev args
@ 2017-05-10 11:01 Ferruh Yigit
  2017-06-08 20:45 ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2017-05-10 11:01 UTC (permalink / raw)
  To: Jan Blunck, Gaetan Rivet, Tetsuya Mukawa, Declan Doherty
  Cc: dev, Ferruh Yigit

Virtual device/driver probing done via name.

A new alternative method introduced to probe the device with providing
driver name in devargs as "driver=<driver_name>".

This patch removes alternative method and fixes virtual device usages
with proper device names.

Fixes: 87c3bf29c642 ("test: do not short-circuit null device creation")
Fixes: d39670086a63 ("eal: parse driver argument before probing drivers")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/null/rte_eth_null.c         |  1 -
 lib/librte_eal/common/eal_common_vdev.c | 40 ++-------------------------------
 test/test/test_link_bonding_rssconf.c   |  5 ++---
 3 files changed, 4 insertions(+), 42 deletions(-)

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 2c94339..5aef059 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -49,7 +49,6 @@ static unsigned default_packet_copy;
 static const char *valid_arguments[] = {
 	ETH_NULL_PACKET_SIZE_ARG,
 	ETH_NULL_PACKET_COPY_ARG,
-	"driver",
 	NULL
 };
 
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 0037a64..8744cc1 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -70,48 +70,14 @@ rte_vdev_unregister(struct rte_vdev_driver *driver)
 	TAILQ_REMOVE(&vdev_driver_list, driver, next);
 }
 
-/*
- * Parse "driver" devargs without adding a dependency on rte_kvargs.h
- */
-static char *parse_driver_arg(const char *args)
-{
-	const char *c;
-	char *str;
-
-	if (!args || args[0] == '\0')
-		return NULL;
-
-	c = args;
-
-	do {
-		if (strncmp(c, "driver=", 7) == 0) {
-			c += 7;
-			break;
-		}
-
-		c = strchr(c, ',');
-		if (c)
-			c++;
-	} while (c);
-
-	if (c)
-		str = strdup(c);
-	else
-		str = NULL;
-
-	return str;
-}
-
 static int
 vdev_probe_all_drivers(struct rte_vdev_device *dev)
 {
 	const char *name;
-	char *drv_name;
 	struct rte_vdev_driver *driver;
 	int ret = 1;
 
-	drv_name = parse_driver_arg(rte_vdev_device_args(dev));
-	name = drv_name ? drv_name : rte_vdev_device_name(dev);
+	name = rte_vdev_device_name(dev);
 
 	RTE_LOG(DEBUG, EAL, "Search driver %s to probe device %s\n", name,
 		rte_vdev_device_name(dev));
@@ -129,7 +95,7 @@ vdev_probe_all_drivers(struct rte_vdev_device *dev)
 			ret = driver->probe(dev);
 			if (ret)
 				dev->device.driver = NULL;
-			goto out;
+			return ret;
 		}
 	}
 
@@ -146,8 +112,6 @@ vdev_probe_all_drivers(struct rte_vdev_device *dev)
 		}
 	}
 
-out:
-	free(drv_name);
 	return ret;
 }
 
diff --git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c
index d28db7d..dcbc9d1 100644
--- a/test/test/test_link_bonding_rssconf.c
+++ b/test/test/test_link_bonding_rssconf.c
@@ -62,7 +62,7 @@
 
 #define BONDED_DEV_NAME         ("rssconf_bond_dev")
 
-#define SLAVE_DEV_NAME_FMT      ("rssconf_slave%d")
+#define SLAVE_DEV_NAME_FMT      ("net_null%d")
 #define SLAVE_RXTX_QUEUE_FMT      ("rssconf_slave%d_q%d")
 
 #define NUM_MBUFS 8191
@@ -550,8 +550,7 @@ test_setup(void)
 		port_id = rte_eth_dev_count();
 		snprintf(name, sizeof(name), SLAVE_DEV_NAME_FMT, port_id);
 
-		retval = rte_vdev_init(name,
-			"driver=net_null,size=64,copy=0");
+		retval = rte_vdev_init(name, "size=64,copy=0");
 		TEST_ASSERT_SUCCESS(retval, "Failed to create null device '%s'\n",
 				name);
 
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH] eal: remove vdev probe by dev args
  2017-05-10 11:01 [dpdk-dev] [PATCH] eal: remove vdev probe by dev args Ferruh Yigit
@ 2017-06-08 20:45 ` Thomas Monjalon
  2017-06-09  9:21   ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2017-06-08 20:45 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, Jan Blunck, Gaetan Rivet, Tetsuya Mukawa, Declan Doherty

10/05/2017 13:01, Ferruh Yigit:
> Virtual device/driver probing done via name.
> 
> A new alternative method introduced to probe the device with providing
> driver name in devargs as "driver=<driver_name>".
> 
> This patch removes alternative method and fixes virtual device usages
> with proper device names.
> 
> Fixes: 87c3bf29c642 ("test: do not short-circuit null device creation")
> Fixes: d39670086a63 ("eal: parse driver argument before probing drivers")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
[...]
>  static int
>  vdev_probe_all_drivers(struct rte_vdev_device *dev)
>  {
>  	const char *name;
> -	char *drv_name;
>  	struct rte_vdev_driver *driver;
>  	int ret = 1;
>  
> -	drv_name = parse_driver_arg(rte_vdev_device_args(dev));
> -	name = drv_name ? drv_name : rte_vdev_device_name(dev);
> +	name = rte_vdev_device_name(dev);

It seems you are reverting the commit d39670086a63:
    eal: parse driver argument before probing drivers
    
    In some cases the virtual device name should be totally different than
    the driver being used for the device. Therefore lets parse the devargs for
    the "driver" argument before probing drivers in vdev_probe_all_drivers().

Is this "driver" option useless?

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

* Re: [dpdk-dev] [PATCH] eal: remove vdev probe by dev args
  2017-06-08 20:45 ` Thomas Monjalon
@ 2017-06-09  9:21   ` Ferruh Yigit
  2017-06-16 14:20     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2017-06-09  9:21 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Jan Blunck, Gaetan Rivet, Tetsuya Mukawa, Declan Doherty

On 6/8/2017 9:45 PM, Thomas Monjalon wrote:
> 10/05/2017 13:01, Ferruh Yigit:
>> Virtual device/driver probing done via name.
>>
>> A new alternative method introduced to probe the device with providing
>> driver name in devargs as "driver=<driver_name>".
>>
>> This patch removes alternative method and fixes virtual device usages
>> with proper device names.
>>
>> Fixes: 87c3bf29c642 ("test: do not short-circuit null device creation")
>> Fixes: d39670086a63 ("eal: parse driver argument before probing drivers")
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
> [...]
>>  static int
>>  vdev_probe_all_drivers(struct rte_vdev_device *dev)
>>  {
>>  	const char *name;
>> -	char *drv_name;
>>  	struct rte_vdev_driver *driver;
>>  	int ret = 1;
>>  
>> -	drv_name = parse_driver_arg(rte_vdev_device_args(dev));
>> -	name = drv_name ? drv_name : rte_vdev_device_name(dev);
>> +	name = rte_vdev_device_name(dev);
> 
> It seems you are reverting the commit d39670086a63:
>     eal: parse driver argument before probing drivers

Mostly yes.

>     
>     In some cases the virtual device name should be totally different than
>     the driver being used for the device. Therefore lets parse the devargs for
>     the "driver" argument before probing drivers in vdev_probe_all_drivers().
> 
> Is this "driver" option useless?

There is already a generic way to probe, why need another method, I
didn't get the motivation but this looks like a hack, only place I found
used is in bonding unit test, which can be switched to generic way
without this support.

And this is a hidden / an undocumented feature.

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH] eal: remove vdev probe by dev args
  2017-06-09  9:21   ` Ferruh Yigit
@ 2017-06-16 14:20     ` Thomas Monjalon
  2017-07-09  7:54       ` Jan Blunck
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2017-06-16 14:20 UTC (permalink / raw)
  To: Jan Blunck
  Cc: dev, Ferruh Yigit, Gaetan Rivet, Tetsuya Mukawa, Declan Doherty

Please Jan, could you comment?

09/06/2017 11:21, Ferruh Yigit:
> On 6/8/2017 9:45 PM, Thomas Monjalon wrote:
> > 10/05/2017 13:01, Ferruh Yigit:
> >> Virtual device/driver probing done via name.
> >>
> >> A new alternative method introduced to probe the device with providing
> >> driver name in devargs as "driver=<driver_name>".
> >>
> >> This patch removes alternative method and fixes virtual device usages
> >> with proper device names.
> >>
> >> Fixes: 87c3bf29c642 ("test: do not short-circuit null device creation")
> >> Fixes: d39670086a63 ("eal: parse driver argument before probing drivers")
> >>
> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> >> ---
> > [...]
> >>  static int
> >>  vdev_probe_all_drivers(struct rte_vdev_device *dev)
> >>  {
> >>  	const char *name;
> >> -	char *drv_name;
> >>  	struct rte_vdev_driver *driver;
> >>  	int ret = 1;
> >>  
> >> -	drv_name = parse_driver_arg(rte_vdev_device_args(dev));
> >> -	name = drv_name ? drv_name : rte_vdev_device_name(dev);
> >> +	name = rte_vdev_device_name(dev);
> > 
> > It seems you are reverting the commit d39670086a63:
> >     eal: parse driver argument before probing drivers
> 
> Mostly yes.
> 
> >     
> >     In some cases the virtual device name should be totally different than
> >     the driver being used for the device. Therefore lets parse the devargs for
> >     the "driver" argument before probing drivers in vdev_probe_all_drivers().
> > 
> > Is this "driver" option useless?
> 
> There is already a generic way to probe, why need another method, I
> didn't get the motivation but this looks like a hack, only place I found
> used is in bonding unit test, which can be switched to generic way
> without this support.
> 
> And this is a hidden / an undocumented feature.
> 
> Thanks,
> ferruh
> 

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

* Re: [dpdk-dev] [PATCH] eal: remove vdev probe by dev args
  2017-06-16 14:20     ` Thomas Monjalon
@ 2017-07-09  7:54       ` Jan Blunck
  2017-07-09 22:02         ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Blunck @ 2017-07-09  7:54 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Ferruh Yigit, Gaetan Rivet, Tetsuya Mukawa, Declan Doherty

On Fri, Jun 16, 2017 at 10:20 AM, Thomas Monjalon <thomas@monjalon.net> wrote:
> Please Jan, could you comment?
>

My intention was to provide a way that devices can have arbitrary
names. Ferruh correctly pointed out that this is undocumented and
hidden functionality. Lets apply this and I can rework this if it
becomes necessary later.

> 09/06/2017 11:21, Ferruh Yigit:
>> On 6/8/2017 9:45 PM, Thomas Monjalon wrote:
>> > 10/05/2017 13:01, Ferruh Yigit:
>> >> Virtual device/driver probing done via name.
>> >>
>> >> A new alternative method introduced to probe the device with providing
>> >> driver name in devargs as "driver=<driver_name>".
>> >>
>> >> This patch removes alternative method and fixes virtual device usages
>> >> with proper device names.
>> >>
>> >> Fixes: 87c3bf29c642 ("test: do not short-circuit null device creation")
>> >> Fixes: d39670086a63 ("eal: parse driver argument before probing drivers")
>> >>
>> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> >> ---
>> > [...]
>> >>  static int
>> >>  vdev_probe_all_drivers(struct rte_vdev_device *dev)
>> >>  {
>> >>    const char *name;
>> >> -  char *drv_name;
>> >>    struct rte_vdev_driver *driver;
>> >>    int ret = 1;
>> >>
>> >> -  drv_name = parse_driver_arg(rte_vdev_device_args(dev));
>> >> -  name = drv_name ? drv_name : rte_vdev_device_name(dev);
>> >> +  name = rte_vdev_device_name(dev);
>> >
>> > It seems you are reverting the commit d39670086a63:
>> >     eal: parse driver argument before probing drivers
>>
>> Mostly yes.
>>
>> >
>> >     In some cases the virtual device name should be totally different than
>> >     the driver being used for the device. Therefore lets parse the devargs for
>> >     the "driver" argument before probing drivers in vdev_probe_all_drivers().
>> >
>> > Is this "driver" option useless?
>>
>> There is already a generic way to probe, why need another method, I
>> didn't get the motivation but this looks like a hack, only place I found
>> used is in bonding unit test, which can be switched to generic way
>> without this support.
>>
>> And this is a hidden / an undocumented feature.
>>
>> Thanks,
>> ferruh
>>
>
>
>

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

* Re: [dpdk-dev] [PATCH] eal: remove vdev probe by dev args
  2017-07-09  7:54       ` Jan Blunck
@ 2017-07-09 22:02         ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2017-07-09 22:02 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, Jan Blunck, Gaetan Rivet, Tetsuya Mukawa, Declan Doherty

09/07/2017 09:54, Jan Blunck:
> On Fri, Jun 16, 2017 at 10:20 AM, Thomas Monjalon <thomas@monjalon.net> wrote:
> > Please Jan, could you comment?
> >
> 
> My intention was to provide a way that devices can have arbitrary
> names. Ferruh correctly pointed out that this is undocumented and
> hidden functionality. Lets apply this and I can rework this if it
> becomes necessary later.
> 
> > 09/06/2017 11:21, Ferruh Yigit:
> >> On 6/8/2017 9:45 PM, Thomas Monjalon wrote:
> >> > 10/05/2017 13:01, Ferruh Yigit:
> >> >> Virtual device/driver probing done via name.
> >> >>
> >> >> A new alternative method introduced to probe the device with providing
> >> >> driver name in devargs as "driver=<driver_name>".
> >> >>
> >> >> This patch removes alternative method and fixes virtual device usages
> >> >> with proper device names.
> >> >>
> >> >> Fixes: 87c3bf29c642 ("test: do not short-circuit null device creation")
> >> >> Fixes: d39670086a63 ("eal: parse driver argument before probing drivers")
> >> >>
> >> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied

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

end of thread, other threads:[~2017-07-09 22:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 11:01 [dpdk-dev] [PATCH] eal: remove vdev probe by dev args Ferruh Yigit
2017-06-08 20:45 ` Thomas Monjalon
2017-06-09  9:21   ` Ferruh Yigit
2017-06-16 14:20     ` Thomas Monjalon
2017-07-09  7:54       ` Jan Blunck
2017-07-09 22:02         ` Thomas Monjalon

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