From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0353E43F5C; Mon, 6 May 2024 20:20:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4131410D3; Mon, 6 May 2024 20:19:10 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 91EE940687 for ; Mon, 6 May 2024 20:18:54 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 63B5D20B2C94; Mon, 6 May 2024 11:18:52 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 63B5D20B2C94 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1715019533; bh=HeHi4aMWlrcn3F3Uhgdo2uidpSzU8SkkucPl4eL1FZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PWWmwBCzlkIfQDLbyr6N2N6AHR4O9UlEnxqL3ZqbCMRGzNPUoGXwaA9lYxvX3QP+V xgTWPhwj4uJMJpb/QZ9Bl1U3rbNfQNi6cVa+RzpgrJEaiRzk/tXJOMtYNmXDm+2Xqv uQ/MKgLmmlC7wkbR9BRgI2NWLmLAMQIqLXWFAJ38= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?UTF-8?q?Morten=20Br=C3=B8rup?= , Akhil Goyal , Aman Singh , Anatoly Burakov , Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Dariusz Sosnowski , Dmitry Kozlyuk , Fan Zhang , Ferruh Yigit , Harman Kalra , Harry van Haaren , Honnappa Nagarahalli , Jiayu Hu , Jingjing Wu , Kevin Laatz , Konstantin Ananyev , Matan Azrad , Ori Kam , Pallavi Kadam , Reshma Pattan , Sameh Gobriel , Suanming Mou , Thomas Monjalon , Tyler Retzlaff , Viacheslav Ovsiienko , Vladimir Medvedkin , Volodymyr Fialko , Yipeng Wang Subject: [PATCH v3 11/19] app/testpmd: remove use of VLAs for Windows built code Date: Mon, 6 May 2024 11:18:43 -0700 Message-Id: <1715019531-22796-12-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 --- app/test-pmd/cmdline.c | 2 +- app/test-pmd/cmdline_flow.c | 9 ++++----- app/test-pmd/config.c | 16 +++++++++------- app/test-pmd/shared_rxq_fwd.c | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b7759e3..dee8f5f 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -12902,7 +12902,7 @@ struct cmd_set_port_ptypes_result { return; } - uint32_t ptypes[ret]; + uint32_t *ptypes = alloca(sizeof(uint32_t) * ret); ret = rte_eth_dev_set_ptypes(port_id, ptype_mask, ptypes, ret); if (ret < 0) { diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 60ee933..a4fe8d9 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -11546,8 +11546,7 @@ struct indlst_conf { char tmp[16]; /* Ought to be enough. */ int ret; unsigned int hexlen = len; - unsigned int length = 256; - uint8_t hex_tmp[length]; + uint8_t hex_tmp[256]; /* Arguments are expected. */ if (!arg_data) @@ -11574,7 +11573,7 @@ struct indlst_conf { str += 2; hexlen -= 2; } - if (hexlen > length) + if (hexlen > RTE_DIM(hex_tmp)) goto error; ret = parse_hex_string(str, hex_tmp, &hexlen); if (ret < 0) @@ -11707,7 +11706,7 @@ struct indlst_conf { void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - char str2[len + 1]; + char *str2 = alloca(len + 1); struct in_addr tmp; int ret; @@ -11753,7 +11752,7 @@ struct indlst_conf { void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - char str2[len + 1]; + char *str2 = alloca(len + 1); struct in6_addr tmp; int ret; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ba1007a..4dce6fa 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1760,7 +1760,8 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops) { struct rte_port *port; struct rte_flow_error error; - const struct rte_flow_queue_attr *attr_list[nb_queue]; + const struct rte_flow_queue_attr **attr_list = + alloca(sizeof(struct rte_flow_queue_attr *) * nb_queue); int std_queue; if (port_id_is_invalid(port_id, ENABLED_WARN) || @@ -2577,10 +2578,10 @@ struct rte_flow_meter_policy * int ret; uint32_t i; struct rte_flow_error error; - struct rte_flow_pattern_template - *flow_pattern_templates[nb_pattern_templates]; - struct rte_flow_actions_template - *flow_actions_templates[nb_actions_templates]; + struct rte_flow_pattern_template **flow_pattern_templates = + alloca(sizeof(struct rte_flow_pattern_template *) * nb_pattern_templates); + struct rte_flow_actions_template **flow_actions_templates = + alloca(sizeof(struct rte_flow_actions_template *) * nb_actions_templates); if (port_id_is_invalid(port_id, ENABLED_WARN) || port_id == (portid_t)RTE_PORT_ALL) @@ -5460,7 +5461,7 @@ struct igb_ring_desc_16_bytes { char *end = NULL; int min, max; int value, i; - unsigned int marked[maxsize]; + unsigned int *marked = alloca(sizeof(unsigned int) * maxsize); if (list == NULL || values == NULL) return 0; @@ -7201,7 +7202,8 @@ static const char *get_ptype_str(uint32_t ptype) if (eth_dev_info_get_print_err(port_id, &dev_info)) return; - struct rte_ether_addr addr[dev_info.max_mac_addrs]; + struct rte_ether_addr *addr = + alloca(sizeof(struct rte_ether_addr) * dev_info.max_mac_addrs); rc = rte_eth_macaddrs_get(port_id, addr, dev_info.max_mac_addrs); if (rc < 0) return; diff --git a/app/test-pmd/shared_rxq_fwd.c b/app/test-pmd/shared_rxq_fwd.c index 623d62d..5d4ffff 100644 --- a/app/test-pmd/shared_rxq_fwd.c +++ b/app/test-pmd/shared_rxq_fwd.c @@ -92,7 +92,7 @@ static bool shared_rxq_fwd(struct fwd_stream *fs) { - struct rte_mbuf *pkts_burst[nb_pkt_per_burst]; + struct rte_mbuf **pkts_burst = alloca(sizeof(struct rte_mbuf *) * nb_pkt_per_burst); uint16_t nb_rx; nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); -- 1.8.3.1