From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by dpdk.org (Postfix) with ESMTP id BE3305A9C for ; Mon, 9 Mar 2015 07:11:09 +0100 (CET) Received: by pabrd3 with SMTP id rd3so36584201pab.6 for ; Sun, 08 Mar 2015 23:11:09 -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 :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=8355F7I4JcBFU9Lm4eAuVfdnY4YD5XJAWrNYjHHa1hU=; b=Ql924P2v+oqjTA1WRCrICNXjkykk3Qs9tXkneONsBnSyLblPMBmJz81PGGPKgvfboK Atg0NNPzzce49PBQz0MpmKs1kje79dBX4SaSsqXUdwWMb+Y+4udXiXx82cuNxsYA4tsH l1O6AvfUT2+XSi69lhGAP66ADm17lYbVhtpik98seJcv8zlchbkI5yeH3luQjL4zH+pa elbr0qGo28nc3XJ0Lm/cRNBK1v1lMQ1RbkUqzzmf3DfSUc1BIhTp3WfpId6qdtD3+HtI WF8PpajZm8KSN6R2BKv6kxDYbsZRsykQLZlGsM9P/teRMRJlggJqibh9Fi0jpQJngNQf e9WA== X-Gm-Message-State: ALoCoQkNbrbgGj16HcPPACVf64lX603sY8e3dA8AU9fangRjukxzCmMW/cYss4g6g/26r8UvMuKo X-Received: by 10.66.119.37 with SMTP id kr5mr50207469pab.136.1425881468884; Sun, 08 Mar 2015 23:11:08 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id np6sm10024008pdb.80.2015.03.08.23.11.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Mar 2015 23:11:08 -0700 (PDT) Message-ID: <54FD397B.9010707@igel.co.jp> Date: Mon, 09 Mar 2015 15:11:07 +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: Michael Qiu , dev@dpdk.org References: <1425881147-27600-1-git-send-email-michael.qiu@intel.com> In-Reply-To: <1425881147-27600-1-git-send-email-michael.qiu@intel.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] testpmd: Fix action of operationg invalid port 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 06:11:10 -0000 On 2015/03/09 15:05, Michael Qiu wrote: > Currently, if try to start/stop/close one invalid prot, > no error shows in testpmd. > This is a bug, need check the port number. > > Signed-off-by: Michael Qiu > --- > app/test-pmd/config.c | 3 +++ > app/test-pmd/testpmd.c | 14 ++++++++++++-- > 2 files changed, 15 insertions(+), 2 deletions(-) > > 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; > + > 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; > + > 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; > + > 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; > + > 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]; Acked-by: Tetsuya Mukawa