DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks
@ 2017-12-14  3:32 Abhinandan Gujjar
  2017-12-14  9:16 ` Ananyev, Konstantin
  0 siblings, 1 reply; 3+ messages in thread
From: Abhinandan Gujjar @ 2017-12-14  3:32 UTC (permalink / raw)
  To: thomas; +Cc: dev, abhinandan.gujjar

The patch frees memory allocated by add rxtx callbacks

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)

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 == user_cb) {
 			/* Remove the user cb from the callback list. */
 			*prev_cb = cb->next;
+			rte_free(cb);
 			ret = 0;
 			break;
 		}
@@ -3263,6 +3264,7 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
 		if (cb == user_cb) {
 			/* Remove the user cb from the callback list. */
 			*prev_cb = cb->next;
+			rte_free(cb);
 			ret = 0;
 			break;
 		}
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks
  2017-12-14  3:32 [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks Abhinandan Gujjar
@ 2017-12-14  9:16 ` Ananyev, Konstantin
  2017-12-14  9:33   ` Gujjar, Abhinandan S
  0 siblings, 1 reply; 3+ messages in thread
From: Ananyev, Konstantin @ 2017-12-14  9:16 UTC (permalink / raw)
  To: Gujjar, Abhinandan S, thomas; +Cc: dev, Gujjar, Abhinandan S



> -----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 <abhinandan.gujjar@intel.com>
> Subject: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks
> 
> The patch frees memory allocated by add rxtx callbacks
> 
> Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> 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 == user_cb) {
>  			/* Remove the user cb from the callback list. */
>  			*prev_cb = 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 safe
to free associated resources. 
I submitted and RFC to fix that issue in a safe way:
http://dpdk.org/dev/patchwork/patch/31867/
Konstantin

>  			ret = 0;
>  			break;
>  		}
> @@ -3263,6 +3264,7 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
>  		if (cb == user_cb) {
>  			/* Remove the user cb from the callback list. */
>  			*prev_cb = cb->next;
> +			rte_free(cb);
>  			ret = 0;
>  			break;
>  		}
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks
  2017-12-14  9:16 ` Ananyev, Konstantin
@ 2017-12-14  9:33   ` Gujjar, Abhinandan S
  0 siblings, 0 replies; 3+ messages in thread
From: Gujjar, Abhinandan S @ 2017-12-14  9:33 UTC (permalink / raw)
  To: Ananyev, Konstantin, thomas; +Cc: dev


> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Thursday, December 14, 2017 2:47 PM
> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>;
> thomas@monjalon.net
> Cc: dev@dpdk.org; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx
> callbacks
> 
> 
> 
> > -----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 <abhinandan.gujjar@intel.com>
> > Subject: [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx
> > callbacks
> >
> > The patch frees memory allocated by add rxtx callbacks
> >
> > Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> > ---
> >  lib/librte_ether/rte_ethdev.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > 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 == user_cb) {
> >  			/* Remove the user cb from the callback list. */
> >  			*prev_cb = 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 safe to free
> associated resources.
> I submitted and RFC to fix that issue in a safe way:
> http://dpdk.org/dev/patchwork/patch/31867/
> Konstantin
Thanks for pointing to the patch. I could not find it in the search!
Abhinandan

> 
> >  			ret = 0;
> >  			break;
> >  		}
> > @@ -3263,6 +3264,7 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id,
> uint16_t queue_idx,
> >  		if (cb == user_cb) {
> >  			/* Remove the user cb from the callback list. */
> >  			*prev_cb = cb->next;
> > +			rte_free(cb);
> >  			ret = 0;
> >  			break;
> >  		}
> > --
> > 1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-14  9:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14  3:32 [dpdk-dev] [PATCH] ethdev: fix memory leaks in remove rxtx callbacks Abhinandan Gujjar
2017-12-14  9:16 ` Ananyev, Konstantin
2017-12-14  9:33   ` Gujjar, Abhinandan S

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).