diff options
author | Ole Troan <ot@cisco.com> | 2019-02-26 16:37:03 +0100 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-02-28 13:25:22 +0000 |
commit | 703908aaf4f80ef6bc78166d46eba3a3b3aa15f7 (patch) | |
tree | 35bf3939113a8e0db85ec41671cdbbdb4f96d687 /src/vpp-api/client | |
parent | 8b409635b44fd599eea37c7f259be294141a38bb (diff) |
stats: Add interface name to sw_if_index as /if/names
Expose interface name to sw_if_index table as a directory node in the stats segment.
Change-Id: Ie50e4af01997d141880f02e3a8496bfeb91b9944
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/client')
-rw-r--r-- | src/vpp-api/client/stat_client.c | 23 | ||||
-rw-r--r-- | src/vpp-api/client/stat_client.h | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c index 2cf53d5d0af..25a37f76da8 100644 --- a/src/vpp-api/client/stat_client.c +++ b/src/vpp-api/client/stat_client.c @@ -252,8 +252,29 @@ copy_data (stat_segment_directory_entry_t * ep, stat_client_main_t * sm) result.error_value = error_base[ep->index]; break; + case STAT_DIR_TYPE_NAME_VECTOR: + if (ep->offset == 0) + return result; + uint8_t **name_vector = + stat_segment_pointer (sm->shared_header, ep->offset); + result.name_vector = vec_dup (name_vector); + offset_vector = + stat_segment_pointer (sm->shared_header, ep->offset_vector); + for (i = 0; i < vec_len (name_vector); i++) + { + if (offset_vector[i]) + { + u8 *name = + stat_segment_pointer (sm->shared_header, offset_vector[i]); + result.name_vector[i] = vec_dup (name); + } + else + result.name_vector[i] = 0; + } + break; + default: - fprintf (stderr, "Unknown type: %d", ep->type); + fprintf (stderr, "Unknown type: %d\n", ep->type); } return result; } diff --git a/src/vpp-api/client/stat_client.h b/src/vpp-api/client/stat_client.h index 89f6fe53ea4..23087abe749 100644 --- a/src/vpp-api/client/stat_client.h +++ b/src/vpp-api/client/stat_client.h @@ -28,6 +28,7 @@ typedef enum STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE, STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED, STAT_DIR_TYPE_ERROR_INDEX, + STAT_DIR_TYPE_NAME_VECTOR, } stat_directory_type_t; /* Default socket to exchange segment fd */ @@ -45,6 +46,7 @@ typedef struct uint64_t error_value; counter_t **simple_counter_vec; vlib_counter_t **combined_counter_vec; + uint8_t **name_vector; }; } stat_segment_data_t; |