25 u32 * policer_index,
u8 is_add)
106 s =
format (s,
"policer at %llx: %s rate, %s color-aware\n",
109 s =
format (s,
"cir %u tok/period, pir %u tok/period, scale %u\n",
111 s =
format (s,
"cur lim %u, cur bkt %u, ext lim %u, ext bkt %u\n",
124 s =
format (s,
"closest");
130 s =
format (s,
"ILLEGAL");
145 s =
format (s,
"ILLEGAL");
161 s =
format (s,
"2r3c-2698");
164 s =
format (s,
"2r3c-4115");
167 s =
format (s,
"2r3c-mef5cf1");
169 s =
format (s,
"ILLEGAL");
181 #define _(v,f,str) case VNET_DSCP_##f: t = str; break; 185 return format (s,
"ILLEGAL");
200 s =
format (s,
"transmit");
204 s =
format (s,
"ILLEGAL");
213 s =
format (s,
"type %U cir %u eir %u cb %u eb %u\n",
217 s =
format (s,
"rate type %U, round type %U\n",
219 s =
format (s,
"conform action %U, exceed action %U, violate action %U\n",
238 else if (
unformat (input,
"2r3c-2698"))
240 else if (
unformat (input,
"2r3c-4115"))
242 else if (
unformat (input,
"2r3c-mef5cf1"))
328 u8 *r = va_arg (*va,
u8 *);
331 #define _(v,f,str) else if (unformat (input, str)) *r = VNET_DSCP_##f; 347 else if (
unformat (input,
"transmit"))
376 u32 *r = va_arg (*va,
u32 *);
381 if (
unformat (input,
"%s", &match_name))
399 u32 *r = va_arg (*va,
u32 *);
401 if (
unformat (input,
"conform-color"))
403 else if (
unformat (input,
"exceed-color"))
411 #define foreach_config_param \ 443 else if (
unformat (line_input,
"name %s", &name))
445 else if (
unformat (line_input,
"color-aware"))
448 #define _(a) else if (unformat (line_input, "%U", unformat_policer_##a, &c)) ; 469 .path =
"configure policer",
470 .short_help =
"configure policer name <name> <params> ",
487 (void)
unformat (input,
"name %s", &match_name);
492 name = (u8 *) p->key;
493 if (match_name == 0 || !strcmp((char *) name, (char *) match_name))
495 pool_index = p->value[0];
496 config = pool_elt_at_index (pm->configs, pool_index);
497 templ = pool_elt_at_index (pm->policer_templates, pool_index);
498 vlib_cli_output (vm,
"Name \"%s\" %U ",
499 name, format_policer_config, config);
500 vlib_cli_output (vm,
"Template %U",
501 format_policer_instance, templ);
502 vlib_cli_output (vm,
"-----------");
512 .path =
"show policer",
513 .short_help =
"show policer [name]",
525 vlib_cli_output (vm,
"pool sizes: configs=%d templates=%d policers=%d",
533 .path =
"show policer pools",
534 .short_help =
"show policer pools",
uword * policer_index_by_name
static uword unformat_policer_eir(unformat_input_t *input, va_list *va)
sse2_qos_pol_cfg_params_st * configs
static uword unformat_policer_action(unformat_input_t *input, va_list *va)
#define foreach_config_param
sse2_qos_pol_action_params_st conform_action
static u8 * format_dscp(u8 *s, va_list *va)
vnet_main_t * vnet_get_main(void)
uword * policer_config_by_name
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
struct sse2_qos_pol_cfg_params_st_::@337::@338 kbps
#define hash_set_mem(h, key, value)
static uword unformat_policer_rate_type(unformat_input_t *input, va_list *va)
u32 pir_tokens_per_period
union sse2_qos_pol_cfg_params_st_::@337 rb
static uword unformat_policer_type(unformat_input_t *input, va_list *va)
u8 * format_policer_instance(u8 *s, va_list *va)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static u8 * format_policer_round_type(u8 *s, va_list *va)
static uword unformat_policer_action_type(unformat_input_t *input, va_list *va)
#define clib_memcpy(d, s, n)
vnet_policer_main_t vnet_policer_main
static clib_error_t * show_policer_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_INIT_FUNCTION(x)
static u8 * format_policer_rate_type(u8 *s, va_list *va)
#define clib_error_return(e, args...)
static uword unformat_policer_round_type(unformat_input_t *input, va_list *va)
static uword unformat_policer_cir(unformat_input_t *input, va_list *va)
#define hash_create_string(elts, value_bytes)
#define hash_unset_mem(h, key)
clib_error_t * policer_init(vlib_main_t *vm)
sse2_qos_pol_action_params_st violate_action
void vnet_classify_register_unformat_opaque_index_fn(unformat_function_t *fn)
policer_read_response_type_st * policers
void vnet_policer_node_funcs_reference(void)
sse2_qos_pol_action_params_st exceed_action
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
static uword unformat_policer_classify_next_index(unformat_input_t *input, va_list *va)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * configure_policer_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int sse2_pol_logical_2_physical(sse2_qos_pol_cfg_params_st *cfg, policer_read_response_type_st *phys)
#define VLIB_CLI_COMMAND(x,...)
#define pool_put_index(p, i)
Free pool element with given index.
u32 cir_tokens_per_period
clib_error_t * policer_add_del(vlib_main_t *vm, u8 *name, sse2_qos_pol_cfg_params_st *cfg, u32 *policer_index, u8 is_add)
static uword unformat_dscp(unformat_input_t *input, va_list *va)
static u8 * format_policer_type(u8 *s, va_list *va)
u8 * format_policer_config(u8 *s, va_list *va)
static clib_error_t * show_policer_pools_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 u8 * format_policer_action_type(u8 *s, va_list *va)
#define hash_get_mem(h, key)
static uword unformat_policer_cb(unformat_input_t *input, va_list *va)
static uword unformat_policer_classify_precolor(unformat_input_t *input, va_list *va)
policer_read_response_type_st * policer_templates
void vnet_classify_register_unformat_policer_next_index_fn(unformat_function_t *fn)
#define CLIB_CACHE_LINE_BYTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static uword unformat_policer_eb(unformat_input_t *input, va_list *va)
static uword pool_elts(void *v)
Number of active elements in a pool.