VPP-1324 SIGSEGV vl_msg_api_handler_with_vm_node()
Increase local arrays sizes to the correct number and gather missing statistics.
Change-Id: If44d43f258730e9a18f50fb59fc526c214d2be8a
Signed-off-by: Lukasz Majczak <lma@semihalf.com>
diff --git a/src/vpp/stats/stats.api b/src/vpp/stats/stats.api
index 5d00908..c66f2e4 100644
--- a/src/vpp/stats/stats.api
+++ b/src/vpp/stats/stats.api
@@ -18,7 +18,7 @@
This file defines the stats API
*/
-option version = "1.0.1";
+option version = "1.0.2";
import "vnet/interface.api";
import "vnet/bier/bier.api";
@@ -408,16 +408,18 @@
/** \brief Reply for vnet_get_summary_stats request
@param context - sender context, to match reply w/ request
@param retval - return code for request
- @param total_pkts -
- @param total_bytes -
+ @param total_pkts - length of the array must match the length of
+ the combined counter part of the enum in interface.h
+ @param total_bytes - length of the array must match the length of
+ the combined counter part of the enum in interface.h
@param vector_rate -
*/
define vnet_get_summary_stats_reply
{
u32 context;
i32 retval;
- u64 total_pkts[2];
- u64 total_bytes[2];
+ u64 total_pkts[8];
+ u64 total_bytes[8];
f64 vector_rate;
};
diff --git a/src/vpp/stats/stats.c b/src/vpp/stats/stats.c
index 9f91210..66d9d32 100644
--- a/src/vpp/stats/stats.c
+++ b/src/vpp/stats/stats.c
@@ -3098,9 +3098,10 @@
vl_api_vnet_get_summary_stats_reply_t *rmp;
vlib_combined_counter_main_t *cm;
vlib_counter_t v;
+ vnet_interface_counter_type_t ct;
int i, which;
- u64 total_pkts[VLIB_N_RX_TX];
- u64 total_bytes[VLIB_N_RX_TX];
+ u64 total_pkts[VNET_N_COMBINED_INTERFACE_COUNTER];
+ u64 total_bytes[VNET_N_COMBINED_INTERFACE_COUNTER];
vl_api_registration_t *reg;
reg = vl_api_client_index_to_registration (mp->client_index);
@@ -3130,10 +3131,17 @@
}
vnet_interface_counter_unlock (im);
- rmp->total_pkts[VLIB_RX] = clib_host_to_net_u64 (total_pkts[VLIB_RX]);
- rmp->total_bytes[VLIB_RX] = clib_host_to_net_u64 (total_bytes[VLIB_RX]);
- rmp->total_pkts[VLIB_TX] = clib_host_to_net_u64 (total_pkts[VLIB_TX]);
- rmp->total_bytes[VLIB_TX] = clib_host_to_net_u64 (total_bytes[VLIB_TX]);
+ foreach_rx_combined_interface_counter (ct)
+ {
+ rmp->total_pkts[ct] = clib_host_to_net_u64 (total_pkts[ct]);
+ rmp->total_bytes[ct] = clib_host_to_net_u64 (total_bytes[ct]);
+ }
+
+ foreach_tx_combined_interface_counter (ct)
+ {
+ rmp->total_pkts[ct] = clib_host_to_net_u64 (total_pkts[ct]);
+ rmp->total_bytes[ct] = clib_host_to_net_u64 (total_bytes[ct]);
+ }
rmp->vector_rate =
clib_host_to_net_u64 (vlib_last_vector_length_per_node (sm->vlib_main));