diff options
author | John Lo <loj@cisco.com> | 2016-09-04 08:55:34 -0400 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-09-06 20:08:36 +0000 |
commit | 7394b5b06b6549b5ff7fe3f1103c269ae966f584 (patch) | |
tree | 535c85514aa52e1728d31f4f3df4b2a7cb43b480 /vnet | |
parent | 07d2f84907e776383572fa5cc89071d90a8be36b (diff) |
Add packet/byte count output tx stats to tunap interface
Change-Id: I167c49d2a64e7a36a176d57054ecd99b398a9cca
Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/unix/tuntap.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vnet/vnet/unix/tuntap.c b/vnet/vnet/unix/tuntap.c index b3fbc7f32e7..48d5dc2387d 100644 --- a/vnet/vnet/unix/tuntap.c +++ b/vnet/vnet/unix/tuntap.c @@ -141,6 +141,9 @@ tuntap_tx (vlib_main_t * vm, u32 * buffers = vlib_frame_args (frame); uword n_packets = frame->n_vectors; tuntap_main_t * tm = &tuntap_main; + vnet_main_t *vnm = vnet_get_main (); + vnet_interface_main_t *im = &vnm->interface_main; + u32 n_bytes = 0; int i; for (i = 0; i < n_packets; i++) @@ -181,8 +184,17 @@ tuntap_tx (vlib_main_t * vm, if (writev (tm->dev_net_tun_fd, tm->iovecs, vec_len (tm->iovecs)) < l) clib_unix_warning ("writev"); + + n_bytes += l; } + /* Update tuntap interface output stats. */ + vlib_increment_combined_counter (im->combined_sw_if_counters + + VNET_INTERFACE_COUNTER_TX, + vm->cpu_index, + tm->sw_if_index, n_packets, n_bytes); + + /** The normal interface path flattens the buffer chain */ if (tm->have_normal_interface) vlib_buffer_free_no_next (vm, buffers, n_packets); |