From patchwork Wed Apr 17 23:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139462 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 E8C2F43E97; Thu, 18 Apr 2024 01:42:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B940A402D4; Thu, 18 Apr 2024 01:42:05 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id CA557402CC for ; Thu, 18 Apr 2024 01:42:02 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id E088520FD4C8; Wed, 17 Apr 2024 16:42:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E088520FD4C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397321; bh=K2zklWy+4N3w1AtS6Cv96tgTgQ0Wz7317GXybbEg4/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N4Tl54yoYYbeRv2e5YHSKvbt5Vhb4PF9sDjnJCgFFOMlJHBjWwzLVTJ+vyKmkzqJ1 DQXOyXFwTDrAYO5QcS8jgSTykPtHGBFC+re9W+1AYFwKfOVzj6dQX/A6LSuEeY23hF Md5B/GvhUMJa0E8fMaP0PYXvWiyUN8F2szBf1unc= 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 01/16] eal: include header required for alloca Date: Wed, 17 Apr 2024 16:41:44 -0700 Message-Id: <1713397319-26135-2-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 Include alloca.h for Linux and malloc.h for Windows to get declaration of alloca(). Signed-off-by: Tyler Retzlaff --- lib/eal/linux/include/rte_os.h | 1 + lib/eal/windows/include/rte_os.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/eal/linux/include/rte_os.h b/lib/eal/linux/include/rte_os.h index c72bf5b..18ee404 100644 --- a/lib/eal/linux/include/rte_os.h +++ b/lib/eal/linux/include/rte_os.h @@ -14,6 +14,7 @@ * which is not supported natively or named differently in Linux. */ +#include #include #include diff --git a/lib/eal/windows/include/rte_os.h b/lib/eal/windows/include/rte_os.h index 1c33058..5c9c542 100644 --- a/lib/eal/windows/include/rte_os.h +++ b/lib/eal/windows/include/rte_os.h @@ -13,6 +13,7 @@ #include #include #include +#include #include 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; From patchwork Wed Apr 17 23:41:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139464 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 B06DF43E97; Thu, 18 Apr 2024 01:42:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB18340685; Thu, 18 Apr 2024 01:42:10 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 23D96402D4 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 095B920FD4CE; Wed, 17 Apr 2024 16:42:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 095B920FD4CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=1UgesD7xdvLHA9+rwinkWvJvo0cgvqofqVp5wXh3rSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K6GtwC5rXa7OZbEE5/iEkVMfQHYUvBoJCIYOnu1ea833hrQjyY2Asg8/kbXZ3pooM z6CZZHdZghkRE0jquWlS3vi37sZubkJWAPp1WQMzxQgHeZauRGIvqo96FgbJwH4Imu LPE+vF0IEL8My5eMRqjY90q5ONfpeZm9ztI2cscA= 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 03/16] ethdev: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:46 -0700 Message-Id: <1713397319-26135-4-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/ethdev/rte_ethdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index f1c658f..cd2ed74 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -3241,7 +3241,8 @@ enum { } /* Get id-name lookup table */ - struct rte_eth_xstat_name xstats_names[cnt_xstats]; + struct rte_eth_xstat_name *xstats_names = + alloca(sizeof(struct rte_eth_xstat_name) * cnt_xstats); if (cnt_xstats != rte_eth_xstats_get_names_by_id( port_id, xstats_names, cnt_xstats, NULL)) { @@ -3342,7 +3343,7 @@ enum { return -EINVAL; if (ids && dev->dev_ops->xstats_get_names_by_id != NULL && size > 0) { - uint64_t ids_copy[size]; + uint64_t *ids_copy = alloca(sizeof(uint64_t) * size); for (i = 0; i < size; i++) { if (ids[i] < basic_count) { @@ -3535,7 +3536,7 @@ enum { if (ret < 0) return ret; expected_entries = (uint16_t)ret; - struct rte_eth_xstat xstats[expected_entries]; + struct rte_eth_xstat *xstats = alloca(sizeof(struct rte_eth_xstat) * expected_entries); basic_count = eth_dev_get_xstats_basic_count(dev); /* Return max number of stats if no ids given */ @@ -3551,7 +3552,7 @@ enum { if (ids && dev->dev_ops->xstats_get_by_id != NULL && size) { unsigned int basic_count = eth_dev_get_xstats_basic_count(dev); - uint64_t ids_copy[size]; + uint64_t *ids_copy = alloca(sizeof(uint64_t) * size); for (i = 0; i < size; i++) { if (ids[i] < basic_count) { From patchwork Wed Apr 17 23:41:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139463 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 D60C043E97; Thu, 18 Apr 2024 01:42:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 493D9402E1; Thu, 18 Apr 2024 01:42:07 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E7449402D0 for ; Thu, 18 Apr 2024 01:42:02 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1876A20FD4D1; Wed, 17 Apr 2024 16:42:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1876A20FD4D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=R/d0mpnsT5jq7tJ3HU3g5YrS5+sT06Ox8KheSbh9d+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H6Ij0InI0q6nSbuOIfT5SaqqawyEZdC7OPUNw2zOwaI8NvOX3tkjh5WuNaQv4mVDQ C8f804iqKDoy8/+6XyAsbiCdmllzhYA0m4lS2BYhKxh8Y+p7w87JV4zGoA3OQPbktI 1xQEkthoM3sYg6H9gRFiPfBPqIWIX6FZ8OXT6osI= 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 04/16] gro: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:47 -0700 Message-Id: <1713397319-26135-5-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/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; From patchwork Wed Apr 17 23:41:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139469 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 E49E943E97; Thu, 18 Apr 2024 01:43:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F65E40A6D; Thu, 18 Apr 2024 01:42:18 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id BABCB402D4 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2986020FD4D4; Wed, 17 Apr 2024 16:42:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2986020FD4D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=TKFMLqsXHL1YrHlSkq1l/5IfceOYrcp71IyrVRqwvSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnAkVtPrXv1J6gA6qdrFjFI6SCjyTFWi3Vv1cLiDsskcVbfLTkoU1cKCd2ooaYjwu FnRjm5vImxGQXi9nlKjfG9q6dwKSf/WFNr6K7RLeGQHMvPyMvbvYmrZScRMOfNd7Lj F+qclPvUdxJ9jItbSAHrlL6l+0rW1bvyQM2bM8io= 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 05/16] latencystats: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:48 -0700 Message-Id: <1713397319-26135-6-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/latencystats/rte_latencystats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c index 4ea9b0d..f59a9eb 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -159,7 +159,7 @@ struct latency_stats_nameoff { { unsigned int i, cnt = 0; uint64_t now; - float latency[nb_pkts]; + float *latency = alloca(sizeof(float) * nb_pkts); static float prev_latency; /* * Alpha represents degree of weighting decrease in EWMA, From patchwork Wed Apr 17 23:41:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139470 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 0611E43E97; Thu, 18 Apr 2024 01:43:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C20EB40A76; Thu, 18 Apr 2024 01:42:19 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D41CB402D8 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 3A91B20FD4D8; Wed, 17 Apr 2024 16:42:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3A91B20FD4D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=Ekhc1eqD34L39mkgE0kMsSoWVQkjqxsUoSyyOeCt248=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pEGPsAtONdFNI/NEpa51jNq+GZPJ6AxM5FIMkTiEAaNslhabErwXgjpSiH+YmHB8L RNpusPburArVbbbtlT9S9cwGVeM5E7iSrqgB7ckmv0VYH0dCh9iALIWrnYm3eTZJwy iwCsd/s9yMs2ZDBNtUg4xX69VK4itBL47J5UdgXc= 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 06/16] lpm: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:49 -0700 Message-Id: <1713397319-26135-7-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/lpm/rte_lpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h index 2888e5f..fc5805c 100644 --- a/lib/lpm/rte_lpm.h +++ b/lib/lpm/rte_lpm.h @@ -337,7 +337,7 @@ struct rte_lpm * uint32_t *next_hops, const unsigned n) { unsigned i; - unsigned tbl24_indexes[n]; + unsigned int *tbl24_indexes = (unsigned int *)alloca(sizeof(unsigned int) * n); const uint32_t *ptbl; /* DEBUG: Check user input arguments. */ From patchwork Wed Apr 17 23:41:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139466 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 CB71A43E97; Thu, 18 Apr 2024 01:42:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BBCF340693; Thu, 18 Apr 2024 01:42:13 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B2240402D0 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 48F0B20FD4DC; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 48F0B20FD4DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=KdqjlJ4A9aEaJV5fZaXs25eLtd12NiU5+QLK9e0/pZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ovVhkwKTzBreE57jABrqUQfB8ex21e4AxoHitXiTTlewmb6WpaeGuK4yQqhrOVf+z TtsOFF53ZNHWhLXvk9hM1Lf4J4W3mWB1Gd0LsIX4mMn+U5AAFlLjgIuebFNCdAoopP NDxC1mT0E60CLVN0BzrkuVMNmhLbLgI97JXNFTnY= 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 07/16] rcu: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:50 -0700 Message-Id: <1713397319-26135-8-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/rcu/rte_rcu_qsbr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rcu/rte_rcu_qsbr.c b/lib/rcu/rte_rcu_qsbr.c index f08d974..971c056 100644 --- a/lib/rcu/rte_rcu_qsbr.c +++ b/lib/rcu/rte_rcu_qsbr.c @@ -356,7 +356,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e) return 1; } - char data[dq->esize]; + char *data = alloca(dq->esize); dq_elem = (__rte_rcu_qsbr_dq_elem_t *)data; /* Start the grace period */ dq_elem->token = rte_rcu_qsbr_start(dq->v); @@ -419,10 +419,10 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e) cnt = 0; - char data[dq->esize]; + char *data = alloca(dq->esize); /* Check reader threads quiescent state and reclaim resources */ while (cnt < n && - rte_ring_dequeue_bulk_elem_start(dq->r, &data, + rte_ring_dequeue_bulk_elem_start(dq->r, data, dq->esize, 1, available) != 0) { dq_elem = (__rte_rcu_qsbr_dq_elem_t *)data; From patchwork Wed Apr 17 23:41:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139468 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 1C22943E97; Thu, 18 Apr 2024 01:42:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE345406BA; Thu, 18 Apr 2024 01:42:16 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A260940042 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 56B8920FD4DF; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 56B8920FD4DF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=HeHi4aMWlrcn3F3Uhgdo2uidpSzU8SkkucPl4eL1FZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONDxLVsyJOyqI78Oo5qy89WRhS87Egvypac9YF9X13A0K1MDhHSWILSCTPMABpvI3 FyLBIi4KxBE4GKDYTZXPGCXZ8VmA9jWxA5gcGh8Gq4TPPMN/LlmBNVEIzCvyDc3OwH bg9YGfguoKE8uiRJ/IP8c7xP97PaVTIMuSPYalck= 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 08/16] app/testpmd: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:51 -0700 Message-Id: <1713397319-26135-9-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 --- 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); From patchwork Wed Apr 17 23:41:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139474 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 778E543E97; Thu, 18 Apr 2024 01:43:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E58840DCD; Thu, 18 Apr 2024 01:42:26 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id DA164402D9 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 6502E20FD885; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6502E20FD885 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=4szHBJf0Z+fUSKIMOwGmNFUrf4ZSbotJcyUzr5oyLbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k3Baf/NsjHfnXXgMbD9zd0LtQ6zK3B+nbmcmeAbIt1pZ6ZyXzq9OjDCXS15aGO/qt dnuzTqXgiOG9cT3ZL0GyR8Pp/zaVBepubVb3vb//IhGOye0LvQ9ECdkx767CUT4EQg +JxcTfuuAgW7MpuHj7hvbU4CnlzmnMZn8fytOP8c= 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 09/16] test: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:52 -0700 Message-Id: <1713397319-26135-10-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 --- app/test/test.c | 2 +- app/test/test_cmdline_string.c | 2 +- app/test/test_cryptodev.c | 32 +++++++++++------------ app/test/test_cryptodev_blockcipher.c | 4 +-- app/test/test_cryptodev_crosscheck.c | 2 +- app/test/test_dmadev.c | 9 ++++--- app/test/test_hash.c | 8 +++--- app/test/test_mempool.c | 25 +++++++++--------- app/test/test_reassembly_perf.c | 4 +-- app/test/test_reorder.c | 48 +++++++++++++++++++---------------- app/test/test_service_cores.c | 9 +++---- app/test/test_thash.c | 7 +++-- 12 files changed, 79 insertions(+), 73 deletions(-) diff --git a/app/test/test.c b/app/test/test.c index 680351f..fd653cb 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -105,7 +105,7 @@ main(int argc, char **argv) { struct cmdline *cl; - char *tests[argc]; /* store an array of tests to run */ + char **tests = alloca(sizeof(char *) * argc); /* store an array of tests to run */ int test_count = 0; int i; char *extra_args; diff --git a/app/test/test_cmdline_string.c b/app/test/test_cmdline_string.c index 97516c9..e1cf860 100644 --- a/app/test/test_cmdline_string.c +++ b/app/test/test_cmdline_string.c @@ -40,7 +40,7 @@ struct string_elt_str string_elt_strs[] = { #if (CMDLINE_TEST_BUFSIZE < STR_TOKEN_SIZE) \ || (CMDLINE_TEST_BUFSIZE < STR_MULTI_TOKEN_SIZE) #undef CMDLINE_TEST_BUFSIZE -#define CMDLINE_TEST_BUFSIZE RTE_MAX(STR_TOKEN_SIZE, STR_MULTI_TOKEN_SIZE) +#define CMDLINE_TEST_BUFSIZE RTE_MAX_T(STR_TOKEN_SIZE, STR_MULTI_TOKEN_SIZE, size_t) #endif struct string_nb_str { diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1703ebc..fead21b 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2686,7 +2686,7 @@ struct crypto_unittest_params { enum rte_crypto_auth_operation op, enum rte_crypto_auth_algorithm algo) { - uint8_t hash_key[key_len]; + uint8_t *hash_key = alloca(key_len); struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -2722,7 +2722,7 @@ struct crypto_unittest_params { const uint8_t *key, const uint8_t key_len, uint8_t iv_len) { - uint8_t cipher_key[key_len]; + uint8_t *cipher_key = alloca(key_len); struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -2874,7 +2874,7 @@ struct crypto_unittest_params { const struct wireless_test_data *tdata) { const uint8_t key_len = tdata->key.len; - uint8_t cipher_auth_key[key_len]; + uint8_t *cipher_auth_key = alloca(key_len); struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -8878,7 +8878,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) const uint16_t aad_len, const uint8_t auth_len, uint8_t iv_len) { - uint8_t aead_key[key_len]; + uint8_t *aead_key = alloca(key_len); struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -12849,7 +12849,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, test_AES_GCM_auth_encryption_fail_aad_corrupt(void) { struct aead_test_data tdata; - uint8_t aad[gcm_test_case_7.aad.len]; + uint8_t *aad = alloca(gcm_test_case_7.aad.len); int res; RTE_LOG(INFO, USER1, "This is a negative test, errors are expected\n"); @@ -13238,7 +13238,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, test_AES_GCM_auth_decryption_fail_aad_corrupt(void) { struct aead_test_data tdata; - uint8_t aad[gcm_test_case_7.aad.len]; + uint8_t *aad = alloca(gcm_test_case_7.aad.len); int res; memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data)); @@ -13490,7 +13490,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, int retval; uint8_t *ciphertext, *auth_tag; uint16_t plaintext_pad_len; - uint8_t key[tdata->key.len + 1]; + uint8_t *key = alloca(tdata->key.len + 1); struct rte_cryptodev_info dev_info; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); @@ -13592,7 +13592,7 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, int retval; uint8_t *plaintext; - uint8_t key[tdata->key.len + 1]; + uint8_t *key = alloca(tdata->key.len + 1); struct rte_cryptodev_info dev_info; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); @@ -14895,7 +14895,7 @@ static int create_gmac_session(uint8_t dev_id, const struct gmac_test_data *tdata, enum rte_crypto_auth_operation auth_op) { - uint8_t auth_key[tdata->key.len]; + uint8_t *auth_key = alloca(tdata->key.len); struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -15552,7 +15552,7 @@ struct test_crypto_vector { enum rte_crypto_auth_operation auth_op) { struct crypto_testsuite_params *ts_params = &testsuite_params; - uint8_t auth_key[reference->auth_key.len + 1]; + uint8_t *auth_key = alloca(reference->auth_key.len + 1); memcpy(auth_key, reference->auth_key.data, reference->auth_key.len); @@ -15583,8 +15583,8 @@ struct test_crypto_vector { enum rte_crypto_cipher_operation cipher_op) { struct crypto_testsuite_params *ts_params = &testsuite_params; - uint8_t cipher_key[reference->cipher_key.len + 1]; - uint8_t auth_key[reference->auth_key.len + 1]; + uint8_t *cipher_key = alloca(reference->cipher_key.len + 1); + uint8_t *auth_key = alloca(reference->auth_key.len + 1); memcpy(cipher_key, reference->cipher_key.data, reference->cipher_key.len); @@ -16084,8 +16084,8 @@ struct test_crypto_vector { uint8_t *authciphertext, *plaintext, *auth_tag; uint16_t plaintext_pad_len; - uint8_t cipher_key[reference->cipher_key.len + 1]; - uint8_t auth_key[reference->auth_key.len + 1]; + uint8_t *cipher_key = alloca(reference->cipher_key.len + 1); + uint8_t *auth_key = alloca(reference->auth_key.len + 1); struct rte_cryptodev_info dev_info; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); @@ -16216,8 +16216,8 @@ struct test_crypto_vector { int retval; uint8_t *ciphertext; - uint8_t cipher_key[reference->cipher_key.len + 1]; - uint8_t auth_key[reference->auth_key.len + 1]; + uint8_t *cipher_key = alloca(reference->cipher_key.len + 1); + uint8_t *auth_key = alloca(reference->auth_key.len + 1); struct rte_cryptodev_info dev_info; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index 87a321f..da7bf2c 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -85,8 +85,8 @@ int status = TEST_SUCCESS; const struct blockcipher_test_data *tdata = t->test_data; - uint8_t cipher_key[tdata->cipher_key.len]; - uint8_t auth_key[tdata->auth_key.len]; + uint8_t *cipher_key = alloca(tdata->cipher_key.len); + uint8_t *auth_key = alloca(tdata->auth_key.len); uint32_t buf_len = tdata->ciphertext.len; uint32_t digest_len = tdata->digest.len; char *buf_p = NULL; diff --git a/app/test/test_cryptodev_crosscheck.c b/app/test/test_cryptodev_crosscheck.c index c29b19c..b9a53a4 100644 --- a/app/test/test_cryptodev_crosscheck.c +++ b/app/test/test_cryptodev_crosscheck.c @@ -894,7 +894,7 @@ struct crosscheck_testsuite_params { crosscheck_with_profile_run(const struct crosscheck_test_profile *profile) { struct crosscheck_testsuite_params *ts_params = &testsuite_params; - uint8_t input_text[profile->input_buf_len]; + uint8_t *input_text = alloca(profile->input_buf_len); uint16_t output_len, encrypted_len; uint8_t encrypted_text[MBUF_SIZE]; uint8_t output_text[MBUF_SIZE]; diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c index 143e1bc..9cbb9a6 100644 --- a/app/test/test_dmadev.c +++ b/app/test/test_dmadev.c @@ -417,9 +417,12 @@ struct runtest_param { dst_len = len / n_dst; src_len = len / n_src; - struct rte_dma_sge sg_src[n_sge], sg_dst[n_sge]; - struct rte_mbuf *src[n_sge], *dst[n_sge]; - char *src_data[n_sge], *dst_data[n_sge]; + struct rte_dma_sge *sg_src = alloca(sizeof(struct rte_dma_sge) * n_sge); + struct rte_dma_sge *sg_dst = alloca(sizeof(struct rte_dma_sge) * n_sge); + struct rte_mbuf **src = alloca(sizeof(struct rte_mbuf *) * n_sge); + struct rte_mbuf **dst = alloca(sizeof(struct rte_mbuf *) * n_sge); + char **src_data = alloca(sizeof(char *) * n_sge); + char **dst_data = alloca(sizeof(char *) * n_sge); for (i = 0 ; i < len; i++) orig_src[i] = rte_rand() & 0xFF; diff --git a/app/test/test_hash.c b/app/test/test_hash.c index d586878..65fd9e6 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -1930,8 +1930,8 @@ static int test_hash_iteration(uint32_t ext_table) .socket_id = 0, .extra_flag = hash_extra_flag, }; - int pos[total_entries]; - int expected_pos[total_entries]; + int *pos = alloca(sizeof(int) * total_entries); + int *expected_pos = alloca(sizeof(int) * total_entries); unsigned int i; size_t sz; int32_t status; @@ -2100,8 +2100,8 @@ static int test_hash_iteration(uint32_t ext_table) .socket_id = 0, .extra_flag = hash_extra_flag, }; - int pos[total_entries]; - int expected_pos[total_entries]; + int *pos = alloca(sizeof(int) * total_entries); + int *expected_pos = alloca(sizeof(int) * total_entries); unsigned int i; size_t sz; int32_t status; diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c index ad7ebd6..4672795 100644 --- a/app/test/test_mempool.c +++ b/app/test/test_mempool.c @@ -515,19 +515,20 @@ struct test_mempool_events_data { #undef RTE_TEST_TRACE_FAILURE #define RTE_TEST_TRACE_FAILURE(...) do { goto fail; } while (0) - static const size_t callback_num = 3; - static const size_t mempool_num = 2; +#define CALLBACK_NUM 3u +#define MEMPOOL_NUM 2u + static const unsigned int mempool_elt_size = 64; static const unsigned int mempool_size = 64; - struct test_mempool_events_data data[callback_num]; - struct rte_mempool *mp[mempool_num], *freed; + struct test_mempool_events_data data[CALLBACK_NUM]; + struct rte_mempool *mp[MEMPOOL_NUM], *freed; char name[RTE_MEMPOOL_NAMESIZE]; size_t i, j; int ret; memset(mp, 0, sizeof(mp)); - for (i = 0; i < callback_num; i++) { + for (i = 0; i < CALLBACK_NUM; i++) { ret = rte_mempool_event_callback_register (test_mempool_events_cb, &data[i]); RTE_TEST_ASSERT_EQUAL(ret, 0, "Failed to register the callback %zu: %s", @@ -548,7 +549,7 @@ struct test_mempool_events_data { SOCKET_ID_ANY, 0); RTE_TEST_ASSERT_NOT_NULL(mp[0], "Cannot create mempool %s: %s", name, rte_strerror(rte_errno)); - for (j = 0; j < callback_num; j++) + for (j = 0; j < CALLBACK_NUM; j++) RTE_TEST_ASSERT_EQUAL(data[j].invoked, false, "Callback %zu invoked on %s mempool creation", j, name); @@ -557,7 +558,7 @@ struct test_mempool_events_data { ret = populate(mp[0]); RTE_TEST_ASSERT_EQUAL(ret, (int)mp[0]->size, "Failed to populate mempool %s: %s", name, rte_strerror(-ret)); - for (j = 0; j < callback_num; j++) { + for (j = 0; j < CALLBACK_NUM; j++) { RTE_TEST_ASSERT_EQUAL(data[j].invoked, true, "Callback %zu not invoked on mempool %s population", j, name); @@ -589,7 +590,7 @@ struct test_mempool_events_data { "Unregistered callback 0 invoked on %s mempool populaton", name); - for (i = 0; i < mempool_num; i++) { + for (i = 0; i < MEMPOOL_NUM; i++) { memset(&data, 0, sizeof(data)); sprintf(name, "empty%zu", i); rte_mempool_free(mp[i]); @@ -599,7 +600,7 @@ struct test_mempool_events_data { */ freed = mp[i]; mp[i] = NULL; - for (j = 1; j < callback_num; j++) { + for (j = 1; j < CALLBACK_NUM; j++) { RTE_TEST_ASSERT_EQUAL(data[j].invoked, true, "Callback %zu not invoked on mempool %s destruction", j, name); @@ -615,7 +616,7 @@ struct test_mempool_events_data { name); } - for (j = 1; j < callback_num; j++) { + for (j = 1; j < CALLBACK_NUM; j++) { ret = rte_mempool_event_callback_unregister (test_mempool_events_cb, &data[j]); RTE_TEST_ASSERT_EQUAL(ret, 0, "Failed to unregister the callback %zu: %s", @@ -624,10 +625,10 @@ struct test_mempool_events_data { return TEST_SUCCESS; fail: - for (j = 0; j < callback_num; j++) + for (j = 0; j < CALLBACK_NUM; j++) rte_mempool_event_callback_unregister (test_mempool_events_cb, &data[j]); - for (i = 0; i < mempool_num; i++) + for (i = 0; i < MEMPOOL_NUM; i++) rte_mempool_free(mp[i]); return TEST_FAILED; diff --git a/app/test/test_reassembly_perf.c b/app/test/test_reassembly_perf.c index 3912179..7f4ed31 100644 --- a/app/test/test_reassembly_perf.c +++ b/app/test/test_reassembly_perf.c @@ -604,7 +604,7 @@ for (j = 0; j < 4; j++) nb_frags += frag_per_flow[i + j]; - struct rte_mbuf *buf_arr[nb_frags]; + struct rte_mbuf **buf_arr = alloca(sizeof(struct rte_mbuf *) * nb_frags); for (j = 0; j < 4; j++) { join_array(buf_arr, mbufs[i + j], prev, frag_per_flow[i + j]); @@ -815,7 +815,7 @@ for (j = 0; j < 4; j++) nb_frags += frag_per_flow[i + j]; - struct rte_mbuf *buf_arr[nb_frags]; + struct rte_mbuf **buf_arr = alloca(sizeof(struct rte_mbuf *) * nb_frags); for (j = 0; j < 4; j++) { join_array(buf_arr, mbufs[i + j], prev, frag_per_flow[i + j]); diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c index 501780c..aaa2c57 100644 --- a/app/test/test_reorder.c +++ b/app/test/test_reorder.c @@ -130,11 +130,12 @@ struct reorder_unittest_params { static int test_reorder_insert(void) { +#define INSERT_NUM_BUFS 7u + struct rte_reorder_buffer *b = NULL; struct rte_mempool *p = test_params->p; const unsigned int size = 4; - const unsigned int num_bufs = 7; - struct rte_mbuf *bufs[num_bufs]; + struct rte_mbuf *bufs[INSERT_NUM_BUFS]; int ret = 0; unsigned i; @@ -146,7 +147,7 @@ struct reorder_unittest_params { b = rte_reorder_create("test_insert", rte_socket_id(), size); TEST_ASSERT_NOT_NULL(b, "Failed to create reorder buffer"); - for (i = 0; i < num_bufs; i++) { + for (i = 0; i < INSERT_NUM_BUFS; i++) { bufs[i] = rte_pktmbuf_alloc(p); TEST_ASSERT_NOT_NULL(bufs[i], "Packet allocation failed\n"); *rte_reorder_seqn(bufs[i]) = i; @@ -207,26 +208,27 @@ struct reorder_unittest_params { ret = 0; exit: rte_reorder_free(b); - for (i = 0; i < num_bufs; i++) { + for (i = 0; i < INSERT_NUM_BUFS; i++) rte_pktmbuf_free(bufs[i]); - } + return ret; } static int test_reorder_drain(void) { +#define DRAIN_NUM_BUFS 8u + struct rte_reorder_buffer *b = NULL; struct rte_mempool *p = test_params->p; const unsigned int size = 4; - const unsigned int num_bufs = 8; - struct rte_mbuf *bufs[num_bufs]; - struct rte_mbuf *robufs[num_bufs]; + struct rte_mbuf *bufs[DRAIN_NUM_BUFS]; + struct rte_mbuf *robufs[DRAIN_NUM_BUFS]; int ret = 0; unsigned i, cnt; /* initialize all robufs to NULL */ - for (i = 0; i < num_bufs; i++) + for (i = 0; i < DRAIN_NUM_BUFS; i++) robufs[i] = NULL; /* This would create a reorder buffer instance consisting of: @@ -246,7 +248,7 @@ struct reorder_unittest_params { goto exit; } - for (i = 0; i < num_bufs; i++) { + for (i = 0; i < DRAIN_NUM_BUFS; i++) { bufs[i] = rte_pktmbuf_alloc(p); TEST_ASSERT_NOT_NULL(bufs[i], "Packet allocation failed\n"); *rte_reorder_seqn(bufs[i]) = i; @@ -320,7 +322,7 @@ struct reorder_unittest_params { ret = 0; exit: rte_reorder_free(b); - for (i = 0; i < num_bufs; i++) { + for (i = 0; i < DRAIN_NUM_BUFS; i++) { rte_pktmbuf_free(bufs[i]); rte_pktmbuf_free(robufs[i]); } @@ -337,15 +339,16 @@ struct reorder_unittest_params { static int test_reorder_drain_up_to_seqn(void) { +#define DRAIN_TO_NUM_BUFS 10u + struct rte_mempool *p = test_params->p; struct rte_reorder_buffer *b = NULL; - const unsigned int num_bufs = 10; const unsigned int size = 4; unsigned int i, cnt; int ret = 0; - struct rte_mbuf *bufs[num_bufs]; - struct rte_mbuf *robufs[num_bufs]; + struct rte_mbuf *bufs[DRAIN_TO_NUM_BUFS]; + struct rte_mbuf *robufs[DRAIN_TO_NUM_BUFS]; /* initialize all robufs to NULL */ memset(robufs, 0, sizeof(robufs)); @@ -358,7 +361,7 @@ struct reorder_unittest_params { b = rte_reorder_create("test_drain_up_to_seqn", rte_socket_id(), size); TEST_ASSERT_NOT_NULL(b, "Failed to create reorder buffer"); - for (i = 0; i < num_bufs; i++) { + for (i = 0; i < DRAIN_TO_NUM_BUFS; i++) { bufs[i] = rte_pktmbuf_alloc(p); TEST_ASSERT_NOT_NULL(bufs[i], "Packet allocation failed\n"); *rte_reorder_seqn(bufs[i]) = i; @@ -372,7 +375,7 @@ struct reorder_unittest_params { buffer_to_reorder_move(&bufs[2], b); buffer_to_reorder_move(&bufs[3], b); /* Draining 1, 2 */ - cnt = rte_reorder_drain_up_to_seqn(b, robufs, num_bufs, 3); + cnt = rte_reorder_drain_up_to_seqn(b, robufs, DRAIN_TO_NUM_BUFS, 3); if (cnt != 2) { printf("%s:%d:%d: number of expected packets not drained\n", __func__, __LINE__, cnt); @@ -396,7 +399,7 @@ struct reorder_unittest_params { buffer_to_reorder_move(&bufs[8], b); /* Drain 3 and 5 */ - cnt = rte_reorder_drain_up_to_seqn(b, robufs, num_bufs, 6); + cnt = rte_reorder_drain_up_to_seqn(b, robufs, DRAIN_TO_NUM_BUFS, 6); if (cnt != 2) { printf("%s:%d:%d: number of expected packets not drained\n", __func__, __LINE__, cnt); @@ -410,7 +413,7 @@ struct reorder_unittest_params { ret = 0; exit: rte_reorder_free(b); - for (i = 0; i < num_bufs; i++) { + for (i = 0; i < DRAIN_TO_NUM_BUFS; i++) { rte_pktmbuf_free(bufs[i]); rte_pktmbuf_free(robufs[i]); } @@ -420,14 +423,15 @@ struct reorder_unittest_params { static int test_reorder_set_seqn(void) { +#define SET_SEQN_NUM_BUFS 7u + struct rte_mempool *p = test_params->p; struct rte_reorder_buffer *b = NULL; - const unsigned int num_bufs = 7; const unsigned int size = 4; unsigned int i; int ret = 0; - struct rte_mbuf *bufs[num_bufs]; + struct rte_mbuf *bufs[SET_SEQN_NUM_BUFS]; /* This would create a reorder buffer instance consisting of: * reorder_seq = 0 @@ -437,7 +441,7 @@ struct reorder_unittest_params { b = rte_reorder_create("test_min_seqn_set", rte_socket_id(), size); TEST_ASSERT_NOT_NULL(b, "Failed to create reorder buffer"); - for (i = 0; i < num_bufs; i++) { + for (i = 0; i < SET_SEQN_NUM_BUFS; i++) { bufs[i] = rte_pktmbuf_alloc(p); if (bufs[i] == NULL) { printf("Packet allocation failed\n"); @@ -479,7 +483,7 @@ struct reorder_unittest_params { ret = 0; exit: rte_reorder_free(b); - for (i = 0; i < num_bufs; i++) + for (i = 0; i < SET_SEQN_NUM_BUFS; i++) rte_pktmbuf_free(bufs[i]); return ret; diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index c12d52d..7c45733 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -561,9 +561,8 @@ static int32_t dummy_mt_safe_cb(void *args) "Service core count not equal to one"); /* retrieve core list, checking lcore ids */ - const uint32_t size = 4; - uint32_t service_core_ids[size]; - int32_t n = rte_service_lcore_list(service_core_ids, size); + uint32_t service_core_ids[4]; + int32_t n = rte_service_lcore_list(service_core_ids, RTE_DIM(service_core_ids)); TEST_ASSERT_EQUAL(1, n, "Service core list return should equal 1"); TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0], "Service core list lcore must equal slcore_id"); @@ -589,7 +588,7 @@ static int32_t dummy_mt_safe_cb(void *args) cores_at_this_point); /* check longer service core list */ - n = rte_service_lcore_list(service_core_ids, size); + n = rte_service_lcore_list(service_core_ids, RTE_DIM(service_core_ids)); TEST_ASSERT_EQUAL(3, n, "Service core list return should equal 3"); TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0], "Service core list[0] lcore must equal 1"); @@ -607,7 +606,7 @@ static int32_t dummy_mt_safe_cb(void *args) "Service core add did not return zero"); TEST_ASSERT_EQUAL(1, rte_service_lcore_count(), "Service core count not equal to one"); - n = rte_service_lcore_list(service_core_ids, size); + n = rte_service_lcore_list(service_core_ids, RTE_DIM(service_core_ids)); TEST_ASSERT_EQUAL(1, n, "Service core list return should equal one"); TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0], "Service core list[0] lcore must equal %d", diff --git a/app/test/test_thash.c b/app/test/test_thash.c index 65d42fd..80d4106 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -576,9 +576,8 @@ enum { { struct rte_thash_ctx *ctx; struct rte_thash_subtuple_helper *h; - const int key_len = 40; int reta_sz = 6; - uint8_t initial_key[key_len]; + uint8_t initial_key[40]; const uint8_t *new_key; int ret; union rte_thash_tuple tuple; @@ -586,9 +585,9 @@ enum { unsigned int desired_value = 27 & HASH_MSK(reta_sz); uint16_t port_value = 22; - memset(initial_key, 0, key_len); + memset(initial_key, 0, RTE_DIM(initial_key)); - ctx = rte_thash_init_ctx("test", key_len, reta_sz, initial_key, + ctx = rte_thash_init_ctx("test", RTE_DIM(initial_key), reta_sz, initial_key, RTE_THASH_MINIMAL_SEQ); RTE_TEST_ASSERT(ctx != NULL, "can not create thash ctx\n"); From patchwork Wed Apr 17 23:41:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139473 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 6E1C643E97; Thu, 18 Apr 2024 01:43:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B54440DC9; Thu, 18 Apr 2024 01:42:24 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A7EA240272 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 73D9E20FD88B; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 73D9E20FD88B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=wBPWBCzKoyZlhYivMRVovQACG370LiUPsUvgQFujYxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mzmov0d66NG+V4p1/fwHo8I/uwWgq4LO3K3OLP+t0fVy/LZGyZUK6/X5BvECyQt7Z 1KLLjh4T7261Vt1tA7vlGLOa3ZfnXUhsTBn2f0fcHXzlAEydoIgHqgRQx7oONJzLYy vPn99GrWToctI3V2f/b8Sy8oDk6BvTSf38C4gwVU= 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 10/16] common/idpf: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:53 -0700 Message-Id: <1713397319-26135-11-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 --- drivers/common/idpf/idpf_common_rxtx.c | 2 +- drivers/common/idpf/idpf_common_rxtx_avx512.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/common/idpf/idpf_common_rxtx.c b/drivers/common/idpf/idpf_common_rxtx.c index 83b131e..da24b78 100644 --- a/drivers/common/idpf/idpf_common_rxtx.c +++ b/drivers/common/idpf/idpf_common_rxtx.c @@ -569,7 +569,7 @@ uint16_t nb_refill = rx_bufq->rx_free_thresh; uint16_t nb_desc = rx_bufq->nb_rx_desc; uint16_t next_avail = rx_bufq->rx_tail; - struct rte_mbuf *nmb[rx_bufq->rx_free_thresh]; + struct rte_mbuf **nmb = alloca(sizeof(struct rte_mbuf *) * rx_bufq->rx_free_thresh); uint64_t dma_addr; uint16_t delta; int i; diff --git a/drivers/common/idpf/idpf_common_rxtx_avx512.c b/drivers/common/idpf/idpf_common_rxtx_avx512.c index f65e8d5..9131bd6 100644 --- a/drivers/common/idpf/idpf_common_rxtx_avx512.c +++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c @@ -1002,7 +1002,8 @@ uint32_t n; uint32_t i; int nb_free = 0; - struct rte_mbuf *m, *free[txq->rs_thresh]; + struct rte_mbuf *m; + struct rte_mbuf **free = alloca(sizeof(struct rte_mbuf *) * txq->rs_thresh); /* check DD bits on threshold descriptor */ if ((txq->tx_ring[txq->next_dd].qw1 & @@ -1319,7 +1320,8 @@ uint32_t n; uint32_t i; int nb_free = 0; - struct rte_mbuf *m, *free[txq->rs_thresh]; + struct rte_mbuf *m; + struct rte_mbuf **free = alloca(sizeof(struct rte_mbuf *) * txq->rs_thresh); n = txq->rs_thresh; From patchwork Wed Apr 17 23:41:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139467 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 019D143E97; Thu, 18 Apr 2024 01:42:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46C3F4069F; Thu, 18 Apr 2024 01:42:15 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C2CA9402D6 for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 82F3820FD890; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 82F3820FD890 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=r/1z3oyeldf1kwkAVHIMXgIqm97PeKIRfGiTMYt18jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bctna4MW+DKnU81wKmIx1CGOfUzf8fdLl6D+tMxcM6kUbpdat+aUpbPgc8vPMXqIQ hFk0XCDCW1hoZb53kfKbjGmaltJBuZlUV/83RMtrOUJArlzkh7g/8Mr9s/k+Utne2y MXgiqZ2E6QNQIiMPY21J/ehEw6uWeFt/W3ppthu4= 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 11/16] net/i40e: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:54 -0700 Message-Id: <1713397319-26135-12-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 --- drivers/net/i40e/i40e_testpmd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c index b6ef5d6..21f5962 100644 --- a/drivers/net/i40e/i40e_testpmd.c +++ b/drivers/net/i40e/i40e_testpmd.c @@ -2168,8 +2168,7 @@ struct cmd_ptype_mapping_get_result { { struct cmd_ptype_mapping_get_result *res = parsed_result; int ret = -ENOTSUP; - int max_ptype_num = 256; - struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num]; + struct rte_pmd_i40e_ptype_mapping mapping[256]; uint16_t count; int i; @@ -2178,7 +2177,7 @@ struct cmd_ptype_mapping_get_result { ret = rte_pmd_i40e_ptype_mapping_get(res->port_id, mapping, - max_ptype_num, + RTE_DIM(mapping), &count, res->valid_only); switch (ret) { From patchwork Wed Apr 17 23:41:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139465 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 71F5743E97; Thu, 18 Apr 2024 01:42:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 391904068E; Thu, 18 Apr 2024 01:42:12 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AB7E1402CC for ; Thu, 18 Apr 2024 01:42:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9160920FD896; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9160920FD896 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=r7qIbiSm1ts9gr24Rw0x2KYQPBeVlKY4dzpvNpbAjks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1EZYP7pwPA7uzPHGvTQr50+T726ruXjx7ogIVKTafx5TFJGCTpu0JsoMyPTIH2ZT vZHpAiz/bW8jvDX2QpjMTM3L6LMuB82gaMOIcKZdthHuEfMAtuPGSdbvTBGIbLLwi8 mOstsXaHbjuxVO+ItAHjnjOCY13CMpm6B0xrYUck= 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 12/16] net/ice: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:55 -0700 Message-Id: <1713397319-26135-13-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 --- drivers/net/ice/ice_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 13aabe9..81e2b50 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1868,7 +1868,7 @@ uint64_t dma_addr; int diag, diag_pay; uint64_t pay_addr; - struct rte_mbuf *mbufs_pay[rxq->rx_free_thresh]; + struct rte_mbuf **mbufs_pay = alloca(sizeof(struct rte_mbuf *) * rxq->rx_free_thresh); /* Allocate buffers in bulk */ alloc_idx = (uint16_t)(rxq->rx_free_trigger - From patchwork Wed Apr 17 23:41:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139471 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 D6FEF43E97; Thu, 18 Apr 2024 01:43:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BFFC40A7A; Thu, 18 Apr 2024 01:42:21 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 1EE05402DC for ; Thu, 18 Apr 2024 01:42:04 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9FC9620FD89E; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9FC9620FD89E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=DP5n0HNNobIG1YowCKQUcSqvBiQy9HlTgX3JdtLvITc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hL84K8sb4FpIQo0zaBsP/M3b+XgdwJcM3ckYrYT5BQGBB3al0oogoQdMpcEh/l+4k 7WXh+BRLgsvWBLEsLS/nbkV+CwORCjAoYvXK9cEefFxD5buzjqNU67S3PKEf6uV5/j OK1qhkiVIA7SYuoUFS4affObyC5M8w39lGD6G5IA= 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 13/16] net/ixgbe: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:56 -0700 Message-Id: <1713397319-26135-14-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 --- 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; From patchwork Wed Apr 17 23:41:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139475 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 6BAFF43E97; Thu, 18 Apr 2024 01:43:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 987D440DDC; Thu, 18 Apr 2024 01:42:27 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2F7F0402E2 for ; Thu, 18 Apr 2024 01:42:04 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id ADE0F20FD8A5; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com ADE0F20FD8A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=k3CYQT0gKPaUKQb+synqrou+8ObN5NXsie4r2fIPSgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fUWhRNeXwGlaZtB1VGxi1W4c7ymleDmxCEPNPAV7sAo7651NWHrgW9U4DhJHmerHt 0U5kx9zhhgdp7zSsYo2xp7iXnHbh/RpjyyEdTgbmD2UT/g/azMxzDwWYN1lZjf8KbO BGdksrozWVFxGVTn30fGd+OUNMhjEM8mVBk6RPR8= 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 14/16] common/mlx5: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:57 -0700 Message-Id: <1713397319-26135-15-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 --- drivers/common/mlx5/mlx5_common.h | 4 ++-- drivers/common/mlx5/mlx5_devx_cmds.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 9c80277..76eba1c 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -112,10 +112,10 @@ /* Allocate a buffer on the stack and fill it with a printf format string. */ #define MKSTR(name, ...) \ int mkstr_size_##name = snprintf(NULL, 0, "" __VA_ARGS__); \ - char name[mkstr_size_##name + 1]; \ + char *name = alloca(mkstr_size_##name + 1); \ \ memset(name, 0, mkstr_size_##name + 1); \ - snprintf(name, sizeof(name), "" __VA_ARGS__) + snprintf(name, mkstr_size_##name + 1, "" __VA_ARGS__) enum { PCI_VENDOR_ID_MELLANOX = 0x15b3, diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 9b7abab..bac272f 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -284,10 +284,9 @@ struct mlx5_devx_obj * void *cmd_comp, uint64_t async_id) { - int out_len = MLX5_ST_SZ_BYTES(query_flow_counter_out) + - MLX5_ST_SZ_BYTES(traffic_counter); - uint32_t out[out_len]; + uint32_t out[MLX5_ST_SZ_BYTES(query_flow_counter_out) + MLX5_ST_SZ_BYTES(traffic_counter)]; uint32_t in[MLX5_ST_SZ_DW(query_flow_counter_in)] = {0}; + const int out_len = RTE_DIM(out); void *stats; int rc; @@ -346,7 +345,7 @@ struct mlx5_devx_obj * int klm_num = attr->klm_num; int in_size_dw = MLX5_ST_SZ_DW(create_mkey_in) + (klm_num ? RTE_ALIGN(klm_num, 4) : 0) * MLX5_ST_SZ_DW(klm); - uint32_t in[in_size_dw]; + uint32_t *in = alloca(sizeof(uint32_t) * in_size_dw); uint32_t out[MLX5_ST_SZ_DW(create_mkey_out)] = {0}; void *mkc; struct mlx5_devx_obj *mkey = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*mkey), From patchwork Wed Apr 17 23:41:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139472 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 3847E43E97; Thu, 18 Apr 2024 01:43:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C405B40A84; Thu, 18 Apr 2024 01:42:22 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2C576402E1 for ; Thu, 18 Apr 2024 01:42:04 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id BC04220FD8AD; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BC04220FD8AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=HSj9HdJwnEdAtmEF/tDCq+jm99I0k05XS3lNL6ErPpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m8pbkJySbQ3Y/OadvroSYk4j0GvKNQhMR3fNXC70i8CQWUA3+SIfsEcq/mgHo9b4W nDs4a5KgZ0x4A5fVWvcM/IPzGKnHr0fN+m/5AgJkU6Oa3RsoXMQYGSuk2kS7cp7V2+ C5ePHE++wOY6Qw4UOtSlDKkDveQBWHOfW83Xx9KA= 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 15/16] net/mlx5: remove use of VLAs for Windows built code Date: Wed, 17 Apr 2024 16:41:58 -0700 Message-Id: <1713397319-26135-16-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 --- drivers/net/mlx5/mlx5.c | 5 ++--- drivers/net/mlx5/mlx5_flow.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index d1a6382..de16acf 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1597,14 +1597,13 @@ mlx5_rt_timestamp_config(struct mlx5_dev_ctx_shared *sh, struct mlx5_hca_attr *hca_attr) { - uint32_t dw_cnt = MLX5_ST_SZ_DW(register_mtutc); - uint32_t reg[dw_cnt]; + uint32_t reg[MLX5_ST_SZ_DW(register_mtutc)]; int ret = ENOTSUP; if (hca_attr->access_register_user) ret = mlx5_devx_cmd_register_read(sh->cdev->ctx, MLX5_REGISTER_ID_MTUTC, 0, - reg, dw_cnt); + reg, RTE_DIM(reg)); if (!ret) { uint32_t ts_mode; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index f31fdfb..b52fb77 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1476,8 +1476,8 @@ struct mlx5_flow_tunnel_info { "mask/last without a spec is not" " supported"); if (item->spec && item->last && !range_accepted) { - uint8_t spec[size]; - uint8_t last[size]; + uint8_t *spec = alloca(size); + uint8_t *last = alloca(size); unsigned int i; int ret; @@ -8344,7 +8344,7 @@ struct mlx5_flow_workspace* .type = RTE_FLOW_ITEM_TYPE_END, }, }; - uint16_t queue[priv->reta_idx_n]; + uint16_t *queue = alloca(sizeof(uint16_t) * priv->reta_idx_n); struct rte_flow_action_rss action_rss = { .func = RTE_ETH_HASH_FUNCTION_DEFAULT, .level = 0, From patchwork Wed Apr 17 23:41:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139476 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 C599F43E97; Thu, 18 Apr 2024 01:43:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0527340DF8; Thu, 18 Apr 2024 01:42:29 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 27D75402CC for ; Thu, 18 Apr 2024 01:42:04 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id CAB7820FD8B4; Wed, 17 Apr 2024 16:42:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CAB7820FD8B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713397322; bh=LjoMEn0aPH4lteVUXR+zqADvR7rGOigvBbve9R5R/aA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e9jYjDFZ8t1UPJD1kVvNftZl89dYBo+OGIDXMfSI2l92e+NyKw5ZPmqG1MNJ7Tkvq p1oWJakUH/q8u6ioVdDPyYo71V+1SqU/aPIGgFuRl64LEUbrBBHZ1F/ukgksd9L475 5UrJPT5IT1mLsTi+kcLAw5ad/byufsDb5LnsDVUQ= 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 16/16] build: enable vla warnings on Windows built code Date: Wed, 17 Apr 2024 16:41:59 -0700 Message-Id: <1713397319-26135-17-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 optional C11 VLAs. When building for Windows enable -Wvla so that mingw and clang also fail if a VLA is used. Signed-off-by: Tyler Retzlaff --- config/meson.build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/meson.build b/config/meson.build index 8c8b019..9e887f2 100644 --- a/config/meson.build +++ b/config/meson.build @@ -344,6 +344,10 @@ if cc.get_id() == 'intel' warning_flags += '-diag-disable=@0@'.format(i) endforeach endif +# no VLAs in code built on Windows +if is_windows + warning_flags += '-Wvla' +endif foreach arg: warning_flags if cc.has_argument(arg) add_project_arguments(arg, language: 'c')