[PATCH 04/16] gro: remove use of VLAs for Windows built code

Tyler Retzlaff roretzla at linux.microsoft.com
Thu Apr 18 01:41:47 CEST 2024


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 at linux.microsoft.com>
---
 lib/gro/rte_gro.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/gro/rte_gro.c b/lib/gro/rte_gro.c
index d824eeb..0f9e85c 100644
--- a/lib/gro/rte_gro.c
+++ b/lib/gro/rte_gro.c
@@ -179,7 +179,7 @@ struct gro_ctx {
 	struct gro_vxlan_udp4_item vxlan_udp_items[RTE_GRO_MAX_BURST_ITEM_NUM]
 			= {{{0}} };
 
-	struct rte_mbuf *unprocess_pkts[nb_pkts];
+	struct rte_mbuf **unprocess_pkts = alloca(sizeof(struct rte_mbuf *) * nb_pkts);
 	uint32_t item_num;
 	int32_t ret;
 	uint16_t i, unprocess_num = 0, nb_after_gro = nb_pkts;
@@ -360,7 +360,7 @@ struct gro_ctx {
 		uint16_t nb_pkts,
 		void *ctx)
 {
-	struct rte_mbuf *unprocess_pkts[nb_pkts];
+	struct rte_mbuf **unprocess_pkts = alloca(sizeof(struct rte_mbuf *) * nb_pkts);
 	struct gro_ctx *gro_ctx = ctx;
 	void *tcp_tbl, *udp_tbl, *vxlan_tcp_tbl, *vxlan_udp_tbl, *tcp6_tbl;
 	uint64_t current_time;
-- 
1.8.3.1



More information about the dev mailing list