DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ye, MingjinX" <mingjinx.ye@intel.com>
To: "Stokes, Ian" <ian.stokes@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH] test: fix option block
Date: Fri, 5 Jul 2024 01:38:57 +0000	[thread overview]
Message-ID: <LV3PR11MB86019F97ED654F34E0131595E5DF2@LV3PR11MB8601.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MW6PR11MB83095700276EB3FB33E3636792DE2@MW6PR11MB8309.namprd11.prod.outlook.com>



> -----Original Message-----
> From: Stokes, Ian <ian.stokes@intel.com>
> Sent: Thursday, July 4, 2024 8:02 PM
> To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> Subject: RE: [PATCH] test: fix option block
> 
> > > -----Original Message-----
> > > From: Stokes, Ian <ian.stokes@intel.com>
> > > Sent: Wednesday, July 3, 2024 10:35 PM
> > > To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> > > Subject: [PATCH] test: fix option block
> > >
> > > > > The options allow (-a) and block (-b) cannot be used at the same time.
> > > > > Therefore, allow (-a) will not be added when block (-b) is present.
> > > > >
> > > > > Fixes: b3ce7891ad38 ("test: fix probing in secondary process")
> > > > > Cc: stable@dpdk.org
> > > > >
> > > > > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> > >
> > > Hi Mingjin, in general the patch looks ok to me.
> > >
> > > A general question of the behaviour of block and allow, is it always
> > > the case that the two are not allowed to be used side by side?
> > Both cannot be used at the same time.
> >
> > > I had a look through the EAL documentation and didn't see and
> > > mention of this behaviour, but maybe I missed it?
> > The "eal_common_usage" function has a clear description, see below:
> > lib/eal/common/eal_common_options.c:2206
> 
> I understand that, but that is a comment in code, I think the behaviour is
> worthy of being called out in documentation API too for usability factors.
Sorry for not providing complete information. There is processing logic in "eal_parse_common_option".
Unsatisfied condition outputs "Options allow (-a) and block (-b) can't be used at the same time".

> 
> Thanks
> Ian
> 
> > >
> > > Thanks
> > > ian
> > > > > ---
> > > > >  app/test/process.h | 17 ++++++++++++++---
> > > > >  1 file changed, 14 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/app/test/process.h b/app/test/process.h index
> > > > > 9fb2bf481c..388c7975cd 100644
> > > > > --- a/app/test/process.h
> > > > > +++ b/app/test/process.h
> > > > > @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int
> > max_capacity)
> > > > >  	int count = 0;
> > > > >
> > > > >  	RTE_EAL_DEVARGS_FOREACH(NULL, devargs) {
> > > > > -		if (strlen(devargs->name) == 0)
> > > > > +		if (strlen(devargs->name) == 0 || devargs->type !=
> > > > > +RTE_DEVTYPE_ALLOWED)
> > > > >  			continue;
> > > > >
> > > > >  		if (devargs->data == NULL || strlen(devargs->data)
> == 0)
> > > { @@
> > > > > -74,7 +74,7 @@ process_dup(const char *const argv[], int
> > > > > numargs, const char *env_value)  {
> > > > >  	int num = 0;
> > > > >  	char **argv_cpy;
> > > > > -	int allow_num;
> > > > > +	int allow_num, block_num;
> > > > >  	int argv_num;
> > > > >  	int i, status;
> > > > >  	char path[32];
> > > > > @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int
> > > > > numargs, const char *env_value)
> > > > >  	if (pid < 0)
> > > > >  		return -1;
> > > > >  	else if (pid == 0) {
> > > > > -		allow_num =
> > > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > > +		allow_num = 0;
> > > > > +		block_num = 0;
> > > > > +
> > > > > +		/* If block (-b) is present, allow (-a) is not added. */
> > > > > +		for (i = 0; i < numargs; i++) {
> > > > > +			if (strcmp(argv[i], "-b") == 0 ||
> > > > > +			    strcmp(argv[i], "-block") == 0)
> > > > > +				block_num++;
> > > > > +		}
> > > > > +		if (!block_num)
> > > > > +			allow_num =
> > > > > rte_devargs_type_count(RTE_DEVTYPE_ALLOWED);
> > > > > +
> > > > >  		argv_num = numargs + allow_num + 1;
> > > > >  		argv_cpy = calloc(argv_num, sizeof(char *));
> > > > >  		if (!argv_cpy)
> > > > > --
> > > > > 2.25.1


  reply	other threads:[~2024-07-05  1:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  9:46 Mingjin Ye
2024-03-15  6:49 ` Jiale, SongX
     [not found] ` <LV3PR11MB8601B4FC344CC7102C5AC010E5DD2@LV3PR11MB8601.namprd11.prod.outlook.com>
2024-07-03 14:35   ` Stokes, Ian
2024-07-04  8:09     ` Ye, MingjinX
2024-07-04 12:02       ` Stokes, Ian
2024-07-05  1:38         ` Ye, MingjinX [this message]
2024-07-10  9:02           ` Stokes, Ian
2024-10-07 17:02 ` Stephen Hemminger
2024-10-12  9:35 ` [PATCH v2] " Mingjin Ye
2024-10-12 22:20   ` Stephen Hemminger
2024-10-14 10:22     ` Ye, MingjinX
2024-10-14 10:00   ` [PATCH v3] test: fix option devices Mingjin Ye
2024-10-15 16:21     ` Stephen Hemminger
2024-10-16  8:17     ` [PATCH v4] " Mingjin Ye
2024-10-17  2:31       ` Jiale, SongX

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=LV3PR11MB86019F97ED654F34E0131595E5DF2@LV3PR11MB8601.namprd11.prod.outlook.com \
    --to=mingjinx.ye@intel.com \
    --cc=dev@dpdk.org \
    --cc=ian.stokes@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).