[dpdk-dev] [PATCH] app/testpmd:fix invalid port id parameters

Wu, Jingjing jingjing.wu at intel.com
Thu Sep 7 10:44:38 CEST 2017



> -----Original Message-----
> From: Rybalchenko, Kirill
> Sent: Monday, September 4, 2017 10:12 PM
> To: Li Han <han.li1 at zte.com.cn>; Wu, Jingjing <jingjing.wu at intel.com>
> Cc: dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd:fix invalid port id parameters
> 
> Hi Han,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Li Han
> > Sent: Tuesday 22 August 2017 06:04
> > To: Wu, Jingjing <jingjing.wu at intel.com>
> > Cc: dev at dpdk.org; Li Han <han.li1 at zte.com.cn>
> > Subject: [dpdk-dev] [PATCH] app/testpmd:fix invalid port id parameters
> >
> > in parse_ringnuma_config/parse_portnuma_config functions,port_id should
> > less than RTE_MAX_ETHPORTS,but port_id_is_invalid check assumes that
> > port_id may be 255.
> >
> > Signed-off-by: Li Han <han.li1 at zte.com.cn>
> > ---
> >  app/test-pmd/parameters.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index
> > 2f7f70f..0c97ba4 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -424,7 +424,8 @@
> >  				return -1;
> >  		}
> >  		port_id = (uint8_t)int_fld[FLD_PORT];
> > -		if (port_id_is_invalid(port_id, ENABLED_WARN)) {
> > +		if (port_id_is_invalid(port_id, ENABLED_WARN) ||
> > +			port_id == (portid_t)RTE_PORT_ALL) {
> In this case the message "printf("Invalid port %d\n", port_id)" will be omitted and there
> will be no way
> To figure out which port id caused the problem
Why? If the port_id is invalid and not RTE_PORT_ALL, the "printf("Invalid port %d\n", port_id)" should be print.


More information about the dev mailing list