From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA1FAA0524; Tue, 20 Apr 2021 11:38:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DE01412B0; Tue, 20 Apr 2021 11:38:25 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id C1426411A5 for ; Tue, 20 Apr 2021 11:38:24 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 98BBF2481; Tue, 20 Apr 2021 05:38:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 20 Apr 2021 05:38:23 -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=fm1; bh= FOSnAg5DKJbTJ4UYpvTnpEU+hnXhvo+vgqjfKKSCsHo=; b=WO2a073oT2lMzLlX 3/ZK4TWAKETRKmcVbrgyMzrqSN/m/Ap7oURP5r84LOmLxFYUEfuHEUvJ/fjEFug7 rhHHCU7vBufJ8dNE4noDsbBdVYCTudz6Ynhf9zJMY5S+EKx8bjBFhF9TLnVKc3y0 6/CTZhg/TDlCy6Y+MXpYSM/WQeXHWX74G6DoQTG/FYEH7n9lHCPC30ds1GhoNkwx EUohuYNCmWJHbO5IfZfK9dbClchGQSRtR0iJ1bAhCr+ZMg6Ujdc7Fp2fBd07fIZK 2YitEtrEbmrpk8KamRoP3lSz/JxgacdgxcRNm05s/JN8aaxlqofkm1LmTC1CP8wv P1ASlg== 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=fm2; bh=FOSnAg5DKJbTJ4UYpvTnpEU+hnXhvo+vgqjfKKSCs Ho=; b=jv+YJpzUS3lt3qSRmQzFi19MBwkWSy5+9SoSB9Cargz+qAzkXLiHlDu2T mGgAe9QcvVmnTKWfcWtfSf28ktHHwEPOtWzsCoiE9tFgV6ik7q+Iy6a4InRPx2az u4hfZC9lbk/G8rWJzSImJyvSf2nBp4NxVjDdnfHVKv31BqeA7g7XvPsfGfhfRrKP hsD75hWe8aLFx8qs52pfj9953qHAVvcIUGZRoI7bSLo+154764+3EWFnX33I5L1e 2BZZ2ry93UvXEyZ7FG5RSqwVD/2wyk+uWeYoTmWuDIfLu6LtBuQJw2EXQZP1F8qG 0xqr2A2rkKO2CCNXa3RBqvFXfbWXg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddtiedgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtqhertddttdejnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepkeethedtieevhfeigeejleegudefjeehkeekteeuveeiuedvveeu tdejveehveetnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght 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 305B0240054; Tue, 20 Apr 2021 05:38:22 -0400 (EDT) From: Thomas Monjalon To: "Min Hu (Connor)" Cc: dev@dpdk.org, ferruh.yigit@intel.com Date: Tue, 20 Apr 2021 11:38:20 +0200 Message-ID: <1909562.CCgIbzmGvW@thomas> In-Reply-To: <78e68559-f9a1-8ea5-317d-189caa22d3ae@huawei.com> References: <1617876888-63458-1-git-send-email-humin29@huawei.com> <29981982.VByYVYEeCf@thomas> <78e68559-f9a1-8ea5-317d-189caa22d3ae@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 2/2] examples/ethtool: add closing port operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 20/04/2021 11:10, Min Hu (Connor): >=20 > =E5=9C=A8 2021/4/20 8:59, Thomas Monjalon =E5=86=99=E9=81=93: > > 08/04/2021 12:14, Min Hu (Connor): > >> From: Huisong Li > >> > >> Currently, ethtool directly ends the process after 'quit' cmd. In this > >> case, software resources are not released and hardware resources of the > >> device are not uninstalled. > >> > >> This patch adds closing port operation to release resources. > >> > >> Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample = application") > >> Cc: stable@dpdk.org > >> > >> Signed-off-by: Huisong Li > >> Signed-off-by: Min Hu (Connor) > >> --- > >> --- a/examples/ethtool/ethtool-app/main.c > >> +++ b/examples/ethtool/ethtool-app/main.c > >> +static void close_ports(void) > >> +{ > >> + uint16_t portid; > >> + int ret; > >> + > >> + for (portid =3D 0; portid < app_cfg.cnt_ports; portid++) { > >> + printf("Closing port %d...", portid); > >> + ret =3D rte_eth_dev_stop(portid); > >> + if (ret !=3D 0) > >> + rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=3D%s, port=3D%u\n", > >> + strerror(-ret), portid); > >> + rte_eth_dev_close(portid); > >> + printf(" Done\n"); > >> + } > >> + > >> + ret =3D rte_eal_cleanup(); > >> + if (ret !=3D 0) > >> + rte_exit(EXIT_FAILURE, "EAL cleanup failed: %s\n", > >> + strerror(-ret)); > >=20 > > It would be better to add EAL cleanup in the main function. > >=20 > Hi, Thomas, > It has already been done in this patch: "examples: add eal > cleanup to examples", please check it out, thanks. So why adding it in this patch about ethdev close?