net/softnic: support packet decap action
Add support for packet decap table action. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
This commit is contained in:
parent
d5ed626f61
commit
b9bcbeeccb
@ -375,6 +375,17 @@ softnic_table_action_profile_create(struct pmd_internals *p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) {
|
||||||
|
status = rte_table_action_profile_action_register(ap,
|
||||||
|
RTE_TABLE_ACTION_DECAP,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
rte_table_action_profile_free(ap);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status = rte_table_action_profile_freeze(ap);
|
status = rte_table_action_profile_freeze(ap);
|
||||||
if (status) {
|
if (status) {
|
||||||
rte_table_action_profile_free(ap);
|
rte_table_action_profile_free(ap);
|
||||||
|
@ -1280,6 +1280,7 @@ cmd_port_in_action_profile(struct pmd_internals *softnic,
|
|||||||
* [stats pkts | bytes | both]
|
* [stats pkts | bytes | both]
|
||||||
* [time]
|
* [time]
|
||||||
* [tag]
|
* [tag]
|
||||||
|
* [decap]
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
cmd_table_action_profile(struct pmd_internals *softnic,
|
cmd_table_action_profile(struct pmd_internals *softnic,
|
||||||
@ -1617,6 +1618,12 @@ cmd_table_action_profile(struct pmd_internals *softnic,
|
|||||||
t0 += 1;
|
t0 += 1;
|
||||||
} /* tag */
|
} /* tag */
|
||||||
|
|
||||||
|
if (t0 < n_tokens &&
|
||||||
|
(strcmp(tokens[t0], "decap") == 0)) {
|
||||||
|
p.action_mask |= 1LLU << RTE_TABLE_ACTION_DECAP;
|
||||||
|
t0 += 1;
|
||||||
|
} /* decap */
|
||||||
|
|
||||||
if (t0 < n_tokens) {
|
if (t0 < n_tokens) {
|
||||||
snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
|
snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
|
||||||
return;
|
return;
|
||||||
@ -3184,6 +3191,7 @@ parse_match(char **tokens,
|
|||||||
* [stats]
|
* [stats]
|
||||||
* [time]
|
* [time]
|
||||||
* [tag <tag>]
|
* [tag <tag>]
|
||||||
|
* [decap <n>]
|
||||||
*
|
*
|
||||||
* where:
|
* where:
|
||||||
* <pa> ::= g | y | r | drop
|
* <pa> ::= g | y | r | drop
|
||||||
@ -3689,6 +3697,22 @@ parse_table_action_tag(char **tokens,
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
parse_table_action_decap(char **tokens,
|
||||||
|
uint32_t n_tokens,
|
||||||
|
struct softnic_table_rule_action *a)
|
||||||
|
{
|
||||||
|
if (n_tokens < 2 ||
|
||||||
|
strcmp(tokens[0], "decap"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (softnic_parser_read_uint16(&a->decap.n, tokens[1]))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
a->action_mask |= 1 << RTE_TABLE_ACTION_DECAP;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
parse_table_action(char **tokens,
|
parse_table_action(char **tokens,
|
||||||
uint32_t n_tokens,
|
uint32_t n_tokens,
|
||||||
@ -3847,6 +3871,20 @@ parse_table_action(char **tokens,
|
|||||||
n_tokens -= n;
|
n_tokens -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n_tokens && (strcmp(tokens[0], "decap") == 0)) {
|
||||||
|
uint32_t n;
|
||||||
|
|
||||||
|
n = parse_table_action_decap(tokens, n_tokens, a);
|
||||||
|
if (n == 0) {
|
||||||
|
snprintf(out, out_size, MSG_ARG_INVALID,
|
||||||
|
"action decap");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tokens += n;
|
||||||
|
n_tokens -= n;
|
||||||
|
}
|
||||||
|
|
||||||
if (n_tokens0 - n_tokens == 1) {
|
if (n_tokens0 - n_tokens == 1) {
|
||||||
snprintf(out, out_size, MSG_ARG_INVALID, "action");
|
snprintf(out, out_size, MSG_ARG_INVALID, "action");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -898,6 +898,7 @@ struct softnic_table_rule_action {
|
|||||||
struct rte_table_action_stats_params stats;
|
struct rte_table_action_stats_params stats;
|
||||||
struct rte_table_action_time_params time;
|
struct rte_table_action_time_params time;
|
||||||
struct rte_table_action_tag_params tag;
|
struct rte_table_action_tag_params tag;
|
||||||
|
struct rte_table_action_decap_params decap;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rte_flow {
|
struct rte_flow {
|
||||||
|
@ -2488,6 +2488,16 @@ action_convert(struct rte_table_action *a,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (action->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) {
|
||||||
|
status = rte_table_action_apply(a,
|
||||||
|
data,
|
||||||
|
RTE_TABLE_ACTION_DECAP,
|
||||||
|
&action->decap);
|
||||||
|
|
||||||
|
if (status)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user