[4/5] net/mlx5/hws: support IP version matching for non relaxed

Message ID 20230126160309.584967-4-hamdani@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series [1/5] net/mlx5/hws: fix alias_rtc_0 print location in debug dump |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hamdan Igbaria Jan. 26, 2023, 4:03 p.m. UTC
  Enable matching on IP version explicitly for non relaxed mode.
This will add support for the user cases where he needs to
match on ip version explicitly, for such case to have outer
ipv6 and inner ipv4 packets, etc.

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
  

Patch

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 6b98eb8c96..79f4f2667f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -539,6 +539,14 @@  mlx5dr_definer_conv_item_ipv4(struct mlx5dr_definer_conv_data *cd,
 		return rte_errno;
 	}
 
+	if (m->version) {
+		fc = &cd->fc[DR_CALC_FNAME(IP_VERSION, inner)];
+		fc->item_idx = item_idx;
+		fc->tag_set = &mlx5dr_definer_ipv4_version_set;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		DR_CALC_SET(fc, eth_l2, l3_type, inner);
+	}
+
 	if (m->fragment_offset) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_FRAG, inner)];
 		fc->item_idx = item_idx;
@@ -628,6 +636,14 @@  mlx5dr_definer_conv_item_ipv6(struct mlx5dr_definer_conv_data *cd,
 		DR_CALC_SET(fc, eth_l4, ip_fragmented, inner);
 	}
 
+	if (DR_GET(header_ipv6_vtc, &m->hdr.vtc_flow, version)) {
+		fc = &cd->fc[DR_CALC_FNAME(IP_VERSION, inner)];
+		fc->item_idx = item_idx;
+		fc->tag_set = &mlx5dr_definer_ipv6_version_set;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		DR_CALC_SET(fc, eth_l2, l3_type, inner);
+	}
+
 	if (DR_GET(header_ipv6_vtc, &m->hdr.vtc_flow, tos)) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_TOS, inner)];
 		fc->item_idx = item_idx;