summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-10-10 14:15:23 +0100
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-10-12 19:33:36 +0200
commitd5ed626f61b2577c63e5fb67526b531150d5105c (patch)
tree9655b3b10c1d6db998593a1289d08ad12d8a5008 /examples
parent196eae61487ca083ba4e98f996f0f70bc311bf2a (diff)
downloaddpdk-d5ed626f61b2577c63e5fb67526b531150d5105c.zip
dpdk-d5ed626f61b2577c63e5fb67526b531150d5105c.tar.gz
dpdk-d5ed626f61b2577c63e5fb67526b531150d5105c.tar.xz
examples/ip_pipeline: support packet decap action
Add support for packet decap table action. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/ip_pipeline/action.c11
-rw-r--r--examples/ip_pipeline/cli.c39
-rw-r--r--examples/ip_pipeline/pipeline.h1
-rw-r--r--examples/ip_pipeline/thread.c10
4 files changed, 60 insertions, 1 deletions
diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
index 3f825a0..d2104aa 100644
--- a/examples/ip_pipeline/action.c
+++ b/examples/ip_pipeline/action.c
@@ -355,6 +355,17 @@ table_action_profile_create(const char *name,
}
}
+ 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);
if (status) {
rte_table_action_profile_free(ap);
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index a85d04c..d1e5540 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -1033,7 +1033,8 @@ static const char cmd_table_action_profile_help[] =
" [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset> "
" mempool_create <mempool_name>\n"
" mempool_init <mempool_name>]\n"
-" [tag]\n";
+" [tag]\n"
+" [decap]\n";
static void
cmd_table_action_profile(char **tokens,
@@ -1457,6 +1458,11 @@ cmd_table_action_profile(char **tokens,
t0 += 1;
} /* 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) {
snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
return;
@@ -3114,6 +3120,7 @@ parse_match(char **tokens,
* digest_size <size>
* data_offset <data_offset>]
* [tag <tag>]
+ * [decap <n>]
*
* where:
* <pa> ::= g | y | r | drop
@@ -4091,6 +4098,22 @@ parse_table_action_tag(char **tokens,
}
static uint32_t
+parse_table_action_decap(char **tokens,
+ uint32_t n_tokens,
+ struct table_rule_action *a)
+{
+ if ((n_tokens < 2) ||
+ strcmp(tokens[0], "decap"))
+ return 0;
+
+ if (parser_read_uint16(&a->decap.n, tokens[1]))
+ return 0;
+
+ a->action_mask |= 1 << RTE_TABLE_ACTION_DECAP;
+ return 2;
+}
+
+static uint32_t
parse_table_action(char **tokens,
uint32_t n_tokens,
char *out,
@@ -4261,6 +4284,20 @@ parse_table_action(char **tokens,
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) {
snprintf(out, out_size, MSG_ARG_INVALID, "action");
return 0;
diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h
index 73485f6..e5b1d5d 100644
--- a/examples/ip_pipeline/pipeline.h
+++ b/examples/ip_pipeline/pipeline.h
@@ -283,6 +283,7 @@ struct table_rule_action {
struct rte_table_action_time_params time;
struct rte_table_action_sym_crypto_params sym_crypto;
struct rte_table_action_tag_params tag;
+ struct rte_table_action_decap_params decap;
};
int
diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c
index 41891f4..4bd971f 100644
--- a/examples/ip_pipeline/thread.c
+++ b/examples/ip_pipeline/thread.c
@@ -2504,6 +2504,16 @@ action_convert(struct rte_table_action *a,
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;
}