*/
udp_encap_t *udp_encap_pool;
+/**
+ * Stats for each UDP encap object
+ */
+vlib_combined_counter_main_t udp_encap_counters;
+
static udp_encap_t *
udp_encap_get_w_id (u32 id)
{
{
u8 pfx_len = 0;
- pool_get (udp_encap_pool, ue);
+ pool_get_aligned (udp_encap_pool, ue, CLIB_CACHE_LINE_BYTES);
uei = ue - udp_encap_pool;
+ vlib_validate_combined_counter (&(udp_encap_counters), uei);
+ vlib_zero_combined_counter (&(udp_encap_counters), uei);
+
hash_set (udp_encap_db, id, uei);
fib_node_init (&ue->ue_fib_node, FIB_NODE_TYPE_UDP_ENCAP);
index_t uei = va_arg (*args, index_t);
u32 indent = va_arg (*args, u32);
u32 details = va_arg (*args, u32);
+ vlib_counter_t to;
udp_encap_t *ue;
ue = udp_encap_get (uei);
// FIXME
- s = format (s, "udp-ecap:[%d]: id:%d ip-fib-index:%d",
+ s = format (s, "udp-ecap:[%d]: id:%d ip-fib-index:%d ",
uei, ue->ue_id, ue->ue_fib_index);
if (FIB_PROTOCOL_IP4 == ue->ue_ip_proto)
{
clib_net_to_host_u16 (ue->ue_hdrs.ip6.ue_udp.src_port),
clib_net_to_host_u16 (ue->ue_hdrs.ip6.ue_udp.dst_port));
}
+ vlib_get_combined_counter (&(udp_encap_counters), uei, &to);
+ s = format (s, " to:[%Ld:%Ld]]", to.packets, to.bytes);
+
if (details)
{
s = format (s, " locks:%d", ue->ue_fib_node.fn_locks);
return (s);
}
+void
+udp_encap_get_stats (index_t uei, u64 * packets, u64 * bytes)
+{
+ vlib_counter_t to;
+
+ vlib_get_combined_counter (&(udp_encap_counters), uei, &to);
+
+ *packets = to.packets;
+ *bytes = to.bytes;
+}
+
static u8 *
format_udp_encap_dpo (u8 * s, va_list * args)
{
return error;
}
+void
+udp_encap_walk (udp_encap_walk_cb_t cb, void *ctx)
+{
+ index_t uei;
+
+ /* *INDENT-OFF* */
+ pool_foreach_index(uei, udp_encap_pool,
+ ({
+ if (!cb(uei, ctx))
+ break;
+ }));
+ /* *INDENT-ON* */
+}
+
clib_error_t *
udp_encap_show (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)