[dpdk-dev,3/7] app/testpmd: add GTP fields to flow command
Checks
Commit Message
This patch exposes the following item fields through the flow command:
- GTP TEID
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
app/test-pmd/cmdline_flow.c | 22 ++++++++++++++++++++++
app/test-pmd/config.c | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 ++++
3 files changed, 27 insertions(+)
Comments
On Fri, Aug 25, 2017 at 03:50:26PM +0800, Beilei Xing wrote:
> This patch exposes the following item fields through the flow command:
>
> - GTP TEID
>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Minor nits, see below.
> ---
> app/test-pmd/cmdline_flow.c | 22 ++++++++++++++++++++++
> app/test-pmd/config.c | 1 +
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 ++++
> 3 files changed, 27 insertions(+)
>
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index a17a004..4ab5bcc 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -171,6 +171,8 @@ enum index {
> ITEM_GRE_PROTO,
> ITEM_FUZZY,
> ITEM_FUZZY_THRESH,
> + ITEM_GTP,
> + ITEM_GTP_TEID,
>
> /* Validate/create actions. */
> ACTIONS,
> @@ -451,6 +453,7 @@ static const enum index next_item[] = {
> ITEM_MPLS,
> ITEM_GRE,
> ITEM_FUZZY,
> + ITEM_GTP,
> ZERO,
> };
>
> @@ -588,6 +591,12 @@ static const enum index item_gre[] = {
> ZERO,
> };
>
> +static const enum index item_gtp[] = {
> + ITEM_GTP_TEID,
> + ITEM_NEXT,
> + ZERO,
> +};
> +
> static const enum index next_action[] = {
> ACTION_END,
> ACTION_VOID,
> @@ -1421,6 +1430,19 @@ static const struct token token_list[] = {
> .args = ARGS(ARGS_ENTRY(struct rte_flow_item_fuzzy,
> thresh)),
> },
> + [ITEM_GTP] = {
> + .name = "gtp",
> + .help = "match GTP header",
> + .priv = PRIV_ITEM(GTP, sizeof(struct rte_flow_item_gtp)),
> + .next = NEXT(item_gtp),
> + .call = parse_vc,
> + },
> + [ITEM_GTP_TEID] = {
> + .name = "teid",
> + .help = "GTP TEID",
No need to repeat "GTP". You may also expand the TEID acronym.
> + .next = NEXT(item_gtp, NEXT_ENTRY(UNSIGNED), item_param),
> + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp, teid)),
> + },
>
> /* Validate/create actions. */
> [ACTIONS] = {
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 3ae3e1c..1f320a0 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -947,6 +947,7 @@ static const struct {
> MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
> MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
> MK_FLOW_ITEM(FUZZY, sizeof(struct rte_flow_item_fuzzy)),
> + MK_FLOW_ITEM(GTP, sizeof(struct rte_flow_item_gtp)),
> };
>
> /** Compute storage space needed by item specification. */
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 2ed62f5..6ec463e 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -2696,6 +2696,10 @@ This section lists supported pattern items and their attributes, if any.
>
> - ``thresh {unsigned}``: accuracy threshold.
>
> +- ``gtp``: match GTP header.
> +
> + - ``teid {unsigned}``: GTP TEID.
> +
Same comment here. Indentation is also wrong.
Thanks.
@@ -171,6 +171,8 @@ enum index {
ITEM_GRE_PROTO,
ITEM_FUZZY,
ITEM_FUZZY_THRESH,
+ ITEM_GTP,
+ ITEM_GTP_TEID,
/* Validate/create actions. */
ACTIONS,
@@ -451,6 +453,7 @@ static const enum index next_item[] = {
ITEM_MPLS,
ITEM_GRE,
ITEM_FUZZY,
+ ITEM_GTP,
ZERO,
};
@@ -588,6 +591,12 @@ static const enum index item_gre[] = {
ZERO,
};
+static const enum index item_gtp[] = {
+ ITEM_GTP_TEID,
+ ITEM_NEXT,
+ ZERO,
+};
+
static const enum index next_action[] = {
ACTION_END,
ACTION_VOID,
@@ -1421,6 +1430,19 @@ static const struct token token_list[] = {
.args = ARGS(ARGS_ENTRY(struct rte_flow_item_fuzzy,
thresh)),
},
+ [ITEM_GTP] = {
+ .name = "gtp",
+ .help = "match GTP header",
+ .priv = PRIV_ITEM(GTP, sizeof(struct rte_flow_item_gtp)),
+ .next = NEXT(item_gtp),
+ .call = parse_vc,
+ },
+ [ITEM_GTP_TEID] = {
+ .name = "teid",
+ .help = "GTP TEID",
+ .next = NEXT(item_gtp, NEXT_ENTRY(UNSIGNED), item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp, teid)),
+ },
/* Validate/create actions. */
[ACTIONS] = {
@@ -947,6 +947,7 @@ static const struct {
MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
MK_FLOW_ITEM(FUZZY, sizeof(struct rte_flow_item_fuzzy)),
+ MK_FLOW_ITEM(GTP, sizeof(struct rte_flow_item_gtp)),
};
/** Compute storage space needed by item specification. */
@@ -2696,6 +2696,10 @@ This section lists supported pattern items and their attributes, if any.
- ``thresh {unsigned}``: accuracy threshold.
+- ``gtp``: match GTP header.
+
+ - ``teid {unsigned}``: GTP TEID.
+
Actions list
^^^^^^^^^^^^