net/mlx5/hws: move warn into debug level when needed
PATCH 1/13 net/mlx5/hws: move warn into debug level when needed
From: Erez Shitrit <[email protected]>
When the user tries to create a matcher and if failed with specific errno (E2BIG) the message will be in debug level and not in warning. It is a part of a feature when the user re-try to insert a new matching depends on that errno, no need the annoying message.
--- drivers/net/mlx5/hws/mlx5dr_definer.c | 6 +++--- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/mlx5/hws/mlx5dr_definer.c +3 -3
@@ -3534,7 +3534,7 @@ mlx5dr_definer_find_best_match_fit(struct mlx5dr_context *ctx,return 0 ; } -DR_LOG (ERR ,"Unable to find supporting match/jumbo definer combination" ); +DR_LOG (DEBUG ,"Unable to find supporting match/jumbo definer combination" ); rte_errno =E2BIG ;return rte_errno; }
@@ -3689,7 +3689,7 @@ mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher,/* Find the match definer layout for header layout match union */ ret =mlx5dr_definer_find_best_match_fit (ctx, match_definer, match_hl);if (ret) { -DR_LOG (ERR ,"Failed to create match definer from header layout" ); +DR_LOG (DEBUG ,"Failed to create match definer from header layout" ); goto free_fc; }
@@ -4041,7 +4041,7 @@ int mlx5dr_definer_matcher_init(struct mlx5dr_context *ctx, ret =mlx5dr_definer_calc_layout (matcher, &match_layout, &range_layout);if (ret) { -DR_LOG (ERR ,"Failed to calculate matcher definer layout" ); +DR_LOG (DEBUG ,"Failed to calculate matcher definer layout" );return ret; }
drivers/net/mlx5/hws/mlx5dr_matcher.c +1 -1
@@ -877,7 +877,7 @@ static int mlx5dr_matcher_bind_mt(struct mlx5dr_matcher *matcher)/* Calculate match, range and hash definers */ ret =mlx5dr_definer_matcher_init (ctx, matcher);if (ret) { -DR_LOG (ERR ,"Failed to set matcher templates with match definers" ); +DR_LOG (DEBUG ,"Failed to set matcher templates with match definers" );return ret; }
Signature · 1 line
2.39.3
PATCH 2/13 common/mlx5: fix error in mlx5 prm structs
From: Yevgeny Kliteynik <[email protected]>
Fix wrong reserved size and add helpful comment
--- drivers/common/mlx5/mlx5_prm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +3 -3
@@ -2360,8 +2360,8 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {u8 reserved_at_d0[0x3 ];u8 log_conn_track_max_alloc[0x5 ];u8 reserved_at_d8[0x3 ]; -u8 log_max_conn_track_offload[0x5 ]; -u8 cross_vhca_object_to_object_supported[0x20 ];/* End of DW7. */ +u8 log_max_conn_track_offload[0x5 ];/* End of DW7. */ +u8 cross_vhca_object_to_object_supported[0x20 ];u8 allowed_object_for_other_vhca_access_high[0x20 ];u8 allowed_object_for_other_vhca_access[0x20 ];u8 reserved_at_140[0x20 ];
@@ -3655,7 +3655,7 @@ struct mlx5_ifc_stc_ste_param_vport_bits {u8 eswitch_owner_vhca_id[0x10 ];u8 vport_number[0x10 ];u8 eswitch_owner_vhca_id_valid[0x1 ]; -u8 reserved_at_21[0x59 ]; +u8 reserved_at_21[0x5f ]; };union mlx5_ifc_stc_param_bits {
Signature · 1 line
2.39.3
PATCH 3/13 net/mlx5/hws: fix wrong comment in mlx5dr_send
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Remove comment that documents parameter that doesn't exist.
--- drivers/net/mlx5/hws/mlx5dr_send.h | 2 -- 1 file changed, 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_send.h +0 -2
@@ -203,8 +203,6 @@ struct mlx5dr_send_ste_attr {* value to write in CPU endian format. * @param addr * Address to write to. -* @param lock -* Address of the lock to use for that UAR access. */ static __rte_always_inline voidmlx5dr_uar_write64_relaxed (uint64_t val,void *addr)
Signature · 1 line
2.39.3
PATCH 4/13 net/mlx5/hws: remove unused capabilities and fields
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
The following caps were never in use:
- wire_regc
- metadata_c
- metadata_c_mask
Also send ring's reg_addr field wasn't in use.
Removing these caps and fields from structs and removing the code that queried them.
--- drivers/net/mlx5/hws/mlx5dr_cmd.c | 11 ++--------- drivers/net/mlx5/hws/mlx5dr_cmd.h | 3 --- drivers/net/mlx5/hws/mlx5dr_send.c | 1 - drivers/net/mlx5/hws/mlx5dr_send.h | 1 - 4 files changed, 2 insertions(+), 14 deletions(-)
drivers/net/mlx5/hws/mlx5dr_cmd.c +2 -9
@@ -1344,12 +1344,10 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,strlcpy (caps->fw_ver, attr_ex.orig_attr.fw_ver,sizeof (caps->fw_ver)); port_info =flow_hw_get_wire_port (ctx); -if (port_info) { - caps->wire_regc = port_info->regc_value; +if (port_info) caps->wire_regc_mask = port_info->regc_mask; - }else { +else DR_LOG (INFO ,"Failed to query wire port regc value" ); - }return ret; }
@@ -1374,10 +1372,5 @@ int mlx5dr_cmd_query_ib_port(struct ibv_context *ctx, vport_caps->vport_num = port_info.vport_id; vport_caps->esw_owner_vhca_id = port_info.esw_owner_vhca_id; -if (port_info.query_flags &MLX5_PORT_QUERY_REG_C0 ) { - vport_caps->metadata_c = port_info.vport_meta_tag; - vport_caps->metadata_c_mask = port_info.vport_meta_mask; - } -return 0 ; }
drivers/net/mlx5/hws/mlx5dr_cmd.h +0 -3
@@ -194,8 +194,6 @@ struct mlx5dr_cmd_query_ft_caps {struct mlx5dr_cmd_query_vport_caps {uint16_t vport_num;uint16_t esw_owner_vhca_id; -uint32_t metadata_c; -uint32_t metadata_c_mask; };struct mlx5dr_cmd_generate_wqe_attr {
@@ -207,7 +205,6 @@ struct mlx5dr_cmd_generate_wqe_attr { };struct mlx5dr_cmd_query_caps { -uint32_t wire_regc;uint32_t wire_regc_mask;uint32_t flex_protocols;uint8_t wqe_based_update;
drivers/net/mlx5/hws/mlx5dr_send.c +0 -1
@@ -729,7 +729,6 @@ static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, buf_sz = queue->num_entries *MAX_WQES_PER_RULE ; sq_log_buf_sz =log2above (buf_sz); sq_buf_sz =1 << (sq_log_buf_sz +log2above (MLX5_SEND_WQE_BB )); - sq->reg_addr = queue->uar->reg_addr; page_size =sysconf (_SC_PAGESIZE); buf_aligned =align (sq_buf_sz, page_size);
drivers/net/mlx5/hws/mlx5dr_send.h +0 -1
@@ -114,7 +114,6 @@ struct mlx5dr_send_ring_sq {char *buf;uint32_t sqn;__be32 *db; -void *reg_addr;uint16_t cur_post;uint16_t buf_mask;struct mlx5dr_send_ring_priv *wr_priv;
Signature · 1 line
2.39.3
PATCH 5/13 net/mlx5/hws: return -rte_errno on rule creation failure
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
mlx5dr_rule_create returns -ret, so internal functions should return rte_errno on failure. Fix return values of the function that creates rule in root table.
--- drivers/net/mlx5/hws/mlx5dr_rule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +1 -1
@@ -733,7 +733,7 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule, free_attr:simple_free (attr); -return -rte_errno; +return rte_errno; } static int mlx5dr_rule_destroy_root(struct mlx5dr_rule *rule,
Signature · 1 line
2.39.3
PATCH 6/13 net/mlx5/hws: simplify send_queues_close code
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Small simplification to the send_queues_close code
--- drivers/net/mlx5/hws/mlx5dr_send.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/mlx5/hws/mlx5dr_send.c +2 -7
@@ -970,13 +970,8 @@ int mlx5dr_send_queue_open(struct mlx5dr_context *ctx,static void __mlx5dr_send_queues_close (struct mlx5dr_context *ctx,uint16_t queues) { -struct mlx5dr_send_engine *queue; - -while (queues--) { - queue = &ctx->send_queue[queues]; - -mlx5dr_send_queue_close (queue); - } +while (queues--) +mlx5dr_send_queue_close (&ctx->send_queue[queues]); }void mlx5dr_send_queues_close (struct mlx5dr_context *ctx)
Signature · 1 line
2.39.3
PATCH 7/13 net/mlx5/hws: fix error flow in mlx5dr_context_open
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Add missing spinlock destruction in error flow.
--- drivers/net/mlx5/hws/mlx5dr_context.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/mlx5/hws/mlx5dr_context.c +1 -0
@@ -263,6 +263,7 @@ struct mlx5dr_context *mlx5dr_context_open(struct ibv_context *ibv_ctx, free_caps:simple_free (ctx->caps); free_ctx: +pthread_spin_destroy (&ctx->ctrl_lock);simple_free (ctx);return NULL ; }
Signature · 1 line
2.39.3
PATCH 8/13 net/mlx5/hws: fix code analysis error in passing 0 enum val
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Instead of passing 0 as an enum parameter, define flag NONE. This resolves the following code analysis error: "enumerated type mixed with another type".
This value is currently used in tests only, and will later be used in backward-compatible steering API.
--- drivers/net/mlx5/hws/mlx5dr.h | 1 + 1 file changed, 1 insertion(+)
drivers/net/mlx5/hws/mlx5dr.h +1 -0
@@ -82,6 +82,7 @@ enum mlx5dr_action_aso_ct_flags { };enum mlx5dr_match_template_flags { +MLX5DR_MATCH_TEMPLATE_FLAG_NONE =0 ,/* Allow relaxed matching by skipping derived dependent match fields. */ MLX5DR_MATCH_TEMPLATE_FLAG_RELAXED_MATCH =1 , };
Signature · 1 line
2.39.3
PATCH 9/13 net/mlx5/hws: simplify code for updating CQ doorbell record
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Simplify the code that does CQ poll - have DB record update as part of CQ polling.
--- drivers/net/mlx5/hws/mlx5dr_send.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/mlx5/hws/mlx5dr_send.c +3 -6
@@ -594,7 +594,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue, cqe_owner != sw_own)return ; -if (unlikely (mlx5dv_get_cqe_opcode (cqe) !=MLX5_CQE_REQ )) +if (unlikely (cqe_opcode !=MLX5_CQE_REQ )) queue->err = true;rte_io_rmb ();
@@ -611,6 +611,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue, cq->poll_wqe = (wqe_cnt + priv->num_wqebbs) & sq->buf_mask;mlx5dr_send_engine_update (queue, cqe, priv, res, i, res_nb, wqe_cnt); cq->cons_index++; + *cq->db =htobe32 (cq->cons_index &0xffffff ); } static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue,
@@ -620,13 +621,9 @@ static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue, {int j; -for (j =0 ; j <MLX5DR_NUM_SEND_RINGS ; j++) { +for (j =0 ; j <MLX5DR_NUM_SEND_RINGS ; j++)mlx5dr_send_engine_poll_cq (queue, &queue->send_ring[j], res, polled, res_nb); - - *queue->send_ring[j].send_cq.db = -htobe32 (queue->send_ring[j].send_cq.cons_index &0xffffff ); - } } static void mlx5dr_send_engine_poll_list(struct mlx5dr_send_engine *queue,
Signature · 1 line
2.39.3
PATCH 10/13 net/mlx5/hws: fix rule is in resize check
In reply to Itamar GozlanFrom: Alex Vesker <[email protected]>
The check to detect if a rule is in resize was done incorrectly, this can lead to an incorrect function call upon completion for rules which are not in resize (move).
Since the resize_info is in a union we cannot rely only on the pointer value but also need to make sure the matcher is in resize process, this assures us the resize info is valid.
--- drivers/net/mlx5/hws/mlx5dr_rule.c | 7 +++++++ drivers/net/mlx5/hws/mlx5dr_rule.h | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +7 -0
@@ -350,6 +350,13 @@ static void mlx5dr_rule_move_init(struct mlx5dr_rule *rule, rule->resize_info->state =MLX5DR_RULE_RESIZE_STATE_WRITING ; } +bool mlx5dr_rule_move_in_progress (struct mlx5dr_rule *rule) +{ +return unlikely (mlx5dr_matcher_is_in_resize (rule->matcher)) && + rule->resize_info && + rule->resize_info->state !=MLX5DR_RULE_RESIZE_STATE_IDLE ; +} + static int mlx5dr_rule_create_hws_fw_wqe(struct mlx5dr_rule *rule, struct mlx5dr_rule_attr *attr, uint8_t mt_idx,
drivers/net/mlx5/hws/mlx5dr_rule.h +1 -5
@@ -72,10 +72,6 @@ int mlx5dr_rule_move_hws_remove(struct mlx5dr_rule *rule,int mlx5dr_rule_move_hws_add (struct mlx5dr_rule *rule,struct mlx5dr_rule_attr *attr); -static inline bool mlx5dr_rule_move_in_progress (struct mlx5dr_rule *rule) -{ -return rule->resize_info && - rule->resize_info->state !=MLX5DR_RULE_RESIZE_STATE_IDLE ; -} +bool mlx5dr_rule_move_in_progress (struct mlx5dr_rule *rule);#endif /* MLX5DR_RULE_H_ */
Signature · 1 line
2.39.3
PATCH 11/13 net/mlx5/hws: drop at attach number of actions
In reply to Itamar GozlanFrom: Alex Vesker <[email protected]>
Requesting the user for number of action resources is not defined well enough, instead the user should provide an initial action template which should contain the future attached action templates.
--- drivers/net/mlx5/hws/mlx5dr_matcher.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/mlx5/hws/mlx5dr_matcher.c +7 -0
@@ -785,6 +785,13 @@ static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)if (matcher->flags &MLX5DR_MATCHER_FLAGS_COLLISION )return 0 ; +if (matcher->attr.max_num_of_at_attach && +mlx5dr_matcher_req_fw_wqe (matcher)) { +DR_LOG (ERR ,"FW extended matcher doesn't support additional at" ); + rte_errno =ENOTSUP ; +return rte_errno; + } +for (i =0 ; i < matcher->num_of_at; i++) {struct mlx5dr_action_template *at = &matcher->at[i];
Signature · 1 line
2.39.3
PATCH 12/13 net/mlx5/hws: extending tag saving for match and jumbo
In reply to Itamar GozlanFrom: Erez Shitrit <[email protected]>
Save the exact tag when matching over jumbo masking.
--- drivers/net/mlx5/hws/mlx5dr_rule.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +7 -2
@@ -195,8 +195,13 @@ mlx5dr_rule_save_delete_info(struct mlx5dr_rule *rule, rule->tag_ptr =simple_calloc (2 ,sizeof (*rule->tag_ptr));assert (rule->tag_ptr); - src_tag = (uint8_t *)ste_attr->wqe_data->tag; -memcpy (rule->tag_ptr[0 ].match, src_tag,MLX5DR_MATCH_TAG_SZ ); +if (is_jumbo) +memcpy (rule->tag_ptr[0 ].jumbo, ste_attr->wqe_data->action, +MLX5DR_JUMBO_TAG_SZ ); +else +memcpy (rule->tag_ptr[0 ].match, ste_attr->wqe_data->tag, +MLX5DR_MATCH_TAG_SZ ); + rule->tag_ptr[1 ].reserved[0 ] = ste_attr->send_attr.match_definer_id;/* Save range definer id and tag for delete */
Signature · 1 line
2.39.3
PATCH 13/13 net/mlx5/hws: fix port ID for root matcher and rule
In reply to Itamar GozlanFrom: Erez Shitrit <[email protected]>
In root tables matcher and rule need to have their port-id, otherwise the translate function that done in dpdk layer will not get the right attributes.
For that whenever the matcher is matching the source-port we need to get the relevant port-id before calling the translate function.
--- drivers/net/mlx5/hws/mlx5dr_matcher.c | 17 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_rule.c | 18 ++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 18 ++++++++++++++++++ 3 files changed, 53 insertions(+)
drivers/net/mlx5/hws/mlx5dr_matcher.c +17 -0
@@ -1227,6 +1227,7 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher)struct mlx5dv_flow_match_parameters *mask;struct mlx5_flow_attr flow_attr = {0 };struct rte_flow_error rte_error; +struct rte_flow_item *item;uint8_t match_criteria;int ret;
@@ -1255,6 +1256,22 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher)return rte_errno; } +/* We need the port id in case of matching representor */ + item = matcher->mt[0 ].items; +while (item->type !=RTE_FLOW_ITEM_TYPE_END ) { +if (item->type ==RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR || + item->type ==RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT ) { + ret =flow_hw_get_port_id_from_ctx (ctx, &flow_attr.port_id); +if (ret) { +DR_LOG (ERR ,"Failed to get port id for dev %s" , + ctx->ibv_ctx->device->name); + rte_errno =EINVAL ; +return rte_errno; + } + } + ++item; + } + mask =simple_calloc (1 ,MLX5_ST_SZ_BYTES (fte_match_param) + offsetof(struct mlx5dv_flow_match_parameters , match_buf));if (!mask) {
drivers/net/mlx5/hws/mlx5dr_rule.c +18 -0
@@ -692,10 +692,28 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule,struct mlx5dv_flow_match_parameters *value;struct mlx5_flow_attr flow_attr = {0 };struct mlx5dv_flow_action_attr *attr; +const struct rte_flow_item *cur_item;struct rte_flow_error error;uint8_t match_criteria;int ret; +/* We need the port id in case of matching representor */ + cur_item = items; +while (cur_item->type !=RTE_FLOW_ITEM_TYPE_END ) { +if (cur_item->type ==RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR || + cur_item->type ==RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT ) { + ret =flow_hw_get_port_id_from_ctx (rule->matcher->tbl->ctx, + &flow_attr.port_id); +if (ret) { +DR_LOG (ERR ,"Failed to get port id for dev %s" , + rule->matcher->tbl->ctx->ibv_ctx->device->name); + rte_errno =EINVAL ; +return rte_errno; + } + } + ++cur_item; + } + attr =simple_calloc (num_actions,sizeof (*attr));if (!attr) { rte_errno =ENOMEM ;
drivers/net/mlx5/mlx5_flow.h +18 -0
@@ -2001,6 +2001,24 @@ flow_hw_get_reg_id(struct rte_eth_dev *dev,#endif } +static __rte_always_inline int +flow_hw_get_port_id_from_ctx (void *dr_ctx,uint32_t *port_val) +{ +uint32_t port; + + MLX5_ETH_FOREACH_DEV(port, NULL) { +struct mlx5_priv *priv; + priv = rte_eth_devices[port].data->dev_private; + +if (priv->dr_ctx == dr_ctx) { + *port_val = port; +return 0 ; + } + } + +return -EINVAL ; +} +/** * Get GENEVE TLV option FW information according type and class. *
Signature · 1 line
2.39.3
Hi,
Quoted 21 lines
-----Original Message-----
From: Itamar Gozlan <[email protected]>
Sent: Thursday, March 14, 2024 1:42 PM
To: Itamar Gozlan <[email protected]>; Erez Shitrit <[email protected]>; Hamdan Agbariya <[email protected]>; Yevgeny Kliteynik <[email protected]>; Alex Vesker <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Dariusz Sosnowski <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; Mark Bloch <[email protected]>
Cc: [email protected]; Maayan Kashani <[email protected]>
Subject: [PATCH 01/13]net/mlx5/hws: move warn into debug level when neededFrom: Erez Shitrit <[email protected]>
When the user tries to create a matcher and if failed with specific errno (E2BIG) the message will be in debug level and not in warning.
It is a part of a feature when the user re-try to insert a new matching depends on that errno, no need the annoying message.
Quoted 4 lines
Fixes c55c2bf3533 ("net/mlx5/hws: net/mlx5/hws: add definer layer")Signed-off-by Erez Shitrit <[email protected]>Acked-by Matan Azrad <[email protected]>
Fixed Cc stable on several patches on this series, and reworded the commits Series applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
18/03/2024 13:56, Raslan Darawsheh:
Quoted 8 lines
From: Itamar Gozlan <[email protected]>
Quoted 7 lines
From: Erez Shitrit <[email protected]>
When the user tries to create a matcher and if failed with specific errno (E2BIG) the message will be in debug level and not in warning.
It is a part of a feature when the user re-try to insert a new matching depends on that errno, no need the annoying message.
Quoted 6 lines
Quoted 4 lines
Fixes c55c2bf3533 ("net/mlx5/hws: net/mlx5/hws: add definer layer")Signed-off-by Erez Shitrit <[email protected]>Acked-by Matan Azrad <[email protected]>Fixed Cc stable on several patches on this series, and reworded the commits Series applied to next-net-mlx,
There is no cover letter for this series,
so we are not able to understand how critical it is, and what is the general intent.
Is it supposed to be integrated in the last week of 24.03 release cycle?
Hi,
Quoted 29 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, March 18, 2024 4:49 PM
To: Itamar Gozlan <[email protected]>; Erez Shitrit <[email protected]>; Hamdan Agbariya <[email protected]>; Yevgeny Kliteynik <[email protected]>; Alex Vesker <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: Slava Ovsiienko <[email protected]>; Dariusz Sosnowski <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; Mark Bloch <[email protected]>; [email protected]; Maayan Kashani <[email protected]>
Subject: Re: [PATCH 01/13]net/mlx5/hws: move warn into debug level when needed18/03/2024 13:56, Raslan Darawsheh:
Quoted 13 lines
From: Itamar Gozlan <[email protected]>
Quoted 12 lines
From: Erez Shitrit <[email protected]>
When the user tries to create a matcher and if failed with specific errno
(E2BIG) the message will be in debug level and not in warning. It is a part of a feature when the user re-try to insert a new matching depends on that errno, no need the annoying message.Fixes c55c2bf3533 ("net/mlx5/hws: net/mlx5/hws: add definer layer")Signed-off-by Erez Shitrit <[email protected]>Acked-by Matan Azrad <[email protected]>
Quoted 8 lines
Quoted 2 lines
Fixed Cc stable on several patches on this series, and reworded the commits Series applied to next-net-mlx,
There is no cover letter for this series, so we are not able to understand how critical it is, and what is the general intent.
Is it supposed to be integrated in the last week of 24.03 release cycle?
No, it's not critical for RC4 It's my fault, I'll drop it for now and we'll merge it in the next release cycle only.
Kindest regards
Raslan Darawsheh
Quoted 6 lines · Raslan Darawsheh
Hi,
Quoted 4 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>18/03/2024 13:56, Raslan Darawsheh:
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
From: Itamar Gozlan <[email protected]>
There is no cover letter for this series, so we are not able to understand how critical it is, and what is the general intent.
Is it supposed to be integrated in the last week of 24.03 release cycle?
No, it's not critical for RC4 It's my fault, I'll drop it for now and we'll merge it in the next release cycle only.
Actually, this series contain a bugfix for a show stopper bug:
[DPDK Upstream - Bug SW #3808915] Seg fault on dequeue flow
The fix is in patch 10/13:
[PATCH 10/13] net/mlx5/hws: fix rule is in resize check
-- YK
Quoted 2 lines
Kindest regards
Raslan Darawsheh
PATCH v2 1/16 net/mlx5/hws: move warn into debug level when needed
In reply to Itamar GozlanFrom: Erez Shitrit <[email protected]>
When the user tries to create a matcher and if failed with specific errno (E2BIG) the message will be in debug level and not in warning. It is a part of a feature when the user re-try to insert a new matching depends on that errno, no need the annoying message.
--- drivers/net/mlx5/hws/mlx5dr_definer.c | 6 +++--- drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/mlx5/hws/mlx5dr_definer.c +3 -3
@@ -3534,7 +3534,7 @@ mlx5dr_definer_find_best_match_fit(struct mlx5dr_context *ctx,return 0 ; } -DR_LOG (ERR ,"Unable to find supporting match/jumbo definer combination" ); +DR_LOG (DEBUG ,"Unable to find supporting match/jumbo definer combination" ); rte_errno =E2BIG ;return rte_errno; }
@@ -3689,7 +3689,7 @@ mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher,/* Find the match definer layout for header layout match union */ ret =mlx5dr_definer_find_best_match_fit (ctx, match_definer, match_hl);if (ret) { -DR_LOG (ERR ,"Failed to create match definer from header layout" ); +DR_LOG (DEBUG ,"Failed to create match definer from header layout" ); goto free_fc; }
@@ -4041,7 +4041,7 @@ int mlx5dr_definer_matcher_init(struct mlx5dr_context *ctx, ret =mlx5dr_definer_calc_layout (matcher, &match_layout, &range_layout);if (ret) { -DR_LOG (ERR ,"Failed to calculate matcher definer layout" ); +DR_LOG (DEBUG ,"Failed to calculate matcher definer layout" );return ret; }
drivers/net/mlx5/hws/mlx5dr_matcher.c +1 -1
@@ -877,7 +877,7 @@ static int mlx5dr_matcher_bind_mt(struct mlx5dr_matcher *matcher)/* Calculate match, range and hash definers */ ret =mlx5dr_definer_matcher_init (ctx, matcher);if (ret) { -DR_LOG (ERR ,"Failed to set matcher templates with match definers" ); +DR_LOG (DEBUG ,"Failed to set matcher templates with match definers" );return ret; }
Signature · 1 line
2.39.3
PATCH v2 2/16 common/mlx5: fix error in mlx5 prm structs
From: Yevgeny Kliteynik <[email protected]>
Fix wrong reserved size and add helpful comment
--- drivers/common/mlx5/mlx5_prm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +3 -3
@@ -2360,8 +2360,8 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {u8 reserved_at_d0[0x3 ];u8 log_conn_track_max_alloc[0x5 ];u8 reserved_at_d8[0x3 ]; -u8 log_max_conn_track_offload[0x5 ]; -u8 cross_vhca_object_to_object_supported[0x20 ];/* End of DW7. */ +u8 log_max_conn_track_offload[0x5 ];/* End of DW7. */ +u8 cross_vhca_object_to_object_supported[0x20 ];u8 allowed_object_for_other_vhca_access_high[0x20 ];u8 allowed_object_for_other_vhca_access[0x20 ];u8 reserved_at_140[0x20 ];
@@ -3655,7 +3655,7 @@ struct mlx5_ifc_stc_ste_param_vport_bits {u8 eswitch_owner_vhca_id[0x10 ];u8 vport_number[0x10 ];u8 eswitch_owner_vhca_id_valid[0x1 ]; -u8 reserved_at_21[0x59 ]; +u8 reserved_at_21[0x5f ]; };union mlx5_ifc_stc_param_bits {
Signature · 1 line
2.39.3
PATCH v2 3/16 net/mlx5/hws: fix wrong comment in mlx5dr send
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Remove comment that documents parameter that doesn't exist.
--- drivers/net/mlx5/hws/mlx5dr_send.h | 2 -- 1 file changed, 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_send.h +0 -2
@@ -203,8 +203,6 @@ struct mlx5dr_send_ste_attr {* value to write in CPU endian format. * @param addr * Address to write to. -* @param lock -* Address of the lock to use for that UAR access. */ static __rte_always_inline voidmlx5dr_uar_write64_relaxed (uint64_t val,void *addr)
Signature · 1 line
2.39.3
PATCH v2 4/16 net/mlx5/hws: remove unused capabilities and fields
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
The following caps were never in use:
- wire_regc
- metadata_c
- metadata_c_mask
Also send ring's reg_addr field wasn't in use.
Removing these caps and fields from structs and removing the code that queried them.
--- drivers/net/mlx5/hws/mlx5dr_cmd.c | 11 ++--------- drivers/net/mlx5/hws/mlx5dr_cmd.h | 3 --- drivers/net/mlx5/hws/mlx5dr_send.c | 1 - drivers/net/mlx5/hws/mlx5dr_send.h | 1 - 4 files changed, 2 insertions(+), 14 deletions(-)
drivers/net/mlx5/hws/mlx5dr_cmd.c +2 -9
@@ -1344,12 +1344,10 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,strlcpy (caps->fw_ver, attr_ex.orig_attr.fw_ver,sizeof (caps->fw_ver)); port_info =flow_hw_get_wire_port (ctx); -if (port_info) { - caps->wire_regc = port_info->regc_value; +if (port_info) caps->wire_regc_mask = port_info->regc_mask; - }else { +else DR_LOG (INFO ,"Failed to query wire port regc value" ); - }return ret; }
@@ -1374,10 +1372,5 @@ int mlx5dr_cmd_query_ib_port(struct ibv_context *ctx, vport_caps->vport_num = port_info.vport_id; vport_caps->esw_owner_vhca_id = port_info.esw_owner_vhca_id; -if (port_info.query_flags &MLX5_PORT_QUERY_REG_C0 ) { - vport_caps->metadata_c = port_info.vport_meta_tag; - vport_caps->metadata_c_mask = port_info.vport_meta_mask; - } -return 0 ; }
drivers/net/mlx5/hws/mlx5dr_cmd.h +0 -3
@@ -194,8 +194,6 @@ struct mlx5dr_cmd_query_ft_caps {struct mlx5dr_cmd_query_vport_caps {uint16_t vport_num;uint16_t esw_owner_vhca_id; -uint32_t metadata_c; -uint32_t metadata_c_mask; };struct mlx5dr_cmd_generate_wqe_attr {
@@ -207,7 +205,6 @@ struct mlx5dr_cmd_generate_wqe_attr { };struct mlx5dr_cmd_query_caps { -uint32_t wire_regc;uint32_t wire_regc_mask;uint32_t flex_protocols;uint8_t wqe_based_update;
drivers/net/mlx5/hws/mlx5dr_send.c +0 -1
@@ -729,7 +729,6 @@ static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx, buf_sz = queue->num_entries *MAX_WQES_PER_RULE ; sq_log_buf_sz =log2above (buf_sz); sq_buf_sz =1 << (sq_log_buf_sz +log2above (MLX5_SEND_WQE_BB )); - sq->reg_addr = queue->uar->reg_addr; page_size =sysconf (_SC_PAGESIZE); buf_aligned =align (sq_buf_sz, page_size);
drivers/net/mlx5/hws/mlx5dr_send.h +0 -1
@@ -114,7 +114,6 @@ struct mlx5dr_send_ring_sq {char *buf;uint32_t sqn;__be32 *db; -void *reg_addr;uint16_t cur_post;uint16_t buf_mask;struct mlx5dr_send_ring_priv *wr_priv;
Signature · 1 line
2.39.3
PATCH v2 5/16 net/mlx5/hws: negating rte errno on rule creation failure
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
mlx5dr_rule_create returns -ret, so internal functions should return rte_errno on failure. Fix return values of the function that creates rule in root table.
--- drivers/net/mlx5/hws/mlx5dr_rule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +1 -1
@@ -733,7 +733,7 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule, free_attr:simple_free (attr); -return -rte_errno; +return rte_errno; } static int mlx5dr_rule_destroy_root(struct mlx5dr_rule *rule,
Signature · 1 line
2.39.3
PATCH v2 6/16 net/mlx5/hws: simplify send queues close code
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Small simplification to the send_queues_close code
--- drivers/net/mlx5/hws/mlx5dr_send.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/mlx5/hws/mlx5dr_send.c +2 -7
@@ -970,13 +970,8 @@ int mlx5dr_send_queue_open(struct mlx5dr_context *ctx,static void __mlx5dr_send_queues_close (struct mlx5dr_context *ctx,uint16_t queues) { -struct mlx5dr_send_engine *queue; - -while (queues--) { - queue = &ctx->send_queue[queues]; - -mlx5dr_send_queue_close (queue); - } +while (queues--) +mlx5dr_send_queue_close (&ctx->send_queue[queues]); }void mlx5dr_send_queues_close (struct mlx5dr_context *ctx)
Signature · 1 line
2.39.3
PATCH v2 7/16 net/mlx5/hws: fix error flow in mlx5dr context open
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Add missing spinlock destruction in error flow.
--- drivers/net/mlx5/hws/mlx5dr_context.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/mlx5/hws/mlx5dr_context.c +1 -0
@@ -263,6 +263,7 @@ struct mlx5dr_context *mlx5dr_context_open(struct ibv_context *ibv_ctx, free_caps:simple_free (ctx->caps); free_ctx: +pthread_spin_destroy (&ctx->ctrl_lock);simple_free (ctx);return NULL ; }
Signature · 1 line
2.39.3
PATCH v2 8/16 net/mlx5/hws: fix code analysis error in passing 0 enum val
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Instead of passing 0 as an enum parameter, define flag NONE. This resolves the following code analysis error: "enumerated type mixed with another type".
This value is currently used in tests only, and will later be used in backward-compatible steering API.
--- drivers/net/mlx5/hws/mlx5dr.h | 1 + 1 file changed, 1 insertion(+)
drivers/net/mlx5/hws/mlx5dr.h +1 -0
@@ -82,6 +82,7 @@ enum mlx5dr_action_aso_ct_flags { };enum mlx5dr_match_template_flags { +MLX5DR_MATCH_TEMPLATE_FLAG_NONE =0 ,/* Allow relaxed matching by skipping derived dependent match fields. */ MLX5DR_MATCH_TEMPLATE_FLAG_RELAXED_MATCH =1 , };
Signature · 1 line
2.39.3
PATCH v2 9/16 net/mlx5/hws: simplify code for updating CQ doorbell record
In reply to Itamar GozlanFrom: Yevgeny Kliteynik <[email protected]>
Simplify the code that does CQ poll - have DB record update as part of CQ polling.
--- drivers/net/mlx5/hws/mlx5dr_send.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/mlx5/hws/mlx5dr_send.c +3 -6
@@ -594,7 +594,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue, cqe_owner != sw_own)return ; -if (unlikely (mlx5dv_get_cqe_opcode (cqe) !=MLX5_CQE_REQ )) +if (unlikely (cqe_opcode !=MLX5_CQE_REQ )) queue->err = true;rte_io_rmb ();
@@ -611,6 +611,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue, cq->poll_wqe = (wqe_cnt + priv->num_wqebbs) & sq->buf_mask;mlx5dr_send_engine_update (queue, cqe, priv, res, i, res_nb, wqe_cnt); cq->cons_index++; + *cq->db =htobe32 (cq->cons_index &0xffffff ); } static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue,
@@ -620,13 +621,9 @@ static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue, {int j; -for (j =0 ; j <MLX5DR_NUM_SEND_RINGS ; j++) { +for (j =0 ; j <MLX5DR_NUM_SEND_RINGS ; j++)mlx5dr_send_engine_poll_cq (queue, &queue->send_ring[j], res, polled, res_nb); - - *queue->send_ring[j].send_cq.db = -htobe32 (queue->send_ring[j].send_cq.cons_index &0xffffff ); - } } static void mlx5dr_send_engine_poll_list(struct mlx5dr_send_engine *queue,
Signature · 1 line
2.39.3
PATCH v2 10/16 net/mlx5/hws: drop at attach number of actions
In reply to Itamar GozlanFrom: Alex Vesker <[email protected]>
Requesting the user for number of action resources is not defined well enough, instead the user should provide an initial action template which should contain the future attached action templates.
--- drivers/net/mlx5/hws/mlx5dr_matcher.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/mlx5/hws/mlx5dr_matcher.c +7 -0
@@ -785,6 +785,13 @@ static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)if (matcher->flags &MLX5DR_MATCHER_FLAGS_COLLISION )return 0 ; +if (matcher->attr.max_num_of_at_attach && +mlx5dr_matcher_req_fw_wqe (matcher)) { +DR_LOG (ERR ,"FW extended matcher doesn't support additional at" ); + rte_errno =ENOTSUP ; +return rte_errno; + } +for (i =0 ; i < matcher->num_of_at; i++) {struct mlx5dr_action_template *at = &matcher->at[i];
Signature · 1 line
2.39.3
PATCH v2 11/16 net/mlx5/hws: extending tag saving for match and jumbo
In reply to Itamar GozlanFrom: Erez Shitrit <[email protected]>
Save the exact tag when matching over jumbo masking.
--- drivers/net/mlx5/hws/mlx5dr_rule.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +7 -2
@@ -195,8 +195,13 @@ mlx5dr_rule_save_delete_info(struct mlx5dr_rule *rule, rule->tag_ptr =simple_calloc (2 ,sizeof (*rule->tag_ptr));assert (rule->tag_ptr); - src_tag = (uint8_t *)ste_attr->wqe_data->tag; -memcpy (rule->tag_ptr[0 ].match, src_tag,MLX5DR_MATCH_TAG_SZ ); +if (is_jumbo) +memcpy (rule->tag_ptr[0 ].jumbo, ste_attr->wqe_data->action, +MLX5DR_JUMBO_TAG_SZ ); +else +memcpy (rule->tag_ptr[0 ].match, ste_attr->wqe_data->tag, +MLX5DR_MATCH_TAG_SZ ); + rule->tag_ptr[1 ].reserved[0 ] = ste_attr->send_attr.match_definer_id;/* Save range definer id and tag for delete */
Signature · 1 line
2.39.3
PATCH v2 12/16 net/mlx5/hws: dw order optimization code enhancement
In reply to Itamar GozlanImproving code readability by following code styles such as mlx5dr prefix and extracting a support check to an external function call. Also, reducing unneeded static memory allocation using a bounded size macro.
--- drivers/net/mlx5/hws/mlx5dr_definer.c | 39 ++++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/mlx5/hws/mlx5dr_definer.c +20 -19
@@ -31,6 +31,8 @@#define MLX5DR_DEFINER_QUOTA_BLOCK 0#define MLX5DR_DEFINER_QUOTA_PASS 2 +#define MLX5DR_DEFINER_MAX_ROW_LOG 32 +#define MLX5DR_DEFINER_HL_OPT_MAX 2/* Setter function based on bit offset and mask, for 32bit DW*/ #define _DR_SET_32 (p, v, byte_off, bit_off, mask) \
@@ -104,21 +106,13 @@ __mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \ __mlx5_mask(typ, fld)) -#define MAX_ROW_LOG 31 - -enum header_layout { -MLX5DR_HL_IPV4_SRC =64 , -MLX5DR_HL_IPV4_DST =65 , -MAX_HL_PRIO , -}; -/* Each row (i) indicates a different matcher size, and each column (j) * represents {DW5, DW4, DW3, DW2, DW1, DW0}. -* For values 0,..,2^i, and j (DW) 0,..,5: optimal_dist_dw[i][j] is 1 if the +* For values 0,..,2^i, and j (DW) 0,..,5: mlx5dr_optimal_dist_dw[i][j] is 1 if the * number of different hash results on these values equals 2^i, meaning this * DW hash distribution is complete. */ -int optimal_dist_dw[MAX_ROW_LOG ][DW_SELECTORS_MATCH ] = { +int mlx5dr_optimal_dist_dw[MLX5DR_DEFINER_MAX_ROW_LOG ][DW_SELECTORS_MATCH ] = { {1 ,1 ,1 ,1 ,1 ,1 }, {0 ,1 ,1 ,0 ,1 ,0 }, {0 ,1 ,1 ,0 ,1 ,0 }, {1 ,0 ,1 ,0 ,1 ,0 }, {0 ,0 ,0 ,1 ,1 ,0 }, {0 ,1 ,1 ,0 ,1 ,0 }, {0 ,0 ,0 ,0 ,1 ,0 }, {0 ,1 ,1 ,0 ,1 ,0 }, {0 ,0 ,0 ,0 ,0 ,0 },
@@ -3471,16 +3465,16 @@ mlx5dr_definer_find_best_range_fit(struct mlx5dr_definer *definer,static void mlx5dr_definer_optimize_order (struct mlx5dr_definer *definer,int num_log) { -uint8_t hl_prio[MAX_HL_PRIO -1 ] = {MLX5DR_HL_IPV4_SRC , -MLX5DR_HL_IPV4_DST , -MAX_HL_PRIO }; +uint8_t hl_prio[MLX5DR_DEFINER_HL_OPT_MAX ];int dw =0 , i =0 , j;int *dw_flag;uint8_t tmp; - dw_flag = optimal_dist_dw[num_log]; + dw_flag = mlx5dr_optimal_dist_dw[num_log]; + hl_prio[0 ] =__mlx5_dw_off (definer_hl, ipv4_src_dest_outer.source_address); + hl_prio[1 ] =__mlx5_dw_off (definer_hl, ipv4_src_dest_outer.destination_address); -while (hl_prio[i] !=MAX_HL_PRIO ) { +while (i <MLX5DR_DEFINER_HL_OPT_MAX ) { j =0 ;/* Finding a candidate to improve its hash distribution */ while (j <DW_SELECTORS_MATCH && (hl_prio[i] != definer->dw_selector[j]))
@@ -3632,6 +3626,16 @@ int mlx5dr_definer_compare(struct mlx5dr_definer *definer_a,return 0 ; } +static int +mlx5dr_definer_optimize_order_supported (struct mlx5dr_definer *match_definer, +struct mlx5dr_matcher *matcher) +{ +return !mlx5dr_definer_is_jumbo (match_definer) && + !mlx5dr_matcher_req_fw_wqe (matcher) && + !mlx5dr_matcher_is_resizable (matcher) && + !mlx5dr_matcher_is_insert_by_idx (matcher); +} + static int mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher, struct mlx5dr_definer *match_definer,
@@ -3693,10 +3697,7 @@ mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher, goto free_fc; } -if (!mlx5dr_definer_is_jumbo (match_definer) && - !mlx5dr_matcher_req_fw_wqe (matcher) && - !mlx5dr_matcher_is_resizable (matcher) && - !mlx5dr_matcher_is_insert_by_idx (matcher)) +if (mlx5dr_definer_optimize_order_supported (match_definer, matcher))mlx5dr_definer_optimize_order (match_definer, matcher->attr.rule.num_log);/* Find the range definer layout for match templates fcrs */
Signature · 1 line
2.39.3
PATCH v2 13/16 net/mlx5/hws: set default miss when replacing table
In reply to Itamar GozlanAllowing the replacement of a miss table without enforcing a previous disconnecting. This feature extension allows the user to change the destination miss table when the system runs without losing traffic.
--- drivers/net/mlx5/hws/mlx5dr_table.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/mlx5/hws/mlx5dr_table.c +6 -5
@@ -611,8 +611,7 @@ static int mlx5dr_table_set_default_miss_not_valid(struct mlx5dr_table *tbl,if (mlx5dr_table_is_root (tbl) || (miss_tbl &&mlx5dr_table_is_root (miss_tbl)) || - (miss_tbl && miss_tbl->type != tbl->type) || - (miss_tbl && tbl->default_miss.miss_tbl)) { + (miss_tbl && miss_tbl->type != tbl->type)) {DR_LOG (ERR ,"Invalid arguments" ); rte_errno =EINVAL ;return -rte_errno;
@@ -625,6 +624,7 @@ int mlx5dr_table_set_default_miss(struct mlx5dr_table *tbl, struct mlx5dr_table *miss_tbl) {struct mlx5dr_context *ctx = tbl->ctx; +struct mlx5dr_table *old_miss_tbl;int ret; ret =mlx5dr_table_set_default_miss_not_valid (tbl, miss_tbl);
@@ -632,15 +632,16 @@ int mlx5dr_table_set_default_miss(struct mlx5dr_table *tbl,return ret;pthread_spin_lock (&ctx->ctrl_lock); - + old_miss_tbl = tbl->default_miss.miss_tbl; ret =mlx5dr_table_connect_to_miss_table (tbl, miss_tbl);if (ret) goto out; +if (old_miss_tbl) +LIST_REMOVE (tbl, default_miss.next); +if (miss_tbl)LIST_INSERT_HEAD (&miss_tbl->default_miss.head, tbl, default_miss.next); -else -LIST_REMOVE (tbl, default_miss.next);pthread_spin_unlock (&ctx->ctrl_lock);return 0 ;
Signature · 1 line
2.39.3
PATCH v2 14/16 net/mlx5/hws: fix invalid memory access in decapl3
In reply to Itamar GozlanFrom: Alex Vesker <[email protected]>
In case decapL3 action is created we would access header data even in case the SHARED flag is not set, this would lead to an invalid memory access.
--- drivers/net/mlx5/hws/mlx5dr_action.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_action.c +3 -1
@@ -1775,7 +1775,9 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action,/* Create a full modify header action list in case shared */ mlx5dr_action_prepare_decap_l3_actions (hdrs->sz, mh_data, &num_of_actions); -mlx5dr_action_prepare_decap_l3_data (hdrs->data, mh_data, num_of_actions); + +if (action->flags &MLX5DR_ACTION_FLAG_SHARED ) +mlx5dr_action_prepare_decap_l3_data (hdrs->data, mh_data, num_of_actions);/* All DecapL3 cases require the same max arg size */ arg_obj = mlx5dr_arg_create_modify_header_arg(ctx,
Signature · 1 line
2.39.3
PATCH v2 15/16 net/mlx5/hws: dump action ste arrays info
In reply to Itamar GozlanFrom: Hamdan Igbaria <[email protected]>
Dump action ste arrays info for resizing matchers.
--- drivers/net/mlx5/hws/mlx5dr_debug.c | 23 +++++++++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_debug.h | 1 + drivers/net/mlx5/hws/mlx5dr_matcher.c | 1 + drivers/net/mlx5/hws/mlx5dr_matcher.h | 1 + 4 files changed, 26 insertions(+)
drivers/net/mlx5/hws/mlx5dr_debug.c +23 -0
@@ -206,6 +206,7 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)bool is_shared =mlx5dr_context_shared_gvmi_used (matcher->tbl->ctx);bool is_root = matcher->tbl->level ==MLX5DR_ROOT_LEVEL ;enum mlx5dr_table_type tbl_type = matcher->tbl->type; +struct mlx5dr_matcher_resize_data *resize_data;struct mlx5dr_cmd_ft_query_attr ft_attr = {0 };struct mlx5dr_devx_obj *ste_0, *ste_1 =NULL ;struct mlx5dr_pool_chunk *ste;
@@ -288,6 +289,28 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)if (ret)return ret; + LIST_FOREACH(resize_data, &matcher->resize_data, next) { + ste = &resize_data->ste; + ste_pool = resize_data->action_ste_pool; +if (ste_pool) { + ste_0 =mlx5dr_pool_chunk_get_base_devx_obj (ste_pool, ste); +if (tbl_type ==MLX5DR_TABLE_TYPE_FDB ) + ste_1 =mlx5dr_pool_chunk_get_base_devx_obj_mirror (ste_pool, ste); + }else { + ste_0 =NULL ; + ste_1 =NULL ; + } + ret =fprintf (f,"%d,0x%" PRIx64",%d,%d,%d,%d\n" , +MLX5DR_DEBUG_RES_TYPE_MATCHER_RESIZABLE_ACTION_ARRAY , + (uint64_t )(uintptr_t )matcher, + resize_data->action_ste_rtc_0 ? resize_data->action_ste_rtc_0->id :0 , + ste_0 ? (int )ste_0->id :-1 , + resize_data->action_ste_rtc_1 ? resize_data->action_ste_rtc_1->id :0 , + ste_1 ? (int )ste_1->id :-1 ); +if (ret <0 ) +return ret; + } +return 0 ; out_err:
drivers/net/mlx5/hws/mlx5dr_debug.h +1 -0
@@ -25,6 +25,7 @@ enum mlx5dr_debug_res_type {MLX5DR_DEBUG_RES_TYPE_MATCHER_TEMPLATE_HASH_DEFINER =4205 ,MLX5DR_DEBUG_RES_TYPE_MATCHER_TEMPLATE_RANGE_DEFINER =4206 ,MLX5DR_DEBUG_RES_TYPE_MATCHER_TEMPLATE_COMPARE_MATCH_DEFINER =4207 , + MLX5DR_DEBUG_RES_TYPE_MATCHER_RESIZABLE_ACTION_ARRAY = 4208, }; static inline uint64_t
drivers/net/mlx5/hws/mlx5dr_matcher.c +1 -0
@@ -724,6 +724,7 @@ mlx5dr_matcher_resize_init(struct mlx5dr_matcher *src_matcher)return rte_errno; } + resize_data->ste = src_matcher->action_ste.ste; resize_data->stc = src_matcher->action_ste.stc; resize_data->action_ste_rtc_0 = src_matcher->action_ste.rtc_0; resize_data->action_ste_rtc_1 = src_matcher->action_ste.rtc_1;
drivers/net/mlx5/hws/mlx5dr_matcher.h +1 -0
@@ -62,6 +62,7 @@ struct mlx5dr_matcher_action_ste { };struct mlx5dr_matcher_resize_data { +struct mlx5dr_pool_chunk ste;struct mlx5dr_pool_chunk stc;struct mlx5dr_devx_obj *action_ste_rtc_0;struct mlx5dr_devx_obj *action_ste_rtc_1;
Signature · 1 line
2.39.3
PATCH v2 16/16 net/mlx5/hws: fix action template only term param dump print
In reply to Itamar GozlanFrom: Hamdan Igbaria <[email protected]>
The debug print of only_term param in the action template was printed incorrectly.
--- drivers/net/mlx5/hws/mlx5dr_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -1
@@ -153,7 +153,7 @@ mlx5dr_debug_dump_matcher_action_template(FILE *f, struct mlx5dr_matcher *matcheMLX5DR_DEBUG_RES_TYPE_MATCHER_ACTION_TEMPLATE , (uint64_t )(uintptr_t )at, (uint64_t )(uintptr_t )matcher, - at->only_term ?0 :1 , + at->only_term, is_root ?0 : at->num_of_action_stes, at->num_actions);if (ret <0 ) {
Signature · 1 line
2.39.3
Hi,
________________________________________
From: Itamar Gozlan <[email protected]>
Sent: Monday, May 6, 2024 2:44 PM
To: Itamar Gozlan; Erez Shitrit; Hamdan Agbariya; Yevgeny Kliteynik; Slava Ovsiienko; NBU-Contact-Thomas Monjalon (EXTERNAL); Suanming Mou; Dariusz Sosnowski; Ori Kam; Matan Azrad; Mark Bloch; Alex Vesker
Cc: [email protected]; [email protected]
Subject: [v2 01/16] net/mlx5/hws: move warn into debug level when needed
From: Erez Shitrit <[email protected]>
When the user tries to create a matcher and if failed with specific errno (E2BIG) the message will be in debug level and not in warning. It is a part of a feature when the user re-try to insert a new matching depends on that errno, no need the annoying message.
Series applied to next-net-mlx,
please make sure you are sending some cover-letter for such big series next time.
Kindest regards,
Raslan Darawsheh