From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4298A0350; Tue, 12 May 2020 06:50:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 135FB1C066; Tue, 12 May 2020 06:50:04 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2FFDB1C01F; Tue, 12 May 2020 06:50:01 +0200 (CEST) IronPort-SDR: 64Mnal+yX4fTL23FCTd2XQx6tHs/wla0mh4LeyjVG8S9CAQl6Q6dw4BYKoRicQg+d4cBDqjZBP L5aLlAitPtYw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2020 21:50:01 -0700 IronPort-SDR: 8W+WJTZantWEzqYcoxavZrumvph7j45b6fdy7yPa6dbcad6yZzGQLzczLd9X21fdnraHRJr72Y x4kFikRC9gEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,382,1583222400"; d="scan'208";a="265384916" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 11 May 2020 21:50:00 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 11 May 2020 21:50:00 -0700 Received: from bgsmsx109.gar.corp.intel.com (10.223.4.211) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 11 May 2020 21:50:00 -0700 Received: from bgsmsx101.gar.corp.intel.com ([169.254.1.187]) by BGSMSX109.gar.corp.intel.com ([169.254.10.178]) with mapi id 14.03.0439.000; Tue, 12 May 2020 10:19:57 +0530 From: "Varghese, Vipin" To: Muhammad Bilal , "Richardson, Bruce" CC: "dev@dpdk.org" , "stable@dpdk.org" , "jgrajcia@cisco.com" Thread-Topic: [PATCH] examples/l2fwd/main.c: free resources in case of error Thread-Index: AQHWJ4gJiMGENLull0a/YDERwnKR7Kij4irg Date: Tue, 12 May 2020 04:49:57 +0000 Message-ID: <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D4D2C85@BGSMSX101.gar.corp.intel.com> References: <20200511112831.25549-1-m.bilal@emumba.com> In-Reply-To: <20200511112831.25549-1-m.bilal@emumba.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.223.10.10] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/l2fwd/main.c: free resources in case of error 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" snipped > Subject: [PATCH] examples/l2fwd/main.c: free resources in case of error >=20 > Bugzilla ID: 437 > Cc: dev@dpdk.org > Cc: stable@dpdk.org > Cc: bruce.richardson@intel.com > Cc: vipin.varghese@intel.com > Cc: jgrajcia@cisco.com > Signed-off-by: Muhammad Bilal > --- > examples/l2fwd/main.c | 72 ++++++++++++++++++++++++++++++++++--------- > 1 file changed, 57 insertions(+), 15 deletions(-) >=20 > diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index > 88ddfe589..dbaa457e2 100644 > --- a/examples/l2fwd/main.c > +++ b/examples/l2fwd/main.c > @@ -517,6 +517,17 @@ signal_handler(int signum) > } > } >=20 > +static void > +stop_and_close_eth_dev(uint16_t portid) { > + RTE_ETH_FOREACH_DEV(portid) { > + printf("Closing port %d...", portid); > + rte_eth_dev_stop(portid); > + rte_eth_dev_close(portid); > + printf(" Done\n"); > + } > +} > + If the solution is to cleanup in application, then all application needs to= do cleanup. Hence `+1` for updating this to all examples in DPDK.=20