diff options
author | Keith Burns (alagalah) <alagalah@gmail.com> | 2017-08-06 08:26:29 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2017-09-07 22:12:31 +0000 |
commit | 8a19f12a0cfe6d611f6e266931af691fb69a74ad (patch) | |
tree | bc47ff7146c235c1df17594f4529929cf25ab8b8 /src/vpp/api | |
parent | 49d66f1f42cbc310e4fa0dc526b9fdb91d0ca220 (diff) |
Allow individual stats API and introduce stats.api
- want_interface_simple_stats
- want_interface_combined_stats
- want_ip4|6_fib|nbr_stats
Change-Id: I4e97461def508958b3e429c3fe8859b36fef2d18
Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
Diffstat (limited to 'src/vpp/api')
-rw-r--r-- | src/vpp/api/api.c | 59 | ||||
-rw-r--r-- | src/vpp/api/vpe.api | 112 | ||||
-rw-r--r-- | src/vpp/api/vpe_all_api_h.h | 3 |
3 files changed, 4 insertions, 170 deletions
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c index e8bc22ae..f9c3129c 100644 --- a/src/vpp/api/api.c +++ b/src/vpp/api/api.c @@ -110,7 +110,6 @@ _(CREATE_VLAN_SUBIF, create_vlan_subif) \ _(CREATE_SUBIF, create_subif) \ _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \ _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \ -_(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats) \ _(RESET_FIB, reset_fib) \ _(CREATE_LOOPBACK, create_loopback) \ _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \ @@ -745,64 +744,6 @@ vl_api_oam_add_del_t_handler (vl_api_oam_add_del_t * mp) REPLY_MACRO (VL_API_OAM_ADD_DEL_REPLY); } -static void -vl_api_vnet_get_summary_stats_t_handler (vl_api_vnet_get_summary_stats_t * mp) -{ - stats_main_t *sm = &stats_main; - vnet_interface_main_t *im = sm->interface_main; - vl_api_vnet_get_summary_stats_reply_t *rmp; - vlib_combined_counter_main_t *cm; - vlib_counter_t v; - int i, which; - u64 total_pkts[VLIB_N_RX_TX]; - u64 total_bytes[VLIB_N_RX_TX]; - - unix_shared_memory_queue_t *q = - vl_api_client_index_to_input_queue (mp->client_index); - - if (!q) - return; - - rmp = vl_msg_api_alloc (sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_VNET_GET_SUMMARY_STATS_REPLY); - rmp->context = mp->context; - rmp->retval = 0; - - memset (total_pkts, 0, sizeof (total_pkts)); - memset (total_bytes, 0, sizeof (total_bytes)); - - vnet_interface_counter_lock (im); - - vec_foreach (cm, im->combined_sw_if_counters) - { - which = cm - im->combined_sw_if_counters; - - for (i = 0; i < vlib_combined_counter_n_counters (cm); i++) - { - vlib_get_combined_counter (cm, i, &v); - total_pkts[which] += v.packets; - total_bytes[which] += v.bytes; - } - } - 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]); - rmp->vector_rate = - clib_host_to_net_u64 (vlib_last_vector_length_per_node (sm->vlib_main)); - - vl_msg_api_send_shmem (q, (u8 *) & rmp); -} - -/* *INDENT-OFF* */ -typedef CLIB_PACKED (struct { - ip4_address_t address; - u32 address_length: 6; - u32 index:26; -}) ip4_route_t; -/* *INDENT-ON* */ static int ip4_reset_fib_t_handler (vl_api_reset_fib_t * mp) diff --git a/src/vpp/api/vpe.api b/src/vpp/api/vpe.api index eda95ce5..d68beae1 100644 --- a/src/vpp/api/vpe.api +++ b/src/vpp/api/vpe.api @@ -47,6 +47,7 @@ * DHCP APIs: see ... /src/vnet/dhcp/{dhcpk.api, dhcp_api.c} * COP APIs: see ... /src/vnet/cop/{cop.api, cop_api.c} * POLICER APIs: see ... /src/vnet/policer/{policer.api, policer_api.c} + * STATS APIs: see .../src/vpp/stats/{stats.api, stats.c} */ /** \brief Create a new subinterface with the given vlan id @@ -136,117 +137,6 @@ autoreply define reset_vrf u32 vrf_id; }; -/** \brief Want Stats, register for stats updates - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request - @param enable_disable - 1 = enable stats, 0 = disable - @param pid - pid of process requesting stats updates -*/ -autoreply define want_stats -{ - u32 client_index; - u32 context; - u32 enable_disable; - u32 pid; -}; - -typeonly manual_print manual_endian define ip4_fib_counter -{ - u32 address; - u8 address_length; - u64 packets; - u64 bytes; -}; - -manual_print manual_endian define vnet_ip4_fib_counters -{ - u32 vrf_id; - u32 count; - vl_api_ip4_fib_counter_t c[count]; -}; - -typeonly manual_print manual_endian define ip4_nbr_counter -{ - u32 address; - u8 link_type; - u64 packets; - u64 bytes; -}; - -/** - * @brief Per-neighbour (i.e. per-adjacency) coutners - * @param count The size of the array of counters - * @param sw_if_index The interface the adjacency is on - * @param begin Flag to indicate this is the first set of stats for this - * interface. If this flag is not set the it is a continuation of - * stats for this interface - * @param c counters - */ -manual_print manual_endian define vnet_ip4_nbr_counters -{ - u32 count; - u32 sw_if_index; - u8 begin; - vl_api_ip4_nbr_counter_t c[count]; -}; - -typeonly manual_print manual_endian define ip6_fib_counter -{ - u64 address[2]; - u8 address_length; - u64 packets; - u64 bytes; -}; - -manual_print manual_endian define vnet_ip6_fib_counters -{ - u32 vrf_id; - u32 count; - vl_api_ip6_fib_counter_t c[count]; -}; - -typeonly manual_print manual_endian define ip6_nbr_counter -{ - u64 address[2]; - u8 link_type; - u64 packets; - u64 bytes; -}; - -manual_print manual_endian define vnet_ip6_nbr_counters -{ - u32 count; - u32 sw_if_index; - u8 begin; - vl_api_ip6_nbr_counter_t c[count]; -}; - -/** \brief Request for a single block of summary stats - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request -*/ -define vnet_get_summary_stats -{ - u32 client_index; - u32 context; -}; - -/** \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 vector_rate - -*/ -define vnet_get_summary_stats_reply -{ - u32 context; - i32 retval; - u64 total_pkts[2]; - u64 total_bytes[2]; - f64 vector_rate; -}; - /** \brief OAM event structure @param dst_address[] - @param state diff --git a/src/vpp/api/vpe_all_api_h.h b/src/vpp/api/vpe_all_api_h.h index 397cd807..d35a0535 100644 --- a/src/vpp/api/vpe_all_api_h.h +++ b/src/vpp/api/vpe_all_api_h.h @@ -28,6 +28,9 @@ /* Include the current layer (third) vpp API definition layer */ #include <vpp/api/vpe.api.h> +/* Include stats APIs */ +#include <vpp/stats/stats.api.h> + /* * fd.io coding-style-patch-verification: ON * |