Skip to contentSkip to conversation

net/mlx5/hws: definitions for Hash Split/Linear Lookup tbls

PATCH In review Yevgeny Kliteynik 4 participants 10 messages Jan 12, 2023 – Jan 25, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 net/mlx5/hws: definitions for Hash Split/Linear Lookup tbls

Added PRM bits for new RTC types: Hash Split and Linear Lookup tables, as well as for HASH_RESULT field that contains hash result of the Hash Split table calculation.

---
 drivers/common/mlx5/mlx5_prm.h    | 26 +++++++++++++++++++++++---
 drivers/net/mlx5/hws/mlx5dr_cmd.c |  2 ++
 drivers/net/mlx5/hws/mlx5dr_cmd.h |  2 ++
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +23 -3
index 3790dc84b8..9294f65e24 100644
@@ -759,6 +759,7 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IP_ECN = 0x73,
 	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
 	MLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76,
+	MLX5_MODI_HASH_RESULT = 0x81,
 };
 
 /* Total number of metadata reg_c's. */
@@ -2043,7 +2044,9 @@ struct mlx5_ifc_ft_fields_support_bits {
  * Table 1872 - Flow Table Fields Supported 2 Format
  */
 struct mlx5_ifc_ft_fields_support_2_bits {
-	u8 reserved_at_0[0xf];
+	u8 reserved_at_0[0xd];
+	u8 hash_result[0x1];
+	u8 reserved_at_e[0x1];
 	u8 tunnel_header_2_3[0x1];
 	u8 tunnel_header_0_1[0x1];
 	u8 macsec_syndrome[0x1];
@@ -2178,7 +2181,9 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits {
 	u8 log_max_num_rtc[0x5];
 	u8 reserved_at_18[0x3];
 	u8 log_max_num_header_modify_pattern[0x5];
-	u8 reserved_at_20[0x3];
+	u8 rtc_hash_split_table[0x1];
+	u8 rtc_linear_lookup_table[0x1];
+	u8 reserved_at_22[0x1];
 	u8 stc_alloc_log_granularity[0x5];
 	u8 reserved_at_28[0x3];
 	u8 stc_alloc_log_max[0x5];
@@ -2198,6 +2203,11 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits {
 	u8 header_insert_type[0x10];
 	u8 header_remove_type[0x10];
 	u8 trivial_match_definer[0x20];
+	u8 reserved_at_140[0x20];
+	u8 reserved_at_160[0x18];
+	u8 access_index_mode[0x8];
+	u8 reserved_at_180[0x20];
+	u8 linear_match_definer_reg_c3[0x20];
 };
 
 union mlx5_ifc_hca_cap_union_bits {
@@ -3215,6 +3225,11 @@ enum mlx5_ifc_rtc_update_mode {
 	MLX5_IFC_RTC_STE_UPDATE_MODE_BY_OFFSET = 0x1,
 };
 
+enum mlx5_ifc_rtc_access_mode {
+	MLX5_IFC_RTC_STE_ACCESS_MODE_BY_HASH = 0x0,
+	MLX5_IFC_RTC_STE_ACCESS_MODE_LINEAR = 0x1,
+};
+
 enum mlx5_ifc_rtc_ste_format {
 	MLX5_IFC_RTC_STE_FORMAT_8DW = 0x4,
 	MLX5_IFC_RTC_STE_FORMAT_11DW = 0x5,
@@ -3225,6 +3240,8 @@ enum mlx5_ifc_rtc_reparse_mode {
 	MLX5_IFC_RTC_REPARSE_ALWAYS = 0x1,
 };
 
+#define MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX 16
+
 struct mlx5_ifc_rtc_bits {
 	u8 modify_field_select[0x40];
 	u8 reserved_at_40[0x40];
@@ -3232,7 +3249,10 @@ struct mlx5_ifc_rtc_bits {
 	u8 reparse_mode[0x2];
 	u8 reserved_at_84[0x4];
 	u8 pd[0x18];
-	u8 reserved_at_a0[0x13];
+	u8 reserved_at_a0[0x9];
+	u8 access_index_mode[0x3];
+	u8 num_hash_definer[0x4];
+	u8 reserved_at_b0[0x3];
 	u8 log_depth[0x5];
 	u8 log_hash_size[0x8];
 	u8 ste_format[0x8];
drivers/net/mlx5/hws/mlx5dr_cmd.c +2 -0
index 754a424bd7..c64f127de8 100644
@@ -264,6 +264,8 @@ mlx5dr_cmd_rtc_create(struct ibv_context *ctx,
 		MLX5_IFC_RTC_STE_FORMAT_8DW);
 	MLX5_SET(rtc, attr, pd, rtc_attr->pd);
 	MLX5_SET(rtc, attr, update_index_mode, rtc_attr->update_index_mode);
+	MLX5_SET(rtc, attr, access_index_mode, rtc_attr->access_index_mode);
+	MLX5_SET(rtc, attr, num_hash_definer, rtc_attr->num_hash_definer);
 	MLX5_SET(rtc, attr, log_depth, rtc_attr->log_depth);
 	MLX5_SET(rtc, attr, log_hash_size, rtc_attr->log_size);
 	MLX5_SET(rtc, attr, table_type, rtc_attr->table_type);
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -0
index 9fe493a8f9..5d8d779708 100644
@@ -41,6 +41,8 @@ struct mlx5dr_cmd_rtc_create_attr {
 	uint32_t ste_offset;
 	uint32_t miss_ft_id;
 	uint8_t update_index_mode;
+	uint8_t access_index_mode;
+	uint8_t num_hash_definer;
 	uint8_t log_depth;
 	uint8_t log_size;
 	uint8_t table_type;
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/4 net/mlx5/hws: read capabilities for Split/Linear tables

Read device capabilities that describe the support for Hash Split table and Linear RTC table.

---
 drivers/net/mlx5/hws/mlx5dr_cmd.c | 16 ++++++++++++++++
 drivers/net/mlx5/hws/mlx5dr_cmd.h |  4 ++++
 2 files changed, 20 insertions(+)
drivers/net/mlx5/hws/mlx5dr_cmd.c +16 -0
index c64f127de8..32378673cf 100644
@@ -970,6 +970,22 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 		caps->stc_alloc_log_gran = MLX5_GET(query_hca_cap_out, out,
 						    capability.wqe_based_flow_table_cap.
 						    stc_alloc_log_granularity);
+
+		caps->rtc_hash_split_table = MLX5_GET(query_hca_cap_out, out,
+						      capability.wqe_based_flow_table_cap.
+						      rtc_hash_split_table);
+
+		caps->rtc_linear_lookup_table = MLX5_GET(query_hca_cap_out, out,
+							 capability.wqe_based_flow_table_cap.
+							 rtc_linear_lookup_table);
+
+		caps->access_index_mode = MLX5_GET(query_hca_cap_out, out,
+						   capability.wqe_based_flow_table_cap.
+						   access_index_mode);
+
+		caps->linear_match_definer = MLX5_GET(query_hca_cap_out, out,
+						      capability.wqe_based_flow_table_cap.
+						      linear_match_definer_reg_c3);
 	}
 
 	if (caps->eswitch_manager) {
drivers/net/mlx5/hws/mlx5dr_cmd.h +4 -0
index 5d8d779708..468557ba16 100644
@@ -170,7 +170,11 @@ struct mlx5dr_cmd_query_caps {
 	uint8_t format_select_gtpu_dw_1;
 	uint8_t format_select_gtpu_dw_2;
 	uint8_t format_select_gtpu_ext_dw_0;
+	uint32_t linear_match_definer;
+	uint8_t access_index_mode;
 	bool full_dw_jumbo_support;
+	bool rtc_hash_split_table;
+	bool rtc_linear_lookup_table;
 	struct mlx5dr_cmd_query_ft_caps nic_ft;
 	struct mlx5dr_cmd_query_ft_caps fdb_ft;
 	bool eswitch_manager;
Signature · 1 line
2.27.0
Acked-by on v1 2/4
#2 lore raw

RE: [PATCH 2/4] net/mlx5/hws: read capabilities for Split/Linear tables

Quoted 10 lines

-----Original Message-----
From: Yevgeny Kliteynik <[email protected]>
Sent: Thursday, January 12, 2023 3:49 PM
To: Yevgeny Kliteynik <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>
Subject: [PATCH 2/4] net/mlx5/hws: read capabilities for Split/Linear tables

Quoted 4 lines

Read device capabilities that describe the support for Hash Split table and Linear RTC table.

#3 lore raw

PATCH 3/4 net/mlx5/hws: support insert/distribute RTC properties

In reply to Yevgeny Kliteynik

Added support for RTC with insertion by hash/index and distribution by normal/linear hash.

Supported modes are:

- INSERT_BY_HASH + DISTRIBUTE_BY_HASH: what we had until now
- INSERT_BY_INDEX + DISTRIBUTE_BY_HASH: Hash Split table, can also be used to calculate hash, in which case the result can be read from the hash_result meta-field (MLX5_MODI_HASH_RESULT)
- INSERT_BY_INDEX + DISTRIBUTE_BY_LINEAR: Linear Lookup table, supported only for metadata_reg_c3[31:16] bits

When setting INSERT_BY_INDEX mode, you can still provide number of rules both through 'rule' and 'table' fields of matcher attributes, but if 'table' is used, then 'table.sz_col_log' has to be 0.

When providing rule with index, this index is used both in rule creation and deletion.

---
 drivers/net/mlx5/hws/mlx5dr.h         |  17 ++-
 drivers/net/mlx5/hws/mlx5dr_debug.c   |   6 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 211 +++++++++++++++++++++-----
 drivers/net/mlx5/hws/mlx5dr_matcher.h |   6 +
 drivers/net/mlx5/hws/mlx5dr_rule.c    |  23 ++-
 drivers/net/mlx5/hws/mlx5dr_rule.h    |   2 +-
 6 files changed, 217 insertions(+), 48 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +16 -1
index c0f9a5e984..b3b2bf34f2 100644
@@ -111,6 +111,16 @@ enum mlx5dr_matcher_flow_src {
 	MLX5DR_MATCHER_FLOW_SRC_VPORT = 0x2,
 };
 
+enum mlx5dr_matcher_insert_mode {
+	MLX5DR_MATCHER_INSERT_BY_HASH = 0x0,
+	MLX5DR_MATCHER_INSERT_BY_INDEX = 0x1,
+};
+
+enum mlx5dr_matcher_distribute_mode {
+	MLX5DR_MATCHER_DISTRIBUTE_BY_HASH = 0x0,
+	MLX5DR_MATCHER_DISTRIBUTE_BY_LINEAR = 0x1,
+};
+
 struct mlx5dr_matcher_attr {
 	/* Processing priority inside table */
 	uint32_t priority;
@@ -120,6 +130,9 @@ struct mlx5dr_matcher_attr {
 	enum mlx5dr_matcher_resource_mode mode;
 	/* Optimize insertion in case packet origin is the same for all rules */
 	enum mlx5dr_matcher_flow_src optimize_flow_src;
+	/* Define the insertion and distribution modes for this matcher */
+	enum mlx5dr_matcher_insert_mode insert_mode;
+	enum mlx5dr_matcher_distribute_mode distribute_mode;
 	union {
 		struct {
 			uint8_t sz_row_log;
@@ -135,7 +148,9 @@ struct mlx5dr_matcher_attr {
 struct mlx5dr_rule_attr {
 	uint16_t queue_id;
 	void *user_data;
-	/* Valid if matcher optimize_using_rule_idx is set */
+	/* Valid if matcher optimize_using_rule_idx is set or
+	 * if matcher is configured to insert rules by index.
+	 */
 	uint32_t rule_idx;
 	uint32_t burst:1;
 };
drivers/net/mlx5/hws/mlx5dr_debug.c +4 -2
index 239dfcae46..0815327b18 100644
@@ -158,7 +158,7 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher)
 	struct mlx5dr_matcher_attr *attr = &matcher->attr;
 	int ret;
 
-	ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d\n",
+	ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d,%d,%d\n",
 		      MLX5DR_DEBUG_RES_TYPE_MATCHER_ATTR,
 		      (uint64_t)(uintptr_t)matcher,
 		      attr->priority,
@@ -166,7 +166,9 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher)
 		      attr->table.sz_row_log,
 		      attr->table.sz_col_log,
 		      attr->optimize_using_rule_idx,
-		      attr->optimize_flow_src);
+		      attr->optimize_flow_src,
+		      attr->insert_mode,
+		      attr->distribute_mode);
 	if (ret < 0) {
 		rte_errno = EINVAL;
 		return rte_errno;
drivers/net/mlx5/hws/mlx5dr_matcher.c +173 -38

370 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_matcher.h +6 -0
index 62004078cf..2bebc4bcce 100644
@@ -82,4 +82,10 @@ int mlx5dr_matcher_create_aliased_obj(struct mlx5dr_context *ctx,
 				      uint32_t aliased_object_id,
 				      uint16_t object_type,
 				      struct mlx5dr_devx_obj **obj);
+
+static inline bool mlx5dr_matcher_is_insert_by_idx(struct mlx5dr_matcher *matcher)
+{
+	return matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX;
+}
+
 #endif /* MLX5DR_MATCHER_H_ */
drivers/net/mlx5/hws/mlx5dr_rule.c +17 -6
index b27318e6d4..60a82c022f 100644
@@ -118,7 +118,8 @@ static int mlx5dr_rule_alloc_action_ste(struct mlx5dr_rule *rule,
 	int ret;
 
 	/* Use rule_idx for locking optimzation, otherwise allocate from pool */
-	if (matcher->attr.optimize_using_rule_idx) {
+	if (matcher->attr.optimize_using_rule_idx ||
+	    mlx5dr_matcher_is_insert_by_idx(matcher)) {
 		rule->action_ste_idx = attr->rule_idx * matcher->action_ste.max_stes;
 	} else {
 		struct mlx5dr_pool_chunk ste = {0};
@@ -138,7 +139,9 @@ void mlx5dr_rule_free_action_ste_idx(struct mlx5dr_rule *rule)
 {
 	struct mlx5dr_matcher *matcher = rule->matcher;
 
-	if (rule->action_ste_idx > -1 && !matcher->attr.optimize_using_rule_idx) {
+	if (rule->action_ste_idx > -1 &&
+	    !matcher->attr.optimize_using_rule_idx &&
+	    !mlx5dr_matcher_is_insert_by_idx(matcher)) {
 		struct mlx5dr_pool_chunk ste = {0};
 
 		/* This release is safe only when the rule match part was deleted */
@@ -244,9 +247,14 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 		mlx5dr_action_apply_setter(&apply, setter--, !i && is_jumbo);
 
 		if (i == 0) {
-			/* Handle last match STE */
-			mlx5dr_definer_create_tag(items, mt->fc, mt->fc_sz,
-						  (uint8_t *)dep_wqe->wqe_data.action);
+			/* Handle last match STE.
+			 * For hash split / linear lookup RTCs, packets reaching any STE
+			 * will always match and perform the specified actions, which
+			 * makes the tag irrelevant.
+			 */
+			if (likely(!mlx5dr_matcher_is_insert_by_idx(matcher)))
+				mlx5dr_definer_create_tag(items, mt->fc, mt->fc_sz,
+							  (uint8_t *)dep_wqe->wqe_data.action);
 
 			/* Rule has dependent WQEs, match dep_wqe is queued */
 			if (action_stes || apply.require_dep)
@@ -258,13 +266,14 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 			ste_attr.send_attr.notify_hw = !attr->burst;
 			ste_attr.send_attr.user_data = dep_wqe->user_data;
 			ste_attr.send_attr.rule = dep_wqe->rule;
-			ste_attr.direct_index = 0;
 			ste_attr.rtc_0 = dep_wqe->rtc_0;
 			ste_attr.rtc_1 = dep_wqe->rtc_1;
 			ste_attr.used_id_rtc_0 = &rule->rtc_0;
 			ste_attr.used_id_rtc_1 = &rule->rtc_1;
 			ste_attr.retry_rtc_0 = dep_wqe->retry_rtc_0;
 			ste_attr.retry_rtc_1 = dep_wqe->retry_rtc_1;
+			ste_attr.direct_index = mlx5dr_matcher_is_insert_by_idx(matcher) ?
+						attr->rule_idx : 0;
 		} else {
 			apply.next_direct_idx = --ste_attr.direct_index;
 		}
@@ -364,6 +373,8 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 	ste_attr.wqe_tag = &rule->tag;
 	ste_attr.wqe_tag_is_jumbo = mlx5dr_definer_is_jumbo(matcher->mt[0]->definer);
 	ste_attr.gta_opcode = MLX5DR_WQE_GTA_OP_DEACTIVATE;
+	if (unlikely(mlx5dr_matcher_is_insert_by_idx(matcher)))
+		ste_attr.direct_index = attr->rule_idx;
 
 	mlx5dr_send_ste(queue, &ste_attr);
 
drivers/net/mlx5/hws/mlx5dr_rule.h +1 -1
index 96c85674f2..f2fe418159 100644
@@ -40,7 +40,7 @@ struct mlx5dr_rule {
 	};
 	uint32_t rtc_0; /* The RTC into which the STE was inserted */
 	uint32_t rtc_1; /* The RTC into which the STE was inserted */
-	int action_ste_idx; /* Action STE pool ID */
+	int action_ste_idx; /* STE array index */
 	uint8_t status; /* enum mlx5dr_rule_status */
 	uint8_t pending_wqes;
 };
Signature · 1 line
2.27.0
Acked-by on v1 3/4
#4 lore raw

RE: [PATCH 3/4] net/mlx5/hws: support insert/distribute RTC properties

Quoted 22 lines

-----Original Message-----
From: Yevgeny Kliteynik <[email protected]>
Sent: Thursday, January 12, 2023 3:49 PM
To: Yevgeny Kliteynik <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>
Subject: [PATCH 3/4] net/mlx5/hws: support insert/distribute RTC properties

Added support for RTC with insertion by hash/index and distribution by normal/linear hash.

Supported modes are:

- INSERT_BY_HASH + DISTRIBUTE_BY_HASH: what we had until now
- INSERT_BY_INDEX + DISTRIBUTE_BY_HASH: Hash Split table, can also be used to calculate hash, in which case the result can be read from the hash_result meta-field (MLX5_MODI_HASH_RESULT)
- INSERT_BY_INDEX + DISTRIBUTE_BY_LINEAR: Linear Lookup table, supported only for metadata_reg_c3[31:16] bits

Quoted 8 lines

When setting INSERT_BY_INDEX mode, you can still provide number of rules both through 'rule' and 'table' fields of matcher attributes, but if 'table' is used, then 'table.sz_col_log' has to be 0.

When providing rule with index, this index is used both in rule creation and deletion.

#5 lore raw

PATCH 4/4 net/mlx5/hws: handle collision matcher for linear RTC

In reply to Yevgeny Kliteynik

No need to create/destroy collision matcher for linear RTC, because it has a constant depth of 1 STE - packets reaching any STE in the array will always match and perform the specified actions.

---
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_matcher.c +4 -2
index 60865bf562..d509a2f0e1 100644
@@ -925,7 +925,8 @@ mlx5dr_matcher_create_col_matcher(struct mlx5dr_matcher *matcher)
 	struct mlx5dr_matcher *col_matcher;
 	int ret;
 
-	if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE)
+	if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE ||
+	    matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX)
 		return 0;
 
 	if (!mlx5dr_matcher_requires_col_tbl(matcher->attr.rule.num_log))
@@ -972,7 +973,8 @@ mlx5dr_matcher_create_col_matcher(struct mlx5dr_matcher *matcher)
 static void
 mlx5dr_matcher_destroy_col_matcher(struct mlx5dr_matcher *matcher)
 {
-	if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE)
+	if (matcher->attr.mode != MLX5DR_MATCHER_RESOURCE_MODE_RULE ||
+	    matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX)
 		return;
 
 	if (matcher->col_matcher) {
Signature · 1 line
2.27.0
Acked-by on v1 4/4
#6 lore raw

RE: [PATCH 4/4] net/mlx5/hws: handle collision matcher for linear RTC

Quoted 10 lines

-----Original Message-----
From: Yevgeny Kliteynik <[email protected]>
Sent: Thursday, January 12, 2023 3:49 PM
To: Yevgeny Kliteynik <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>
Subject: [PATCH 4/4] net/mlx5/hws: handle collision matcher for linear RTC

Quoted 5 lines

No need to create/destroy collision matcher for linear RTC, because it has a constant depth of 1 STE - packets reaching any STE in the array will always match and perform the specified actions.

#7 lore raw
In reply to Yevgeny Kliteynik

Hello,

ci/iol-testing tried to apply this patchset on the main branch, even though it's intended for dpdk-next-net-mlx:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

The helper script in dpdk-ci repo reports dpdk-next-net-mlx:

$ ./tools/pw_maintainers_cli.py --type series list-trees 26507
dpdk-next-net-mlx

Can you please help check and let me know if it's an issue I can help with?

Thanks,
Ali

Quoted 136 lines

-----Original Message-----
From: Yevgeny Kliteynik <[email protected]>
Sent: Thursday, January 12, 2023 3:49 PM
To: Yevgeny Kliteynik <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>
Subject: [PATCH 1/4] net/mlx5/hws: definitions for Hash Split/Linear Lookup tbls

Added PRM bits for new RTC types: Hash Split and Linear Lookup tables, as well as for HASH_RESULT field that contains hash result of the Hash Split table calculation.

---
 drivers/common/mlx5/mlx5_prm.h    | 26 +++++++++++++++++++++++---
 drivers/net/mlx5/hws/mlx5dr_cmd.c |  2 ++
 drivers/net/mlx5/hws/mlx5dr_cmd.h |  2 ++
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +12 -2
index 3790dc84b8..9294f65e24 100644
@@ -759,6 +759,7 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IP_ECN = 0x73,
 	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
 	MLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76,
+	MLX5_MODI_HASH_RESULT = 0x81,
 };
 
 /* Total number of metadata reg_c's. */
@@ -2043,7 +2044,9 @@ struct mlx5_ifc_ft_fields_support_bits {
  * Table 1872 - Flow Table Fields Supported 2 Format
  */
 struct mlx5_ifc_ft_fields_support_2_bits {
-	u8 reserved_at_0[0xf];
+	u8 reserved_at_0[0xd];
+	u8 hash_result[0x1];
+	u8 reserved_at_e[0x1];
 	u8 tunnel_header_2_3[0x1];
 	u8 tunnel_header_0_1[0x1];
 	u8 macsec_syndrome[0x1];
@@ -2178,7 +2181,9 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits {
 	u8 log_max_num_rtc[0x5];
 	u8 reserved_at_18[0x3];
 	u8 log_max_num_header_modify_pattern[0x5];
-	u8 reserved_at_20[0x3];
+	u8 rtc_hash_split_table[0x1];
+	u8 rtc_linear_lookup_table[0x1];
+	u8 reserved_at_22[0x1];
 	u8 stc_alloc_log_granularity[0x5];
 	u8 reserved_at_28[0x3];
 	u8 stc_alloc_log_max[0x5];
@@ -2198,6 +2203,11 @@ struct mlx5_ifc_wqe_based_flow_table_cap_bits
 {
 	u8 header_insert_type[0x10];
 	u8 header_remove_type[0x10];
 	u8 trivial_match_definer[0x20];
+	u8 reserved_at_140[0x20];
+	u8 reserved_at_160[0x18];
+	u8 access_index_mode[0x8];
+	u8 reserved_at_180[0x20];
+	u8 linear_match_definer_reg_c3[0x20];
 };
 

union mlx5_ifc_hca_cap_union_bits {

drivers/common/mlx5/mlx5_prm.h +11 -1
@@ -3215,6 +3225,11 @@ enum mlx5_ifc_rtc_update_mode {
 	MLX5_IFC_RTC_STE_UPDATE_MODE_BY_OFFSET = 0x1,
 };
 
+enum mlx5_ifc_rtc_access_mode {
+	MLX5_IFC_RTC_STE_ACCESS_MODE_BY_HASH = 0x0,
+	MLX5_IFC_RTC_STE_ACCESS_MODE_LINEAR = 0x1,
+};
+
 enum mlx5_ifc_rtc_ste_format {
 	MLX5_IFC_RTC_STE_FORMAT_8DW = 0x4,
 	MLX5_IFC_RTC_STE_FORMAT_11DW = 0x5,
@@ -3225,6 +3240,8 @@ enum mlx5_ifc_rtc_reparse_mode {
 	MLX5_IFC_RTC_REPARSE_ALWAYS = 0x1,
 };
 
+#define MLX5_IFC_RTC_LINEAR_LOOKUP_TBL_LOG_MAX 16
+
 struct mlx5_ifc_rtc_bits {
 	u8 modify_field_select[0x40];
 	u8 reserved_at_40[0x40];
@@ -3232,7 +3249,10 @@ struct mlx5_ifc_rtc_bits {
 	u8 reparse_mode[0x2];
 	u8 reserved_at_84[0x4];
 	u8 pd[0x18];
-	u8 reserved_at_a0[0x13];
+	u8 reserved_at_a0[0x9];
+	u8 access_index_mode[0x3];
+	u8 num_hash_definer[0x4];
+	u8 reserved_at_b0[0x3];
 	u8 log_depth[0x5];
 	u8 log_hash_size[0x8];
 	u8 ste_format[0x8];
drivers/net/mlx5/hws/mlx5dr_cmd.c +2 -0
index 754a424bd7..c64f127de8 100644
@@ -264,6 +264,8 @@ mlx5dr_cmd_rtc_create(struct ibv_context *ctx,
 		MLX5_IFC_RTC_STE_FORMAT_8DW);
 	MLX5_SET(rtc, attr, pd, rtc_attr->pd);
 	MLX5_SET(rtc, attr, update_index_mode, rtc_attr-
 >update_index_mode);
+	MLX5_SET(rtc, attr, access_index_mode, rtc_attr-
 >access_index_mode);
+	MLX5_SET(rtc, attr, num_hash_definer, rtc_attr-
 >num_hash_definer);
drivers/net/mlx5/hws/mlx5dr_cmd.c +0 -0
 	MLX5_SET(rtc, attr, log_depth, rtc_attr->log_depth);
 	MLX5_SET(rtc, attr, log_hash_size, rtc_attr->log_size);
 	MLX5_SET(rtc, attr, table_type, rtc_attr->table_type);
drivers/net/mlx5/hws/mlx5dr_cmd.h +2 -1
index 9fe493a8f9..5d8d779708 100644
@@ -41,6 +41,8 @@ struct mlx5dr_cmd_rtc_create_attr {
 	uint32_t ste_offset;
 	uint32_t miss_ft_id;
 	uint8_t update_index_mode;
+	uint8_t access_index_mode;
+	uint8_t num_hash_definer;
 	uint8_t log_depth;
 	uint8_t log_size;
 	uint8_t table_type;
--

2.27.0

Acked-by on v1 1/4
#8 lore raw
In reply to Yevgeny Kliteynik
Quoted 11 lines

-----Original Message-----
From: Yevgeny Kliteynik <[email protected]>
Sent: Thursday, January 12, 2023 3:49 PM
To: Yevgeny Kliteynik <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>
Subject: [PATCH 1/4] net/mlx5/hws: definitions for Hash Split/Linear Lookup tbls

Quoted 5 lines

Added PRM bits for new RTC types: Hash Split and Linear Lookup tables, as well as for HASH_RESULT field that contains hash result of the Hash Split table calculation.

#9 lore raw
In reply to Yevgeny Kliteynik

Hi,

Quoted 11 lines

-----Original Message-----
From: Yevgeny Kliteynik <[email protected]>
Sent: Thursday, January 12, 2023 3:49 PM
To: Yevgeny Kliteynik <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>
Subject: [PATCH 1/4] net/mlx5/hws: definitions for Hash Split/Linear Lookup tbls

Quoted 5 lines

Added PRM bits for new RTC types: Hash Split and Linear Lookup tables, as well as for HASH_RESULT field that contains hash result of the Hash Split table calculation.

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh