DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xueming(Steven) Li" <xuemingl@nvidia.com>
To: "olivier.matz@6wind.com" <olivier.matz@6wind.com>
Cc: Lior Margalit <lmargalit@nvidia.com>,
	Parav Pandit <parav@nvidia.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>,
	"mdr@ashroe.eu" <mdr@ashroe.eu>
Subject: Re: [PATCH v2] kvargs: fix device iterator match from arguments
Date: Wed, 24 Nov 2021 11:19:11 +0000	[thread overview]
Message-ID: <5fa4af1001a369b3ff95dfa7fec54f5af1b5d371.camel@nvidia.com> (raw)
In-Reply-To: <YZ4c2FYRHU1FVixq@platinum>

On Wed, 2021-11-24 at 12:07 +0100, Olivier Matz wrote:
> Hi Xueming,
> 
> On Wed, Nov 24, 2021 at 06:17:40PM +0800, Xueming Li wrote:
> > 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>
> 
> I just sent a v3 with the unit test.
> 
> In case there is an issue with it, your v2 looks good to me:
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> As a side note, I was wondering if we should keep
> rte_kvargs_get_with_value() in kvargs api, since there
> is no more user. I think there it can still be useful, let's
> keep it for now.

Agree, nice to keep.

> 
> Thanks!
> Olivier
> 
> > ---
> > 21.11 specific bug, no copy to stable.org
> > ---
> >  drivers/bus/auxiliary/auxiliary_params.c | 14 +++++++++-----
> >  drivers/bus/vdev/vdev_params.c           | 14 +++++++++-----
> >  2 files changed, 18 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/bus/auxiliary/auxiliary_params.c b/drivers/bus/auxiliary/auxiliary_params.c
> > index a9c7853ed1d..9cbc1f7c777 100644
> > --- a/drivers/bus/auxiliary/auxiliary_params.c
> > +++ b/drivers/bus/auxiliary/auxiliary_params.c
> > @@ -26,11 +26,15 @@ auxiliary_dev_match(const struct rte_device *dev,
> >  {
> >  	const struct rte_kvargs *kvlist = _kvlist;
> >  	const char *key = auxiliary_params_keys[RTE_AUXILIARY_PARAM_NAME];
> > -
> > -	if (rte_kvargs_get_with_value(kvlist, key, dev->name) == NULL)
> > -		return -1;
> > -
> > -	return 0;
> > +	const char *name;
> > +
> > +	if (kvlist == NULL)
> > +		return 0;
> > +	name = rte_kvargs_get(kvlist, key);
> > +	if (name == NULL)
> > +		/* Iterate all devices if name not specified. */
> > +		return 0;
> > +	return strcmp(name, dev->name);
> >  }
> >  
> >  void *
> > diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
> > index 37d95395e7a..b4baecb7c0d 100644
> > --- a/drivers/bus/vdev/vdev_params.c
> > +++ b/drivers/bus/vdev/vdev_params.c
> > @@ -28,11 +28,15 @@ vdev_dev_match(const struct rte_device *dev,
> >  {
> >  	const struct rte_kvargs *kvlist = _kvlist;
> >  	const char *key = vdev_params_keys[RTE_VDEV_PARAM_NAME];
> > -
> > -	if (rte_kvargs_get_with_value(kvlist, key, dev->name) == NULL)
> > -		return -1;
> > -
> > -	return 0;
> > +	const char *name;
> > +
> > +	if (kvlist == NULL)
> > +		return 0;
> > +	name = rte_kvargs_get(kvlist, key);
> > +	if (name == NULL)
> > +		/* Iterate all devices if name not specified. */
> > +		return 0;
> > +	return strcmp(name, dev->name);
> >  }
> >  
> >  void *
> > -- 
> > 2.34.0
> > 


  reply	other threads:[~2021-11-24 11:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  6:12 [PATCH] " 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 [this message]
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

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=5fa4af1001a369b3ff95dfa7fec54f5af1b5d371.camel@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=lmargalit@nvidia.com \
    --cc=mdr@ashroe.eu \
    --cc=olivier.matz@6wind.com \
    --cc=parav@nvidia.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).