Hi Lu From: Lu, Wenzhuo [mailto:wenzhuo...@intel.com] > Hi Matan, > > > > -----Original Message----- > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Matan Azrad > > Sent: Tuesday, January 23, 2018 12:38 AM > > To: Thomas Monjalon <tho...@monjalon.net>; Gaetan Rivet > > <gaetan.ri...@6wind.com>; Wu, Jingjing <jingjing...@intel.com> > > Cc: dev@dpdk.org; Neil Horman <nhor...@tuxdriver.com>; Richardson, > > Bruce <bruce.richard...@intel.com>; Ananyev, Konstantin > > <konstantin.anan...@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 <ma...@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.