DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/4] net/mlx5/hws: fix bug in pattern creation
@ 2023-03-20 14:53 Erez Shitrit
  2023-03-20 14:53 ` [PATCH 2/4] net/mlx5/hws: shared context uses defaults from local context Erez Shitrit
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Erez Shitrit @ 2023-03-20 14:53 UTC (permalink / raw)
  To: dev; +Cc: valex, Matan Azrad, Viacheslav Ovsiienko


When creating a new pattern the data area should be clean, otherwise
when the data will come from the arg object it will do OR operation on
the data part in the pattern.

Fixes: f8c8a6d8440d ("net/mlx5/hws: add action object")
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_cmd.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index a444fb4438..0adcedd9c9 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -523,9 +523,11 @@ mlx5dr_cmd_header_modify_pattern_create(struct ibv_context *ctx,
 	uint32_t in[MLX5_ST_SZ_DW(create_header_modify_pattern_in)] = {0};
 	uint32_t out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)] = {0};
 	struct mlx5dr_devx_obj *devx_obj;
-	void *pattern_data;
+	uint64_t *pattern_data;
+	int num_of_actions;
 	void *pattern;
 	void *attr;
+	int i;
 
 	if (pattern_length > MAX_ACTIONS_DATA_IN_HEADER_MODIFY) {
 		DR_LOG(ERR, "Pattern length %d exceeds limit %d",
@@ -551,9 +553,19 @@ mlx5dr_cmd_header_modify_pattern_create(struct ibv_context *ctx,
 	/* Pattern_length is in ddwords */
 	MLX5_SET(header_modify_pattern_in, pattern, pattern_length, pattern_length / (2 * DW_SIZE));
 
-	pattern_data = MLX5_ADDR_OF(header_modify_pattern_in, pattern, pattern_data);
+	pattern_data = (uint64_t *)MLX5_ADDR_OF(header_modify_pattern_in, pattern, pattern_data);
 	memcpy(pattern_data, actions, pattern_length);
 
+	num_of_actions = pattern_length / MLX5DR_MODIFY_ACTION_SIZE;
+	for (i = 0; i < num_of_actions; i++) {
+		int type;
+
+		type = MLX5_GET(set_action_in, &pattern_data[i], action_type);
+		if (type != MLX5_MODIFICATION_TYPE_COPY)
+			/* Action typ-copy use all bytes for control */
+			MLX5_SET(set_action_in, &pattern_data[i], data, 0);
+	}
+
 	devx_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out, sizeof(out));
 	if (!devx_obj->obj) {
 		DR_LOG(ERR, "Failed to create header_modify_pattern");
-- 
2.18.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-20 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 14:53 [PATCH 1/4] net/mlx5/hws: fix bug in pattern creation Erez Shitrit
2023-03-20 14:53 ` [PATCH 2/4] net/mlx5/hws: shared context uses defaults from local context Erez Shitrit
2023-03-20 14:53 ` [PATCH 3/4] net/mlx5/hws: keep all jumbo tag for deletion Erez Shitrit
2023-03-20 14:53 ` [PATCH 4/4] net/mlx5/hws: add check for modify-header actions Erez Shitrit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).