From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 296C45A85 for ; Thu, 5 Mar 2015 14:33:13 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 05 Mar 2015 05:33:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,347,1422950400"; d="scan'208";a="687341924" Received: from pgsmsx102.gar.corp.intel.com ([10.221.44.80]) by fmsmga002.fm.intel.com with ESMTP; 05 Mar 2015 05:33:11 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX102.gar.corp.intel.com (10.221.44.80) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 5 Mar 2015 21:33:11 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.192]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.46]) with mapi id 14.03.0195.001; Thu, 5 Mar 2015 21:33:09 +0800 From: "Qiu, Michael" To: Tetsuya Mukawa , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command Thread-Index: AQHQVxZUkeUi1+JMQE6Z/J1a0wvVMQ== Date: Thu, 5 Mar 2015 13:33:10 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CEEEC5@SHSMSX101.ccr.corp.intel.com> References: <1425540606-12554-1-git-send-email-mukawa@igel.co.jp> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Thu, 05 Mar 2015 13:33:14 -0000 Hi, Tetsuya and Pablo=0A= This is not a full fix, I have generate the full fix patch two days ago,=0A= See below:=0A= =0A= diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c=0A= index 49be819..ec53923 100644=0A= --- a/app/test-pmd/config.c=0A= +++ b/app/test-pmd/config.c=0A= @@ -384,6 +384,9 @@ port_infos_display(portid_t port_id)=0A= int=0A= port_id_is_invalid(portid_t port_id, enum print_warning warning)=0A= {=0A= + if (port_id =3D=3D (portid_t)RTE_PORT_ALL)=0A= + return 0;=0A= +=0A= if (ports[port_id].enabled)=0A= return 0;=0A= =0A= diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c=0A= index e556b4c..1c4c651 100644=0A= --- a/app/test-pmd/testpmd.c=0A= +++ b/app/test-pmd/testpmd.c=0A= @@ -1326,6 +1326,9 @@ start_port(portid_t pid)=0A= return -1;=0A= }=0A= =0A= + if (port_id_is_invalid(pid, ENABLED_WARN))=0A= + return 0;=0A= +=0A= if (init_fwd_streams() < 0) {=0A= printf("Fail from init_fwd_streams()\n");=0A= return -1;=0A= @@ -1482,10 +1485,14 @@ stop_port(portid_t pid)=0A= dcb_test =3D 0;=0A= dcb_config =3D 0;=0A= }=0A= +=0A= + if (port_id_is_invalid(pid, ENABLED_WARN))=0A= + return;=0A= +=0A= printf("Stopping ports...\n");=0A= =0A= FOREACH_PORT(pi, ports) {=0A= - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid !=3D pi)= =0A= + if (pid !=3D pi && pid !=3D (portid_t)RTE_PORT_ALL)=0A= continue;=0A= =0A= port =3D &ports[pi];=0A= @@ -1517,10 +1524,13 @@ close_port(portid_t pid)=0A= return;=0A= }=0A= =0A= + if (port_id_is_invalid(pid, ENABLED_WARN))=0A= + return;=0A= +=0A= printf("Closing ports...\n");=0A= =0A= FOREACH_PORT(pi, ports) {=0A= - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid !=3D pi)= =0A= + if (pid !=3D pi && pid !=3D (portid_t)RTE_PORT_ALL)=0A= continue;=0A= =0A= port =3D &ports[pi];=0A= -- =0A= 1.9.3=0A= =0A= Thanks,=0A= Michael=0A= =0A= On 3/5/2015 3:31 PM, Tetsuya Mukawa wrote:=0A= > When "port stop all" is executed, the command doesn't work as it should= =0A= > because of wrong port validation. The patch fixes this issue.=0A= >=0A= > Reported-by: Pablo de Lara =0A= > Signed-off-by: Tetsuya Mukawa =0A= > ---=0A= > app/test-pmd/testpmd.c | 2 +-=0A= > 1 file changed, 1 insertion(+), 1 deletion(-)=0A= >=0A= > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c=0A= > index 61291be..bb65342 100644=0A= > --- a/app/test-pmd/testpmd.c=0A= > +++ b/app/test-pmd/testpmd.c=0A= > @@ -1484,7 +1484,7 @@ stop_port(portid_t pid)=0A= > printf("Stopping ports...\n");=0A= > =0A= > FOREACH_PORT(pi, ports) {=0A= > - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid !=3D pi)=0A= > + if (pid !=3D pi && pid !=3D (portid_t)RTE_PORT_ALL)=0A= > continue;=0A= > =0A= > port =3D &ports[pi];=0A= =0A=