From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 74E795B36 for ; Thu, 18 Oct 2018 13:29:07 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1B6BF2264F; Thu, 18 Oct 2018 07:29:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 18 Oct 2018 07:29:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=Ox+LxjFLVZxBjPXDI0SzRHIC1ln+qsu5kFfYEl9H1EA=; b=nzguO01YUVRa WHo+kx8f64WB/BXuTyRgXjv7jKEoCG+icT9ALbmTJ4J/vZm2OAtzPKDOXSncvyVz dCcDIvy0s0E+wIYOZl5aNxWww+mZT80cTjTC7gbx/vl5LqZeMNuOnxbce0XnM5u7 bJJlZalKcIn3isejChi5w+HxZEelWsU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Ox+LxjFLVZxBjPXDI0SzRHIC1ln+qsu5kFfYEl9H1 EA=; b=Bb5/mYZ0PZJoNlX/qKZFhaPP13ZeXdKpnohBwA+sRAGhz64Ak913ofLU1 QOfD8jWXd8ZvhH1EhaSAZgB1bgXz4viLYonRqAZvQMi4YSW7JKbwx/+yuvMyq1yl UBKEO7+bo+dE60V6Q9OFDOaHcZn3B2fg2hdY+c2oYnRLsDvECHBMsZumZ0vmEKDZ 4Mh46q+RN4AtX4Cseq3iCk5VyZ3o56wRODM0/tjraJWnZs6r/B4V8Z0TmkrDX6Qa eRVqzNyCRkAPRR4iSqSFNkKx8tUA3M6OW1mnDXQp+KKmUdSVpFcibZRGETYgiA4E MwTKrOiEpMpC3wbFNR92AUrq4ErJQ== X-ME-Sender: X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id B83DCE4412; Thu, 18 Oct 2018 07:29:05 -0400 (EDT) From: Thomas Monjalon To: "Iremonger, Bernard" Cc: dev@dpdk.org, "Yigit, Ferruh" , "arybchenko@solarflare.com" , "ophirmu@mellanox.com" , "rahul.lakkireddy@chelsio.com" , Wisam Jaddo Date: Thu, 18 Oct 2018 13:29:10 +0200 Message-ID: <4896325.UA0OBGhyO2@xps> In-Reply-To: <8CEF83825BEC744B83065625E567D7C260D12CD2@IRSMSX107.ger.corp.intel.com> References: <20180907233929.21950-1-thomas@monjalon.net> <20181018012402.1240-2-thomas@monjalon.net> <8CEF83825BEC744B83065625E567D7C260D12CD2@IRSMSX107.ger.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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:29:07 -0000 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 = nb_ports - 1; > > + > > + for (i = 0; i < last_port_idx + 1; i++) { /* iterate in ports_ids */ > > Why not use " i <= 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 == > > RTE_ETH_DEV_UNUSED) { > > + /* skip unused ports at the end */ > > + while (rte_eth_devices[ports_ids[last_port_idx]].state > > + == RTE_ETH_DEV_UNUSED && i <= > > last_port_idx) > > WARNING:LONG_LINE: line over 80 characters > #48: FILE: app/test-pmd/testpmd.c:2199: > + == RTE_ETH_DEV_UNUSED && i <= 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--;