[3/4] net/mlx5/hws: add fragment packet ID matching support

Message ID 20240416153054.3216706-4-michaelba@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: some unrelated fixes and improvements |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Michael Baum April 16, 2024, 3:30 p.m. UTC
Add HWS support of IPv4 fragment packet id field matching.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 11 ++++++++++-
 drivers/net/mlx5/hws/mlx5dr_definer.h |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index f1f544deab..7bb328e85e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -171,6 +171,7 @@  struct mlx5dr_definer_conv_data {
 	X(SET,		ipv4_version,		STE_IPV4,		rte_ipv4_hdr) \
 	X(SET_BE16,	ipv4_frag,		v->fragment_offset,	rte_ipv4_hdr) \
 	X(SET_BE16,	ipv4_len,		v->total_length,	rte_ipv4_hdr) \
+	X(SET_BE16,	ipv4_identification,	v->packet_id,		rte_ipv4_hdr) \
 	X(SET,          ip_fragmented,          !!v->fragment_offset,   rte_ipv4_hdr) \
 	X(SET_BE16,	ipv6_payload_len,	v->hdr.payload_len,	rte_flow_item_ipv6) \
 	X(SET,		ipv6_proto,		v->hdr.proto,		rte_flow_item_ipv6) \
@@ -1026,7 +1027,7 @@  mlx5dr_definer_conv_item_ipv4(struct mlx5dr_definer_conv_data *cd,
 	if (!m)
 		return 0;
 
-	if (m->packet_id || m->hdr_checksum ||
+	if (m->hdr_checksum ||
 	    (l && (l->next_proto_id || l->type_of_service))) {
 		rte_errno = ENOTSUP;
 		return rte_errno;
@@ -1060,6 +1061,14 @@  mlx5dr_definer_conv_item_ipv4(struct mlx5dr_definer_conv_data *cd,
 		DR_CALC_SET(fc, eth_l3, protocol_next_header, inner);
 	}
 
+	if (m->packet_id) {
+		fc = &cd->fc[DR_CALC_FNAME(IP_ID, inner)];
+		fc->item_idx = item_idx;
+		fc->is_range = l && l->packet_id;
+		fc->tag_set = &mlx5dr_definer_ipv4_identification_set;
+		DR_CALC_SET(fc, eth_l3, identification, inner);
+	}
+
 	if (m->total_length) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_LEN, inner)];
 		fc->item_idx = item_idx;
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.h b/drivers/net/mlx5/hws/mlx5dr_definer.h
index ca530ebf30..a42ba9b81a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.h
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.h
@@ -75,6 +75,8 @@  enum mlx5dr_definer_fname {
 	MLX5DR_DEFINER_FNAME_IP_VERSION_I,
 	MLX5DR_DEFINER_FNAME_IP_FRAG_O,
 	MLX5DR_DEFINER_FNAME_IP_FRAG_I,
+	MLX5DR_DEFINER_FNAME_IP_ID_O,
+	MLX5DR_DEFINER_FNAME_IP_ID_I,
 	MLX5DR_DEFINER_FNAME_IP_LEN_O,
 	MLX5DR_DEFINER_FNAME_IP_LEN_I,
 	MLX5DR_DEFINER_FNAME_IP_TOS_O,