[dpdk-dev] [PATCH v5 7/7] app/testpmd: adjust ethdev port ownership

Lu, Wenzhuo wenzhuo.lu at intel.com
Fri Jan 26 01:50:14 CET 2018


> -----Original Message-----
> From: Matan Azrad [mailto:matan at mellanox.com]
> Sent: Thursday, January 25, 2018 4:30 PM
> To: Lu, Wenzhuo <wenzhuo.lu at intel.com>; Thomas Monjalon
> <thomas at monjalon.net>; Gaetan Rivet <gaetan.rivet at 6wind.com>; Wu,
> Jingjing <jingjing.wu at intel.com>
> Cc: dev at dpdk.org; Neil Horman <nhorman at tuxdriver.com>; Richardson,
> Bruce <bruce.richardson at intel.com>; Ananyev, Konstantin
> <konstantin.ananyev at intel.com>
> Subject: RE: [dpdk-dev] [PATCH v5 7/7] app/testpmd: adjust ethdev port
> ownership
> 
> Hi Lu
> 
> From: Lu, Wenzhuo [mailto:wenzhuo.lu at intel.com]
> > Hi Matan,
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Matan Azrad
> > > Sent: Tuesday, January 23, 2018 12:38 AM
> > > To: Thomas Monjalon <thomas at monjalon.net>; Gaetan Rivet
> > > <gaetan.rivet at 6wind.com>; Wu, Jingjing <jingjing.wu at intel.com>
> > > Cc: dev at dpdk.org; Neil Horman <nhorman at tuxdriver.com>; Richardson,
> > > Bruce <bruce.richardson at intel.com>; Ananyev, Konstantin
> > > <konstantin.ananyev at intel.com>
> > > Subject: [dpdk-dev] [PATCH v5 7/7] app/testpmd: adjust ethdev port
> > > ownership
> > >
> > > Testpmd should not use ethdev ports which are managed by other DPDK
> > > entities.
> > >
> > > Set Testpmd ownership to each port which is not used by other entity
> > > and prevent any usage of ethdev ports which are not owned by Testpmd.
> > >
> > > Signed-off-by: Matan Azrad <matan at mellanox.com>
> > > ---
> > >  app/test-pmd/cmdline.c      | 89 +++++++++++++++++++---------------------
> > -----
> > >  app/test-pmd/cmdline_flow.c |  2 +-
> > >  app/test-pmd/config.c       | 37 ++++++++++---------
> > >  app/test-pmd/parameters.c   |  4 +-
> > >  app/test-pmd/testpmd.c      | 63 ++++++++++++++++++++------------
> > >  app/test-pmd/testpmd.h      |  3 ++
> > >  6 files changed, 103 insertions(+), 95 deletions(-)
> > >
> > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > > 9f12c0f..36dba6c 100644
> > > --- a/app/test-pmd/cmdline.c
> > > +++ b/app/test-pmd/cmdline.c
> > > @@ -1394,7 +1394,7 @@ struct cmd_config_speed_all {
> > >  			&link_speed) < 0)
> > >  		return;
> > >
> > > -	RTE_ETH_FOREACH_DEV(pid) {
> > > +	RTE_ETH_FOREACH_DEV_OWNED_BY(pid, my_owner.id) {
> > I see my_owner is a global variable, so, don't know why we need the
> > parameter 'my_owner.id' here.
> 
> Yes it is a testpmd global variable (which was initiated in testpmd main
> function - you can see it in this patch) as a lot of variables in testpmd.
> RTE_ETH_FOREACH_DEV_OWNED_BY iterator is an ethdev iterator -> not
> only for testpmd\applications.
> So, each dpdk entity(application, PMDs, any other libs) should use this
> iterator with its specific owner id to get its owned ports.
Sorry, I may express myself too simple to understand.
I think about that RTE use a callback to get the owner ID and even other necessary info from APP. RTE can use the callback in RTE_ETH_FOREACH_DEV. Then APP need hardly change anything. Only need register a callback. I think it's more friendly to the users.
Or even APP defines its own macro ' FOREACH_DEV_OWNED(pid)' to wrap ' RTE_ETH_FOREACH_DEV_OWNED_BY(pid, my_owner.id) ' looks better.

> 
> > I think we can still use
> > RTE_ETH_FOREACH_DEV and check 'my_owner' in it. If there's some reason
> > and you don't want change RTE_ETH_FOREACH_DEV, I think '
> > RTE_ETH_FOREACH_DEV_OWNED(pid) {' is better.


More information about the dev mailing list