|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
39 .
name =
"Policer-Conform",
40 .stat_segment_name =
"/net/policer/conform",
43 .name =
"Policer-Exceed",
44 .stat_segment_name =
"/net/policer/exceed",
47 .name =
"Policer-Violate",
48 .stat_segment_name =
"/net/policer/violate",
54 u32 *policer_index,
u8 is_add)
147 return VNET_API_ERROR_NO_SUCH_ENTRY;
156 return VNET_API_ERROR_INVALID_WORKER;
179 return VNET_API_ERROR_NO_SUCH_ENTRY;
183 policer_index = policer - pm->
policers;
214 s =
format (s,
"policer at %llx: %s rate, %s color-aware\n",
215 i,
i->single_rate ?
"single" :
"dual",
216 i->color_aware ?
"is" :
"not");
217 s =
format (s,
"cir %u tok/period, pir %u tok/period, scale %u\n",
218 i->cir_tokens_per_period,
i->pir_tokens_per_period,
i->scale);
219 s =
format (s,
"cur lim %u, cur bkt %u, ext lim %u, ext bkt %u\n",
221 i->current_bucket,
i->extended_limit,
i->extended_bucket);
222 s =
format (s,
"last update %llu\n",
i->last_update_time);
223 s =
format (s,
"conform %llu packets, %llu bytes\n",
225 s =
format (s,
"exceed %llu packets, %llu bytes\n",
227 s =
format (s,
"violate %llu packets, %llu bytes\n",
238 s =
format (s,
"closest");
244 s =
format (s,
"ILLEGAL");
259 s =
format (s,
"ILLEGAL");
275 s =
format (s,
"2r3c-2698");
278 s =
format (s,
"2r3c-4115");
281 s =
format (s,
"2r3c-mef5cf1");
283 s =
format (s,
"ILLEGAL");
295 s =
format (s,
"transmit");
299 s =
format (s,
"ILLEGAL");
308 s =
format (s,
"type %U cir %u eir %u cb %u eb %u\n",
311 c->rb.kbps.eir_kbps,
c->rb.kbps.cb_bytes,
c->rb.kbps.eb_bytes);
312 s =
format (s,
"rate type %U, round type %U\n",
314 s =
format (s,
"conform action %U, exceed action %U, violate action %U\n",
333 else if (
unformat (input,
"2r3c-2698"))
335 else if (
unformat (input,
"2r3c-4115"))
337 else if (
unformat (input,
"2r3c-mef5cf1"))
385 if (
unformat (input,
"cir %u", &
c->rb.kbps.cir_kbps))
395 if (
unformat (input,
"eir %u", &
c->rb.kbps.eir_kbps))
405 if (
unformat (input,
"cb %u", &
c->rb.kbps.cb_bytes))
415 if (
unformat (input,
"eb %u", &
c->rb.kbps.eb_bytes))
427 else if (
unformat (input,
"transmit"))
462 if (
unformat (input,
"%s", &match_name))
482 if (
unformat (input,
"conform-color"))
484 else if (
unformat (input,
"exceed-color"))
492 #define foreach_config_param \
525 else if (
unformat (line_input,
"color-aware"))
528 #define _(a) else if (unformat (line_input, "%U", unformat_policer_##a, &c)) ;
600 else if (
unformat (line_input,
"unbind"))
602 else if (
unformat (line_input,
"%d", &worker))
612 if (bind && ~0 == worker)
652 else if (
unformat (line_input,
"unapply"))
686 .path =
"configure policer",
687 .short_help =
"configure policer name <name> <params> ",
691 .path =
"policer add",
692 .short_help =
"policer name <name> <params> ",
696 .path =
"policer del",
697 .short_help =
"policer del name <name> ",
701 .path =
"policer bind",
702 .short_help =
"policer bind [unbind] name <name> <worker>",
706 .path =
"policer input",
707 .short_help =
"policer input [unapply] name <name> <interfac>",
725 (void)
unformat (input,
"name %s", &match_name);
730 name = (u8 *) p->key;
731 if (match_name == 0 || !strcmp((char *) name, (char *) match_name))
733 pi = hash_get_mem (pm->policer_index_by_name, name);
735 pool_index = p->value[0];
736 config = pool_elt_at_index (pm->configs, pool_index);
737 templ = pool_elt_at_index (pm->policer_templates, pool_index);
738 vlib_cli_output (vm,
"Name \"%s\" %U ", name, format_policer_config,
740 vlib_cli_output (vm,
"Template %U", format_policer_instance, templ,
742 vlib_cli_output (vm,
"-----------");
752 .path =
"show policer",
753 .short_help =
"show policer [name]",
773 .path =
"show policer pools",
774 .short_help =
"show policer pools",
static uword unformat_policer_classify_precolor(unformat_input_t *input, va_list *va)
#define NUM_POLICE_RESULTS
qos_pol_cfg_params_st * configs
void vnet_classify_register_unformat_policer_next_index_fn(unformat_function_t *fn)
uword * policer_config_by_name
static u32 vlib_num_workers()
#define foreach_config_param
int policer_input(u8 *name, u32 sw_if_index, bool apply)
static uword unformat_policer_type(unformat_input_t *input, va_list *va)
u8 * format_policer_instance(u8 *s, va_list *va)
static vlib_cli_command_t policer_bind_command
(constructor) VLIB_CLI_COMMAND (policer_bind_command)
@ QOS_POLICER_TYPE_2R3C_RFC_4115
#define clib_memcpy(d, s, n)
@ QOS_POLICER_TYPE_2R3C_RFC_2698
static uword unformat_policer_eir(unformat_input_t *input, va_list *va)
vnet_policer_main_t vnet_policer_main
static u8 * format_policer_round_type(u8 *s, va_list *va)
static u32 vlib_get_worker_thread_index(u32 worker_index)
static clib_error_t * policer_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
static clib_error_t * show_policer_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
vlib_main_t vlib_node_runtime_t * node
static uword unformat_policer_action_type(unformat_input_t *input, va_list *va)
#define hash_create_string(elts, value_bytes)
#define clib_error_return(e, args...)
#define hash_set_mem(h, key, value)
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ QOS_POLICER_TYPE_1R3C_RFC_2697
char * name
The counter collection's name.
vlib_log_class_t log_class
clib_error_t * policer_init(vlib_main_t *vm)
static clib_error_t * policer_bind_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_hw_if_output_node_runtime_t * r
#define pool_put_index(p, i)
Free pool element with given index.
static clib_error_t * policer_input_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 vlib_frame_queue_main_init(u32 node_index, u32 frame_queue_nelts)
void vnet_classify_register_unformat_opaque_index_fn(unformat_function_t *fn)
u8 * format_policer_handoff_trace(u8 *s, va_list *args)
vlib_combined_counter_main_t policer_counters[]
static uword unformat_policer_rate_type(unformat_input_t *input, va_list *va)
static vlib_cli_command_t policer_del_command
(constructor) VLIB_CLI_COMMAND (policer_del_command)
static u8 * format_policer_rate_type(u8 *s, va_list *va)
clib_error_t * policer_add_del(vlib_main_t *vm, u8 *name, qos_pol_cfg_params_st *cfg, u32 *policer_index, u8 is_add)
#define hash_unset_mem(h, key)
vnet_main_t * vnet_get_main(void)
static uword unformat_policer_round_type(unformat_input_t *input, va_list *va)
Combined counter to hold both packets and byte differences.
static uword unformat_policer_classify_next_index(unformat_input_t *input, va_list *va)
static vlib_cli_command_t configure_policer_command
(constructor) VLIB_CLI_COMMAND (configure_policer_command)
static clib_error_t * policer_add_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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.
@ QOS_ACTION_MARK_AND_TRANSMIT
u32 * policer_index_by_sw_if_index
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static int apply(phash_main_t *pm, u32 tail, u32 rollback)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static uword unformat_policer_cir(unformat_input_t *input, va_list *va)
#define CLIB_CACHE_LINE_BYTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
policer_t * policer_templates
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...
#define hash_get_mem(h, key)
#define vec_free(V)
Free vector's memory (no header).
static vlib_cli_command_t policer_add_command
(constructor) VLIB_CLI_COMMAND (policer_add_command)
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
A collection of combined counters.
int pol_logical_2_physical(qos_pol_cfg_params_st *cfg, policer_t *phys)
#define VLIB_INIT_FUNCTION(x)
static u8 * format_policer_type(u8 *s, va_list *va)
vlib_node_registration_t policer_input_node
(constructor) VLIB_REGISTER_NODE (policer_input_node)
static uword pool_elts(void *v)
Number of active elements in a pool.
static vlib_cli_command_t policer_input_command
(constructor) VLIB_CLI_COMMAND (policer_input_command)
int policer_bind_worker(u8 *name, u32 worker, bool bind)
static clib_error_t * show_policer_pools_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static vlib_cli_command_t show_policer_command
(constructor) VLIB_CLI_COMMAND (show_policer_command)
static uword unformat_policer_action(unformat_input_t *input, va_list *va)
static vlib_cli_command_t show_policer_pools_command
(constructor) VLIB_CLI_COMMAND (show_policer_pools_command)
static uword unformat_policer_cb(unformat_input_t *input, va_list *va)
unformat_function_t unformat_ip_dscp
vl_api_interface_index_t sw_if_index
static uword unformat_policer_eb(unformat_input_t *input, va_list *va)
u8 * format_ip_dscp(u8 *s, va_list *va)
@ QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1
u8 * format_policer_config(u8 *s, va_list *va)
uword * policer_index_by_name
static u8 * format_policer_action_type(u8 *s, va_list *va)