MCPcopy Create free account
hub / github.com/F-Stack/f-stack / parse_table_action_fwd

Function parse_table_action_fwd

dpdk/examples/ip_pipeline/cli.c:3044–3094  ·  view source on GitHub ↗

* table_action ::= * * action * fwd * drop * | port * | meta * | table * [balance ... ] * [meter * tc0 meter policer g y r * [tc1 meter policer g y r * tc2 meter policer g y r * tc3 meter <meter

Source from the content-addressed store, hash-verified

3042 * <pa> ::= g | y | r | drop
3043 */
3044static uint32_t
3045parse_table_action_fwd(char **tokens,
3046 uint32_t n_tokens,
3047 struct table_rule_action *a)
3048{
3049 if ((n_tokens == 0) || (strcmp(tokens[0], "fwd") != 0))
3050 return 0;
3051
3052 tokens++;
3053 n_tokens--;
3054
3055 if (n_tokens && (strcmp(tokens[0], "drop") == 0)) {
3056 a->fwd.action = RTE_PIPELINE_ACTION_DROP;
3057 a->action_mask |= 1 << RTE_TABLE_ACTION_FWD;
3058 return 1 + 1;
3059 }
3060
3061 if (n_tokens && (strcmp(tokens[0], "port") == 0)) {
3062 uint32_t id;
3063
3064 if ((n_tokens < 2) ||
3065 parser_read_uint32(&id, tokens[1]))
3066 return 0;
3067
3068 a->fwd.action = RTE_PIPELINE_ACTION_PORT;
3069 a->fwd.id = id;
3070 a->action_mask |= 1 << RTE_TABLE_ACTION_FWD;
3071 return 1 + 2;
3072 }
3073
3074 if (n_tokens && (strcmp(tokens[0], "meta") == 0)) {
3075 a->fwd.action = RTE_PIPELINE_ACTION_PORT_META;
3076 a->action_mask |= 1 << RTE_TABLE_ACTION_FWD;
3077 return 1 + 1;
3078 }
3079
3080 if (n_tokens && (strcmp(tokens[0], "table") == 0)) {
3081 uint32_t id;
3082
3083 if ((n_tokens < 2) ||
3084 parser_read_uint32(&id, tokens[1]))
3085 return 0;
3086
3087 a->fwd.action = RTE_PIPELINE_ACTION_TABLE;
3088 a->fwd.id = id;
3089 a->action_mask |= 1 << RTE_TABLE_ACTION_FWD;
3090 return 1 + 2;
3091 }
3092
3093 return 0;
3094}
3095
3096static uint32_t
3097parse_table_action_balance(char **tokens,

Callers 1

parse_table_actionFunction · 0.85

Calls 2

strcmpFunction · 0.85
parser_read_uint32Function · 0.70

Tested by

no test coverage detected