VXLAN extensions (VXLAN-GPE and VXLAN-GBP) are unified in a single VXLAN flow item.
It is user responsibility to explicitly match VXLAN-GPE with its UDP port. Below are 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 | 195 +++++++++++++------- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 35 ++-- 2 files changed, 150 insertions(+), 80 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 60ee9337cf..b98c134202 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -382,6 +382,19 @@ enum index { ITEM_SCTP_CKSUM, ITEM_VXLAN, ITEM_VXLAN_VNI, + 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_GBP_ID, + ITEM_VXLAN_GPE_PROTO, + ITEM_VXLAN_FIRST_RSVD, + ITEM_VXLAN_SECND_RSVD, + ITEM_VXLAN_THIRD_RSVD, ITEM_VXLAN_LAST_RSVD, ITEM_E_TAG, ITEM_E_TAG_GRP_ECID_B, @@ -410,12 +423,6 @@ enum index { ITEM_GENEVE_VNI, ITEM_GENEVE_PROTO, ITEM_GENEVE_OPTLEN, - ITEM_VXLAN_GPE, - ITEM_VXLAN_GPE_VNI, - ITEM_VXLAN_GPE_PROTO, - ITEM_VXLAN_GPE_FLAGS, - ITEM_VXLAN_GPE_RSVD0, - ITEM_VXLAN_GPE_RSVD1, ITEM_ARP_ETH_IPV4, ITEM_ARP_ETH_IPV4_SHA, ITEM_ARP_ETH_IPV4_SPA, @@ -1604,7 +1611,6 @@ static const enum index next_item[] = { ITEM_GTPC, ITEM_GTPU, ITEM_GENEVE, - ITEM_VXLAN_GPE, ITEM_ARP_ETH_IPV4, ITEM_IPV6_EXT, ITEM_IPV6_FRAG_EXT, @@ -1778,6 +1784,19 @@ static const enum index item_sctp[] = { static const enum index item_vxlan[] = { ITEM_VXLAN_VNI, + 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_GBP_ID, + ITEM_VXLAN_GPE_PROTO, + ITEM_VXLAN_FIRST_RSVD, + ITEM_VXLAN_SECND_RSVD, + ITEM_VXLAN_THIRD_RSVD, ITEM_VXLAN_LAST_RSVD, ITEM_NEXT, ZERO, @@ -1844,16 +1863,6 @@ static const enum index item_geneve[] = { ZERO, }; -static const enum index item_vxlan_gpe[] = { - ITEM_VXLAN_GPE_VNI, - ITEM_VXLAN_GPE_PROTO, - ITEM_VXLAN_GPE_FLAGS, - ITEM_VXLAN_GPE_RSVD0, - ITEM_VXLAN_GPE_RSVD1, - ITEM_NEXT, - ZERO, -}; - static const enum index item_arp_eth_ipv4[] = { ITEM_ARP_ETH_IPV4_SHA, ITEM_ARP_ETH_IPV4_SPA, @@ -4910,6 +4919,110 @@ static const struct token token_list[] = { item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, hdr.vni)), }, + [ITEM_VXLAN_FLAG_G] = { + .name = "flag_g", + .help = "VXLAN 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 GPE version", + .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 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 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 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 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 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 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_GBP_ID] = { + .name = "group_policy_id", + .help = "VXLAN GBP 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_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_FIRST_RSVD] = { + .name = "first_rsvd", + .help = "VXLAN rsvd0 first byte", + .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, + hdr.rsvd0[0])), + }, + [ITEM_VXLAN_SECND_RSVD] = { + .name = "second_rsvd", + .help = "VXLAN rsvd0 second byte", + .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, + hdr.rsvd0[1])), + }, + [ITEM_VXLAN_THIRD_RSVD] = { + .name = "third_rsvd", + .help = "VXLAN rsvd0 third byte", + .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, + hdr.rsvd0[2])), + }, [ITEM_VXLAN_LAST_RSVD] = { .name = "last_rsvd", .help = "VXLAN last reserved bits", @@ -5127,54 +5240,6 @@ static const struct token token_list[] = { ver_opt_len_o_c_rsvd0, "\x3f\x00")), }, - [ITEM_VXLAN_GPE] = { - .name = "vxlan-gpe", - .help = "match VXLAN-GPE header", - .priv = PRIV_ITEM(VXLAN_GPE, - sizeof(struct rte_flow_item_vxlan_gpe)), - .next = NEXT(item_vxlan_gpe), - .call = parse_vc, - }, - [ITEM_VXLAN_GPE_VNI] = { - .name = "vni", - .help = "VXLAN-GPE identifier", - .next = NEXT(item_vxlan_gpe, NEXT_ENTRY(COMMON_UNSIGNED), - item_param), - .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, - hdr.vni)), - }, - [ITEM_VXLAN_GPE_PROTO] = { - .name = "protocol", - .help = "VXLAN-GPE next protocol", - .next = NEXT(item_vxlan_gpe, NEXT_ENTRY(COMMON_UNSIGNED), - item_param), - .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, - protocol)), - }, - [ITEM_VXLAN_GPE_FLAGS] = { - .name = "flags", - .help = "VXLAN-GPE flags", - .next = NEXT(item_vxlan_gpe, NEXT_ENTRY(COMMON_UNSIGNED), - item_param), - .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, - flags)), - }, - [ITEM_VXLAN_GPE_RSVD0] = { - .name = "rsvd0", - .help = "VXLAN-GPE rsvd0", - .next = NEXT(item_vxlan_gpe, NEXT_ENTRY(COMMON_UNSIGNED), - item_param), - .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, - rsvd0)), - }, - [ITEM_VXLAN_GPE_RSVD1] = { - .name = "rsvd1", - .help = "VXLAN-GPE rsvd1", - .next = NEXT(item_vxlan_gpe, NEXT_ENTRY(COMMON_UNSIGNED), - item_param), - .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan_gpe, - rsvd1)), - }, [ITEM_ARP_ETH_IPV4] = { .name = "arp_eth_ipv4", .help = "match ARP header for Ethernet/IPv4", diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index ecd040504e..1de1420b94 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -214,7 +214,6 @@ For example: vxlan geneve nvgre - vxlan-gpe show port (module_eeprom|eeprom) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1104,12 +1103,12 @@ Where: * ``ip|udp|tcp|sctp`` always relate to the inner layer. * ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized - as a tunnel packet by the forwarding engine (geneve, gre, gtp, ipip, vxlan and vxlan-gpe are - supported). See also the ``csum parse-tunnel`` command. + as a tunnel packet by the forwarding engine (geneve, gre, gtp, ipip and vxlan are supported). + See also the ``csum parse-tunnel`` command. * ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized - as a tunnel packet by the forwarding engine (geneve, gtp, vxlan and vxlan-gpe are - supported). See also the ``csum parse-tunnel`` command. + as a tunnel packet by the forwarding engine (geneve, gtp and vxlan are supported). + See also the ``csum parse-tunnel`` command. .. note:: @@ -1124,7 +1123,7 @@ engine:: testpmd> csum parse-tunnel (on|off) (tx_port_id) If enabled, the csum forward engine will try to recognize supported -tunnel headers (geneve, gtp, gre, ipip, vxlan, vxlan-gpe). +tunnel headers (geneve, gtp, gre, ipip, vxlan). If disabled, treat tunnel packets as non-tunneled packets (a inner header is handled as a packet payload). @@ -2222,7 +2221,7 @@ port config udp_tunnel_port Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols:: - testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe|ecpri (udp_port) + testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|ecpri (udp_port) port config tx_metadata ~~~~~~~~~~~~~~~~~~~~~~~ @@ -3696,7 +3695,20 @@ This section lists supported pattern items and their attributes, if any. - ``vxlan``: match VXLAN header. - ``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. + - ``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. + - ``first_rsvd {unsigned}`` : VXLAN rsvd0 first byte. + - ``secnd_rsvd {unsigned}`` : VXLAN rsvd0 second byte. + - ``third_rsvd {unsigned}`` : VXLAN rsvd0 third byte. + - ``last_rsvd {unsigned}``: VXLAN last reserved byte. - ``e_tag``: match IEEE 802.1BR E-Tag header. @@ -3745,13 +3757,6 @@ This section lists supported pattern items and their attributes, if any. - ``data {hex string}``: GENEVE option data, the length is defined by ``length`` field. -- ``vxlan-gpe``: match VXLAN-GPE header. - - - ``vni {unsigned}``: VXLAN-GPE identifier. - - ``flags {unsigned}``: VXLAN-GPE flags. - - ``rsvd0 {unsigned}``: VXLAN-GPE reserved field 0. - - ``rsvd1 {unsigned}``: VXLAN-GPE reserved field 1. - - ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4. - ``sha {MAC-48}``: sender hardware address. -- 2.34.1