From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 929D543F5C;
	Mon,  6 May 2024 20:20:24 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 31B7E41153;
	Mon,  6 May 2024 20:19:16 +0200 (CEST)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id BB69240696
 for <dev@dpdk.org>; Mon,  6 May 2024 20:18:54 +0200 (CEST)
Received: by linux.microsoft.com (Postfix, from userid 1086)
 id AC11C20B2C9B; Mon,  6 May 2024 11:18:53 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AC11C20B2C9B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1715019533;
 bh=DP5n0HNNobIG1YowCKQUcSqvBiQy9HlTgX3JdtLvITc=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=ktyKHs+bjATxui/vlm6d481fstPa+9AO2Pap8EvscZLzfVJ/ObAj2JmEzHMA1dX9m
 zKpkZTrl8I1YlhlC+HMZae/TkfbORBhZmvKNVR59fSBy3teqaLtep/sAxPqrbyEimM
 uz3ISC+sGnUfxXapJP5dP8b/eGrWF62slOuGMvhI=
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: =?UTF-8?q?Morten=20Br=C3=B8rup?= <mb@smartsharesystems.com>,
 Akhil Goyal <gakhil@marvell.com>, Aman Singh <aman.deep.singh@intel.com>,
 Anatoly Burakov <anatoly.burakov@intel.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 Bruce Richardson <bruce.richardson@intel.com>,
 Chengwen Feng <fengchengwen@huawei.com>,
 Dariusz Sosnowski <dsosnowski@nvidia.com>,
 Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
 Fan Zhang <fanzhang.oss@gmail.com>, Ferruh Yigit <ferruh.yigit@amd.com>,
 Harman Kalra <hkalra@marvell.com>,
 Harry van Haaren <harry.van.haaren@intel.com>,
 Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
 Jiayu Hu <hujiayu.hu@foxmail.com>, Jingjing Wu <jingjing.wu@intel.com>,
 Kevin Laatz <kevin.laatz@intel.com>,
 Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
 Matan Azrad <matan@nvidia.com>, Ori Kam <orika@nvidia.com>,
 Pallavi Kadam <pallavi.kadam@intel.com>,
 Reshma Pattan <reshma.pattan@intel.com>,
 Sameh Gobriel <sameh.gobriel@intel.com>,
 Suanming Mou <suanmingm@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>,
 Tyler Retzlaff <roretzla@linux.microsoft.com>,
 Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
 Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
 Volodymyr Fialko <vfialko@marvell.com>,
 Yipeng Wang <yipeng1.wang@intel.com>
Subject: [PATCH v3 16/19] net/ixgbe: remove use of VLAs for Windows built code
Date: Mon,  6 May 2024 11:18:48 -0700
Message-Id: <1715019531-22796-17-git-send-email-roretzla@linux.microsoft.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1715019531-22796-1-git-send-email-roretzla@linux.microsoft.com>
References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com>
 <1715019531-22796-1-git-send-email-roretzla@linux.microsoft.com>
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

MSVC does not support VLAs, replace VLAs with standard C arrays
or alloca(). alloca() is available for all toolchain/platform
combinations officially supported by DPDK.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c          | 5 +++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index c61c52b..d460596 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3553,7 +3553,8 @@ static int ixgbe_dev_xstats_get_names_by_id(
 
 	uint16_t i;
 	uint16_t size = ixgbe_xstats_calc_num();
-	struct rte_eth_xstat_name xstats_names_copy[size];
+	struct rte_eth_xstat_name *xstats_names_copy =
+	    alloca(sizeof(struct rte_eth_xstat_name) * size);
 
 	ixgbe_dev_xstats_get_names_by_id(dev, NULL, xstats_names_copy,
 			size);
@@ -3736,7 +3737,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 
 	uint16_t i;
 	uint16_t size = ixgbe_xstats_calc_num();
-	uint64_t values_copy[size];
+	uint64_t *values_copy = alloca(sizeof(uint64_t) * size);
 
 	ixgbe_dev_xstats_get_by_id(dev, NULL, values_copy, size);
 
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index a4d9ec9..78b63b9 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -14,7 +14,7 @@
 reassemble_packets(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_bufs,
 		   uint16_t nb_bufs, uint8_t *split_flags)
 {
-	struct rte_mbuf *pkts[nb_bufs]; /*finished pkts*/
+	struct rte_mbuf **pkts = alloca(sizeof(struct rte_mbuf *) * nb_bufs); /*finished pkts*/
 	struct rte_mbuf *start = rxq->pkt_first_seg;
 	struct rte_mbuf *end =  rxq->pkt_last_seg;
 	unsigned int pkt_idx, buf_idx;
-- 
1.8.3.1