From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id F07BB1B016; Wed, 10 Jan 2018 07:38:00 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2018 22:37:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,338,1511856000"; d="scan'208";a="8915570" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 09 Jan 2018 22:37:59 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 9 Jan 2018 22:37:58 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 9 Jan 2018 22:37:58 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by shsmsx102.ccr.corp.intel.com ([169.254.2.189]) with mapi id 14.03.0319.002; Wed, 10 Jan 2018 14:37:56 +0800 From: "Yang, Qiming" To: "Dai, Wei" , "Lu, Wenzhuo" , "Wu, Jingjing" , "Peng, Yuan" , "Ananyev, Konstantin" CC: "dev@dpdk.org" , "stable@dpdk.org" , "Dai, Wei" Thread-Topic: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix invalid txq number setting Thread-Index: AQHTicve0Efiqmlga0SQhCIi4tuuI6NspdWQ Date: Wed, 10 Jan 2018 06:37:55 +0000 Message-ID: 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: <1515557660-36763-3-git-send-email-wei.dai@intel.com> Accept-Language: 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: [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 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 06:38:01 -0000 I think the name bak is a little bit confused, what do you think just use n= d_txq_backup/nd_rxq_backup? And I think it's no need to break the patch into two patch, them fix the sa= me thing and the code amount are not large. > -----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 se= tting >=20 > If an invalid TX queue is configured from testpmd command like "port conf= ig 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 con= figured > is detected. >=20 > Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") > Cc: stable@dpdk.org >=20 > 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(-) >=20 > 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. */ >=20 > queueid_t nb_rxq_bak =3D 1; /**< Backup of last correct number of RX que= ues */ > +queueid_t nb_txq_bak =3D 1; /**< Backup of last correct number of TX > +queues */ >=20 > /* > * 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) > } > } >=20 > - /* 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; >=20 > 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; >=20 > extern queueid_t nb_rxq_bak; > +extern queueid_t nb_txq_bak; >=20 > extern uint16_t nb_rxd; > extern uint16_t nb_txd; > -- > 2.7.5