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 E51E3A0524; Tue, 20 Apr 2021 02:59:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C256841448; Tue, 20 Apr 2021 02:59:23 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mails.dpdk.org (Postfix) with ESMTP id 6E66C40685 for ; Tue, 20 Apr 2021 02:59:22 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 1D7845C00BD; Mon, 19 Apr 2021 20:59:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 19 Apr 2021 20:59:22 -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= R+NylbcErdInE8WQkkwEire3JlcEsrugR6NNh1JLup8=; b=SCIlgDH7sLlP5eYy kl21jCjGBZcneWMbqho3flJsiyQLZzOl92cs1k9XhDNfdBAo/8Afr1yToYGaoowD 7IZ4U+KB5LSlNwHM3eQVHnHDHFexBDqcdy9kiSrrnXJp2U0uOcxCN83O/ckTGsYx by+PGF9q3kve5THLB1akbEA8HuWorU5aid21f0k0TPX+4/sjeed5+UuqQamG2Y8C nAxvMNoMMW5KcZsFSVcTIoLZ5tAoyknsinpTqq5zlyBRoG4QaetUppRkBrEg3Zlf YKpT4cJnoC4mbe35PDZ051VV2f3TTvV5hFhs/CfYf8A0dxnnOLZZkYUiXQH+SBSQ jDfevA== 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=R+NylbcErdInE8WQkkwEire3JlcEsrugR6NNh1JLu p8=; b=RpLqycRVNQCEnJ/RG/2VgAZwonHCx7QJIMN9sEShNTnPql56uHpS2Tbgg 6n6su/BCXLP6g+y0ZmW3xJSOGRCBSVfsLNf8oJ5pjqf+yS1OTDqGYQ2wvtdP7434 IRPVcD4u2fBWHAPxCy42zME4uDMVZcKZ5ibeDvIjSRZ1Dj4EpenPg+xaoxAueoKJ 6oDWqb1LenPsdomBpmt6PQYgKExAEtTIDcy+EzSuG5qx2u8JD354i8bh+kOpUsZm WwpTHeJFj0CknXzyfqTFfTLnkqsMm8PEY+nA/XlKknjnpr+2H8PofXiySCX6Jqnt Y6Vs0rHzE8UD3Ma1+axzCIart1unw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddthedggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 C7D0224005A; Mon, 19 Apr 2021 20:59:20 -0400 (EDT) From: Thomas Monjalon To: "Min Hu (Connor)" Cc: dev@dpdk.org, ferruh.yigit@intel.com Date: Tue, 20 Apr 2021 02:59:19 +0200 Message-ID: <29981982.VByYVYEeCf@thomas> In-Reply-To: <1617876888-63458-3-git-send-email-humin29@huawei.com> References: <1617876888-63458-1-git-send-email-humin29@huawei.com> <1617876888-63458-3-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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" 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 = 0; portid < app_cfg.cnt_ports; portid++) { > + printf("Closing port %d...", portid); > + ret = rte_eth_dev_stop(portid); > + if (ret != 0) > + rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, port=%u\n", > + strerror(-ret), portid); > + rte_eth_dev_close(portid); > + printf(" Done\n"); > + } > + > + ret = rte_eal_cleanup(); > + if (ret != 0) > + rte_exit(EXIT_FAILURE, "EAL cleanup failed: %s\n", > + strerror(-ret)); It would be better to add EAL cleanup in the main function.