[v5,2/2] app/testpmd: support VXLAN the last 8-bits field matching

Message ID 20210713095517.54259-3-rongweil@nvidia.com (mailing list archive)
State Changes Requested, archived
Delegated to: Andrew Rybchenko
Headers
Series support VXLAN header the last 8-bits matching |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Rongwei Liu July 13, 2021, 9:55 a.m. UTC
  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 <rongweil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 app/test-pmd/cmdline_flow.c                 | 9 +++++++++
 app/test-pmd/util.c                         | 5 +++--
 doc/guides/rel_notes/release_21_08.rst      | 6 ++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 1 +
 4 files changed, 19 insertions(+), 2 deletions(-)
  

Comments

Raslan Darawsheh July 13, 2021, 10:02 a.m. UTC | #1
Hi,
[...]
> diff --git a/doc/guides/rel_notes/release_21_08.rst
> b/doc/guides/rel_notes/release_21_08.rst
> index 6a902ef9ac..3fb17bbf77 100644
> --- a/doc/guides/rel_notes/release_21_08.rst
> +++ b/doc/guides/rel_notes/release_21_08.rst
> @@ -117,6 +117,11 @@ New Features
>    The experimental PMD power management API now supports managing
>    multiple Ethernet Rx queues per lcore.
> 
> +* **Updated Mellanox mlx5 driver.**
> +
> +  Updated the Mellanox mlx5 driver with new features and improvements,
> including:
> +
> +  * Added support for matching on vxlan header last 8-bits reserved field.
> 
This change should be part of the first patch not related to testpmd part.

Also, how about something like this:
Added support for matching on the reserved filed of VXLAN header (last 8-bits).

[..]
Kindest regards
Raslan Darawsheh
  
Andrew Rybchenko July 13, 2021, 10:06 a.m. UTC | #2
On 7/13/21 1:02 PM, Raslan Darawsheh wrote:
> Hi,
> [...]
>> diff --git a/doc/guides/rel_notes/release_21_08.rst
>> b/doc/guides/rel_notes/release_21_08.rst
>> index 6a902ef9ac..3fb17bbf77 100644
>> --- a/doc/guides/rel_notes/release_21_08.rst
>> +++ b/doc/guides/rel_notes/release_21_08.rst
>> @@ -117,6 +117,11 @@ New Features
>>    The experimental PMD power management API now supports managing
>>    multiple Ethernet Rx queues per lcore.
>>
>> +* **Updated Mellanox mlx5 driver.**
>> +
>> +  Updated the Mellanox mlx5 driver with new features and improvements,
>> including:
>> +
>> +  * Added support for matching on vxlan header last 8-bits reserved field.
>>
> This change should be part of the first patch not related to testpmd part.
> 
> Also, how about something like this:
> Added support for matching on the reserved filed of VXLAN header (last 8-bits).
> 

Also it should be merged with already existing "Updated
Mellanox mlx5 driver." in 21.08 release notes.

Thanks,
Andrew.
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 8fc0e1469d..3d5ab806c3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -205,6 +205,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,
@@ -1127,6 +1128,7 @@  static const enum index item_sctp[] = {
 
 static const enum index item_vxlan[] = {
 	ITEM_VXLAN_VNI,
+	ITEM_VXLAN_LAST_RSVD,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2839,6 +2841,13 @@  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(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/rel_notes/release_21_08.rst b/doc/guides/rel_notes/release_21_08.rst
index 6a902ef9ac..3fb17bbf77 100644
--- a/doc/guides/rel_notes/release_21_08.rst
+++ b/doc/guides/rel_notes/release_21_08.rst
@@ -117,6 +117,11 @@  New Features
   The experimental PMD power management API now supports managing
   multiple Ethernet Rx queues per lcore.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated the Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for matching on vxlan header last 8-bits reserved field.
 
 Removed Items
 -------------
@@ -208,3 +213,4 @@  Tested Platforms
    This section is a comment. Do not overwrite or remove it.
    Also, make sure to start the actual text at the margin.
    =======================================================
+
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 33857acf54..4ca3103067 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3694,6 +3694,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.