After unification of VXLAN and all its extension protocols(VXLAN-GPE and
VXLAN-GBP currently), all related RTE items should be specified after
'vxlan'. And it's user's responsibility to specify correct UDP port for
the protocol to be matched.

Below are the examples to match standard VXLAN, VXLAN-GPE and VXLAN-GBP.
To match standard vxlan,
... / udp dst is 4789 / vxlan ... / ...
To match VXLAN-GBP, group policy ID is 4321,
... / udp dst is 4789 / vxlan flag_g is 1 group_policy_id is 4321 ... / ...
To match VXLAN-GPE, next protocol is IPv6
... / udp dst is 4790 / vxlan flag_p is 1 protocol is 2 ... / ...

Signed-off-by: Gavin Li <gav...@nvidia.com>
Acked-by: Thomas Monjalon <tho...@monjalon.net>
Acked-by: Ori Kam <or...@nvidia.com>
---
 app/test-pmd/cmdline_flow.c                 | 110 ++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  11 ++
 2 files changed, 121 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 60ee9337cf..6c8210ccd4 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -383,6 +383,17 @@ enum index {
        ITEM_VXLAN,
        ITEM_VXLAN_VNI,
        ITEM_VXLAN_LAST_RSVD,
+       ITEM_VXLAN_FLAG_G,
+       ITEM_VXLAN_FLAG_VER,
+       ITEM_VXLAN_FLAG_I,
+       ITEM_VXLAN_FLAG_P,
+       ITEM_VXLAN_FLAG_B,
+       ITEM_VXLAN_FLAG_O,
+       ITEM_VXLAN_FLAG_D,
+       ITEM_VXLAN_FLAG_A,
+       ITEM_VXLAN_EXT_GBP_GPI,
+       ITEM_VXLAN_EXT_GPE_PROTO,
+       ITEM_VXLAN_EXT_GPE_RSVD0,
        ITEM_E_TAG,
        ITEM_E_TAG_GRP_ECID_B,
        ITEM_NVGRE,
@@ -1779,6 +1790,17 @@ static const enum index item_sctp[] = {
 static const enum index item_vxlan[] = {
        ITEM_VXLAN_VNI,
        ITEM_VXLAN_LAST_RSVD,
+       ITEM_VXLAN_FLAG_G,
+       ITEM_VXLAN_FLAG_VER,
+       ITEM_VXLAN_FLAG_I,
+       ITEM_VXLAN_FLAG_P,
+       ITEM_VXLAN_FLAG_B,
+       ITEM_VXLAN_FLAG_O,
+       ITEM_VXLAN_FLAG_D,
+       ITEM_VXLAN_FLAG_A,
+       ITEM_VXLAN_EXT_GBP_GPI,
+       ITEM_VXLAN_EXT_GPE_PROTO,
+       ITEM_VXLAN_EXT_GPE_RSVD0,
        ITEM_NEXT,
        ZERO,
 };
@@ -4918,6 +4940,94 @@ static const struct token token_list[] = {
                .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
                                             hdr.rsvd1)),
        },
+       [ITEM_VXLAN_FLAG_G] = {
+               .name = "flag_g",
+               .help = "VXLAN flag GBP bit",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_g, 1)),
+       },
+       [ITEM_VXLAN_FLAG_VER] = {
+               .name = "flag_ver",
+               .help = "VXLAN flag GPE version bits",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_ver, 2)),
+       },
+       [ITEM_VXLAN_FLAG_I] = {
+               .name = "flag_i",
+               .help = "VXLAN flag instance bit",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_i, 1)),
+       },
+       [ITEM_VXLAN_FLAG_P] = {
+               .name = "flag_p",
+               .help = "VXLAN flag GPE Next Protocol bit",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_p, 1)),
+       },
+       [ITEM_VXLAN_FLAG_B] = {
+               .name = "flag_b",
+               .help = "VXLAN flag GPE Ingress-Replicated BUM",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_b, 1)),
+       },
+       [ITEM_VXLAN_FLAG_O] = {
+               .name = "flag_o",
+               .help = "VXLAN flag GPE OAM Packet bit",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_o, 1)),
+       },
+       [ITEM_VXLAN_FLAG_D] = {
+               .name = "flag_d",
+               .help = "VXLAN flag GBP Don't Learn bit",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_d, 1)),
+       },
+       [ITEM_VXLAN_FLAG_A] = {
+               .name = "flag_a",
+               .help = "VXLAN flag GBP Applied bit",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_vxlan,
+                                          hdr.flag_a, 1)),
+       },
+       [ITEM_VXLAN_EXT_GBP_GPI] = {
+               .name = "group_policy_id",
+               .help = "VXLAN Group Based Policy ID",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
+                                            hdr.policy_id)),
+       },
+       [ITEM_VXLAN_EXT_GPE_PROTO] = {
+               .name = "protocol",
+               .help = "VXLAN-GPE next protocol",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
+                                            hdr.proto)),
+       },
+       [ITEM_VXLAN_EXT_GPE_RSVD0] = {
+               .name = "rsvd0_gpe",
+               .help = "VXLAN-GPE rsvd0",
+               .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+                            item_param),
+               .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
+                                            hdr.rsvd0_gpe)),
+       },
        [ITEM_E_TAG] = {
                .name = "e_tag",
                .help = "match E-Tag header",
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index ecd040504e..5fb369c107 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3697,6 +3697,17 @@ This section lists supported pattern items and their 
attributes, if any.
 
   - ``vni {unsigned}``: VXLAN identifier.
   - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits.
+  - ``flag_g {unsigned}``: VXLAN flag GBP bit
+  - ``flag_ver {unsigned}``: VXLAN flag GPE version bits
+  - ``flag_i {unsigned}``: VXLAN flag instance bit
+  - ``flag_p {unsigned}``: VXLAN flag GPE Next Protocol bit
+  - ``flag_b {unsigned}``: VXLAN flag GPE Ingress-Replicated BUM
+  - ``flag_o {unsigned}``: VXLAN flag GPE OAM Packet bit
+  - ``flag_d {unsigned}``: VXLAN flag GBP Don't Learn bit
+  - ``flag_a {unsigned}``: VXLAN flag GBP Applied bit
+  - ``group_policy_id {unsigned}``: VXLAN-GBP Group Policy ID.
+  - ``protocol {unsigned}`` : VXLAN-GPE next protocol
+  - ``rsvd0_gpe {unsigned}`` : VXLAN-GPE rsvd0
 
 - ``e_tag``: match IEEE 802.1BR E-Tag header.
 
-- 
2.34.1

Reply via email to