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

Matan Azrad matan at mellanox.com
Thu Jan 25 09:30:28 CET 2018


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.

> 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