From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by dpdk.org (Postfix) with ESMTP id 912115A9C for ; Mon, 9 Mar 2015 03:22:55 +0100 (CET) Received: by pdjp10 with SMTP id p10so54112125pdj.10 for ; Sun, 08 Mar 2015 19:22:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=OlD68jT7B5vyYNOEki0UYgK7yE3EMzuZLDxwwN7lSRs=; b=KgpTLUKzXFDvxy+0U2gB6bS6QJ+/iNYJr8I8JyQ9yAFICGWTEiBNwnLA3Ko1EpgLmM hpSWiWcmzwXFOf8A+asHbHParmGbmniOs1pCikcGnRh21vHAt0X2poDCNRXCjH3fqnFq Fs/x4Wa0IGkY55TM6B/4qYfZ0TQc0n5dQOFASDhx1jvGZcIgU28jsJQYGnmDgSkK4WiE FqYYVgLo4yMN/J3WGhABBDykrN33bwAzoEpA3X+4yY2QfID914rNORxgx3zarHDXUTpi xfDJWymzQMJbNlbqfjkyMX6OEME14uEY+fYItF+jZJxHf2cTfctWPhMph5tyLJmbxiOZ xbnA== X-Gm-Message-State: ALoCoQnXPZojR1iHEcPSviTHqJL0ghf4Ro9q8kdlCdNeGTubq5vvWIW+h5plT3VZeOSPyrtOWWm+ X-Received: by 10.70.133.2 with SMTP id oy2mr47926895pdb.169.1425867774594; Sun, 08 Mar 2015 19:22:54 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id hz8sm16393525pac.5.2015.03.08.19.22.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Mar 2015 19:22:53 -0700 (PDT) Message-ID: <54FD03FC.4010807@igel.co.jp> Date: Mon, 09 Mar 2015 11:22:52 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "De Lara Guarch, Pablo" , "Qiu, Michael" , "dev@dpdk.org" References: <1425540606-12554-1-git-send-email-mukawa@igel.co.jp> <533710CFB86FA344BFBF2D6802E60286CEEEC5@SHSMSX101.ccr.corp.intel.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2015 02:22:55 -0000 On 2015/03/06 22:53, De Lara Guarch, Pablo wrote: > Hi Michael, > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiu, Michael >> Sent: Thursday, March 05, 2015 1:33 PM >> To: Tetsuya Mukawa; dev@dpdk.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 ag= o, 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 =3D=3D (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 =3D 0; >> dcb_config =3D 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 !=3D= pi) >> + if (pid !=3D pi && pid !=3D (portid_t)RTE_PORT_ALL) >> continue; >> >> port =3D &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 !=3D= pi) >> + if (pid !=3D pi && pid !=3D (portid_t)RTE_PORT_ALL) >> continue; >> >> port =3D &ports[pi]; >> -- >> 1.9.3 FOREACH_PORT() returns valid ports, so is it not enough to check like abo= ve? 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 shou= ld >>> because of wrong port validation. The patch fixes this issue. >>> >>> Reported-by: Pablo de Lara >>> Signed-off-by: Tetsuya Mukawa >>> --- >>> 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 !=3D pi) >>> + if (pid !=3D pi && pid !=3D (portid_t)RTE_PORT_ALL) >>> continue; >>> >>> port =3D &ports[pi];