From: "Wang, ShougangX" <shougangx.wang@intel.com>
To: "Yigit, Ferruh" <ferruh.yigit@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
"Yang, Qiming" <qiming.yang@intel.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwd
Date: Tue, 17 Sep 2019 09:22:27 +0000 [thread overview]
Message-ID: <00A8E5A1740DFA49A87AFFAC34B8EDEA385D4D@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <b929e993-a655-2af7-650f-c789c80c1cc2@intel.com>
> Let's assume port already stopped before calling the reset, reset will cause port
> to be started.
Indeed, automatically start looks strange in this case. User explicitly do the
"port start" command should be better.
> I am for user explicitly do the stop, reset and start commands, instead of reset
> automatically stop and start later.
There are two reasons that it is necessary to stop automatically in "port reset" command:
1) Even without this patch, user does not need to manually execute "port stop" command
before "port reset" too, because port will be stopped in rte_eth_dev_reset() function.
But this function does not update the port status flag of testpmd. It makes the port state
recorded by testpmd inconsistent with the actual port state. So I add stop processing in
reset_port() function to stop port as same as running "port stop" command.
2) If let user to stop port manually when he wants to reset port, it is not easy to use than before.
Thanks.
Shougang
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Monday, September 16, 2019 11:28 PM
> To: Wang, ShougangX <shougangx.wang@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start
> fwd
>
> On 9/16/2019 7:37 AM, Wang, ShougangX wrote:
> > Hi Ferruh
> >
> > Thanks for your reply.
> >
> >> Not sure if 'reset' command should do more than it says, if there is
> >> a requirement that port should be stopped, why not add this condition
> >> with an error message so that user can stop the port in advance if she wants.
> >
> > Firstly, port must be stopped before reset. Usually, port is stopped
> > by rte_eth_dev_reset(), so testpmd does not prompt user to stop port.
> > Although it can stop port, but testpmd does not change its own port status
> flag to "RTE_PORT_STOPPED" and it will cause "port start" to fail.
> > So I add this patch to stop port as same as running "port stop" command.
>
> Let's assume port already stopped before calling the reset, reset will cause port
> to be started.
> I am for user explicitly do the stop, reset and start commands, instead of reset
> automatically stop and start later.
>
> >
> >> - 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()'
> >> but it works on single port, the loop looked unnecessary to me, can
> >> you please check and remove the loop if required?
> >
> > "port reset" supports reset all ports (testpmd > port reset all), so this loop is
> necessary.
>
> Got it.
>
> >
> >> - I am not able to see 'reset' has been documented in
> >> 'doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can
> >> you please check and add it if required?
> >
> > OK. I will add it in the next patch.
> >
> > Thanks.
> > Shougang
> >
> >
> >> -----Original Message-----
> >> From: Yigit, Ferruh
> >> Sent: Saturday, September 14, 2019 1:35 AM
> >> To: Wang, ShougangX <shougangx.wang@intel.com>; dev@dpdk.org
> >> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> >> <qiming.yang@intel.com>; stable@dpdk.org
> >> Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault
> >> when start fwd
> >>
> >> On 9/6/2019 2:28 AM, Wang ShougangX wrote:
> >>> This patch fixed the reset function to avoid crash when user don't
> >>> call port reset , port stop and port start functions as sequence.
> >>>
> >>> Fixes: 97f1e19679 ("app/testpmd: add port reset command")
> >>> Cc: stable@dpdk.org
> >>>
> >>> Signed-off-by: Wang ShougangX <shougangx.wang@intel.com>
> >>> ---
> >>> app/test-pmd/testpmd.c | 6 ++++++
> >>> 1 file changed, 6 insertions(+)
> >>>
> >>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> >>> e8e2a39b6..273a7aa02 100644
> >>> --- a/app/test-pmd/testpmd.c
> >>> +++ b/app/test-pmd/testpmd.c
> >>> @@ -2344,6 +2344,9 @@ reset_port(portid_t pid)
> >>> if (port_id_is_invalid(pid, ENABLED_WARN))
> >>> return;
> >>>
> >>> + printf("Stopping ports...\n");
> >>> + stop_port(pid);
> >>> +
> >>> printf("Resetting ports...\n");
> >>>
> >>> RTE_ETH_FOREACH_DEV(pi) {
> >>> @@ -2372,6 +2375,9 @@ reset_port(portid_t pid)
> >>> }
> >>> }
> >>>
> >>> + printf("Starting ports...\n");
> >>> + start_port(pid);
> >>> +
> >>> printf("Done\n");
> >>> }
> >>
> >> Hi Shougang,
> >>
> >> Not sure if 'reset' command should do more than it says, if there is
> >> a requirement that port should be stopped, why not add this condition
> >> with an error message so that user can stop the port in advance if she wants.
> >>
> >>
> >> Btw, a few things related,
> >> - 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()'
> >> but it works on single port, the loop looked unnecessary to me, can
> >> you please check and remove the loop if required?
> >>
> >> - I am not able to see 'reset' has been documented in
> >> 'doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can
> >> you please check and add it if required?
> >>
> >> Thanks,
> >> ferruh
next prev parent reply other threads:[~2019-09-17 9:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 1:28 [dpdk-dev] " Wang ShougangX
2019-09-12 13:26 ` Iremonger, Bernard
2019-09-13 17:34 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-09-16 6:37 ` Wang, ShougangX
2019-09-16 15:27 ` Ferruh Yigit
2019-09-17 9:22 ` Wang, ShougangX [this message]
2019-09-23 11:04 ` Ferruh Yigit
2019-09-23 14:18 ` Iremonger, Bernard
2019-09-24 2:31 ` Wang, ShougangX
2019-09-20 3:13 ` [dpdk-dev] [PATCH v2] " Wang ShougangX
2019-09-23 10:19 ` Iremonger, Bernard
2019-09-24 1:43 ` Wang, ShougangX
2019-09-24 4:49 ` [dpdk-dev] [PATCH v3] " Wang ShougangX
2019-09-24 9:09 ` Iremonger, Bernard
2019-09-25 17:37 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00A8E5A1740DFA49A87AFFAC34B8EDEA385D4D@SHSMSX101.ccr.corp.intel.com \
--to=shougangx.wang@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=qiming.yang@intel.com \
--cc=stable@dpdk.org \
--cc=wenzhuo.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).