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 5207F1B169; Wed, 10 Jan 2018 09:51:02 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2018 00:51:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,339,1511856000"; d="scan'208";a="18918678" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by orsmga003.jf.intel.com with ESMTP; 10 Jan 2018 00:51:00 -0800 Received: from pgsmsx112.gar.corp.intel.com ([169.254.3.86]) by PGSMSX104.gar.corp.intel.com ([169.254.3.6]) with mapi id 14.03.0319.002; Wed, 10 Jan 2018 16:50:59 +0800 From: "Dai, Wei" To: "Yang, Qiming" , "Lu, Wenzhuo" , "Wu, Jingjing" , "Peng, Yuan" , "Ananyev, Konstantin" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq number setting Thread-Index: AQHTid2NDT0GlQsmPUKkromHnubidqNsy9KQ Date: Wed, 10 Jan 2018 08:50:58 +0000 Message-ID: <49759EB36A64CF4892C1AFEC9231E8D66CF20BB3@PGSMSX112.gar.corp.intel.com> References: <1515416551-28636-1-git-send-email-wei.dai@intel.com> <1515557660-36763-1-git-send-email-wei.dai@intel.com> <1515557660-36763-3-git-send-email-wei.dai@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDRkNWEzZmQtN2Y4YS00NWZhLTkwMTMtZGZiZTlmMDNhNDc0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IndHRUpjUXVnVWpEbGpLQXVrU3ZVTzhUK0hJZTAybXluQ0xoa1E5TitsN2c9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq number setting X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 08:51:03 -0000 > -----Original Message----- > From: Yang, Qiming > Sent: Wednesday, January 10, 2018 2:38 PM > To: Dai, Wei ; Lu, Wenzhuo ; > Wu, Jingjing ; Peng, Yuan ; > Ananyev, Konstantin > Cc: dev@dpdk.org; stable@dpdk.org; Dai, Wei > Subject: RE: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq numbe= r > setting >=20 > I think the name bak is a little bit confused, what do you think just use > nd_txq_backup/nd_rxq_backup? > And I think it's no need to break the patch into two patch, them fix the = same > thing and the code amount are not large. I will follow Konstantin's guide to give v3 patch set. By the way, I think 2 patches are much clearer and keep each very simple=20 for others to review and for maintainer's convenience. >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Dai > > Sent: Wednesday, January 10, 2018 12:14 PM > > To: Lu, Wenzhuo ; Wu, Jingjing > > ; Peng, Yuan ; Ananyev, > > Konstantin > > Cc: dev@dpdk.org; stable@dpdk.org; Dai, Wei > > Subject: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq number > > setting > > > > If an invalid TX queue is configured from testpmd command like "port > > config all txq number", the global variable txq is updated by this > > invalid value. It may cause testpmd crash. > > This patch restores its last correct value when an invalid txq number > > configured is detected. > > > > Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") > > Cc: stable@dpdk.org > > > > Signed-off-by: Wei Dai > > --- > > app/test-pmd/cmdline.c | 2 ++ > > app/test-pmd/testpmd.c | 12 +++++++++--- app/test-pmd/testpmd.h | > 1 > > + > > 3 files changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > > a5a1d57..26dd81a 100644 > > --- a/app/test-pmd/cmdline.c > > +++ b/app/test-pmd/cmdline.c > > @@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, > > printf("Warning: Either rx or tx queues should be non zero\n"); > > return; > > } > > + /* bakcup last correct nb_txq */ > > + nb_txq_bak =3D nb_txq; > > nb_txq =3D res->value; > > } > > else if (!strcmp(res->name, "rxd")) { diff --git > > a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > efafc24..8b49d96 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -190,6 +190,7 @@ queueid_t nb_rxq =3D 1; /**< Number of RX queues > per > > port. */ queueid_t nb_txq =3D 1; /**< Number of TX queues per port. */ > > > > queueid_t nb_rxq_bak =3D 1; /**< Backup of last correct number of RX > > queues */ > > +queueid_t nb_txq_bak =3D 1; /**< Backup of last correct number of TX > > +queues */ > > > > /* > > * Configurable number of RX/TX ring descriptors. > > @@ -721,8 +722,12 @@ init_fwd_streams(void) > > } > > if (nb_txq > port->dev_info.max_tx_queues) { > > printf("Fail: nb_txq(%d) is greater than " > > - "max_tx_queues(%d)\n", nb_txq, > > - port->dev_info.max_tx_queues); > > + "max_tx_queues(%d), restored to backup " > > + "txq number(%d)\n", nb_txq, > > + port->dev_info.max_tx_queues, > > + nb_txq_bak); > > + /* restored to last correct nb_txq */ > > + nb_txq =3D nb_txq_bak; > > return -1; > > } > > if (numa_support) { > > @@ -744,8 +749,9 @@ init_fwd_streams(void) > > } > > } > > > > - /* backup the correct nb_rxq */ > > + /* backup the correct nb_rxq and nb_txq */ > > nb_rxq_bak =3D nb_rxq; > > + nb_txq_bak =3D nb_txq; > > > > q =3D RTE_MAX(nb_rxq, nb_txq); > > if (q =3D=3D 0) { > > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index > > 6f7932d..bca93c1 100644 > > --- a/app/test-pmd/testpmd.h > > +++ b/app/test-pmd/testpmd.h > > @@ -393,6 +393,7 @@ extern queueid_t nb_rxq; extern queueid_t > nb_txq; > > > > extern queueid_t nb_rxq_bak; > > +extern queueid_t nb_txq_bak; > > > > extern uint16_t nb_rxd; > > extern uint16_t nb_txd; > > -- > > 2.7.5