summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_api.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-05-17 10:46:40 -0400
committerDave Wallace <dwallacelf@gmail.com>2019-05-17 21:06:13 +0000
commit8fdde3c22ff981f0c41b78d3640e3249873e8495 (patch)
tree15016f3c45d2c9a7ec68863302820ee342445c13 /src/vnet/interface_api.c
parentce5c2ce518346990d081e4e0c56070be4a743586 (diff)
Add a debug-CLI leak-checker
leak-check { <any-debug-cli-command-and-args> } Hint: "set term history off" or you'll have to sort through a bunch of bogus leaks related to the debug cli history mechanism. Cleaned up a set of reported leaks in the "show interface" command. At some point, we thought about making a per-thread vlib_mains vector, but we never did that. Several interface-related CLI's maintained local static cache vectors. Not a bad idea, but not useful as things shook out. Removed the static vectors. Change-Id: I756bf2721a0d91993ecfded34c79da406f30a548 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/interface_api.c')
-rw-r--r--src/vnet/interface_api.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 58035fbf47d..1b913823708 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -661,52 +661,34 @@ vl_api_sw_interface_clear_stats_t_handler (vl_api_sw_interface_clear_stats_t *
vnet_interface_main_t *im = &vnm->interface_main;
vlib_simple_counter_main_t *sm;
vlib_combined_counter_main_t *cm;
- static vnet_main_t **my_vnet_mains;
- int i, j, n_counters;
+ int j, n_counters;
int rv = 0;
if (mp->sw_if_index != ~0)
VALIDATE_SW_IF_INDEX (mp);
- vec_reset_length (my_vnet_mains);
-
- for (i = 0; i < vec_len (vnet_mains); i++)
- {
- if (vnet_mains[i])
- vec_add1 (my_vnet_mains, vnet_mains[i]);
- }
-
- if (vec_len (vnet_mains) == 0)
- vec_add1 (my_vnet_mains, vnm);
-
n_counters = vec_len (im->combined_sw_if_counters);
for (j = 0; j < n_counters; j++)
{
- for (i = 0; i < vec_len (my_vnet_mains); i++)
- {
- im = &my_vnet_mains[i]->interface_main;
- cm = im->combined_sw_if_counters + j;
- if (mp->sw_if_index == (u32) ~ 0)
- vlib_clear_combined_counters (cm);
- else
- vlib_zero_combined_counter (cm, ntohl (mp->sw_if_index));
- }
+ im = &vnm->interface_main;
+ cm = im->combined_sw_if_counters + j;
+ if (mp->sw_if_index == (u32) ~ 0)
+ vlib_clear_combined_counters (cm);
+ else
+ vlib_zero_combined_counter (cm, ntohl (mp->sw_if_index));
}
n_counters = vec_len (im->sw_if_counters);
for (j = 0; j < n_counters; j++)
{
- for (i = 0; i < vec_len (my_vnet_mains); i++)
- {
- im = &my_vnet_mains[i]->interface_main;
- sm = im->sw_if_counters + j;
- if (mp->sw_if_index == (u32) ~ 0)
- vlib_clear_simple_counters (sm);
- else
- vlib_zero_simple_counter (sm, ntohl (mp->sw_if_index));
- }
+ im = &vnm->interface_main;
+ sm = im->sw_if_counters + j;
+ if (mp->sw_if_index == (u32) ~ 0)
+ vlib_clear_simple_counters (sm);
+ else
+ vlib_zero_simple_counter (sm, ntohl (mp->sw_if_index));
}
BAD_SW_IF_INDEX_LABEL;