28 .stat_segment_name =
"/net/punt",
136 return (
format (s,
"[%d] %v", pr, punt_reason_data[pr].
pd_name));
156 pc->pc_name = pc_name;
178 return (((
u64) node_index) << 32 | reason);
215 u32 pri, *prip, *pris;
253 const char *node_name)
399 u32 *result = va_arg (*args,
u32 *);
408 u32 pri = va_arg (*args,
u32);
413 s =
format (s,
"%U -> %U",
431 s =
format (s,
"%v ", pc->pc_name);
441 u32 pci = va_arg (*args,
u32);
447 s =
format (s,
"%v", pc->pc_name);
454 s =
format (s,
"\n registrations:");
460 s =
format (s,
"\n reasons:");
514 .path =
"show punt client",
515 .short_help =
"show client[s] registered with the punt infra",
537 .path =
"show punt reasons",
538 .short_help =
"show all punt reasons",
559 " (for each punt-reason the edge[s] from punt-dispatch)");
580 .path =
"show punt db",
581 .short_help =
"show the punt DB",
607 .path =
"show punt stats",
608 .short_help =
"show the punt stats",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static uword * punt_client_db
DB of clients key'd by their name.
#define vec_foreach_index(var, v)
Iterate over vector indices.
uword unformat_punt_client(unformat_input_t *input, va_list *args)
A registration, by a client, to direct punted traffic to a given node.
#define hash_set(h, key, value)
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
format_function_t format_vlib_node_name
#define hash_unset(h, key)
static void punt_reg_mk_dp(vlib_punt_reason_t reason)
reconstruct the DP per-reason DB
u16 pr_edge
The edge from the punt dispatch node to the requested node.
u32 pr_node_index
node-index to send punted packets to
u8 * format_punt_reason_data(u8 *s, va_list *args)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Combined counter to hold both packets and byte differences.
int vlib_punt_hdl_t
Typedef for a client handle.
#define hash_set_mem(h, key, value)
static punt_reg_t * punt_reg_pool
Pool of registrations.
static vlib_punt_reason_t punt_reason_last
The last allocated punt reason.
u32 * pc_regs
The registrations is has made.
int vlib_punt_reason_alloc(vlib_punt_hdl_t client, const char *reason_name, vlib_punt_reason_t *reason)
Allocate a new punt reason.
u8 * pd_name
The reason name.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u16 pr_locks
number of clients that have made this registration
static uword * punt_reg_db
A DB of all the register nodes against punt reason and node index.
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
u8 * format_vlib_punt_reason(u8 *s, va_list *args)
Format a punt reason.
static punt_client_t * punt_client_pool
Pool of clients.
#define VLIB_INIT_FUNCTION(x)
#define hash_foreach(key_var, value_var, h, body)
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
A client using the punt serivce and its registrations.
struct punt_reg_t_ punt_reg_t
A registration, by a client, to direct punted traffic to a given node.
vlib_punt_hdl_t vlib_punt_client_register(const char *who)
Register a new clinet.
vlib_punt_reason_t pd_reason
The allocated reason value.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
struct punt_reason_data_t_ punt_reason_data_t
A punt reason.
counter_t packets
packet counter
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
static void punt_reg_remove(const punt_reg_t *pr)
static clib_error_t * punt_stats_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_put(P, E)
Free an object E in pool P.
static clib_error_t * punt_reason_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * punt_db_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_del1(v, i)
Delete the element at index I.
u8 * format_punt_reg(u8 *s, va_list *args)
static clib_error_t * punt_init(vlib_main_t *vm)
unformat_function_t unformat_hash_vec_string
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
static punt_reason_data_t * punt_reason_data
data for each punt reason
#define vec_free(V)
Free vector's memory (no header).
int vlib_punt_unregister(vlib_punt_hdl_t client, vlib_punt_reason_t reason, const char *node_name)
vlib_punt_reason_t pr_reason
Reason the packets were punted.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define VLIB_CLI_COMMAND(x,...)
struct punt_client_t_ punt_client_t
A client using the punt serivce and its registrations.
u8 * format_punt_client(u8 *s, va_list *args)
static vlib_main_t * vlib_get_main(void)
counter_t bytes
byte counter
static u64 punt_reg_mk_key(vlib_punt_reason_t reason, u32 node_index)
int vlib_punt_register(vlib_punt_hdl_t client, vlib_punt_reason_t reason, const char *node_name)
Register a node to receive particular punted buffers.
#define hash_create_vec(elts, key_bytes, value_bytes)
static clib_error_t * punt_client_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_combined_counter_main_t punt_counters
Counters per punt-reason.
char * name
The counter collection's name.
A collection of combined counters.
u16 ** punt_dp_db
A DB used in the DP per-reason to dispatch packets to the requested nodes.
u32 * pd_owners
Clients/owners that have registered this reason.
#define hash_get_mem(h, key)
enum punt_format_flags_t_ punt_format_flags_t
u8 * pc_name
The name of the client.
static u32 punt_reg_find(vlib_punt_reason_t reason, u32 node_index)
#define vec_foreach(var, vec)
Vector iterator.
static void punt_reg_add(const punt_reg_t *pr)
static int punt_validate_client(vlib_punt_hdl_t client)
enum vlib_punt_reason_t_ vlib_punt_reason_t
The 'syatem' defined punt reasons.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)