Hi Lu
From: Lu, Wenzhuo [mailto:[email protected]]
> Hi Matan,
>
>
> > -----Original Message-----
> > From: dev [mailto:[email protected]] On Behalf Of Matan Azrad
> > Sent: Tuesday, January 23, 2018 12:38 AM
> > To: Thomas Monjalon <[email protected]>; Gaetan Rivet
> > <[email protected]>; Wu, Jingjing <[email protected]>
> > Cc: [email protected]; Neil Horman <[email protected]>; Richardson,
> > Bruce <[email protected]>; Ananyev, Konstantin
> > <[email protected]>
> > 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 <[email protected]>
> > ---
> > 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.