diff mbox series

[1/2] bitratestats: add support for free

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

Commit Message

Hemant Agrawal May 13, 2020, 11:38 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                | 9 +++++++++
 lib/librte_bitratestats/rte_bitratestats_version.map | 6 ++++++
 3 files changed, 23 insertions(+)

-- 
2.17.1

Comments

Jerin Jacob May 13, 2020, 11:47 a.m. UTC | #1
On Wed, May 13, 2020 at 5:10 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>

> 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                | 9 +++++++++

>  lib/librte_bitratestats/rte_bitratestats_version.map | 6 ++++++

>  3 files changed, 23 insertions(+)

>

> diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c

> index d18152365..1d4715d6c 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 ef10f22ff..b2d532b95 100644

> --- a/lib/librte_bitratestats/rte_bitrate.h

> +++ b/lib/librte_bitratestats/rte_bitrate.h

> @@ -27,6 +27,15 @@ 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_create()


s/rte_stats_create()/rte_stats_bitrate_create()

> + */

> +__rte_experimental

> +int rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data);

>

>  /**

>   * Register bitrate statistics with the metric library.

> diff --git a/lib/librte_bitratestats/rte_bitratestats_version.map b/lib/librte_bitratestats/rte_bitratestats_version.map

> index 88fc2912d..85522a05d 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;

> +};

> --

> 2.17.1

>
diff mbox series

Patch

diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c
index d18152365..1d4715d6c 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 ef10f22ff..b2d532b95 100644
--- a/lib/librte_bitratestats/rte_bitrate.h
+++ b/lib/librte_bitratestats/rte_bitrate.h
@@ -27,6 +27,15 @@  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_create()
+ */
+__rte_experimental
+int rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data);
 
 /**
  * Register bitrate statistics with the metric library.
diff --git a/lib/librte_bitratestats/rte_bitratestats_version.map b/lib/librte_bitratestats/rte_bitratestats_version.map
index 88fc2912d..85522a05d 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;
+};