patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Tal Shnaiderman <talshn@nvidia.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, matan@nvidia.com, rasland@nvidia.com,
	ophirmu@nvidia.com, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v5 01/32] net/mlx5: fix folding constant array error
Date: Mon, 28 Dec 2020 11:54:05 +0200	[thread overview]
Message-ID: <20201228095436.14996-2-talshn@nvidia.com> (raw)
In-Reply-To: <20201228095436.14996-1-talshn@nvidia.com>

Before this commit the PMD used:
   const int elt_n = 8
   const int *stack[elt_n];

In Windows clang compiler complains:
net/mlx5/mlx5_flow.c:215:19: error: variable length array folded
to constant array as an extension [-Werror,-Wgnu-folding-constant]

Fix it by using a constant macro definition instead of a variable:
   #define MLX5_RSS_EXP_ELT_N 8
   const int *stack[MLX5_RSS_EXP_ELT_N];

Fixes: c7870bfe09dc ("ethdev: move RSS expansion code to mlx5 driver")
Cc: stable@dpdk.org

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 82e24d7067..bf86aaaa39 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -212,6 +212,8 @@ mlx5_flow_expand_rss_item_complete(const struct rte_flow_item *item)
 	return ret;
 }
 
+#define MLX5_RSS_EXP_ELT_N 8
+
 /**
  * Expand RSS flows into several possible flows according to the RSS hash
  * fields requested and the driver capabilities.
@@ -242,13 +244,12 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size,
 		     const struct mlx5_flow_expand_node graph[],
 		     int graph_root_index)
 {
-	const int elt_n = 8;
 	const struct rte_flow_item *item;
 	const struct mlx5_flow_expand_node *node = &graph[graph_root_index];
 	const int *next_node;
-	const int *stack[elt_n];
+	const int *stack[MLX5_RSS_EXP_ELT_N];
 	int stack_pos = 0;
-	struct rte_flow_item flow_items[elt_n];
+	struct rte_flow_item flow_items[MLX5_RSS_EXP_ELT_N];
 	unsigned int i;
 	size_t lsize;
 	size_t user_pattern_size = 0;
@@ -261,10 +262,10 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size,
 
 	memset(&missed_item, 0, sizeof(missed_item));
 	lsize = offsetof(struct mlx5_flow_expand_rss, entry) +
-		elt_n * sizeof(buf->entry[0]);
+		MLX5_RSS_EXP_ELT_N * sizeof(buf->entry[0]);
 	if (lsize <= size) {
 		buf->entry[0].priority = 0;
-		buf->entry[0].pattern = (void *)&buf->entry[elt_n];
+		buf->entry[0].pattern = (void *)&buf->entry[MLX5_RSS_EXP_ELT_N];
 		buf->entries = 0;
 		addr = buf->entry[0].pattern;
 	}
@@ -367,7 +368,7 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size,
 		/* Go deeper. */
 		if (node->next) {
 			next_node = node->next;
-			if (stack_pos++ == elt_n) {
+			if (stack_pos++ == MLX5_RSS_EXP_ELT_N) {
 				rte_errno = E2BIG;
 				return -rte_errno;
 			}
-- 
2.16.1.windows.4


  parent reply	other threads:[~2020-12-28  9:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201027232335.31427-1-ophirmu@nvidia.com>
2020-10-27 23:22 ` [dpdk-stable] [PATCH v1 01/72] mlx5: fix relaxed ordering DevX flow Ophir Munk
     [not found]   ` <20201210150648.8784-1-talshn@nvidia.com>
2020-12-10 15:06     ` [dpdk-stable] [PATCH v2 01/33] net/mlx5: fix folding constant array error Tal Shnaiderman
     [not found]       ` <20201213102056.11380-1-talshn@nvidia.com>
2020-12-13 10:20         ` [dpdk-stable] [PATCH v3 01/32] " Tal Shnaiderman
     [not found]           ` <20201213205005.7300-1-talshn@nvidia.com>
2020-12-13 20:49             ` [dpdk-stable] [PATCH v4 " Tal Shnaiderman
     [not found]               ` <20201228095436.14996-1-talshn@nvidia.com>
2020-12-28  9:54                 ` Tal Shnaiderman [this message]
2020-12-28  9:54                 ` [dpdk-stable] [PATCH v5 04/32] net/mlx5: fix freeing packet pacing Tal Shnaiderman
2020-12-28  9:54                 ` [dpdk-stable] [PATCH v5 11/32] net/mlx5: fix adding destroy flow action wrapper Tal Shnaiderman
2020-12-13 20:49             ` [dpdk-stable] [PATCH v4 04/32] net/mlx5: fix freeing packet pacing Tal Shnaiderman
2020-12-13 20:49             ` [dpdk-stable] [PATCH v4 11/32] net/mlx5: fix adding destroy flow action wrapper Tal Shnaiderman
2020-12-13 10:20         ` [dpdk-stable] [PATCH v3 04/32] net/mlx5: fix freeing packet pacing Tal Shnaiderman
2020-12-13 10:20         ` [dpdk-stable] [PATCH v3 11/32] net/mlx5: fix adding destroy flow action wrapper Tal Shnaiderman
2020-12-10 15:06     ` [dpdk-stable] [PATCH v2 04/33] net/mlx5: fix freeing packet pacing Tal Shnaiderman
2020-12-10 15:06     ` [dpdk-stable] [PATCH v2 11/33] net/mlx5: fix adding destroy flow action wrapper Tal Shnaiderman
2020-10-27 23:22 ` [dpdk-stable] [PATCH v1 02/72] net/mlx5: fix flow sample definitions Ophir Munk
2020-10-27 23:22 ` [dpdk-stable] [PATCH v1 06/72] net/mlx5: fix freeing packet pacing Ophir Munk
2020-10-27 23:23 ` [dpdk-stable] [PATCH v1 62/72] net/mlx5/linux: fix add OS dest_devx_tir action Ophir Munk
2020-10-27 23:23 ` [dpdk-stable] [PATCH v1 70/72] common/mlx5: fix Windows warnings on missing enum Ophir Munk
2020-10-27 23:23 ` [dpdk-stable] [PATCH v1 71/72] net/mlx5: fix Windows warnings on get_if_name Ophir Munk
2020-10-28  7:34   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201228095436.14996-2-talshn@nvidia.com \
    --to=talshn@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=ophirmu@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).