[PATCHv2,1/2] bitratestats: add support for free
Checks
Commit Message
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(-)
Comments
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.
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?
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?
@@ -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)
{
@@ -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
@@ -7,3 +7,9 @@ DPDK_20.0 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ rte_stats_bitrate_free;
+};