|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
14 #include <mactime/mactime.api_types.h>
15 #include <mactime/mactime.api_enum.h>
55 #define foreach_mactime_api_msg \
56 _(MACTIME_DUMP_REPLY, mactime_dump_reply) \
57 _(MACTIME_DETAILS, mactime_details)
63 i32 retval = clib_net_to_host_u32 (mp->
retval);
88 memset (dev, 0,
sizeof (*dev));
101 for (
i = 0;
i < clib_net_to_host_u32 (mp->
nranges);
i++)
109 #define vl_print(handle, ...) fformat(handle, __VA_ARGS__)
111 #include <mactime/mactime.api.h>
116 #include <mactime/mactime.api.h>
119 #define vl_api_version(n,v) static u32 api_version = v;
120 #include <mactime/mactime.api.h>
121 #undef vl_api_version
128 u8 *msg_base_lookup_name;
136 msg_base_lookup_name =
format (0,
"mactime_%08x%c", api_version, 0);
139 ((
char *) msg_base_lookup_name);
147 vl_msg_api_set_handlers((VL_API_##N + mm->msg_id_base), \
149 vl_api_##n##_t_handler, \
151 vl_api_##n##_t_endian, \
152 vl_api_##n##_t_print, \
153 sizeof(vl_api_##n##_t), 1);
164 u32 deadman_counter = 1000;
168 memset (mp, 0,
sizeof (*mp));
170 clib_host_to_net_u16 (VL_API_MACTIME_DUMP + mm->
msg_id_base);
179 if (mm->
retval && (mm->
retval != VNET_API_ERROR_NO_CHANGE))
193 int need_update2 = 0;
194 static u32 *pool_indices;
206 if (
vec_len (pool_indices) == 0)
232 for (j = 0; j <
vec_len (counters_by_thread); j++)
265 for (j = 0; j <
vec_len (counters_by_thread); j++)
280 u8 *
a = va_arg (*args,
u8 *);
282 return format (s,
"%02x:%02x:%02x:%02x:%02x:%02x",
283 a[0],
a[1],
a[2],
a[3],
a[4],
a[5]);
290 int width = va_arg (*va,
int);
296 fmt =
format (0,
"%%%d.3f%%s%c", width, 0);
300 if (nbytes > (1024ULL * 1024ULL * 1024ULL))
302 nbytes_f64 = ((
f64) nbytes) / (1024.0 * 1024.0 * 1024.0);
305 else if (nbytes > (1024ULL * 1024ULL))
307 nbytes_f64 = ((
f64) nbytes) / (1024.0 * 1024.0);
310 else if (nbytes > 1024ULL)
312 nbytes_f64 = ((
f64) nbytes) / (1024.0);
317 nbytes_f64 = (
f64) nbytes;
321 s =
format (s, (
char *)
fmt, nbytes_f64, suffix);
331 int verbose = va_arg (*args,
int);
332 int current_status = 99;
340 s =
format (s,
"%-15s %5s %18s %14s %10s %11s %13s",
341 "Device Name",
"Index",
"Addresses",
"Status",
342 "AllowPkt",
"AllowByte",
"DropPkt");
361 s =
format (s,
" Range %d: %U - %U\n", j,
365 if (
now >= start0 &&
now <= end0)
375 s =
format (s,
" Time in range %d:", j);
376 s =
format (s,
" %U - %U\n",
384 s =
format (s,
" No range match.\n");
398 switch (current_status)
401 status_string =
"static drop";
404 status_string =
"static allow";
407 status_string =
"dynamic drop";
410 status_string =
"dynamic allow";
413 status_string =
"d-quota inact";
416 status_string =
"d-quota activ";
419 status_string =
"code bug!";
423 s =
format (s,
"%-15s %5d %18s %14s %10lld %U %13lld\n",
433 s =
format (s,
"%-59s %s%U %s%U",
" ",
"Quota ",
465 fformat (stderr,
"vpp api client connect error\n");
471 fformat (stderr,
"stat segment connect error");
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
stat_segment_directory_entry_t * directory_vector
#define MACTIME_DEVICE_FLAG_DYNAMIC_DROP
mactime table entry details
u32 client_index
client index, from api_main
u32 my_table_epoch
to suppress dump if no changes
static void unix_sleep(f64 dt)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define MACTIME_DEVICE_FLAG_DYNAMIC_ALLOW_QUOTA
svm_queue_t * vl_input_queue
#define MACTIME_DEVICE_FLAG_STATIC_DROP
Always drop packets from this device.
struct _svm_queue svm_queue_t
#define MACTIME_DEVICE_FLAG_DYNAMIC_ALLOW
#define hash_create_string(elts, value_bytes)
vnet_hw_if_output_node_runtime_t * r
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static void dump_mactime_table(mt_main_t *mm)
static int stat_segment_access_start(stat_segment_access_t *sa, stat_client_main_t *sm)
static u8 * format_bytes_with_width(u8 *s, va_list *va)
__clib_export void clib_time_init(clib_time_t *c)
uint32_t * stat_segment_ls(uint8_t **patterns)
static bool stat_segment_access_end(stat_segment_access_t *sa, stat_client_main_t *sm)
format_function_t format_clib_timebase_time
stat_client_main_t * stat_client_main
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
mactime_device_t * devices
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_dup(V)
Return copy of vector (no header, no alignment)
int stat_segment_connect(const char *socket_name)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Combined counter to hold both packets and byte differences.
vlib_counter_t * drop_counters
static void vl_api_mactime_details_t_handler(vl_api_mactime_details_t *mp)
stat_segment_shared_header_t * shared_header
clib_timebase_range_t * ranges
static unsigned char * print(const cJSON *const item, cJSON_bool format, const internal_hooks *const hooks)
static u8 * format_mac_address(u8 *s, va_list *args)
#define hash_set_mem(h, key, value)
Fixed length block allocator. Pools are built from clib vectors and bitmaps. Use pools when repeatedl...
static api_main_t * vlibapi_get_main(void)
vlib_counter_t * allow_counters
sll srl srl sll sra u16x4 i
__clib_export void clib_timebase_init(clib_timebase_t *tb, i32 timezone_offset_in_hours, clib_timebase_daylight_time_t daylight_type, clib_time_t *clib_time)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static void vl_api_mactime_dump_reply_t_handler(vl_api_mactime_dump_reply_t *mp)
static u8 * format_device(u8 *s, va_list *args)
counter_t packets
packet counter
volatile u32 result_ready
vl_api_mactime_time_range_t ranges[nranges]
API main structure, used by both vpp and binary API clients.
static void print_device_table(mt_main_t *mm)
u16 vl_client_get_first_plugin_msg_id(const char *plugin_name)
vl_api_mac_address_t mac_address
#define vec_free(V)
Free vector's memory (no header).
#define foreach_mactime_api_msg
#define hash_get_mem(h, key)
description fragment has unexpected format
uword * device_by_device_name
static f64 clib_timebase_now(clib_timebase_t *tb)
stat_client_main_t stat_client_main
counter_t bytes
byte counter
int main(int argc, char **argv)
static void * stat_segment_adjust(stat_client_main_t *sm, void *data)
static int connect_to_vpp(char *name)
@ CLIB_TIMEBASE_DAYLIGHT_USA
#define MACTIME_DEVICE_FLAG_STATIC_ALLOW
void * clib_mem_init(void *base, uword size)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
static void scrape_stats_segment(mt_main_t *mm)
#define clib_warning(format, args...)
int vl_client_connect_to_vlib(const char *svm_name, const char *client_name, int rx_queue_size)
__clib_export f64 clib_timebase_find_sunday_midnight(f64 start_time)
dump mactime table reply Includes the vpp table epoch, needed to optimize API traffic
void * vl_msg_api_alloc(int nbytes)