From: Tetsuya Mukawa <mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
To: "De Lara Guarch,
Pablo"
<pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"Qiu,
Michael" <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"dev-VfR2kkLFssw@public.gmane.org"
<dev-VfR2kkLFssw@public.gmane.org>
Subject: Re: [PATCH] testpmd: Fix port validation code of "port stop all" command
Date: Mon, 09 Mar 2015 11:22:52 +0900 [thread overview]
Message-ID: <54FD03FC.4010807@igel.co.jp> (raw)
In-Reply-To: <E115CCD9D858EF4F90C690B0DCB4D89727267732-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
On 2015/03/06 22:53, De Lara Guarch, Pablo wrote:
> Hi Michael,
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of Qiu, Michael
>> Sent: Thursday, March 05, 2015 1:33 PM
>> To: Tetsuya Mukawa; dev-VfR2kkLFssw@public.gmane.org
>> Subject: Re: [dpdk-dev] [PATCH] testpmd: Fix port validation code of "port
>> stop all" command
>>
>> Hi, Tetsuya and Pablo
>> This is not a full fix, I have generate the full fix patch two days ago,
Hi Michel,
I am sorry for late replying, and thanks for your work.
> Sorry I did not see this earlier. Did you upstream this patch already?
> I acked Tetsuya's patch, as it was simple and works, but I cannot find
> this one.
>
> Thanks,
> Pablo
>
>> See below:
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 49be819..ec53923 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -384,6 +384,9 @@ port_infos_display(portid_t port_id)
>> int
>> port_id_is_invalid(portid_t port_id, enum print_warning warning)
>> {
>> + if (port_id == (portid_t)RTE_PORT_ALL)
>> + return 0;
>> +
I am not clearly sure that we need to add above 'if statement'.
>> if (ports[port_id].enabled)
>> return 0;
>>
>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>> index e556b4c..1c4c651 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -1326,6 +1326,9 @@ start_port(portid_t pid)
>> return -1;
>> }
>>
>> + if (port_id_is_invalid(pid, ENABLED_WARN))
>> + return 0;
>> +
Same as above.
>> if (init_fwd_streams() < 0) {
>> printf("Fail from init_fwd_streams()\n");
>> return -1;
>> @@ -1482,10 +1485,14 @@ stop_port(portid_t pid)
>> dcb_test = 0;
>> dcb_config = 0;
>> }
>> +
>> + if (port_id_is_invalid(pid, ENABLED_WARN))
>> + return;
>> +
Same as above.
>> printf("Stopping ports...\n");
>>
>> FOREACH_PORT(pi, ports) {
>> - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
>> + if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
>> continue;
>>
>> port = &ports[pi];
>> @@ -1517,10 +1524,13 @@ close_port(portid_t pid)
>> return;
>> }
>>
>> + if (port_id_is_invalid(pid, ENABLED_WARN))
>> + return;
>> +
Same as above.
>> printf("Closing ports...\n");
>>
>> FOREACH_PORT(pi, ports) {
>> - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
>> + if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
>> continue;
>>
>> port = &ports[pi];
>> --
>> 1.9.3
FOREACH_PORT() returns valid ports, so is it not enough to check like above?
I am not clearly understand which case we need to add above extra if
statements.
Could you please describe?
But I agree we cannot use my previous patch.
We need to fix not only stop_port() but also close_port() like start_port().
Thanks,
Tetsuya
>> Thanks,
>> Michael
>>
>> On 3/5/2015 3:31 PM, Tetsuya Mukawa wrote:
>>> When "port stop all" is executed, the command doesn't work as it should
>>> because of wrong port validation. The patch fixes this issue.
>>>
>>> Reported-by: Pablo de Lara <pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>> Signed-off-by: Tetsuya Mukawa <mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
>>> ---
>>> app/test-pmd/testpmd.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>>> index 61291be..bb65342 100644
>>> --- a/app/test-pmd/testpmd.c
>>> +++ b/app/test-pmd/testpmd.c
>>> @@ -1484,7 +1484,7 @@ stop_port(portid_t pid)
>>> printf("Stopping ports...\n");
>>>
>>> FOREACH_PORT(pi, ports) {
>>> - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
>>> + if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
>>> continue;
>>>
>>> port = &ports[pi];
next prev parent reply other threads:[~2015-03-09 2:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 7:30 [PATCH] testpmd: Fix port validation code of "port stop all" command Tetsuya Mukawa
2015-03-05 13:33 ` Qiu, Michael
2015-03-05 13:38 ` Qiu, Michael
[not found] ` <533710CFB86FA344BFBF2D6802E60286CEEEC5-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-06 13:53 ` De Lara Guarch, Pablo
[not found] ` <E115CCD9D858EF4F90C690B0DCB4D89727267732-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-09 2:22 ` Tetsuya Mukawa [this message]
2015-03-09 3:49 ` Qiu, Michael
[not found] ` <533710CFB86FA344BFBF2D6802E60286CF051C-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-09 5:21 ` Tetsuya Mukawa
2015-03-09 6:01 ` Qiu, Michael
[not found] ` <1425540606-12554-1-git-send-email-mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
2015-03-06 13:44 ` De Lara Guarch, Pablo
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=54FD03FC.4010807@igel.co.jp \
--to=mukawa-alsx/un32fvpdbfq/vqriq@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
--cc=michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=pablo.de.lara.guarch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.