From: Lukasz Majczak Date: Thu, 28 Jun 2018 13:00:40 +0000 (+0200) Subject: VPP-1324 SIGSEGV vl_msg_api_handler_with_vm_node() X-Git-Tag: v18.07-rc1~70 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=a21a36763b4f68d3ca42d4d03b44ab2494b3e3ab 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 --- diff --git a/src/vpp/stats/stats.api b/src/vpp/stats/stats.api index 5d00908cca6..c66f2e4ab43 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 @@ define vnet_get_summary_stats /** \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 9f912109e6e..66d9d32a314 100644 --- a/src/vpp/stats/stats.c +++ b/src/vpp/stats/stats.c @@ -3098,9 +3098,10 @@ vl_api_vnet_get_summary_stats_t_handler (vl_api_vnet_get_summary_stats_t * mp) 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 @@ vl_api_vnet_get_summary_stats_t_handler (vl_api_vnet_get_summary_stats_t * mp) } 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));