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)
419 u32 *result = va_arg (*args,
u32 *);
428 u32 pri = va_arg (*args,
u32);
433 s =
format (s,
"%U -> %U",
451 s =
format (s,
"%v ", pc->pc_name);
461 u32 pci = va_arg (*args,
u32);
467 s =
format (s,
"%v", pc->pc_name);
474 s =
format (s,
"\n registrations:");
480 s =
format (s,
"\n reasons:");
534 .path =
"show punt client",
535 .short_help =
"show client[s] registered with the punt infra",
557 .path =
"show punt reasons",
558 .short_help =
"show all punt reasons",
579 " (for each punt-reason the edge[s] from punt-dispatch)");
600 .path =
"show punt db",
601 .short_help =
"show the punt DB",
627 .path =
"show punt stats",
628 .short_help =
"show the punt stats",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
int(* punt_reason_walk_cb_t)(vlib_punt_reason_t id, const u8 *name, void *ctx)
Walk each punt reason.
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)
int vlib_punt_reason_validate(vlib_punt_reason_t reason)
Validate that a punt reason is assigned.
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.
void punt_reason_walk(punt_reason_walk_cb_t cb, void *ctx)
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,...)