23 u32 * policer_index,
u8 is_add)
91 s =
format (s,
"policer at %llx: %s rate, %s color-aware\n",
94 s =
format (s,
"cir %u tok/period, pir %u tok/period, scale %u\n",
96 s =
format (s,
"cur lim %u, cur bkt %u, ext lim %u, ext bkt %u\n",
109 s =
format (s,
"closest");
115 s =
format (s,
"ILLEGAL");
130 s =
format (s,
"ILLEGAL");
146 s =
format (s,
"2r3c-2698");
149 s =
format (s,
"2r3c-4115");
152 s =
format (s,
"2r3c-mef5cf1");
154 s =
format (s,
"ILLEGAL");
166 #define _(v,f,str) case VNET_DSCP_##f: t = str; break; 170 return format (s,
"ILLEGAL");
185 s =
format (s,
"transmit");
189 s =
format (s,
"ILLEGAL");
198 s =
format (s,
"type %U cir %u eir %u cb %u eb %u\n",
202 s =
format (s,
"rate type %U, round type %U\n",
204 s =
format (s,
"conform action %U, exceed action %U, violate action %U\n",
223 else if (
unformat (input,
"2r3c-2698"))
225 else if (
unformat (input,
"2r3c-4115"))
227 else if (
unformat (input,
"2r3c-mef5cf1"))
313 u8 *r = va_arg (*va,
u8 *);
316 #define _(v,f,str) else if (unformat (input, str)) *r = VNET_DSCP_##f; 332 else if (
unformat (input,
"transmit"))
361 u32 *r = va_arg (*va,
u32 *);
366 if (
unformat (input,
"%s", &match_name))
384 u32 *r = va_arg (*va,
u32 *);
386 if (
unformat (input,
"conform-color"))
388 else if (
unformat (input,
"exceed-color"))
396 #define foreach_config_param \ 422 memset (&c, 0,
sizeof (c));
428 else if (
unformat (line_input,
"name %s", &name))
430 else if (
unformat (line_input,
"color-aware"))
433 #define _(a) else if (unformat (line_input, "%U", unformat_policer_##a, &c)) ; 454 .path =
"configure policer",
455 .short_help =
"configure policer name <name> <params> ",
472 (void)
unformat (input,
"name %s", &match_name);
477 name = (u8 *) p->key;
478 if (match_name == 0 || !strcmp((char *) name, (char *) match_name))
480 pool_index = p->value[0];
481 config = pool_elt_at_index (pm->configs, pool_index);
482 templ = pool_elt_at_index (pm->policer_templates, pool_index);
483 vlib_cli_output (vm,
"Name \"%s\" %U ",
484 name, format_policer_config, config);
485 vlib_cli_output (vm,
"Template %U",
486 format_policer_instance, templ);
487 vlib_cli_output (vm,
"-----------");
497 .path =
"show policer",
498 .short_help =
"show policer [name]",
uword * policer_index_by_name
static uword unformat_policer_eir(unformat_input_t *input, va_list *va)
sse2_qos_pol_cfg_params_st * configs
sll srl srl sll sra u16x4 i
static uword unformat_policer_action(unformat_input_t *input, va_list *va)
#define foreach_config_param
sse2_qos_pol_action_params_st conform_action
union sse2_qos_pol_cfg_params_st_::@198 rb
static u8 * format_dscp(u8 *s, va_list *va)
vnet_main_t * vnet_get_main(void)
uword * policer_config_by_name
#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
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).
struct sse2_qos_pol_cfg_params_st_::@198::@199 kbps
static u8 * format_policer_round_type(u8 *s, va_list *va)
static uword unformat_policer_action_type(unformat_input_t *input, va_list *va)
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 (general version).
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)
#define clib_memcpy(a, b, c)
int sse2_pol_logical_2_physical(sse2_qos_pol_cfg_params_st *cfg, policer_read_response_type_st *phys)
#define VLIB_CLI_COMMAND(x,...)
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)
#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
vnet_policer_main_t vnet_policer_main
static uword unformat_policer_eb(unformat_input_t *input, va_list *va)