diff mbox series

[PATCHv2,1/2] bitratestats: add support for free

Message ID 20200514093001.12007-1-hemant.agrawal@nxp.com
State Superseded
Headers show
Series [PATCHv2,1/2] bitratestats: add support for free | expand

Commit Message

Hemant Agrawal May 14, 2020, 9:30 a.m. UTC
This patch adds support for free funnction.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 lib/librte_bitratestats/rte_bitrate.c                |  8 ++++++++
 lib/librte_bitratestats/rte_bitrate.h                | 11 ++++++++++-
 lib/librte_bitratestats/rte_bitratestats_version.map |  6 ++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

-- 
2.17.1

Comments

Stephen Hemminger May 19, 2020, 3:19 p.m. UTC | #1
On Thu, 14 May 2020 15:00:00 +0530
Hemant Agrawal <hemant.agrawal@nxp.com> wrote:

>  

> +int

> +rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data)

> +{

> +	if (bitrate_data)

> +		rte_free(bitrate_data);

> +	return 0;

> +}


rte_free of NULL is allowed, the test is not needed.

Should be void not int function.
Thomas Monjalon July 10, 2020, 10:30 p.m. UTC | #2
19/05/2020 17:19, Stephen Hemminger:
> On Thu, 14 May 2020 15:00:00 +0530

> Hemant Agrawal <hemant.agrawal@nxp.com> wrote:

> >  

> > +int

> > +rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data)

> > +{

> > +	if (bitrate_data)

> > +		rte_free(bitrate_data);

> > +	return 0;

> > +}

> 

> rte_free of NULL is allowed, the test is not needed.

> 

> Should be void not int function.


Ping, why no answer? Can we expect a v3?
Hemant Agrawal July 11, 2020, 3:11 a.m. UTC | #3
Missed it. I will send v3

Get BlueMail for Android<http://www.bluemail.me/r?b=15860>
On 11 Jul 2020, at 4:00 AM, Thomas Monjalon <thomas@monjalon.net<mailto:thomas@monjalon.net>> wrote:

19/05/2020 17:19, Stephen Hemminger:
 On Thu, 14 May 2020 15:00:00 +0530
 Hemant Agrawal <hemant.agrawal@nxp.com> wrote:

 +int
 +rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data)
 +{
 + if (bitrate_data)
 +  rte_free(bitrate_data);
 + return 0;
 +}

 rte_free of NULL is allowed, the test is not needed.

 Should be void not int function.

Ping, why no answer? Can we expect a v3?
diff mbox series

Patch

diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c
index d18152365e..1d4715d6c0 100644
--- a/lib/librte_bitratestats/rte_bitrate.c
+++ b/lib/librte_bitratestats/rte_bitrate.c
@@ -35,6 +35,14 @@  rte_stats_bitrate_create(void)
 		RTE_CACHE_LINE_SIZE);
 }
 
+int
+rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data)
+{
+	if (bitrate_data)
+		rte_free(bitrate_data);
+	return 0;
+}
+
 int
 rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data)
 {
diff --git a/lib/librte_bitratestats/rte_bitrate.h b/lib/librte_bitratestats/rte_bitrate.h
index ef10f22ff3..0e5b625b79 100644
--- a/lib/librte_bitratestats/rte_bitrate.h
+++ b/lib/librte_bitratestats/rte_bitrate.h
@@ -27,12 +27,21 @@  struct rte_stats_bitrates;
  */
 struct rte_stats_bitrates *rte_stats_bitrate_create(void);
 
+/**
+ * Free bitrate statistics structure
+ *
+ *
+ * @param bitrate_data
+ *   Pointer allocated by rte_stats_bitrate_create()
+ */
+__rte_experimental
+int rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data);
 
 /**
  * Register bitrate statistics with the metric library.
  *
  * @param bitrate_data
- *   Pointer allocated by rte_stats_create()
+ *   Pointer allocated by rte_stats_bitrate_create()
  *
  * @return
  *   Zero on success
diff --git a/lib/librte_bitratestats/rte_bitratestats_version.map b/lib/librte_bitratestats/rte_bitratestats_version.map
index 88fc2912db..85522a05d5 100644
--- a/lib/librte_bitratestats/rte_bitratestats_version.map
+++ b/lib/librte_bitratestats/rte_bitratestats_version.map
@@ -7,3 +7,9 @@  DPDK_20.0 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+	global:
+
+	rte_stats_bitrate_free;
+};