summaryrefslogtreecommitdiffstats
path: root/lib/librte_latencystats
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2018-08-14 18:52:30 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2018-08-14 18:53:17 +0100
commitb63264c8342e6a1b6971c79550d2af2024b6a4de (patch)
tree83114aac64286fe616506c0b3dfaec2ab86ef835 /lib/librte_latencystats
parentca33590b6af032bff57d9cc70455660466a654b2 (diff)
New upstream version 18.08upstream/18.08
Change-Id: I32fdf5e5016556d9c0a6d88ddaf1fc468961790a Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'lib/librte_latencystats')
-rw-r--r--lib/librte_latencystats/rte_latencystats.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c
index 66330203..1fdec68e 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017 Intel Corporation
+ * Copyright(c) 2018 Intel Corporation
*/
#include <unistd.h>
@@ -46,7 +46,7 @@ struct rte_latency_stats {
static struct rte_latency_stats *glob_stats;
struct rxtx_cbs {
- struct rte_eth_rxtx_callback *cb;
+ const struct rte_eth_rxtx_callback *cb;
};
static struct rxtx_cbs rx_cbs[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
@@ -201,7 +201,6 @@ rte_latencystats_init(uint64_t app_samp_intvl,
uint16_t pid;
uint16_t qid;
struct rxtx_cbs *cbs = NULL;
- const uint16_t nb_ports = rte_eth_dev_count();
const char *ptr_strings[NUM_LATENCY_STATS] = {0};
const struct rte_memzone *mz = NULL;
const unsigned int flags = 0;
@@ -234,7 +233,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
}
/** Register Rx/Tx callbacks */
- for (pid = 0; pid < nb_ports; pid++) {
+ RTE_ETH_FOREACH_DEV(pid) {
struct rte_eth_dev_info dev_info;
rte_eth_dev_info_get(pid, &dev_info);
for (qid = 0; qid < dev_info.nb_rx_queues; qid++) {
@@ -266,10 +265,10 @@ rte_latencystats_uninit(void)
uint16_t qid;
int ret = 0;
struct rxtx_cbs *cbs = NULL;
- const uint16_t nb_ports = rte_eth_dev_count();
+ const struct rte_memzone *mz = NULL;
/** De register Rx/Tx callbacks */
- for (pid = 0; pid < nb_ports; pid++) {
+ RTE_ETH_FOREACH_DEV(pid) {
struct rte_eth_dev_info dev_info;
rte_eth_dev_info_get(pid, &dev_info);
for (qid = 0; qid < dev_info.nb_rx_queues; qid++) {
@@ -290,6 +289,11 @@ rte_latencystats_uninit(void)
}
}
+ /* free up the memzone */
+ mz = rte_memzone_lookup(MZ_RTE_LATENCY_STATS);
+ if (mz)
+ rte_memzone_free(mz);
+
return 0;
}