From patchwork Wed Apr 17 23:41:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139461 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5A2BF43E97; Thu, 18 Apr 2024 01:42:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3618C402E3; Thu, 18 Apr 2024 01:42:04 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id BDA7040272 for ; Thu, 18 Apr 2024 01:42:02 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id EF75220FD4CB; Wed, 17 Apr 2024 16:42:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EF75220FD4CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397321; bh=VX1JW+TCNJFvDGb5Nd5z00eVBNn2wuTDEyeJ3OyqkYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dg6CDCE7atTW+pi65MhG1OiHGMjqDOWYW9IcFMQJ8XB6n+pG6D92o02Sudul6AK9k shbc7Vj7wp6HUtVsJ6iDkB+dQR6sW5E56s66SaB/3MleBk2is/2SXTLb9XoQCGaU6y 3ESl8/C62aIRgHEjvEBT6hpDvy1c3mlrZcvpLI+4= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?utf-8?q?Morten_Br=C3=B8rup?= , Akhil Goyal , Aman Singh , Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Dariusz Sosnowski , Dmitry Kozlyuk , Fan Zhang , Ferruh Yigit , 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 , Yuying Zhang Subject: [PATCH 02/16] hash: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:45 -0700 Message-Id: <1713397319-26135-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> References: <1713397319-26135-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 --- lib/hash/rte_cuckoo_hash.c | 4 ++-- lib/hash/rte_thash.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c index 9cf9464..bd2ff08 100644 --- a/lib/hash/rte_cuckoo_hash.c +++ b/lib/hash/rte_cuckoo_hash.c @@ -2359,7 +2359,7 @@ struct rte_hash * (num_keys > RTE_HASH_LOOKUP_BULK_MAX) || (hit_mask == NULL)), -EINVAL); - int32_t positions[num_keys]; + int32_t *positions = alloca(sizeof(int32_t) * num_keys); __rte_hash_lookup_bulk(h, keys, num_keys, positions, hit_mask, data); @@ -2475,7 +2475,7 @@ struct rte_hash * (num_keys > RTE_HASH_LOOKUP_BULK_MAX) || (hit_mask == NULL)), -EINVAL); - int32_t positions[num_keys]; + int32_t *positions = alloca(sizeof(int32_t) * num_keys); __rte_hash_lookup_with_hash_bulk(h, keys, sig, num_keys, positions, hit_mask, data); diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 68f653f..633e211 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -771,7 +771,7 @@ struct rte_thash_subtuple_helper * uint32_t desired_value, unsigned int attempts, rte_thash_check_tuple_t fn, void *userdata) { - uint32_t tmp_tuple[tuple_len / sizeof(uint32_t)]; + uint32_t *tmp_tuple = alloca(tuple_len); unsigned int i, j, ret = 0; uint32_t hash, adj_bits; const uint8_t *hash_key;