bitrate: add free function

This patch adds support for free function.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
Hemant Agrawal 2020-07-11 13:58:45 +05:30 committed by Thomas Monjalon
parent c6887eca58
commit f030bff72f
4 changed files with 24 additions and 2 deletions

View File

@ -32,12 +32,14 @@ test_stats_bitrate_create(void)
return TEST_SUCCESS;
}
/* To test free the resources from bitrate_reg test */
/* To test free the resources from bitrate_create test */
static int
test_stats_bitrate_free(void)
{
int ret = 0;
rte_stats_bitrate_free(bitrate_data);
ret = rte_metrics_deinit();
TEST_ASSERT(ret >= 0, "Test Failed: rte_metrics_deinit failed");

View File

@ -35,6 +35,12 @@ rte_stats_bitrate_create(void)
RTE_CACHE_LINE_SIZE);
}
void
rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data)
{
rte_free(bitrate_data);
}
int
rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data)
{

View File

@ -27,12 +27,20 @@ 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
void 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

View File

@ -7,3 +7,9 @@ DPDK_21 {
local: *;
};
EXPERIMENTAL {
global:
rte_stats_bitrate_free;
};