From: Rongwei Liu Date: Tue, 13 Jul 2021 12:09:20 +0000 (+0300) Subject: app/testpmd: support matching on VXLAN reserved field X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=dbd8e4102d49ba89f5b4ae7a9557e48693da4609;p=dpdk.git app/testpmd: support matching on VXLAN reserved field Add a new testpmd pattern field 'last_rsvd' that supports the last 8-bits matching of VXLAN header. The examples for the "last_rsvd" pattern field are as below: 1. ...pattern eth / ipv4 / udp / vxlan last_rsvd is 0x80 / end ... This flow will exactly match the last 8-bits to be 0x80. 2. ...pattern eth / ipv4 / udp / vxlan last_rsvd spec 0x80 vxlan mask 0x80 / end ... This flow will only match the MSB of the last 8-bits to be 1. Signed-off-by: Rongwei Liu Acked-by: Viacheslav Ovsiienko Acked-by: Raslan Darawsheh --- diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 34e043621c..813e0f8d8c 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -206,6 +206,7 @@ enum index { ITEM_SCTP_CKSUM, ITEM_VXLAN, ITEM_VXLAN_VNI, + ITEM_VXLAN_LAST_RSVD, ITEM_E_TAG, ITEM_E_TAG_GRP_ECID_B, ITEM_NVGRE, @@ -1129,6 +1130,7 @@ static const enum index item_sctp[] = { static const enum index item_vxlan[] = { ITEM_VXLAN_VNI, + ITEM_VXLAN_LAST_RSVD, ITEM_NEXT, ZERO, }; @@ -2849,6 +2851,14 @@ static const struct token token_list[] = { item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)), }, + [ITEM_VXLAN_LAST_RSVD] = { + .name = "last_rsvd", + .help = "VXLAN last reserved bits", + .next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, + rsvd1)), + }, [ITEM_E_TAG] = { .name = "e_tag", .help = "match E-Tag header", diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index a9e431a8b2..59626518d5 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -266,8 +266,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni); MKDUMPSTR(print_buf, buf_size, cur_len, " - VXLAN packet: packet type =%d, " - "Destination UDP port =%d, VNI = %d", - packet_type, udp_port, vx_vni >> 8); + "Destination UDP port =%d, VNI = %d, " + "last_rsvd = %d", packet_type, + udp_port, vx_vni >> 8, vx_vni & 0xff); } } MKDUMPSTR(print_buf, buf_size, cur_len, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index ab7e91ad6c..2c43719ad3 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3695,6 +3695,7 @@ 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. - ``e_tag``: match IEEE 802.1BR E-Tag header.