From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3F252A051C
	for <public@inbox.dpdk.org>; Tue, 11 Feb 2020 12:42:21 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 3461F1C012;
	Tue, 11 Feb 2020 12:42:21 +0100 (CET)
Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com
 [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 61CB91C012
 for <stable@dpdk.org>; Tue, 11 Feb 2020 12:42:19 +0100 (CET)
Received: by mail-wr1-f65.google.com with SMTP id g3so10869501wrs.12
 for <stable@dpdk.org>; Tue, 11 Feb 2020 03:42:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=/EY+g8/WtItVC+Ekm/AEzJn5kGlox6QWLjORYLp9m7U=;
 b=UM6uxbeL9H1N6BMx+uE2dzwkN78LTRT/1jIAiGA/K/rsDO7JT2nZjZoLqMqzmN5nSy
 yaMvN+RfKRNB89JBHHkd+aDH/Q+Jmm4H3NpSrNvhcsHtYDtEk4LAWu0Lam7ssVdDB/TE
 tHhW60MpcsjEK7BQc4HxC6p50WDLg0PY9oG+QeApoZYmX8g5EKs9tApZiFZ1cDPTIBug
 7uAtfZYa1mZWfmVkXnu2g4NyD8ykiqigRgw6oI8gD+qLaAJ6Qjg0+nLzOe+Ft+IWPjBm
 e7lUqv1vjiXUxDcP5VltGeATGsON1/sYydv4/yZzSlkQ9dYjTTWwA/0e3SLbUYAFoKCK
 sjhQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=/EY+g8/WtItVC+Ekm/AEzJn5kGlox6QWLjORYLp9m7U=;
 b=NDY+6Kub4Miccrry8X6pP71HZ27bFJWb7YVR0vqddlfYdZpLSVJ9qVe4HIKBGCLcD7
 EZtloWvSwUiEiCz2G81FxfPmwKzCRaP0KMyD9OvxztefwWGh7bUJPN43efPturvQ7mX0
 wQB34H8iRnN1M5VapL4Xkd+kxSPMlEXsPZ8/n92b+U61OU/rTX/yCgWgYjz/OQ/qlM+L
 d+Rgr13pRZPQciOlPVs6QxcT7hRWJDWkl88Kr7KGzpvyBIqNJ5ymKWrE/TvUotIvdDgy
 TMSV5ZOcDpH6A5/tLoIF0y+ov4/iZ375ccqnESwsWJoyvoeUQRSL52jgnP3QtEc5EOqH
 Sq3g==
X-Gm-Message-State: APjAAAUWjurJQJRvFqeOgiyejL/7vkEsyrGd6+Xqvb5gXZHct42MJZrG
 Z7H/OwmM2eIyTDbENiIfKlVKkoaqPos=
X-Google-Smtp-Source: APXvYqwzl4K5cz8tZWBD4mNYnAWE1JUjNAKiG8JjqtwT3CaJO78jhLuRj8TT6TjlMD8hQVbLZzxoEw==
X-Received: by 2002:a5d:55d2:: with SMTP id i18mr7834372wrw.287.1581421338854; 
 Tue, 11 Feb 2020 03:42:18 -0800 (PST)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id p11sm5078003wrn.40.2020.02.11.03.42.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 11 Feb 2020 03:42:18 -0800 (PST)
From: luca.boccassi@gmail.com
To: Dekel Peled <dekelp@mellanox.com>
Cc: Matan Azrad <matan@mellanox.com>,
 Viacheslav Ovsiienko <viacheslavo@mellanox.com>,
 dpdk stable <stable@dpdk.org>
Date: Tue, 11 Feb 2020 11:22:00 +0000
Message-Id: <20200211112216.3929-174-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com>
References: <20200211112216.3929-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'net/mlx5: fix dirty array of actions' has been
	queued to stable release 19.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 19.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/13/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 9aab6dd691a5d3f3555e8c6f3ad0ffb1198ed98e Mon Sep 17 00:00:00 2001
From: Dekel Peled <dekelp@mellanox.com>
Date: Wed, 5 Feb 2020 08:42:02 +0200
Subject: [PATCH] net/mlx5: fix dirty array of actions

[ upstream commit ff44839929d0bea529be581ba784a48d085ab893 ]

Previous patch changed the format of struct
mlx5_flow_dv_modify_hdr_resource, to use a flexible array for
modification actions.
In __flow_dv_translate() a union was defined with item of this struct,
and an array of maximal possible size.
Array elements are filled in several functions.
In function flow_dv_convert_action_set_reg(), array element is filled
partially, while the other fields of this array element are left
uninitialized.
This may cause failure of flow_dv_modify_hdr_resource_register()
when calling driver function with the 'dirty' array.

This patch updates flow_dv_convert_action_set_reg(), setting the
selected array element fields while clearing the other fields.
Other functions that fill the same array elements are also updated
for clarity and proofing future use.

Fixes: 024e95759c16 ("net/mlx5: fix modify actions support limitation")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7bf1aa518d..df5e279ff4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -380,10 +380,12 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,
 			 off_b - __builtin_clz(mask);
 		assert(size_b);
 		size_b = size_b == sizeof(uint32_t) * CHAR_BIT ? 0 : size_b;
-		actions[i].action_type = type;
-		actions[i].field = field->id;
-		actions[i].offset = off_b;
-		actions[i].length = size_b;
+		actions[i] = (struct mlx5_modification_cmd) {
+			.action_type = type,
+			.field = field->id,
+			.offset = off_b,
+			.length = size_b,
+		};
 		/* Convert entire record to expected big-endian format. */
 		actions[i].data0 = rte_cpu_to_be_32(actions[i].data0);
 		if (type == MLX5_MODIFICATION_TYPE_COPY) {
@@ -573,10 +575,12 @@ flow_dv_convert_action_modify_vlan_vid
 		return rte_flow_error_set(error, EINVAL,
 			 RTE_FLOW_ERROR_TYPE_ACTION, NULL,
 			 "too many items to modify");
-	actions[i].action_type = MLX5_MODIFICATION_TYPE_SET;
-	actions[i].field = field->id;
-	actions[i].length = field->size;
-	actions[i].offset = field->offset;
+	actions[i] = (struct mlx5_modification_cmd) {
+		.action_type = MLX5_MODIFICATION_TYPE_SET,
+		.field = field->id,
+		.length = field->size,
+		.offset = field->offset,
+	};
 	actions[i].data0 = rte_cpu_to_be_32(actions[i].data0);
 	actions[i].data1 = conf->vlan_vid;
 	actions[i].data1 = actions[i].data1 << 16;
@@ -908,8 +912,10 @@ flow_dv_convert_action_set_reg
 					  "too many items to modify");
 	assert(conf->id != REG_NONE);
 	assert(conf->id < RTE_DIM(reg_to_field));
-	actions[i].action_type = MLX5_MODIFICATION_TYPE_SET;
-	actions[i].field = reg_to_field[conf->id];
+	actions[i] = (struct mlx5_modification_cmd) {
+		.action_type = MLX5_MODIFICATION_TYPE_SET,
+		.field = reg_to_field[conf->id],
+	};
 	actions[i].data0 = rte_cpu_to_be_32(actions[i].data0);
 	actions[i].data1 = rte_cpu_to_be_32(conf->data);
 	++i;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-11 11:17:44.625373626 +0000
+++ 0174-net-mlx5-fix-dirty-array-of-actions.patch	2020-02-11 11:17:38.820009200 +0000
@@ -1,8 +1,10 @@
-From ff44839929d0bea529be581ba784a48d085ab893 Mon Sep 17 00:00:00 2001
+From 9aab6dd691a5d3f3555e8c6f3ad0ffb1198ed98e Mon Sep 17 00:00:00 2001
 From: Dekel Peled <dekelp@mellanox.com>
 Date: Wed, 5 Feb 2020 08:42:02 +0200
 Subject: [PATCH] net/mlx5: fix dirty array of actions
 
+[ upstream commit ff44839929d0bea529be581ba784a48d085ab893 ]
+
 Previous patch changed the format of struct
 mlx5_flow_dv_modify_hdr_resource, to use a flexible array for
 modification actions.
@@ -21,7 +23,6 @@
 for clarity and proofing future use.
 
 Fixes: 024e95759c16 ("net/mlx5: fix modify actions support limitation")
-Cc: stable@dpdk.org
 
 Signed-off-by: Dekel Peled <dekelp@mellanox.com>
 Acked-by: Matan Azrad <matan@mellanox.com>
@@ -31,12 +32,12 @@
  1 file changed, 16 insertions(+), 10 deletions(-)
 
 diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
-index 2878393b17..3daabd3e68 100644
+index 7bf1aa518d..df5e279ff4 100644
 --- a/drivers/net/mlx5/mlx5_flow_dv.c
 +++ b/drivers/net/mlx5/mlx5_flow_dv.c
-@@ -385,10 +385,12 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,
+@@ -380,10 +380,12 @@ flow_dv_convert_modify_action(struct rte_flow_item *item,
  			 off_b - __builtin_clz(mask);
- 		MLX5_ASSERT(size_b);
+ 		assert(size_b);
  		size_b = size_b == sizeof(uint32_t) * CHAR_BIT ? 0 : size_b;
 -		actions[i].action_type = type;
 -		actions[i].field = field->id;
@@ -51,7 +52,7 @@
  		/* Convert entire record to expected big-endian format. */
  		actions[i].data0 = rte_cpu_to_be_32(actions[i].data0);
  		if (type == MLX5_MODIFICATION_TYPE_COPY) {
-@@ -578,10 +580,12 @@ flow_dv_convert_action_modify_vlan_vid
+@@ -573,10 +575,12 @@ flow_dv_convert_action_modify_vlan_vid
  		return rte_flow_error_set(error, EINVAL,
  			 RTE_FLOW_ERROR_TYPE_ACTION, NULL,
  			 "too many items to modify");
@@ -68,10 +69,10 @@
  	actions[i].data0 = rte_cpu_to_be_32(actions[i].data0);
  	actions[i].data1 = conf->vlan_vid;
  	actions[i].data1 = actions[i].data1 << 16;
-@@ -913,8 +917,10 @@ flow_dv_convert_action_set_reg
+@@ -908,8 +912,10 @@ flow_dv_convert_action_set_reg
  					  "too many items to modify");
- 	MLX5_ASSERT(conf->id != REG_NONE);
- 	MLX5_ASSERT(conf->id < RTE_DIM(reg_to_field));
+ 	assert(conf->id != REG_NONE);
+ 	assert(conf->id < RTE_DIM(reg_to_field));
 -	actions[i].action_type = MLX5_MODIFICATION_TYPE_SET;
 -	actions[i].field = reg_to_field[conf->id];
 +	actions[i] = (struct mlx5_modification_cmd) {