From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 8376F16E for ; Thu, 14 Dec 2017 10:16:39 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2017 01:16:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,400,1508828400"; d="scan'208";a="186864630" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by fmsmga006.fm.intel.com with ESMTP; 14 Dec 2017 01:16:37 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.67]) by IRSMSX152.ger.corp.intel.com ([169.254.6.87]) with mapi id 14.03.0319.002; Thu, 14 Dec 2017 09:16:36 +0000 From: "Ananyev, Konstantin" To: "Gujjar, Abhinandan S" , "thomas@monjalon.net" CC: "dev@dpdk.org" , "Gujjar, Abhinandan S" Thread-Topic: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks Thread-Index: AQHTdLpNkxGDP9S5rkik+WV+NhY3M6NCjTeg Date: Thu, 14 Dec 2017 09:16:35 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772585FAC9700@irsmsx105.ger.corp.intel.com> References: <1513222343-79143-1-git-send-email-abhinandan.gujjar@intel.com> In-Reply-To: <1513222343-79143-1-git-send-email-abhinandan.gujjar@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWIwNjI4NmEtMzdlNS00NjZiLTk5ODYtYWM5ZjY2MWEwMTE1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjBHUkorUjJKemdwaHJHd0hYZnFDZ3lqanNPdFQ4d29nV0ZrbEJuVmdjOG89In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks 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, 14 Dec 2017 09:16:39 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Abhinandan Gujjar > Sent: Thursday, December 14, 2017 3:32 AM > To: thomas@monjalon.net > Cc: dev@dpdk.org; Gujjar, Abhinandan S > Subject: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callb= acks >=20 > The patch frees memory allocated by add rxtx callbacks >=20 > Signed-off-by: Abhinandan Gujjar > --- > lib/librte_ether/rte_ethdev.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c > index 318af28..2ab6e05 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -3229,6 +3229,7 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, = uint16_t queue_idx, > if (cb =3D=3D user_cb) { > /* Remove the user cb from the callback list. */ > *prev_cb =3D cb->next; > + rte_free(cb); It is not that straightforward unfortunately - that function can be called while RX/TX is active for the same queue. That's why it is a responsibility of the caller to determine when it is saf= e to free associated resources.=20 I submitted and RFC to fix that issue in a safe way: http://dpdk.org/dev/patchwork/patch/31867/ Konstantin > ret =3D 0; > break; > } > @@ -3263,6 +3264,7 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, = uint16_t queue_idx, > if (cb =3D=3D user_cb) { > /* Remove the user cb from the callback list. */ > *prev_cb =3D cb->next; > + rte_free(cb); > ret =3D 0; > break; > } > -- > 1.9.1