From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70041.outbound.protection.outlook.com [40.107.7.41]) by dpdk.org (Postfix) with ESMTP id 069A15F1C for ; Thu, 18 Oct 2018 13:49:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iSI4MBKIIq6r4/xPyDjXpjTOsjlw4XbaVybTOLeOoqs=; b=dbSOyqj+iLALZ45VPdUWqn0g3Z9SbWKgx+T7XQdvv1f3YtJ53EkTlC/mtZgeuOELQcVX+Cgq4HXcTbUQk5FhoA34sSkb5aldFmaEymDIWVHX35r7SGbb05CVyTko2d1hm8HQd720wvU4Joc5MRlXHBzVV4P5Xh6ZwbCm/871VME= Received: from AM4PR05MB1874.eurprd05.prod.outlook.com (10.167.90.28) by AM4PR05MB1699.eurprd05.prod.outlook.com (10.165.246.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Thu, 18 Oct 2018 11:49:15 +0000 Received: from AM4PR05MB1874.eurprd05.prod.outlook.com ([fe80::9c3c:d83e:2a9c:eed5]) by AM4PR05MB1874.eurprd05.prod.outlook.com ([fe80::9c3c:d83e:2a9c:eed5%6]) with mapi id 15.20.1228.027; Thu, 18 Oct 2018 11:49:13 +0000 From: Wisam Monther To: Thomas Monjalon , "Iremonger, Bernard" CC: "dev@dpdk.org" , "Yigit, Ferruh" , "arybchenko@solarflare.com" , Ophir Munk , "rahul.lakkireddy@chelsio.com" Thread-Topic: [dpdk-dev] [PATCH v5 1/6] app/testpmd: fix ports list after removing several at once Thread-Index: AQHUZoFGE52DBxdZhE6j/6zxc6fr3aUk0NeAgAANugCAAAVKfQ== Date: Thu, 18 Oct 2018 11:49:13 +0000 Message-ID: References: <20180907233929.21950-1-thomas@monjalon.net> <20181018012402.1240-2-thomas@monjalon.net> <8CEF83825BEC744B83065625E567D7C260D12CD2@IRSMSX107.ger.corp.intel.com>, <4896325.UA0OBGhyO2@xps> In-Reply-To: <4896325.UA0OBGhyO2@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=wisamm@mellanox.com; x-originating-ip: [82.213.2.186] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB1699; 6:mcjU7YaxIHlqDi+8oGQ+ptVEt9icAG33R0egjgwSEZUnpPMCt54IXy7tXus6UkiuMnFC0ceRwlqi4VdNKqJ1cOF9I1WfpFDtKPtgD5wGfRik6/Q3IS0sQNsswGoZhDmGmiaSI3JYNL4RTjkSY3/Sj1CBBWWPu0C9j3Mp7Yr/ze5Ewx6ZxZpH3CECKTSEWEQU9LSPH7rZmY8vj8VbeIS7e1m5ifSAR2ZufFnR22vgpzfu4EXsKtv2OxhyH+mfoxlvDxSNoFXrzUs/WOnVB6OJcj7mBzaI8zmXyUUCd5UtIiny8kQkb2Kpw9N7dL0IRcOMX0ybQPjbmLB07kVyI5SloO0WzbZPijEsNA/luujEPhj66o/9j8mKbxHjNCz+nViSelC7nKzmgOVmMEJZOTt3JYyo74e4IITyfKfinoCQAImVTQAA9QWKaTtpgBKzcH504m833YKi8e2zzc+hR4MlVcY9QhdqJ29ITaK72AJ1aoQ=; 5:ghSEYQKgdO20mnFv/uIEzUCFnibmJWnsPwb57TX/8OQ36gtiCDMe+X+Q1Zg5e4wamI5oRaq3/GcJucZ0ITgFGaN7jWMgggm/ApZeKLzUSmOEwE1qsbDvR2Z/FoHhXvFo9Q6lbxj09gMguKr9pu8VkBmdJchR4utgW4AbTCZt4t8=; 7:u0PqRtWM22QmWvij1BcIyhzG0v/w5Pv27EHaxY6yNZ8VXkkCRvN3G9ElZNPTFLcGwmo5AyztkSnNOl3/Io9d3psDVCvdTBsofvy4h194vnQSypCyYojNmoAV0PmZ1MpuuHk204ic5g6JxtCOE2GaVZjO2PyEugokSVgD+ugO0keS937bv/v/bSBTQTNhyBS56CD2N3htHBz3JwhyFXWMmjNXqstnOyeyvJSeF8rCMcS8wlsPwIXZEKfm+BOlBlfR x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 589d4955-c02f-4909-68c2-08d634efb9dd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB1699; x-ms-traffictypediagnostic: AM4PR05MB1699: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(21748063052155)(28532068793085)(190501279198761)(227612066756510)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB1699; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB1699; x-forefront-prvs: 08296C9B35 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(136003)(39860400002)(366004)(52314003)(189003)(199004)(6436002)(25786009)(229853002)(7696005)(486006)(236005)(53936002)(446003)(9686003)(54906003)(76176011)(110136005)(55016002)(8936002)(2906002)(54896002)(81156014)(8676002)(97736004)(81166006)(14454004)(11346002)(53546011)(6306002)(99286004)(476003)(66066001)(102836004)(26005)(256004)(86362001)(14444005)(186003)(5250100002)(6506007)(316002)(2900100001)(71200400001)(7736002)(71190400001)(6116002)(3846002)(93886005)(33656002)(6246003)(68736007)(478600001)(106356001)(4326008)(5660300001)(74316002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB1699; H:AM4PR05MB1874.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: PX6DEOZYKpHHTFW1olzEcl67vlzeX6HlFIgcAx4bN2jUi2TNM8WS8rHm244YeHpj+QNiejXgmaTrEHbGtbRHyhwWYS3F6nNBhylz3YbLkYiDySLvqOT1zB9cvpu7HuURVSg+ycop6NBCAqXuzjKRMaCmoyn168ALfKvhKXKpesvy489rq2h2kZa5GsemFBNNs4vjRrnz/6JISHPZ2yMt/fvqnKdkIEa8j2K6nwTuKGoDrg9CK25IkR5N8Ho1W28KIHTxDLrHgiesSEjbEQWGgAaEnj5J7ArrIBq7DPW4ZSZ3BMBaGWaTlCkdmXlO9vbCjn8DElNZIcuHxfGPc7SQu171AcutJ66ryFbEkp502oU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 589d4955-c02f-4909-68c2-08d634efb9dd X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2018 11:49:13.8476 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB1699 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v5 1/6] app/testpmd: fix ports list after removing several at once 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: Thu, 18 Oct 2018 11:49:19 -0000 Are we saving cycles by set it to be <=3D instead of < _ +1? BRs, Wisam Jaddo From: Thomas Monjalon Sent: Thursday, October 18, 2018 2:29 PM To: Iremonger, Bernard Cc: dev@dpdk.org; Yigit, Ferruh; arybchenko@solarflare.com; Ophi= r Munk; rahul.lakkireddy@chelsio.com; Wisam Monther Subject: Re: [dpdk-dev] [PATCH v5 1/6] app/testpmd: fix ports list after re= moving several at once 18/10/2018 12:40, Iremonger, Bernard: > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > From: Wisam Jaddo > > > > When detaching a port, the full rte_device is removed. > > If the rte_device was hosting several ports, the testpmd list of ports = must be > > updated for multiple removals. > > ./devtools/check-git-log.sh -1 > Missing 'Fixes' tag: > app/testpmd: fix ports list after removing several at once I think it is OK. It is fixing a case which was not tested before. And we don't really need to backport it. > > Signed-off-by: Wisam Jaddo > > --- > > app/test-pmd/testpmd.c | 36 +++++++++++++++++++++++++----------- > > 1 file changed, 25 insertions(+), 11 deletions(-) > > > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > 5dbbf783f..c4109417a 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -2186,6 +2186,30 @@ stop_port(portid_t pid) > > printf("Done\n"); > > } > > > > +static void > > +remove_unused_fwd_ports(void) > > +{ > > + int i; > > + int last_port_idx =3D nb_ports - 1; > > + > > + for (i =3D 0; i < last_port_idx + 1; i++) { /* iterate in ports_ids= */ > > Why not use " i <=3D last_port_index" instead of adding back 1 If Wisam agrees, I can fix it in v6. > > + if (rte_eth_devices[ports_ids[i]].state =3D=3D > > RTE_ETH_DEV_UNUSED) { > > + /* skip unused ports at the end */ > > + while (rte_eth_devices[ports_ids[last_port_idx]].st= ate > > + =3D=3D RTE_ETH_DEV_UNUSED && i <=3D > > last_port_idx) > > WARNING:LONG_LINE: line over 80 characters > #48: FILE: app/test-pmd/testpmd.c:2199: > + =3D=3D RTE_ETH_DEV_UNUSED && i <= =3D last_port_idx) Will fix it. Anyway, we should reverse the order of this check in order to avoid accessing ports_ids[-1]. > > + last_port_idx--;