From fd2417b2a42e34062e3d07875e5c4e11922513d5 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Fri, 16 Jul 2021 14:00:16 +0000 Subject: ip-neighbor: ARP and ND stats per-interface. Type: feature stats of the like from: https://datatracker.ietf.org/doc/html/draft-ietf-rtgwg-arp-yang-model-03#section-4 Signed-off-by: Neale Ranns Change-Id: Icb1bf4f6f7e6ccc2f44b0008d4774b61cae96184 --- src/vnet/arp/arp.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/vnet/arp/arp.c') diff --git a/src/vnet/arp/arp.c b/src/vnet/arp/arp.c index a2292f1c922..5765101701d 100644 --- a/src/vnet/arp/arp.c +++ b/src/vnet/arp/arp.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -565,8 +566,14 @@ arp_reply (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) error0 = ETHERNET_ARP_ERROR_l3_dst_address_not_local; else if (arp0->ip4_over_ethernet[0].ip4.as_u32 == arp0->ip4_over_ethernet[1].ip4.as_u32) - error0 = arp_learn (sw_if_index0, - &arp0->ip4_over_ethernet[0]); + { + vlib_increment_simple_counter ( + &ip_neighbor_counters[AF_IP4] + .ipnc[VLIB_RX][IP_NEIGHBOR_CTR_GRAT], + vm->thread_index, sw_if_index0, 1); + error0 = + arp_learn (sw_if_index0, &arp0->ip4_over_ethernet[0]); + } goto drop; case ARP_DST_FIB_CONN: /* destination is connected, continue to process */ @@ -600,6 +607,14 @@ arp_reply (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) goto drop; } + vlib_increment_simple_counter ( + &ip_neighbor_counters[AF_IP4] + .ipnc[VLIB_RX][arp0->opcode == clib_host_to_net_u16 ( + ETHERNET_ARP_OPCODE_reply) ? + IP_NEIGHBOR_CTR_REPLY : + IP_NEIGHBOR_CTR_REQUEST], + vm->thread_index, sw_if_index0, 1); + /* Learn or update sender's mapping only for replies to addresses * that are local to the subnet */ if (arp0->opcode == @@ -653,6 +668,9 @@ arp_reply (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) if (!error0) error0 = arp_learn (sw_if_index0, &arp0->ip4_over_ethernet[1]); + vlib_increment_simple_counter ( + &ip_neighbor_counters[AF_IP4].ipnc[VLIB_TX][IP_NEIGHBOR_CTR_REPLY], + vm->thread_index, sw_if_index0, 1); n_replies_sent += 1; goto enqueue; -- cgit 1.2.3-korg