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 48BA8A0579; Tue, 20 Apr 2021 11:10:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F0D641683; Tue, 20 Apr 2021 11:10:22 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id B3397411A5 for ; Tue, 20 Apr 2021 11:10:20 +0200 (CEST) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FPdBP5fdyzrfkn; Tue, 20 Apr 2021 17:07:57 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Tue, 20 Apr 2021 17:10:16 +0800 To: Thomas Monjalon CC: , References: <1617876888-63458-1-git-send-email-humin29@huawei.com> <1617876888-63458-3-git-send-email-humin29@huawei.com> <29981982.VByYVYEeCf@thomas> From: "Min Hu (Connor)" Message-ID: <78e68559-f9a1-8ea5-317d-189caa22d3ae@huawei.com> Date: Tue, 20 Apr 2021 17:10:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <29981982.VByYVYEeCf@thomas> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected 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" ÔÚ 2021/4/20 8:59, Thomas Monjalon дµÀ: > 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. > Hi, Thomas, It has already been done in this patch: "examples: add eal cleanup to examples", please check it out, thanks. > > . >