This patch exposes the following item fields through the flow command:

- GTP TEID

Signed-off-by: Beilei Xing <beilei.x...@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(+)

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",
+               .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.
+
 Actions list
 ^^^^^^^^^^^^
 
-- 
2.5.5

Reply via email to