From patchwork Tue Feb 4 16:21:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150868 X-Patchwork-Delegate: david.marchand@redhat.com 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 B2C654618E; Tue, 4 Feb 2025 17:23:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AB364042E; Tue, 4 Feb 2025 17:22:53 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3EE834025F for ; Tue, 4 Feb 2025 17:22:48 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 3FB2320BCAD8; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3FB2320BCAD8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=YzGc7hhQtj8BdrIVxvCHYME5w8BEBaj2w46xJ9lYvTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asyQbPOgt2y0zaUbQlXieIgK49UKHZxDfmORltwFc5fWWHhn8S4ZH267/tsSMBYNB 3OJD/zBx3r9fBo3pVEdCw+bkzx24lueFikgIVrJvduwJJ/qmzLe73zi46DqxgqDz0M auVFNeTMtwhSF6gWk8lAVtvFFRZrhBplGANUfH3I= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v20 01/27] eal: include header required for alloca Date: Tue, 4 Feb 2025 08:21:38 -0800 Message-Id: <1738686124-16173-2-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Tyler Retzlaff Include alloca.h for Linux and malloc.h for Windows to get declaration of alloca(). Signed-off-by: Tyler Retzlaff --- lib/eal/freebsd/include/rte_os.h | 1 + lib/eal/linux/include/rte_os.h | 1 + lib/eal/windows/include/rte_os.h | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/eal/freebsd/include/rte_os.h b/lib/eal/freebsd/include/rte_os.h index 62e70dc15b..94b9275beb 100644 --- a/lib/eal/freebsd/include/rte_os.h +++ b/lib/eal/freebsd/include/rte_os.h @@ -11,6 +11,7 @@ */ #include +#include /* Declares alloca() */ #include /* These macros are compatible with system's sys/queue.h. */ diff --git a/lib/eal/linux/include/rte_os.h b/lib/eal/linux/include/rte_os.h index 35c07c70cb..20eff0409a 100644 --- a/lib/eal/linux/include/rte_os.h +++ b/lib/eal/linux/include/rte_os.h @@ -10,6 +10,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 9d69467aaa..d09adeb3b4 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 Tue Feb 4 16:21:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150866 X-Patchwork-Delegate: david.marchand@redhat.com 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 2829A4618E; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF8D9400D7; Tue, 4 Feb 2025 17:22:48 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E7CE4400D6 for ; Tue, 4 Feb 2025 17:22:47 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 4BEE1205491C; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4BEE1205491C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=2fmXqIY7d9DD5WHHGxmMWwbKO6+hmuFgIZsUSG4mry0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUHomLmlCjINe5cNG4WglbVwLWGp1+8oVLt/4XI1J839NjMA8ZNQ4h4EwWTviMus+ QyLH00LEKk5xcLz3y9ZGXeRpBGtKg6vMtd+XluyeTKr21eWxJJ2rL1zt7O0KkzF3gV wvr7HB4DLyIJ9SvBIAPF6Rw32j8q17ETqcEJs3qA= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 02/27] eal/linux: remove use of VLAs Date: Tue, 4 Feb 2025 08:21:39 -0800 Message-Id: <1738686124-16173-3-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Konstantin Ananyev 1) ./lib/eal/linux/eal_interrupts.c:1073:16 : warning: ISO C90 forbids variable length array 'events' MSVC does not support VLAs. Use alloca() to allocate the memory on the stack. 2) ./lib/eal/linux/eal_interrupts.c:1319:16 : warning: ISO C90 forbids variable length array 'evs' make eal_epoll_wait() use a fixed size array and use it though multiple iterations to process up to @maxevents events. Note that technically it is not one to one replacement, as here we might reduce number of events returned by first call to epoll_wait(..., timeout); Signed-off-by: Konstantin Ananyev --- lib/eal/linux/eal_interrupts.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c index 6436f796eb..23039964fc 100644 --- a/lib/eal/linux/eal_interrupts.c +++ b/lib/eal/linux/eal_interrupts.c @@ -34,6 +34,8 @@ #define EAL_INTR_EPOLL_WAIT_FOREVER (-1) #define NB_OTHER_INTR 1 +#define MAX_ITER_EVNUM RTE_EVENT_ETH_INTR_RING_SIZE + static RTE_DEFINE_PER_LCORE(int, _epfd) = -1; /**< epoll fd per thread */ /** @@ -1070,7 +1072,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) static void eal_intr_handle_interrupts(int pfd, unsigned totalfds) { - struct epoll_event events[totalfds]; + struct epoll_event *events = alloca(sizeof(struct epoll_event) * totalfds); int nfds = 0; for(;;) { @@ -1316,8 +1318,9 @@ static int eal_epoll_wait(int epfd, struct rte_epoll_event *events, int maxevents, int timeout, bool interruptible) { - struct epoll_event evs[maxevents]; int rc; + uint32_t i, k, n, num; + struct epoll_event evs[MAX_ITER_EVNUM]; if (!events) { EAL_LOG(ERR, "rte_epoll_event can't be NULL"); @@ -1328,12 +1331,31 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events, if (epfd == RTE_EPOLL_PER_THREAD) epfd = rte_intr_tls_epfd(); + num = maxevents; + n = RTE_MIN(RTE_DIM(evs), num); + + /* Process events in chunks of MAX_ITER_EVNUM */ + while (1) { - rc = epoll_wait(epfd, evs, maxevents, timeout); + rc = epoll_wait(epfd, evs, n, timeout); if (likely(rc > 0)) { + /* epoll_wait has at least one fd ready to read */ - rc = eal_epoll_process_event(evs, rc, events); - break; + for (i = 0, k = 0; rc > 0;) { + k += rc; + rc = eal_epoll_process_event(evs, rc, + events + i); + i += rc; + + /* + * try to read more events that are already + * available (up to maxevents in total). + */ + n = RTE_MIN(RTE_DIM(evs), num - k); + rc = (n == 0) ? 0 : epoll_wait(epfd, evs, n, 0); + } + return i; + } else if (rc < 0) { if (errno == EINTR) { if (interruptible) From patchwork Tue Feb 4 16:21:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150867 X-Patchwork-Delegate: david.marchand@redhat.com 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 E7EE34618E; Tue, 4 Feb 2025 17:22:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 348F94066E; Tue, 4 Feb 2025 17:22:50 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 266984025D for ; Tue, 4 Feb 2025 17:22:48 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 588A8205491D; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 588A8205491D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=u1k0J9KHgyKMJJQ+jY2M9UbJp2qABMapCrIFCPl7Huo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V68v33oJd6/fqJ1BG1Z2osM0fuUWxJPMlNLE7tNAXd4eb7LyF36KzMNqzTuoUACpV MkTRFWD9txbO9kJEiPwLJ5tjKiYYFhYWUsUk8eoumc4Li3zLFL1KO6Fyf/p0JRnz0l Ia7ECddjqy/BtMN+4uA6j2LdPRgjkPycuhtEKkUw= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 03/27] eal/common: remove use of VLAs Date: Tue, 4 Feb 2025 08:21:40 -0800 Message-Id: <1738686124-16173-4-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Konstantin Ananyev 1) ../lib/eal/common/eal_common_proc.c:695:15 : warning: variable length array used As msg->num_fds should not exceed RTE_MP_MAX_FD_NUM, replaced it with fixed size array. Signed-off-by: Konstantin Ananyev Acked-by: Stephen Hemminger --- lib/eal/common/eal_common_proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c index d24093937c..201973c5db 100644 --- a/lib/eal/common/eal_common_proc.c +++ b/lib/eal/common/eal_common_proc.c @@ -692,7 +692,8 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type) struct sockaddr_un dst; struct mp_msg_internal m; int fd_size = msg->num_fds * sizeof(int); - char control[CMSG_SPACE(fd_size)]; + const int32_t control_sz = CMSG_SPACE(fd_size); + char control[CMSG_SPACE(sizeof(msg->fds))]; m.type = type; memcpy(&m.msg, msg, sizeof(*msg)); @@ -712,7 +713,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type) msgh.msg_iov = &iov; msgh.msg_iovlen = 1; msgh.msg_control = control; - msgh.msg_controllen = sizeof(control); + msgh.msg_controllen = control_sz; cmsg = CMSG_FIRSTHDR(&msgh); cmsg->cmsg_len = CMSG_LEN(fd_size); From patchwork Tue Feb 4 16:21:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150869 X-Patchwork-Delegate: david.marchand@redhat.com 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 E3CA74618E; Tue, 4 Feb 2025 17:23:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B2BB4060B; Tue, 4 Feb 2025 17:22:54 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 416424029B for ; Tue, 4 Feb 2025 17:22:48 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 64B2C205491E; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 64B2C205491E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=k7jdG7dFf2HwAk1Sk5hywytB3erCymZtHNKpmFOusg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lozVErzE6H64fpqX21E3sVVd7COIm0bk4ocSmzNrL2g82cafJnNrBY/xt8S8Gu14s SPNjAKeElVWIaUinJXOkA6Mi+SEJPqTXI8ipe77oWdmyqYq2zt9JAfJ6s8J+aghgnc ghjYvbEWhLsu2scDaFR0kFpHFVDn8ZEgwMJ84rsA= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 04/27] ethdev: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:41 -0800 Message-Id: <1738686124-16173-5-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 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 From: Konstantin Ananyev 1) ./lib/ethdev/rte_ethdev.c:3244:16 : warning: ISO C90 forbids variable length array ‘xstats_names’ 2) ./lib/ethdev/rte_ethdev.c:3345:17 : warning: ISO C90 forbids variable length array ‘ids_copy’ 3) ./lib/ethdev/rte_ethdev.c:3538:16 : warning: ISO C90 forbids variable length array ‘xstats’ 4) ./lib/ethdev/rte_ethdev.c:3554:17 : warning: ISO C90 forbids variable length array ‘ids_copy’ For 1) and 3) - just replaced VLA with arrays allocated from heap. As I understand xstats extraction belongs to control-path, so extra calloc/free is hopefully acceptable. Also ethdev xstats already doing that within rte_eth_xstats_get_id_by_name(). For 2) and 4) changed the code to use fixed size array and call appropriate devops function several times, if needed. Signed-off-by: Konstantin Ananyev --- lib/ethdev/rte_ethdev.c | 183 +++++++++++++++++++++++++--------------- 1 file changed, 113 insertions(+), 70 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 6413c54e3b..09cc4764c3 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -36,6 +36,8 @@ #include "ethdev_trace.h" #include "sff_telemetry.h" +#define ETH_XSTATS_ITER_NUM 0x100 + struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; /* public fast-path API */ @@ -3308,7 +3310,8 @@ int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name, uint64_t *id) { - int cnt_xstats, idx_xstat; + int cnt_xstats, idx_xstat, rc; + struct rte_eth_xstat_name *xstats_names; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); @@ -3334,26 +3337,33 @@ rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name, } /* Get id-name lookup table */ - struct rte_eth_xstat_name xstats_names[cnt_xstats]; + xstats_names = calloc(cnt_xstats, sizeof(xstats_names[0])); + if (xstats_names == NULL) { + RTE_ETHDEV_LOG_LINE(ERR, "Can't allocate memory"); + return -ENOMEM; + } if (cnt_xstats != rte_eth_xstats_get_names_by_id( port_id, xstats_names, cnt_xstats, NULL)) { RTE_ETHDEV_LOG_LINE(ERR, "Cannot get xstats lookup"); + free(xstats_names); return -1; } + rc = -EINVAL; for (idx_xstat = 0; idx_xstat < cnt_xstats; idx_xstat++) { if (!strcmp(xstats_names[idx_xstat].name, xstat_name)) { *id = idx_xstat; rte_eth_trace_xstats_get_id_by_name(port_id, xstat_name, *id); - - return 0; + rc = 0; + break; }; } - return -EINVAL; + free(xstats_names); + return rc; } /* retrieve basic stats names */ @@ -3399,6 +3409,38 @@ eth_basic_stats_get_names(struct rte_eth_dev *dev, return cnt_used_entries; } +static int +eth_xstats_get_by_name_by_id(struct rte_eth_dev *dev, const uint64_t *ids, + struct rte_eth_xstat_name *xstats_names, uint32_t size, + uint32_t basic_count) +{ + int32_t rc; + uint32_t i, k, m, n; + uint64_t ids_copy[ETH_XSTATS_ITER_NUM]; + + m = 0; + for (n = 0; n != size; n += k) { + + k = RTE_MIN(size - n, RTE_DIM(ids_copy)); + + /* + * Convert ids to xstats ids that PMD knows. + * ids known by user are basic + extended stats. + */ + for (i = 0; i < k; i++) + ids_copy[i] = ids[n + i] - basic_count; + + rc = (*dev->dev_ops->xstats_get_names_by_id)(dev, ids_copy, + xstats_names + m, k); + if (rc < 0) + return rc; + m += rc; + } + + return m; +} + + /* retrieve ethdev extended statistics names */ int rte_eth_xstats_get_names_by_id(uint16_t port_id, @@ -3406,9 +3448,8 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, uint64_t *ids) { struct rte_eth_xstat_name *xstats_names_copy; - unsigned int no_basic_stat_requested = 1; - unsigned int no_ext_stat_requested = 1; unsigned int expected_entries; + unsigned int nb_basic_stats; unsigned int basic_count; struct rte_eth_dev *dev; unsigned int i; @@ -3434,27 +3475,18 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, if (ids && !xstats_names) return -EINVAL; - if (ids && dev->dev_ops->xstats_get_names_by_id != NULL && size > 0) { - uint64_t ids_copy[size]; - - for (i = 0; i < size; i++) { - if (ids[i] < basic_count) { - no_basic_stat_requested = 0; - break; - } - - /* - * Convert ids to xstats ids that PMD knows. - * ids known by user are basic + extended stats. - */ - ids_copy[i] = ids[i] - basic_count; - } - - if (no_basic_stat_requested) - return (*dev->dev_ops->xstats_get_names_by_id)(dev, - ids_copy, xstats_names, size); + nb_basic_stats = 0; + if (ids != NULL) { + for (i = 0; i < size; i++) + nb_basic_stats += (ids[i] < basic_count); } + /* no basic stats requested, devops function provided */ + if (nb_basic_stats == 0 && ids != NULL && size != 0 && + dev->dev_ops->xstats_get_names_by_id != NULL) + return eth_xstats_get_by_name_by_id(dev, ids, xstats_names, + size, basic_count); + /* Retrieve all stats */ if (!ids) { int num_stats = rte_eth_xstats_get_names(port_id, xstats_names, @@ -3473,17 +3505,8 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, return -ENOMEM; } - if (ids) { - for (i = 0; i < size; i++) { - if (ids[i] >= basic_count) { - no_ext_stat_requested = 0; - break; - } - } - } - /* Fill xstats_names_copy structure */ - if (ids && no_ext_stat_requested) { + if (ids && nb_basic_stats == size) { eth_basic_stats_get_names(dev, xstats_names_copy); } else { ret = rte_eth_xstats_get_names(port_id, xstats_names_copy, @@ -3607,17 +3630,47 @@ eth_basic_stats_get(uint16_t port_id, struct rte_eth_xstat *xstats) return count; } +static int +eth_xtats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, + uint64_t *values, uint32_t size, uint32_t basic_count) +{ + int32_t rc; + uint32_t i, k, m, n; + uint64_t ids_copy[ETH_XSTATS_ITER_NUM]; + + m = 0; + for (n = 0; n != size; n += k) { + + k = RTE_MIN(size - n, RTE_DIM(ids_copy)); + + /* + * Convert ids to xstats ids that PMD knows. + * ids known by user are basic + extended stats. + */ + for (i = 0; i < k; i++) + ids_copy[i] = ids[n + i] - basic_count; + + rc = (*dev->dev_ops->xstats_get_by_id)(dev, ids_copy, + values + m, k); + if (rc < 0) + return rc; + m += rc; + } + + return m; +} + /* retrieve ethdev extended statistics */ int rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, uint64_t *values, unsigned int size) { - unsigned int no_basic_stat_requested = 1; - unsigned int no_ext_stat_requested = 1; + unsigned int nb_basic_stats; unsigned int num_xstats_filled; unsigned int basic_count; uint16_t expected_entries; struct rte_eth_dev *dev; + struct rte_eth_xstat *xstats; unsigned int i; int ret; @@ -3628,7 +3681,6 @@ rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, if (ret < 0) return ret; expected_entries = (uint16_t)ret; - struct rte_eth_xstat xstats[expected_entries]; basic_count = eth_dev_get_xstats_basic_count(dev); /* Return max number of stats if no ids given */ @@ -3642,51 +3694,41 @@ rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, if (ids && !values) return -EINVAL; - 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]; - - for (i = 0; i < size; i++) { - if (ids[i] < basic_count) { - no_basic_stat_requested = 0; - break; - } - - /* - * Convert ids to xstats ids that PMD knows. - * ids known by user are basic + extended stats. - */ - ids_copy[i] = ids[i] - basic_count; - } - - if (no_basic_stat_requested) - return (*dev->dev_ops->xstats_get_by_id)(dev, ids_copy, - values, size); + nb_basic_stats = 0; + if (ids != NULL) { + for (i = 0; i < size; i++) + nb_basic_stats += (ids[i] < basic_count); } - if (ids) { - for (i = 0; i < size; i++) { - if (ids[i] >= basic_count) { - no_ext_stat_requested = 0; - break; - } - } + /* no basic stats requested, devops function provided */ + if (nb_basic_stats == 0 && ids != NULL && size != 0 && + dev->dev_ops->xstats_get_by_id != NULL) + return eth_xtats_get_by_id(dev, ids, values, size, basic_count); + + xstats = calloc(expected_entries, sizeof(xstats[0])); + if (xstats == NULL) { + RTE_ETHDEV_LOG_LINE(ERR, "Can't allocate memory"); + return -ENOMEM; } /* Fill the xstats structure */ - if (ids && no_ext_stat_requested) + if (ids && nb_basic_stats == size) ret = eth_basic_stats_get(port_id, xstats); else ret = rte_eth_xstats_get(port_id, xstats, expected_entries); - if (ret < 0) + if (ret < 0) { + free(xstats); return ret; + } num_xstats_filled = (unsigned int)ret; /* Return all stats */ if (!ids) { for (i = 0; i < num_xstats_filled; i++) values[i] = xstats[i].value; + + free(xstats); return expected_entries; } @@ -3694,14 +3736,15 @@ rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, for (i = 0; i < size; i++) { if (ids[i] >= expected_entries) { RTE_ETHDEV_LOG_LINE(ERR, "Id value isn't valid"); - return -1; + break; } values[i] = xstats[ids[i]].value; } rte_eth_trace_xstats_get_by_id(port_id, ids, values, size); - return size; + free(xstats); + return (i == size) ? (int32_t)size : -1; } int From patchwork Tue Feb 4 16:21:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150871 X-Patchwork-Delegate: david.marchand@redhat.com 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 833F04618E; Tue, 4 Feb 2025 17:23:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E2734066A; Tue, 4 Feb 2025 17:22:56 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id F03754025F for ; Tue, 4 Feb 2025 17:22:48 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 71404205491F; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 71404205491F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=N4vguHG6PEsLbIgbNHV9UMQLsOxnQR/SrPuum4VvO50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHxb7rpmq6lZgkS1WdRO9nnjLiku4uyr84ewleb9hFgBltOtLJxyMtZAbuPGn+FsL tYEOKPVAc9nE5L0AuQboO8ZXCtZXu/3DE50MxPWc40VCrlcVAEqLkyeDvkJXzfm876 /65M928iw238NjD7PxOrFlm7phgDkz9EPcqqTBWU= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 05/27] hash: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:42 -0800 Message-Id: <1738686124-16173-6-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 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 From: Konstantin Ananyev 1) ./lib/hash/rte_cuckoo_hash.c:2362:9 : warning: ISO C90 forbids variable length array ‘positions’ 2) ../lib/hash/rte_cuckoo_hash.c:2478:9 : warning: ISO C90 forbids variable length array ‘positions’ Both rte_hash_lookup_bulk_data() and rte_hash_lookup_with_hash_bulk_data() expect @num_keys <= RTE_HASH_LOOKUP_BULK_MAX. So, for both cases it should be safe to replace VLA with fixed size array. Signed-off-by: Konstantin Ananyev Reviewed-by: Bruce Richardson Acked-by: Vladimir Medvedkin Acked-by: Chengwen Feng --- lib/hash/rte_cuckoo_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c index 9575e8aa0c..fc93182efe 100644 --- a/lib/hash/rte_cuckoo_hash.c +++ b/lib/hash/rte_cuckoo_hash.c @@ -2418,7 +2418,7 @@ rte_hash_lookup_bulk_data(const struct rte_hash *h, const void **keys, (num_keys > RTE_HASH_LOOKUP_BULK_MAX) || (hit_mask == NULL)), -EINVAL); - int32_t positions[num_keys]; + int32_t positions[RTE_HASH_LOOKUP_BULK_MAX]; __rte_hash_lookup_bulk(h, keys, num_keys, positions, hit_mask, data); @@ -2534,7 +2534,7 @@ rte_hash_lookup_with_hash_bulk_data(const struct rte_hash *h, (num_keys > RTE_HASH_LOOKUP_BULK_MAX) || (hit_mask == NULL)), -EINVAL); - int32_t positions[num_keys]; + int32_t positions[RTE_HASH_LOOKUP_BULK_MAX]; __rte_hash_lookup_with_hash_bulk(h, keys, sig, num_keys, positions, hit_mask, data); From patchwork Tue Feb 4 16:21:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150876 X-Patchwork-Delegate: david.marchand@redhat.com 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 4EBC94618E; Tue, 4 Feb 2025 17:23:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D712C40E96; Tue, 4 Feb 2025 17:23:01 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 1EA8B402EF for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 7DEF52054920; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7DEF52054920 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=v1DHxZV1C0sGKMHWBH1Ir4BACtxlCv2pTOINU5xG0Hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8My7YmGT6aqXBXWif/nYYTXf4fxDwWLh2AZSNcrIUIKHqcADbBqyQ+3PqbXy6umi YZXbKHb3O9KUZ1R+2uI63xPGRSZQZmEysP43c3JFAp6dsG2aoGZ8cB+FiYohQBqW19 ifd3YLR12yT64Gtem2P12x74x/tdq3i7qfzqNTx4= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 06/27] hash/thash: remove use of VLAs for Windows built Date: Tue, 4 Feb 2025 08:21:43 -0800 Message-Id: <1738686124-16173-7-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 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 From: Konstantin Ananyev 1) ./lib/hash/rte_thash.c:774:9 : warning: ISO C90 forbids variable length array ‘tmp_tuple’ The tuple can exceed sizeof(union rte_thash_tuple), for example if any tunneling header is used in the RSS hash calculation. The longest RSS hash key currently supported is 52 bytes. Technically, the longest tuple with such a key should be (52 - sizeof(uint32_t)), so this can be used as a size of the tmp_tuple array. Signed-off-by: Konstantin Ananyev --- lib/hash/rte_thash.c | 2 +- lib/hash/rte_thash.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 336c228e64..fa78787143 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -761,7 +761,7 @@ rte_thash_adjust_tuple(struct rte_thash_ctx *ctx, 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[RTE_THASH_TUPLE_LEN_MAX]; unsigned int i, j, ret = 0; uint32_t hash, adj_bits; const uint8_t *hash_key; diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h index c0af5968df..04f9f1875c 100644 --- a/lib/hash/rte_thash.h +++ b/lib/hash/rte_thash.h @@ -121,6 +121,13 @@ __rte_internal uint32_t thash_get_rand_poly(uint32_t poly_degree); +/** + * Longest RSS hash key currently supported + */ +#define RTE_THASH_KEY_LEN_MAX 52 + +#define RTE_THASH_TUPLE_LEN_MAX (RTE_THASH_KEY_LEN_MAX - sizeof(uint32_t)) + /** * Prepare special converted key to use with rte_softrss_be() * @param orig From patchwork Tue Feb 4 16:21:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150870 X-Patchwork-Delegate: david.marchand@redhat.com 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 41D064618E; Tue, 4 Feb 2025 17:23:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36BF34066F; Tue, 4 Feb 2025 17:22:55 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id F065F4029B for ; Tue, 4 Feb 2025 17:22:48 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 8A15F2054921; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8A15F2054921 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=VrdBdvJUUltk+ZXtsDAj7IT45LyJQnArjkgdKInocWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwFG709fBPisGLt4ASfcEYFH6WopT6fgvaQrzNSwtdzAeoeltx+tyRAS+cnIaLg6p kRZpg5dKLGjtGbX9yUJ+Wli/w4iU9/eydKqvAxZh6GGBwkLer3RlfSPBXNaHNMDAkG h5kfC5WNDfLuQJ8atstsY564GT+rUbG2CD8H1U8Y= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 07/27] rcu: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:44 -0800 Message-Id: <1738686124-16173-8-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 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 From: Konstantin Ananyev 1) ./lib/rcu/rte_rcu_qsbr.c:359:9 : warning: ISO C90 forbids variable length array ‘data’ [-Wvla] 2) ./lib/rcu/rte_rcu_qsbr.c:422:9 : warning: ISO C90 forbids variable length array ‘data’ [-Wvla] In both cases we allocate VLA for one element from RCU deferred queue. Right now, size of element in RCU queue is not limited by API. The approach is to introduce some reasonable limitation on RCU DQ element size. Choose 128B for now. With that in place we can replace both VLA occurencies with fixed size array. Note that such change need to be treated as API change. So can be applied only at 24.11. Signed-off-by: Konstantin Ananyev --- lib/rcu/rte_rcu_qsbr.c | 7 ++++--- lib/rcu/rte_rcu_qsbr.h | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/rcu/rte_rcu_qsbr.c b/lib/rcu/rte_rcu_qsbr.c index dbf31501a6..fe68d16326 100644 --- a/lib/rcu/rte_rcu_qsbr.c +++ b/lib/rcu/rte_rcu_qsbr.c @@ -245,7 +245,8 @@ rte_rcu_qsbr_dq_create(const struct rte_rcu_qsbr_dq_parameters *params) if (params == NULL || params->free_fn == NULL || params->v == NULL || params->name == NULL || params->size == 0 || params->esize == 0 || - (params->esize % 4 != 0)) { + (params->esize % 4 != 0) || + params->esize > RTE_QSBR_ESIZE_MAX) { RCU_LOG(ERR, "Invalid input parameter"); rte_errno = EINVAL; @@ -323,7 +324,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e) return 1; } - char data[dq->esize]; + char data[RTE_QSBR_ESIZE_MAX + __RTE_QSBR_TOKEN_SIZE]; dq_elem = (__rte_rcu_qsbr_dq_elem_t *)data; /* Start the grace period */ dq_elem->token = rte_rcu_qsbr_start(dq->v); @@ -386,7 +387,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n, cnt = 0; - char data[dq->esize]; + char data[RTE_QSBR_ESIZE_MAX + __RTE_QSBR_TOKEN_SIZE]; /* Check reader threads quiescent state and reclaim resources */ while (cnt < n && rte_ring_dequeue_bulk_elem_start(dq->r, &data, diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h index 550fadf56a..abcbd78914 100644 --- a/lib/rcu/rte_rcu_qsbr.h +++ b/lib/rcu/rte_rcu_qsbr.h @@ -86,6 +86,11 @@ struct __rte_cache_aligned rte_rcu_qsbr_cnt { #define __RTE_QSBR_CNT_MAX ((uint64_t)~0) #define __RTE_QSBR_TOKEN_SIZE sizeof(uint64_t) +/** + * Max allowable size (in bytes) of each element in the defer queue + */ +#define RTE_QSBR_ESIZE_MAX (2 * RTE_CACHE_LINE_MIN_SIZE) + /* RTE Quiescent State variable structure. * This structure has two elements that vary in size based on the * 'max_threads' parameter. From patchwork Tue Feb 4 16:21:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150872 X-Patchwork-Delegate: david.marchand@redhat.com 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 E80CD4618E; Tue, 4 Feb 2025 17:23:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 840E440687; Tue, 4 Feb 2025 17:22:57 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 29E6B402F1; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 978682054925; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 978682054925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=Zaw3j4IpC+ev3dZ58fCpkMXxz+DLueTBX9Y4LIBnsoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktQOOdBeSSWPelcKR0amEpK31G+uSVsBcmazC/CxPk/x/MxVyQAgLt9xQ9gKWyLiy pkLIfhiUKgJAKaqk5u3FxK0PKde0ZNSbBOB2HYvRT/0TDWMzXpH9E2XpFGrfu0belT N8MZAzfw+n29X16E3/qAxpUIEUJLhQrEVajRLz5E= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, stable@dpdk.org Subject: [PATCH v20 08/27] gro: fix overwrite unprocessed packets Date: Tue, 4 Feb 2025 08:21:45 -0800 Message-Id: <1738686124-16173-9-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Konstantin Ananyev gro_vxlan_tcp4_tbl_timeout_flush() is called without taking into account that first entries in pkts[] can be already occupied by un-processed packets. Fixes: 74080d7dcf31 ("gro: support IPv6 for TCP") Cc: stable@dpdk.org Signed-off-by: Konstantin Ananyev Acked-by: Ferruh Yigit --- lib/gro/rte_gro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gro/rte_gro.c b/lib/gro/rte_gro.c index d824eebd93..db86117609 100644 --- a/lib/gro/rte_gro.c +++ b/lib/gro/rte_gro.c @@ -327,7 +327,7 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, /* Flush all packets from the tables */ if (do_vxlan_tcp_gro) { i += gro_vxlan_tcp4_tbl_timeout_flush(&vxlan_tcp_tbl, - 0, pkts, nb_pkts); + 0, &pkts[i], nb_pkts - i); } if (do_vxlan_udp_gro) { From patchwork Tue Feb 4 16:21:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150873 X-Patchwork-Delegate: david.marchand@redhat.com 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 560F64618E; Tue, 4 Feb 2025 17:23:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B67D540A81; Tue, 4 Feb 2025 17:22:58 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 18868402E7 for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id A3C7A2054928; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A3C7A2054928 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=R1q3dWwl0t6YhWGgHYDG3ZXRsMth7Rdr4mn/KHJaCzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IanuWD2UPmlV4IKpwWhKPQKuPDn5tT2Sc5EorxZFu95YKdUuoDxJrdZoFn7jqaQBM ZXj47km75IWhG77GKU4Ail22jqQBUDhzSVyRYJc3p6I94F2XWxmD/fGzi55qvlfRtx kIrJ5OxZ97/3VRZo4itpH9QEuPS2JmFlAYmplXCA= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 09/27] gro: remove use of VLAs Date: Tue, 4 Feb 2025 08:21:46 -0800 Message-Id: <1738686124-16173-10-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Konstantin Ananyev ../lib/gro/rte_gro.c:182:34: warning: variable length array used [-Wvla] ../lib/gro/rte_gro.c:363:34: warning: variable length array used [-Wvla] In both cases the pattern is the same: we use unprocess_pkts[nb_pkts] to collect un-used by GRO packets, and then copy them to the start of input/output pkts[] array. In both cases, we can safely copy pkts[i] into already processed entry at the same array, i.e. into pkts[unprocess_num]. Such change eliminates need of temporary VLA: unprocess_pkts[nb_pkts]. Signed-off-by: Konstantin Ananyev Acked-by: Ferruh Yigit --- lib/gro/rte_gro.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/lib/gro/rte_gro.c b/lib/gro/rte_gro.c index db86117609..6d5aadf32a 100644 --- a/lib/gro/rte_gro.c +++ b/lib/gro/rte_gro.c @@ -179,7 +179,6 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, struct gro_vxlan_udp4_item vxlan_udp_items[RTE_GRO_MAX_BURST_ITEM_NUM] = {{{0}} }; - struct rte_mbuf *unprocess_pkts[nb_pkts]; uint32_t item_num; int32_t ret; uint16_t i, unprocess_num = 0, nb_after_gro = nb_pkts; @@ -275,7 +274,7 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, /* Merge successfully */ nb_after_gro--; else if (ret < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV4_VXLAN_UDP4_PKT(pkts[i]->packet_type) && do_vxlan_udp_gro) { ret = gro_vxlan_udp4_reassemble(pkts[i], @@ -284,7 +283,7 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, /* Merge successfully */ nb_after_gro--; else if (ret < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV4_TCP_PKT(pkts[i]->packet_type) && do_tcp4_gro) { ret = gro_tcp4_reassemble(pkts[i], &tcp_tbl, 0); @@ -292,7 +291,7 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, /* merge successfully */ nb_after_gro--; else if (ret < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV4_UDP_PKT(pkts[i]->packet_type) && do_udp4_gro) { ret = gro_udp4_reassemble(pkts[i], &udp_tbl, 0); @@ -300,7 +299,7 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, /* merge successfully */ nb_after_gro--; else if (ret < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV6_TCP_PKT(pkts[i]->packet_type) && do_tcp6_gro) { ret = gro_tcp6_reassemble(pkts[i], &tcp6_tbl, 0); @@ -308,21 +307,15 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, /* merge successfully */ nb_after_gro--; else if (ret < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } if ((nb_after_gro < nb_pkts) || (unprocess_num < nb_pkts)) { - i = 0; - /* Copy unprocessed packets */ - if (unprocess_num > 0) { - memcpy(&pkts[i], unprocess_pkts, - sizeof(struct rte_mbuf *) * - unprocess_num); - i = unprocess_num; - } + + i = unprocess_num; /* Flush all packets from the tables */ if (do_vxlan_tcp_gro) { @@ -360,7 +353,6 @@ rte_gro_reassemble(struct rte_mbuf **pkts, uint16_t nb_pkts, void *ctx) { - struct rte_mbuf *unprocess_pkts[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; @@ -396,33 +388,29 @@ rte_gro_reassemble(struct rte_mbuf **pkts, do_vxlan_tcp_gro) { if (gro_vxlan_tcp4_reassemble(pkts[i], vxlan_tcp_tbl, current_time) < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV4_VXLAN_UDP4_PKT(pkts[i]->packet_type) && do_vxlan_udp_gro) { if (gro_vxlan_udp4_reassemble(pkts[i], vxlan_udp_tbl, current_time) < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV4_TCP_PKT(pkts[i]->packet_type) && do_tcp4_gro) { if (gro_tcp4_reassemble(pkts[i], tcp_tbl, current_time) < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV4_UDP_PKT(pkts[i]->packet_type) && do_udp4_gro) { if (gro_udp4_reassemble(pkts[i], udp_tbl, current_time) < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else if (IS_IPV6_TCP_PKT(pkts[i]->packet_type) && do_tcp6_gro) { if (gro_tcp6_reassemble(pkts[i], tcp6_tbl, current_time) < 0) - unprocess_pkts[unprocess_num++] = pkts[i]; + pkts[unprocess_num++] = pkts[i]; } else - unprocess_pkts[unprocess_num++] = pkts[i]; - } - if (unprocess_num > 0) { - memcpy(pkts, unprocess_pkts, sizeof(struct rte_mbuf *) * - unprocess_num); + pkts[unprocess_num++] = pkts[i]; } return unprocess_num; From patchwork Tue Feb 4 16:21:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150878 X-Patchwork-Delegate: david.marchand@redhat.com 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 B53674618E; Tue, 4 Feb 2025 17:24:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB08040F16; Tue, 4 Feb 2025 17:23:03 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3FC294042C for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id AFC2F210C317; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AFC2F210C317 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=oLu7UWExVKp69S7C/lob/OoLtIJfTcLoLkvoKiCP8Rs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xam4frqYx22AckxF/L2QW0aOlJ3thawkIa0wnyU9ryc2AdyzIyA3ipfPqmXT3Cjw1 w4jBviqfwSmH7a8ANqDDf24F5nx6TbDROMBYPTfwGpyjVo7r6+T6yBmi30kwkxDTwc Z2K4/FctWo9BjU7SRGVASdAXdmv/NED1vboIH210= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 10/27] net/ixgbe: remove use of VLAs Date: Tue, 4 Feb 2025 08:21:47 -0800 Message-Id: <1738686124-16173-11-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Konstantin Ananyev 1) ../drivers/net/ixgbe/ixgbe_ethdev.c:3556:46: warning: variable length array used [-Wvla] 2) ../drivers/net/ixgbe/ixgbe_ethdev.c:3739:23: warning: variable length array used [-Wvla] 3) ../drivers/net/ixgbe/ixgbe_rxtx_vec_common.h:17:24: warning: variable length array used [-Wvla] For first two cases: in fact ixgbe_xstats_calc_num() always returns constant value, so it should be safe to replace that function invocation just with a macro that performs same calculations. For case #3: reassemble_packets() is invoked only by ixgbe_recv_scattered_burst_vec(). And in turn, ixgbe_recv_scattered_burst_vec() operates only on fixed max amount of packets per call: RTE_IXGBE_MAX_RX_BURST. So, it should be safe to replace VLA with fixed size array. Signed-off-by: Konstantin Ananyev Acked-by: Anatoly Burakov --- drivers/net/intel/ixgbe/ixgbe_ethdev.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c index 5f18fbaad5..c79ecd6eec 100644 --- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c @@ -3437,11 +3437,16 @@ ixgbe_dev_stats_reset(struct rte_eth_dev *dev) } /* This function calculates the number of xstats based on the current config */ + +#define IXGBE_XSTATS_CALC_NUM \ + (IXGBE_NB_HW_STATS + IXGBE_NB_MACSEC_STATS + \ + (IXGBE_NB_RXQ_PRIO_STATS * IXGBE_NB_RXQ_PRIO_VALUES) + \ + (IXGBE_NB_TXQ_PRIO_STATS * IXGBE_NB_TXQ_PRIO_VALUES)) + static unsigned -ixgbe_xstats_calc_num(void) { - return IXGBE_NB_HW_STATS + IXGBE_NB_MACSEC_STATS + - (IXGBE_NB_RXQ_PRIO_STATS * IXGBE_NB_RXQ_PRIO_VALUES) + - (IXGBE_NB_TXQ_PRIO_STATS * IXGBE_NB_TXQ_PRIO_VALUES); +ixgbe_xstats_calc_num(void) +{ + return IXGBE_XSTATS_CALC_NUM; } static int ixgbe_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, @@ -3557,8 +3562,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[IXGBE_XSTATS_CALC_NUM]; + const uint16_t size = RTE_DIM(xstats_names_copy); ixgbe_dev_xstats_get_names_by_id(dev, NULL, xstats_names_copy, size); @@ -3740,8 +3745,8 @@ ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, } uint16_t i; - uint16_t size = ixgbe_xstats_calc_num(); - uint64_t values_copy[size]; + uint64_t values_copy[IXGBE_XSTATS_CALC_NUM]; + const uint16_t size = RTE_DIM(values_copy); ixgbe_dev_xstats_get_by_id(dev, NULL, values_copy, size); From patchwork Tue Feb 4 16:21:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150874 X-Patchwork-Delegate: david.marchand@redhat.com 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 D0A974618E; Tue, 4 Feb 2025 17:23:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D113340E30; Tue, 4 Feb 2025 17:22:59 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 07A3D402DF for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id BBE36210C337; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BBE36210C337 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=P2GILx611CmHWZQamm6DnO2lGy135vG+YjfFI9+sUH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbfcED5W26pqvukZs89Hzx+SHlPkvUpzCh4m8nsD7ewpJxW+9hRG38FhZhXtFstWY RU9JmyudVomuUPGqEVnpg0hymzZNiaV2NvdbyYFDveUR4QL0CNQ2Fy+xwHj44huf9V Fy7YI1tcqPwdTmite3wIVA78uvohW9pGCYbVYLks= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com Subject: [PATCH v20 11/27] net/ice: remove use of VLAs Date: Tue, 4 Feb 2025 08:21:48 -0800 Message-Id: <1738686124-16173-12-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Konstantin Ananyev ../drivers/net/ice/ice_rxtx.c:1871:29: warning: variable length array used [-Wvla] Here VLA is used as a temp array for mbufs that will be used as a split RX data buffers. As at any given time only one thread can do RX from particular queue, at rx_queue_setup() we can allocate extra space for that array, and then safely use it at RX fast-path. Signed-off-by: Konstantin Ananyev Acked-by: Anatoly Burakov --- drivers/net/intel/ice/ice_rxtx.c | 18 ++++++++++++------ drivers/net/intel/ice/ice_rxtx.h | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/intel/ice/ice_rxtx.c b/drivers/net/intel/ice/ice_rxtx.c index 8dd8644b16..437cf0d807 100644 --- a/drivers/net/intel/ice/ice_rxtx.c +++ b/drivers/net/intel/ice/ice_rxtx.c @@ -1172,7 +1172,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, struct ice_vsi *vsi = pf->main_vsi; struct ice_rx_queue *rxq; const struct rte_memzone *rz; - uint32_t ring_size; + uint32_t ring_size, tlen; uint16_t len; int use_def_burst_func = 1; uint64_t offloads; @@ -1280,9 +1280,14 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, /* always reserve more for bulk alloc */ len = (uint16_t)(nb_desc + ICE_RX_MAX_BURST); + /* allocate extra entries for SW split buffer */ + tlen = ((rxq->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) != 0) ? + rxq->rx_free_thresh : 0; + tlen += len; + /* Allocate the software ring. */ rxq->sw_ring = rte_zmalloc_socket(NULL, - sizeof(struct ice_rx_entry) * len, + sizeof(struct ice_rx_entry) * tlen, RTE_CACHE_LINE_SIZE, socket_id); if (!rxq->sw_ring) { @@ -1291,6 +1296,8 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, return -ENOMEM; } + rxq->sw_split_buf = (tlen == len) ? NULL : rxq->sw_ring + len; + ice_reset_rx_queue(rxq); rxq->q_set = true; dev->data->rx_queues[queue_idx] = rxq; @@ -1864,7 +1871,6 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) uint64_t dma_addr; int diag, diag_pay; uint64_t pay_addr; - struct rte_mbuf *mbufs_pay[rxq->rx_free_thresh]; /* Allocate buffers in bulk */ alloc_idx = (uint16_t)(rxq->rx_free_trigger - @@ -1879,7 +1885,7 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) if (rxq->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) { diag_pay = rte_mempool_get_bulk(rxq->rxseg[1].mp, - (void *)mbufs_pay, rxq->rx_free_thresh); + (void *)rxq->sw_split_buf, rxq->rx_free_thresh); if (unlikely(diag_pay != 0)) { rte_mempool_put_bulk(rxq->mp, (void *)rxep, rxq->rx_free_thresh); @@ -1906,8 +1912,8 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) rxdp[i].read.hdr_addr = 0; rxdp[i].read.pkt_addr = dma_addr; } else { - mb->next = mbufs_pay[i]; - pay_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbufs_pay[i])); + mb->next = rxq->sw_split_buf[i].mbuf; + pay_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mb->next)); rxdp[i].read.hdr_addr = dma_addr; rxdp[i].read.pkt_addr = pay_addr; } diff --git a/drivers/net/intel/ice/ice_rxtx.h b/drivers/net/intel/ice/ice_rxtx.h index f9293ac6f9..276d40b57f 100644 --- a/drivers/net/intel/ice/ice_rxtx.h +++ b/drivers/net/intel/ice/ice_rxtx.h @@ -139,6 +139,8 @@ struct ice_rx_queue { uint32_t hw_time_high; /* high 32 bits of timestamp */ uint32_t hw_time_low; /* low 32 bits of timestamp */ uint64_t hw_time_update; /* SW time of HW record updating */ + struct ice_rx_entry *sw_split_buf; + /* address of temp buffer for RX split mbufs */ struct rte_eth_rxseg_split rxseg[ICE_RX_MAX_NSEG]; uint32_t rxseg_nb; bool ts_enable; /* if rxq timestamp is enabled */ From patchwork Tue Feb 4 16:21:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150875 X-Patchwork-Delegate: david.marchand@redhat.com 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 1FD954618E; Tue, 4 Feb 2025 17:23:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA65140E3B; Tue, 4 Feb 2025 17:23:00 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0CC7D402E6 for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id C8337210C338; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C8337210C338 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=R3V4XamouzonlE20qOkBxm8ebIicgN8hHsgTyx8pLrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XkO0m/0qOZXFeWHMODqRnYu8C8OqIePgCrrPSyDt/nijrSj9PGQmOZWrf4dKsRtYz c4fsk4ruVxI68qkTau0xhqwi+Td02RPHScvMPd27LDqrPTd+bgJUNZBKGxVSaNxeF6 GNfYR0Hi3ZDkYfIN2lWH/41ckIeK+dx4tWjXGV5o= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v20 12/27] app/testpmd: remove use of VLAs for Windows built Date: Tue, 4 Feb 2025 08:21:49 -0800 Message-Id: <1738686124-16173-13-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Tyler Retzlaff 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 Acked-by: Chengwen Feng --- app/test-pmd/cmdline.c | 2 +- app/test-pmd/cmdline_flow.c | 15 ++++++++++----- app/test-pmd/config.c | 16 +++++++++------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 7e0666e9f6..2897e44c34 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -13274,7 +13274,7 @@ cmd_set_port_ptypes_parsed( 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 9e4fc2d95d..e1720e54d7 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -11707,8 +11707,7 @@ parse_hex(struct context *ctx, const struct token *token, 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) @@ -11735,7 +11734,7 @@ parse_hex(struct context *ctx, const struct token *token, 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) @@ -11868,10 +11867,13 @@ parse_ipv4_addr(struct context *ctx, const struct token *token, void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - char str2[len + 1]; + char str2[INET_ADDRSTRLEN]; struct in_addr tmp; int ret; + /* Length is longer than the max length an IPv4 address can have. */ + if (len >= INET_ADDRSTRLEN) + return -1; /* Argument is expected. */ if (!arg) return -1; @@ -11914,11 +11916,14 @@ parse_ipv6_addr(struct context *ctx, const struct token *token, void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - char str2[len + 1]; + char str2[INET6_ADDRSTRLEN]; struct rte_ipv6_addr tmp; int ret; (void)token; + /* Length is longer than the max length an IPv6 address can have. */ + if (len >= INET6_ADDRSTRLEN) + return -1; /* Argument is expected. */ if (!arg) return -1; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 4e7fb69183..b19df95321 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1802,7 +1802,8 @@ port_flow_configure(portid_t port_id, { 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) || @@ -2616,10 +2617,10 @@ port_flow_template_table_create(portid_t port_id, uint32_t id, 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) @@ -5551,7 +5552,7 @@ parse_port_list(const char *list, unsigned int *values, unsigned int maxsize) 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; @@ -7292,7 +7293,8 @@ show_macs(portid_t port_id) 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; From patchwork Tue Feb 4 16:21:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150882 X-Patchwork-Delegate: david.marchand@redhat.com 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 1755F4618E; Tue, 4 Feb 2025 17:24:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45FC040649; Tue, 4 Feb 2025 17:23:07 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4D6E24042F for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id D46B8210C339; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D46B8210C339 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=kueUIoi3zIyA9B9XC/OXG4lvpA3rwhyCg/uJebuSZJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BE8JDmmwM1oMtw7NW/GZ/O3o5f/rckl+DTsBRQW6i3cwc3hH429mPkEYj49KNov5Q TAA6iqADY/vbNVhPZSJVKmv6WEa3M7bDDWg454JKefmLnBcfkgG1H94CqY6GJpivkM TjUtRgBcHbkrgGkqeBxq3tGg55K5ODL/vy//VqH4= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v20 13/27] test: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:50 -0800 Message-Id: <1738686124-16173-14-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Tyler Retzlaff 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 Acked-by: Chengwen Feng --- app/test/test.c | 2 +- app/test/test_cmdline_string.c | 2 +- app/test/test_cryptodev.c | 34 +++++++++---------- 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 | 14 ++++---- app/test/test_mempool.c | 25 +++++++------- app/test/test_reorder.c | 48 +++++++++++++++------------ app/test/test_service_cores.c | 9 +++-- app/test/test_thash.c | 7 ++-- 11 files changed, 82 insertions(+), 74 deletions(-) diff --git a/app/test/test.c b/app/test/test.c index 680351f6a3..fd653cbbfd 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -105,7 +105,7 @@ int 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 97516c9400..e1cf86020f 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 7cddb1517c..441ecc6ad5 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2886,7 +2886,7 @@ create_wireless_algo_hash_session(uint8_t dev_id, 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; @@ -2922,7 +2922,7 @@ create_wireless_algo_cipher_session(uint8_t dev_id, 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; @@ -3074,7 +3074,7 @@ create_wireless_cipher_auth_session(uint8_t dev_id, 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; @@ -9078,7 +9078,7 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo, 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; @@ -12989,7 +12989,7 @@ test_cryptodev_error_recover_helper(uint8_t dev_id, const void *test_data, bool struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; const struct blockcipher_test_data *tdata = test_data; - uint8_t cipher_key[tdata->cipher_key.len]; + uint8_t *cipher_key = alloca(tdata->cipher_key.len); struct rte_crypto_sym_op *sym_op = NULL; struct rte_crypto_op *op = NULL; char *dst; @@ -13345,7 +13345,7 @@ static int 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"); @@ -13734,7 +13734,7 @@ static int 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)); @@ -13986,7 +13986,7 @@ test_authenticated_encryption_sessionless( 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); @@ -14088,7 +14088,7 @@ test_authenticated_decryption_sessionless( 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); @@ -15495,7 +15495,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; @@ -16152,7 +16152,7 @@ create_auth_session(struct crypto_unittest_params *ut_params, 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); @@ -16184,8 +16184,8 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params, 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); @@ -16686,8 +16686,8 @@ test_authenticated_encrypt_with_esn( 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); @@ -16818,8 +16818,8 @@ test_authenticated_decrypt_with_esn( 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 8e13cdfc7a..5a124bbb5e 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -85,8 +85,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, 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 c29b19cf6b..b9a53a430c 100644 --- a/app/test/test_cryptodev_crosscheck.c +++ b/app/test/test_cryptodev_crosscheck.c @@ -894,7 +894,7 @@ static int 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 143e1bcd68..9cbb9a6552 100644 --- a/app/test/test_dmadev.c +++ b/app/test/test_dmadev.c @@ -417,9 +417,12 @@ test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan) 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 6b5ef2d1e5..5791fd7f4c 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -1947,6 +1947,8 @@ test_hash_rcu_qsbr_add(void) return 0; } +#define HASH_RCU_QSBR_MAX_TOTAL_ENTRIES 9 + /* * rte_hash_rcu_qsbr_add DQ mode functional test. * Reader and writer are in the same thread in this test. @@ -1966,7 +1968,7 @@ test_hash_rcu_qsbr_add(void) static int test_hash_rcu_qsbr_dq_mode(uint8_t ext_bkt) { - uint32_t total_entries = (ext_bkt == 0) ? 8 : 9; + const uint32_t total_entries = (ext_bkt == 0) ? 8 : HASH_RCU_QSBR_MAX_TOTAL_ENTRIES; uint8_t hash_extra_flag = RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF; @@ -1982,8 +1984,8 @@ test_hash_rcu_qsbr_dq_mode(uint8_t ext_bkt) .socket_id = 0, .extra_flag = hash_extra_flag, }; - int pos[total_entries]; - int expected_pos[total_entries]; + int pos[HASH_RCU_QSBR_MAX_TOTAL_ENTRIES]; + int expected_pos[HASH_RCU_QSBR_MAX_TOTAL_ENTRIES]; unsigned int i; size_t sz; int32_t status; @@ -2136,7 +2138,7 @@ test_hash_rcu_qsbr_reader(void *arg) static int test_hash_rcu_qsbr_sync_mode(uint8_t ext_bkt) { - uint32_t total_entries = (ext_bkt == 0) ? 8 : 9; + const uint32_t total_entries = (ext_bkt == 0) ? 8 : HASH_RCU_QSBR_MAX_TOTAL_ENTRIES; uint8_t hash_extra_flag = RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF; @@ -2152,8 +2154,8 @@ test_hash_rcu_qsbr_sync_mode(uint8_t ext_bkt) .socket_id = 0, .extra_flag = hash_extra_flag, }; - int pos[total_entries]; - int expected_pos[total_entries]; + int pos[HASH_RCU_QSBR_MAX_TOTAL_ENTRIES]; + int expected_pos[HASH_RCU_QSBR_MAX_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 3f7ba5872d..61385e096e 100644 --- a/app/test/test_mempool.c +++ b/app/test/test_mempool.c @@ -515,19 +515,20 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) #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 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) 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 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) 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 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) "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 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) */ 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 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) 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 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) 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_reorder.c b/app/test/test_reorder.c index 501780cb26..aaa2c57086 100644 --- a/app/test/test_reorder.c +++ b/app/test/test_reorder.c @@ -130,11 +130,12 @@ test_reorder_free(void) 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 @@ test_reorder_insert(void) 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 @@ test_reorder_insert(void) 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 @@ test_reorder_drain(void) 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 @@ test_reorder_drain(void) 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 @@ buffer_to_reorder_move(struct rte_mbuf **mbuf, struct rte_reorder_buffer *b) 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 @@ test_reorder_drain_up_to_seqn(void) 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 @@ test_reorder_drain_up_to_seqn(void) 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 @@ test_reorder_drain_up_to_seqn(void) 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 @@ test_reorder_drain_up_to_seqn(void) 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 @@ test_reorder_drain_up_to_seqn(void) 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 @@ test_reorder_set_seqn(void) 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 @@ test_reorder_set_seqn(void) 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 46ed9a1868..d95a71f80b 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -603,9 +603,8 @@ service_lcore_add_del(void) "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"); @@ -631,7 +630,7 @@ service_lcore_add_del(void) 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"); @@ -649,7 +648,7 @@ service_lcore_add_del(void) "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 b9c6e9118e..33b0c6adac 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -565,9 +565,8 @@ test_predictable_rss_min_seq(void) { 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; @@ -575,9 +574,9 @@ test_predictable_rss_min_seq(void) 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 Tue Feb 4 16:21:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150877 X-Patchwork-Delegate: david.marchand@redhat.com 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 CF4784618E; Tue, 4 Feb 2025 17:23:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E35F840EE2; Tue, 4 Feb 2025 17:23:02 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 455A64042E for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id E1989210C33A; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E1989210C33A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=8ExafJgLh1IxftT5BWlc87g++0TfLbSnzKlAjZo3A/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pet9sw7Sxr1prZvKejhzFUlk11+PYPAa3ukkmyvsdtJd61b/vVhGaG45Y1VDUHndo /+KHmFhSVBgPWg9JsNXudChQlBXoxbObYd7c0AUyOBPo1EF7lajVXQaZaIoXp+HWTZ Octw+ze0inF8KMyCPWldr3GJlapNOS6J3lIWboYk= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v20 14/27] common/idpf: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:51 -0800 Message-Id: <1738686124-16173-15-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Tyler Retzlaff 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 Acked-by: Bruce Richardson --- 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 a04e54ce26..e04ab40fa2 100644 --- a/drivers/common/idpf/idpf_common_rxtx.c +++ b/drivers/common/idpf/idpf_common_rxtx.c @@ -569,7 +569,7 @@ idpf_split_rx_bufq_refill(struct idpf_rx_queue *rx_bufq) 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 81052e72c1..6fbfee1b2d 100644 --- a/drivers/common/idpf/idpf_common_rxtx_avx512.c +++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c @@ -998,7 +998,8 @@ idpf_tx_singleq_free_bufs_avx512(struct idpf_tx_queue *txq) 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 & @@ -1322,7 +1323,8 @@ idpf_tx_splitq_free_bufs_avx512(struct idpf_tx_queue *txq) 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 Tue Feb 4 16:21:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150888 X-Patchwork-Delegate: david.marchand@redhat.com 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 765CC4618E; Tue, 4 Feb 2025 17:25:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 219FD40E1D; Tue, 4 Feb 2025 17:23:13 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 074C040657 for ; Tue, 4 Feb 2025 17:22:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id EDB33210C33B; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EDB33210C33B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686167; bh=VBzdCs4Vk7omdaZhx0PODKhULU/9lWDaJ9q39L8JA3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=caFdIVDt42f7KTimSPmr/+V9GsZPHxW9w3M4ES/+AFLwTnfrGM7a54xJ2mWwr3OF/ 5kCZJfiO/lkqnJOZ5vKSzTUDR/35Q9nS2GLfrftjrQdWUdU9BX4E64gdqOLtNRnOM0 AAAEWFNzgILDoMSoVbWGVTg9TG/3SdGJrTu2ycJQ= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v20 15/27] net/i40e: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:52 -0800 Message-Id: <1738686124-16173-16-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Tyler Retzlaff 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 Reviewed-by: Bruce Richardson --- drivers/net/intel/i40e/i40e_testpmd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/intel/i40e/i40e_testpmd.c b/drivers/net/intel/i40e/i40e_testpmd.c index b6ef5d6e42..21f596297b 100644 --- a/drivers/net/intel/i40e/i40e_testpmd.c +++ b/drivers/net/intel/i40e/i40e_testpmd.c @@ -2168,8 +2168,7 @@ cmd_ptype_mapping_get_parsed(void *parsed_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 @@ cmd_ptype_mapping_get_parsed(void *parsed_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 Tue Feb 4 16:21:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150881 X-Patchwork-Delegate: david.marchand@redhat.com 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 A71534618E; Tue, 4 Feb 2025 17:24:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D55C4111B; Tue, 4 Feb 2025 17:23:06 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 711C040608 for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 05CA5210C33C; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 05CA5210C33C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=n3fSQnNofQakaC6d4g4JW0HciO7hBKP91yevfTvAgQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CdWvxxlaTgUeINwbus3mwY2NM8mHxDAO99rriPWtZhQ9+3f2HKFw/NB3yE2G1mX1g GMZkKZpTpbsrIW36zAdihZD3ttYDpB20fyW/OSbeDTAq/k5xQnk+gaZrWyUJGWciZL aR4jmAnoGNRYzZ238/WJ3mi1V5HetkmLGJRTqLQ4= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v20 16/27] common/mlx5: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:53 -0800 Message-Id: <1738686124-16173-17-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Tyler Retzlaff 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 1abd1e8239..f29f06a86e 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -125,10 +125,10 @@ mlx5_fp_debug_enabled(void) /* 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 a75f011750..804ee67cd6 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -284,10 +284,9 @@ mlx5_devx_cmd_flow_counter_query(struct mlx5_devx_obj *dcs, 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 @@ mlx5_devx_cmd_mkey_create(void *ctx, 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 Tue Feb 4 16:21:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150885 X-Patchwork-Delegate: david.marchand@redhat.com 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 A79574618E; Tue, 4 Feb 2025 17:24:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 434334279A; Tue, 4 Feb 2025 17:23:10 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 72BDB40609 for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 1217D210C33D; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1217D210C33D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=ZPS/L28btd1uIsyaf4eDFI/mEOlNgYYzcA0fTqjUX9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DiN/Ck2WmGlgNvZEFY6tbr0GVpbyiPraGt/LW0X9pL26EnFdDanZMF3hEldqEQTSX CUR/9k2iZ7Off1rOpFfBjO7+qzAEtGDMTY4tVBsO0Y98bxmaZgoJLZND+PG/7Pw0Oz n3e+WVgqxvt15QUsbJwaUTIOPGs903C/eQN/coeM= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v20 17/27] net/mlx5: remove use of VLAs for Windows built code Date: Tue, 4 Feb 2025 08:21:54 -0800 Message-Id: <1738686124-16173-18-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 From: Tyler Retzlaff 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 6e4473e2f4..979e54686b 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1598,14 +1598,13 @@ void 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 3e79754b83..bfc44f25bf 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1479,8 +1479,8 @@ mlx5_flow_item_acceptable(const struct rte_eth_dev *dev, "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; @@ -8481,7 +8481,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, .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 Tue Feb 4 16:21:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150892 X-Patchwork-Delegate: david.marchand@redhat.com 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 E319C4618E; Tue, 4 Feb 2025 17:25:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36796427C1; Tue, 4 Feb 2025 17:23:17 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 166C240666 for ; Tue, 4 Feb 2025 17:22:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 1E36B210C33E; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1E36B210C33E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=jg3chQpsyWg++29dFr/6MLhfpIlJil2s3/sbC3cLWlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E+6NsI1AuY1H972flCjf4BolrjPYgk+mhvWVoEcgkCjIO/H4Pzfd/qaXVm1bt27Px 2G2/p8BZTDW3nUUYuz4t7MK5xVwzfcNiR+dZ3oIfKyG7A17+r7IAK+UWr2iiGBhRW5 BG3kNOLYxU4ZKoFEfHbmYMmGJ6/iSgvquG/RjOio= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 18/27] test: remove use of VLAs for Windows built code in bitset tests Date: Tue, 4 Feb 2025 08:21:55 -0800 Message-Id: <1738686124-16173-19-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 1) MSVC does not support VLAs. Use standard fixed C arrays of maximum size required instead. 2) ../usr/lib/gcc/x86_64-redhat-linux/13/include/emmintrin.h:742:8: error: array subscript 9 is outside array bounds of 'uint64_t[16]' {aka 'long unsigned int[16]'} [-Werror=array-bounds=] 3695 742 | *__P = __B; Compile with -Wno-array-bounds to avoid false positives when using gcc version 11 or newer (gcc compiler bug/limitation). Signed-off-by: Andre Muezerie --- app/test/test_bitset.c | 69 +++++++++++++++++++----------- app/test/test_lcore_var_perf.c | 2 +- app/test/test_reassembly_perf.c | 22 +++++----- app/test/test_soring_stress_impl.h | 13 +++--- 4 files changed, 63 insertions(+), 43 deletions(-) diff --git a/app/test/test_bitset.c b/app/test/test_bitset.c index 50b8bf0da4..45460204c1 100644 --- a/app/test/test_bitset.c +++ b/app/test/test_bitset.c @@ -99,11 +99,13 @@ typedef void clear_fun(uint64_t *bitset, size_t bit_num); typedef void assign_fun(uint64_t *bitset, size_t bit_num, bool value); typedef void flip_fun(uint64_t *bitset, size_t bit_num); +#define RAND_SET_MAX_SIZE 1000 + static int test_set_clear_size(test_fun test_fun, set_fun set_fun, clear_fun clear_fun, size_t size) { size_t i; - bool reference[size]; + bool reference[RAND_SET_MAX_SIZE]; uint64_t *bitset; rand_bool_ary(reference, size); @@ -131,8 +133,7 @@ test_set_clear_size(test_fun test_fun, set_fun set_fun, clear_fun clear_fun, siz return TEST_SUCCESS; } -#define RAND_ITERATIONS (10000) -#define RAND_SET_MAX_SIZE (1000) +#define RAND_ITERATIONS 10000 static int test_set_clear_fun(test_fun test_fun, set_fun set_fun, clear_fun clear_fun) @@ -168,10 +169,20 @@ test_flip_size(test_fun test_fun, assign_fun assign_fun, flip_fun flip_fun, size rand_bitset(bitset, size); for (i = 0; i < size; i++) { - RTE_BITSET_DECLARE(reference, size); + RTE_BITSET_DECLARE(reference, RAND_SET_MAX_SIZE); + +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 110000) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif + /* gcc is giving false positives here when code is optimized */ rte_bitset_copy(reference, bitset, size); +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 110000) +#pragma GCC diagnostic pop +#endif + bool value = test_fun(bitset, i); flip_fun(bitset, i); @@ -282,13 +293,13 @@ find_clear(const bool *ary, size_t num_bools, size_t start, size_t len) return find(ary, num_bools, start, len, false); } -#define FFS_ITERATIONS (100) +#define FFS_ITERATIONS 100 static int test_find_size(size_t size, bool set) { uint64_t *bitset; - bool reference[size]; + bool reference[RAND_SET_MAX_SIZE]; size_t i; bitset = alloc_bitset(size); @@ -388,8 +399,8 @@ record_match(ssize_t match_idx, size_t size, int *calls) static int test_foreach_size(ssize_t size, bool may_wrap, bool set) { - bool reference[size]; - int calls[size]; + bool reference[RAND_SET_MAX_SIZE]; + int calls[RAND_SET_MAX_SIZE]; uint64_t *bitset; ssize_t i; ssize_t start_bit; @@ -633,17 +644,19 @@ test_define(void) typedef void bitset_op(uint64_t *dst, const uint64_t *a, const uint64_t *b, size_t bit_num); typedef bool bool_op(bool a, bool b); +#define LOGIC_MAX_SET_SIZE 200 + static int test_logic_op(bitset_op bitset_op, bool_op bool_op) { - const size_t size = 1 + rte_rand_max(200); - RTE_BITSET_DECLARE(bitset_a, size); - RTE_BITSET_DECLARE(bitset_b, size); - RTE_BITSET_DECLARE(bitset_d, size); + const size_t size = 1 + rte_rand_max(LOGIC_MAX_SET_SIZE); + RTE_BITSET_DECLARE(bitset_a, LOGIC_MAX_SET_SIZE); + RTE_BITSET_DECLARE(bitset_b, LOGIC_MAX_SET_SIZE); + RTE_BITSET_DECLARE(bitset_d, LOGIC_MAX_SET_SIZE); - bool ary_a[size]; - bool ary_b[size]; - bool ary_d[size]; + bool ary_a[LOGIC_MAX_SET_SIZE]; + bool ary_b[LOGIC_MAX_SET_SIZE]; + bool ary_d[LOGIC_MAX_SET_SIZE]; rand_bool_ary(ary_a, size); rand_bool_ary(ary_b, size); @@ -708,14 +721,14 @@ test_complement(void) for (i = 0; i < RAND_ITERATIONS; i++) { const size_t size = 1 + rte_rand_max(RAND_SET_MAX_SIZE - 1); - RTE_BITSET_DECLARE(src, size); + RTE_BITSET_DECLARE(src, RAND_SET_MAX_SIZE); rand_bitset(src, size); bool bit_idx = rte_rand_max(size); bool bit_value = rte_bitset_test(src, bit_idx); - RTE_BITSET_DECLARE(dst, size); + RTE_BITSET_DECLARE(dst, RAND_SET_MAX_SIZE); rte_bitset_complement(dst, src, size); @@ -726,6 +739,8 @@ test_complement(void) return TEST_SUCCESS; } +#define SHIFT_SET_MAX_SIZE 500 + static int test_shift(bool right) { @@ -734,12 +749,12 @@ test_shift(bool right) const char *direction = right ? "right" : "left"; for (i = 0; i < 10000; i++) { - const int size = 1 + (int)rte_rand_max(500); + const int size = 1 + (int)rte_rand_max(SHIFT_SET_MAX_SIZE); const int shift_count = (int)rte_rand_max(1.5 * size); int src_idx; - RTE_BITSET_DECLARE(src, size); - RTE_BITSET_DECLARE(reference, size); + RTE_BITSET_DECLARE(src, SHIFT_SET_MAX_SIZE); + RTE_BITSET_DECLARE(reference, SHIFT_SET_MAX_SIZE); rte_bitset_init(src, size); rte_bitset_init(reference, size); @@ -788,12 +803,14 @@ test_shift_left(void) return test_shift(false); } +#define EQUAL_SET_MAX_SIZE 100 + static int test_equal(void) { - const size_t size = 100; - RTE_BITSET_DECLARE(bitset_a, size); - RTE_BITSET_DECLARE(bitset_b, size); + const size_t size = EQUAL_SET_MAX_SIZE; + RTE_BITSET_DECLARE(bitset_a, EQUAL_SET_MAX_SIZE); + RTE_BITSET_DECLARE(bitset_b, EQUAL_SET_MAX_SIZE); rand_buf(bitset_a, RTE_BITSET_SIZE(size)); rand_buf(bitset_b, RTE_BITSET_SIZE(size)); @@ -821,9 +838,9 @@ test_equal(void) static int test_copy(void) { - const size_t size = 100; - RTE_BITSET_DECLARE(bitset_a, size); - RTE_BITSET_DECLARE(bitset_b, size); + const size_t size = EQUAL_SET_MAX_SIZE; + RTE_BITSET_DECLARE(bitset_a, EQUAL_SET_MAX_SIZE); + RTE_BITSET_DECLARE(bitset_b, EQUAL_SET_MAX_SIZE); rand_buf(bitset_a, RTE_BITSET_SIZE(size)); rand_buf(bitset_b, RTE_BITSET_SIZE(size)); diff --git a/app/test/test_lcore_var_perf.c b/app/test/test_lcore_var_perf.c index 41e29bbd49..5a74ce4808 100644 --- a/app/test/test_lcore_var_perf.c +++ b/app/test/test_lcore_var_perf.c @@ -185,7 +185,7 @@ test_lcore_var_access_n(unsigned int num_mods) double tls_latency; double lazy_tls_latency; double lvar_latency; - unsigned int mods[num_mods]; + unsigned int mods[MAX_MODS]; unsigned int i; for (i = 0; i < num_mods; i++) diff --git a/app/test/test_reassembly_perf.c b/app/test/test_reassembly_perf.c index 69cf029468..7d3c692547 100644 --- a/app/test/test_reassembly_perf.c +++ b/app/test/test_reassembly_perf.c @@ -557,6 +557,8 @@ ipv4_outstanding_reassembly_perf(int8_t nb_frags, uint8_t fill_order, return TEST_SUCCESS; } +#define TEST_REASSEMBLY_ITERATIONS 4 + static int ipv4_reassembly_interleaved_flows_perf(uint8_t nb_frags) { @@ -568,17 +570,17 @@ ipv4_reassembly_interleaved_flows_perf(uint8_t nb_frags) uint64_t total_cyc = 0; uint32_t i, j; - for (i = 0; i < flow_cnt; i += 4) { + for (i = 0; i < flow_cnt; i += TEST_REASSEMBLY_ITERATIONS) { struct rte_mbuf *buf_out[4] = {NULL}; uint8_t reassembled = 0; uint8_t nb_frags = 0; uint8_t prev = 0; - for (j = 0; j < 4; j++) + for (j = 0; j < TEST_REASSEMBLY_ITERATIONS; j++) nb_frags += frag_per_flow[i + j]; - struct rte_mbuf *buf_arr[nb_frags]; - for (j = 0; j < 4; j++) { + struct rte_mbuf *buf_arr[TEST_REASSEMBLY_ITERATIONS * MAX_FRAGMENTS]; + for (j = 0; j < TEST_REASSEMBLY_ITERATIONS; j++) { join_array(buf_arr, mbufs[i + j], prev, frag_per_flow[i + j]); prev += frag_per_flow[i + j]; @@ -608,7 +610,7 @@ ipv4_reassembly_interleaved_flows_perf(uint8_t nb_frags) total_cyc += rte_rdtsc_precise() - flow_tstamp; if (reassembled != 4) return TEST_FAILED; - for (j = 0; j < 4; j++) { + for (j = 0; j < TEST_REASSEMBLY_ITERATIONS; j++) { memset(mbufs[i + j], 0, sizeof(struct rte_mbuf *) * MAX_FRAGMENTS); mbufs[i + j][0] = buf_out[j]; @@ -779,17 +781,17 @@ ipv6_reassembly_interleaved_flows_perf(int8_t nb_frags) uint64_t total_cyc = 0; uint32_t i, j; - for (i = 0; i < flow_cnt; i += 4) { + for (i = 0; i < flow_cnt; i += TEST_REASSEMBLY_ITERATIONS) { struct rte_mbuf *buf_out[4] = {NULL}; uint8_t reassembled = 0; uint8_t nb_frags = 0; uint8_t prev = 0; - for (j = 0; j < 4; j++) + for (j = 0; j < TEST_REASSEMBLY_ITERATIONS; j++) nb_frags += frag_per_flow[i + j]; - struct rte_mbuf *buf_arr[nb_frags]; - for (j = 0; j < 4; j++) { + struct rte_mbuf *buf_arr[TEST_REASSEMBLY_ITERATIONS * MAX_FRAGMENTS]; + for (j = 0; j < TEST_REASSEMBLY_ITERATIONS; j++) { join_array(buf_arr, mbufs[i + j], prev, frag_per_flow[i + j]); prev += frag_per_flow[i + j]; @@ -825,7 +827,7 @@ ipv6_reassembly_interleaved_flows_perf(int8_t nb_frags) total_cyc += rte_rdtsc_precise() - flow_tstamp; if (reassembled != 4) return TEST_FAILED; - for (j = 0; j < 4; j++) { + for (j = 0; j < TEST_REASSEMBLY_ITERATIONS; j++) { memset(mbufs[i + j], 0, sizeof(struct rte_mbuf *) * MAX_FRAGMENTS); mbufs[i + j][0] = buf_out[j]; diff --git a/app/test/test_soring_stress_impl.h b/app/test/test_soring_stress_impl.h index bea33f58d1..9e22de98d2 100644 --- a/app/test/test_soring_stress_impl.h +++ b/app/test/test_soring_stress_impl.h @@ -630,24 +630,25 @@ role_mask_even_odd(uint32_t nb_stage, uint32_t role_mask[RTE_MAX_LCORE]) static void role_mask_div(uint32_t nb_stage, uint32_t role_mask[RTE_MAX_LCORE]) { + const uint32_t msk_count = nb_stage + 1; uint32_t i, lc; - uint32_t msk[nb_stage + 1]; + uint32_t *msk = alloca(sizeof(uint32_t) * msk_count); memset(role_mask, 0, sizeof(role_mask[0]) * RTE_MAX_LCORE); - for (i = 0; i != RTE_DIM(msk); i++) { + for (i = 0; i != msk_count; i++) { msk[i] = RTE_BIT32(i); }; i = 0; RTE_LCORE_FOREACH_WORKER(lc) { - role_mask[lc] = msk[i % RTE_DIM(msk)]; + role_mask[lc] = msk[i % msk_count]; i++; } - if (i < RTE_DIM(msk)) { + if (i < msk_count) { lc = rte_get_next_lcore(-1, 1, 0); - for (; i != RTE_DIM(msk); i++) - role_mask[lc] |= msk[i % RTE_DIM(msk)]; + for (; i != msk_count; i++) + role_mask[lc] |= msk[i % msk_count]; } } From patchwork Tue Feb 4 16:21:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150886 X-Patchwork-Delegate: david.marchand@redhat.com 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 6DC3A4618E; Tue, 4 Feb 2025 17:24:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2ED75427A3; Tue, 4 Feb 2025 17:23:11 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8F5524029B for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 2A82D210C33F; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2A82D210C33F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=SRTZ560hU6hoVKD+Fkx5M+2z0vU/hDztzmfhWxbC+cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LCimS14NVUX1eHKAs8l1E/B/eUKlfARstWAutYcwXGEHbuu8tzybMMNPzAgdU3Srx S/adxh2ykRdAokafYeTVRVFjY1PhrMja7c2/y7qBnsnfwtAH2oobLNw4tH2sCfAPci w0/1j21HeQ9sskVYS3isaeEvYpc8Dw641zCPg11A= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 19/27] app/testpmd: remove use of VLAs for Windows built code in shared_rxq_fwd Date: Tue, 4 Feb 2025 08:21:56 -0800 Message-Id: <1738686124-16173-20-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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: Andre Muezerie Acked-by: Chengwen Feng --- app/test-pmd/shared_rxq_fwd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-pmd/shared_rxq_fwd.c b/app/test-pmd/shared_rxq_fwd.c index 623d62da88..b85830b90e 100644 --- a/app/test-pmd/shared_rxq_fwd.c +++ b/app/test-pmd/shared_rxq_fwd.c @@ -92,7 +92,7 @@ forward_shared_rxq(struct fwd_stream *fs, uint16_t nb_rx, static bool shared_rxq_fwd(struct fwd_stream *fs) { - struct rte_mbuf *pkts_burst[nb_pkt_per_burst]; + struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; uint16_t nb_rx; nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); From patchwork Tue Feb 4 16:21:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150883 X-Patchwork-Delegate: david.marchand@redhat.com 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 1B5934618E; Tue, 4 Feb 2025 17:24:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23F2C42788; Tue, 4 Feb 2025 17:23:08 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E9DB840648 for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 371C5210D0C1; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 371C5210D0C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=5K8NnvBuKfNdoeRH2uHEHHTvXAo3jG0xU1HKYV9xnjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqV9RNDm5JNz81TyIxTfY52NwTMWehdK2sgP+Tql1hxUZ67cUNrpkshyf5hbO/3js Xs+IhHo+dUnxUp2I37kCujpQwQYC4M8KZvh59B9IW+4pv4o/RYVZssh83F3K+AHQpf zPpQ1WffoqMD1RtlhMngcuVzTDNtRptjk/J2DUVE= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 20/27] hash: remove use of VLAs by using standard arrays Date: Tue, 4 Feb 2025 08:21:57 -0800 Message-Id: <1738686124-16173-21-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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. Signed-off-by: Andre Muezerie --- lib/hash/rte_thash_gf2_poly_math.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/hash/rte_thash_gf2_poly_math.c b/lib/hash/rte_thash_gf2_poly_math.c index 1c62974e71..825da4382f 100644 --- a/lib/hash/rte_thash_gf2_poly_math.c +++ b/lib/hash/rte_thash_gf2_poly_math.c @@ -8,6 +8,7 @@ #include #include +#define MAX_POLY_DEGREE 32 #define MAX_TOEPLITZ_KEY_LENGTH 64 RTE_LOG_REGISTER_SUFFIX(thash_poly_logtype, thash_poly, INFO); #define RTE_LOGTYPE_HASH thash_poly_logtype @@ -149,7 +150,7 @@ gf2_pow(uint32_t a, uint32_t pow, uint32_t r, int degree) static uint32_t __thash_get_rand_poly(int poly_degree) { - uint32_t roots[poly_degree]; + uint32_t roots[MAX_POLY_DEGREE]; uint32_t rnd; uint32_t ret_poly = 0; int i, j; @@ -194,9 +195,7 @@ __thash_get_rand_poly(int poly_degree) * Get coefficients of the polynomial for * (x - roots[0])(x - roots[1])...(x - roots[n]) */ - uint32_t poly_coefficients[poly_degree + 1]; - for (i = 0; i <= poly_degree; i++) - poly_coefficients[i] = 0; + uint32_t poly_coefficients[MAX_POLY_DEGREE + 1] = {0}; poly_coefficients[0] = 1; /* highest degree term coefficient in the end */ for (i = 0; i < (int)poly_degree; i++) { @@ -247,7 +246,7 @@ thash_get_rand_poly(uint32_t poly_degree) { uint32_t ret_poly; - if (poly_degree > 32) { + if (poly_degree > MAX_POLY_DEGREE) { HASH_LOG(ERR, "Wrong polynomial degree %d, must be in range [1, 32]", poly_degree); return 0; } From patchwork Tue Feb 4 16:21:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150880 X-Patchwork-Delegate: david.marchand@redhat.com 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 4FDA44618E; Tue, 4 Feb 2025 17:24:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C90E40F35; Tue, 4 Feb 2025 17:23:05 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A81BC4060B for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 4397A210D0C2; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4397A210D0C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=XX83F6jTPPstTVxG2Fp3urWxYW1XMHKRIECZhjpTpOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BtxQyvzMUHjvUWUmaLV5aVy8NVGLtGlGfd+qQkYDHHUd5iHH8hP2JQars8LwdxvMi VuMR6VyoP+Mbz6Fj+TfP+q3kQNyCySv1sF493XOR9tjqbaJ6xZwdebKIUiEYwBQ8XP I+m3SezGLgGPVGKwtHcyy8wXP/DGfpukr4sHVpso= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 21/27] config: define no_wvla_cflag Date: Tue, 4 Feb 2025 08:21:58 -0800 Message-Id: <1738686124-16173-22-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 We define no_wvla_cflag in a top directory so that it can be used by meson.build files in lower directories that are not yet VLA-free. Signed-off-by: Andre Muezerie --- config/meson.build | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/meson.build b/config/meson.build index 6aaad6d8a4..a251ce49b1 100644 --- a/config/meson.build +++ b/config/meson.build @@ -342,6 +342,14 @@ if cc.get_id() == 'intel' warning_flags += '-diag-disable=@0@'.format(i) endforeach endif + +no_wvla_cflag = [] +if cc.has_argument('-Wvla') + if not is_windows + no_wvla_cflag = '-Wno-vla' + endif +endif + foreach arg: warning_flags if cc.has_argument(arg) add_project_arguments(arg, language: 'c') From patchwork Tue Feb 4 16:21:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150891 X-Patchwork-Delegate: david.marchand@redhat.com 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 3B3734618E; Tue, 4 Feb 2025 17:25:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFE4D427BA; Tue, 4 Feb 2025 17:23:15 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 26B514066C for ; Tue, 4 Feb 2025 17:22:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 4FBEC210D0C3; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4FBEC210D0C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=uChABuleYtCEmITg/Decau+IfCFFQhcm3c+EQS1t5FM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RbbNue2LdwCJkNkRtepV6WBDdWzYrrjVCgua146g6/PF2pZtvGDFc9l19+5AxN/ko wDfVchbk2g8i4u1lauBhX4OJfrlkJRL7yWPoDXT3dOLOpa7k/gJiJYde7Ii3HOFRqz u8vwachgNYk2zBum1/XlwL9c5+JTs4WybxWDKJC8= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 22/27] app: add no_wvla_cflag to directories that are not VLA-free Date: Tue, 4 Feb 2025 08:21:59 -0800 Message-Id: <1738686124-16173-23-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 The no_wvla_cflag is added to meson.build files in directories that are not yet VLA-free. Signed-off-by: Andre Muezerie --- app/pdump/meson.build | 2 ++ app/proc-info/meson.build | 2 ++ app/test-acl/meson.build | 2 ++ app/test-bbdev/meson.build | 2 ++ app/test-crypto-perf/meson.build | 2 ++ app/test-dma-perf/meson.build | 2 ++ app/test-eventdev/meson.build | 2 ++ app/test-flow-perf/meson.build | 2 ++ app/test-pmd/meson.build | 10 +++++++++- app/test-sad/meson.build | 2 ++ app/test/meson.build | 17 ++++++++++++----- 11 files changed, 39 insertions(+), 6 deletions(-) diff --git a/app/pdump/meson.build b/app/pdump/meson.build index fb282bba1f..a4c7dd44e7 100644 --- a/app/pdump/meson.build +++ b/app/pdump/meson.build @@ -9,3 +9,5 @@ endif sources = files('main.c') deps += ['ethdev', 'kvargs', 'pdump'] + +cflags += no_wvla_cflag diff --git a/app/proc-info/meson.build b/app/proc-info/meson.build index 4f83f29a64..316253cd5d 100644 --- a/app/proc-info/meson.build +++ b/app/proc-info/meson.build @@ -12,3 +12,5 @@ deps += ['ethdev', 'security', 'eventdev'] if dpdk_conf.has('RTE_LIB_METRICS') deps += 'metrics' endif + +cflags += no_wvla_cflag diff --git a/app/test-acl/meson.build b/app/test-acl/meson.build index c0dc4b221a..7d8b707794 100644 --- a/app/test-acl/meson.build +++ b/app/test-acl/meson.build @@ -9,3 +9,5 @@ endif sources = files('main.c') deps += ['acl', 'net'] + +cflags += no_wvla_cflag diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build index 926e0a5271..85b060edec 100644 --- a/app/test-bbdev/meson.build +++ b/app/test-bbdev/meson.build @@ -26,3 +26,5 @@ endif if dpdk_conf.has('RTE_BASEBAND_LA12XX') deps += ['baseband_la12xx'] endif + +cflags += no_wvla_cflag diff --git a/app/test-crypto-perf/meson.build b/app/test-crypto-perf/meson.build index 7b02b518f0..87dd3bc5f1 100644 --- a/app/test-crypto-perf/meson.build +++ b/app/test-crypto-perf/meson.build @@ -23,3 +23,5 @@ deps += ['cryptodev', 'net', 'security'] if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') deps += 'crypto_scheduler' endif + +cflags += no_wvla_cflag diff --git a/app/test-dma-perf/meson.build b/app/test-dma-perf/meson.build index b1557b8125..40d6b7f8e4 100644 --- a/app/test-dma-perf/meson.build +++ b/app/test-dma-perf/meson.build @@ -13,3 +13,5 @@ sources = files( 'main.c', 'benchmark.c', ) + +cflags += no_wvla_cflag diff --git a/app/test-eventdev/meson.build b/app/test-eventdev/meson.build index ab8769c755..f0da9fadf2 100644 --- a/app/test-eventdev/meson.build +++ b/app/test-eventdev/meson.build @@ -23,3 +23,5 @@ sources = files( 'test_pipeline_queue.c', ) deps += 'eventdev' + +cflags += no_wvla_cflag diff --git a/app/test-flow-perf/meson.build b/app/test-flow-perf/meson.build index 766e4516ad..5758f8d9c6 100644 --- a/app/test-flow-perf/meson.build +++ b/app/test-flow-perf/meson.build @@ -15,3 +15,5 @@ sources = files( ) deps += ['ethdev'] + +cflags += no_wvla_cflag diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index f1c36529b4..8de1528428 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -3,7 +3,15 @@ # override default name to drop the hyphen name = 'testpmd' -cflags += '-Wno-deprecated-declarations' + +extra_flags = ['-Wno-deprecated-declarations'] + +foreach arg: extra_flags + if cc.has_argument(arg) + cflags += arg + endif +endforeach + sources = files( '5tswap.c', 'cmdline.c', diff --git a/app/test-sad/meson.build b/app/test-sad/meson.build index a50616a9c7..a1cbcc71d6 100644 --- a/app/test-sad/meson.build +++ b/app/test-sad/meson.build @@ -9,3 +9,5 @@ endif sources = files('main.c') deps += ['ipsec', 'net'] + +cflags += no_wvla_cflag diff --git a/app/test/meson.build b/app/test/meson.build index 48cf77fda9..b6285a6b45 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -250,12 +250,19 @@ foreach d:optional_deps endif endforeach -if cc.has_argument('-Wno-format-truncation') - cflags += '-Wno-format-truncation' -endif +cflags += no_wvla_cflag + +extra_flags = [ + # Strict-aliasing rules are violated by uint8_t[] to context size casts. + '-fno-strict-aliasing', + '-Wno-format-truncation', +] -# Strict-aliasing rules are violated by uint8_t[] to context size casts. -cflags += '-fno-strict-aliasing' +foreach arg: extra_flags + if cc.has_argument(arg) + cflags += arg + endif +endforeach # Enable using internal APIs in unit tests cflags += '-DALLOW_INTERNAL_API' From patchwork Tue Feb 4 16:22:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150884 X-Patchwork-Delegate: david.marchand@redhat.com 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 AB1E54618E; Tue, 4 Feb 2025 17:24:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01CF642792; Tue, 4 Feb 2025 17:23:09 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A12FF4025F for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 5BE75210D0C7; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5BE75210D0C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=iqybCPFgA2xnaRP787MPNRajQee4qhAVzitnlkUfGiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DL//DQ8DZP63YHf6KPzPWl/PB+R22u5GbBCsWqwsVh4akkHZKePX57NCKvdnrF6DC STjukJR7ydnzBTjFA0IwPk7Q/pqDQJfVa4LfKdjqO4H+x3YLc6FNyT5KXbKWJg1t1J R5IS3HLYTUgYJQ+n9/2R+MxxKbuPZmTPUe8iTPXI= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 23/27] drivers: add no_wvla_cflag to directories that are not VLA-free Date: Tue, 4 Feb 2025 08:22:00 -0800 Message-Id: <1738686124-16173-24-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 The no_wvla_cflag is added to meson.build files in directories that are not yet VLA-free. Signed-off-by: Andre Muezerie --- drivers/common/cnxk/meson.build | 2 ++ drivers/common/mlx5/meson.build | 2 ++ drivers/common/qat/meson.build | 2 ++ drivers/crypto/ccp/meson.build | 2 ++ drivers/crypto/cnxk/meson.build | 2 ++ drivers/crypto/ipsec_mb/meson.build | 2 ++ drivers/crypto/octeontx/meson.build | 2 ++ drivers/crypto/openssl/meson.build | 1 + drivers/crypto/scheduler/meson.build | 2 ++ drivers/dma/dpaa/meson.build | 2 ++ drivers/event/cnxk/meson.build | 2 ++ drivers/event/dsw/meson.build | 1 + drivers/event/opdl/meson.build | 1 + drivers/event/sw/meson.build | 1 + drivers/net/af_xdp/meson.build | 2 ++ drivers/net/bnxt/meson.build | 2 ++ drivers/net/bonding/meson.build | 2 ++ drivers/net/cnxk/meson.build | 2 ++ drivers/net/cxgbe/meson.build | 2 ++ drivers/net/dpaa/meson.build | 2 ++ drivers/net/dpaa2/meson.build | 2 ++ drivers/net/failsafe/meson.build | 1 + drivers/net/gve/meson.build | 2 ++ drivers/net/hns3/meson.build | 2 ++ drivers/net/mana/meson.build | 2 ++ drivers/net/mlx4/meson.build | 2 ++ drivers/net/mlx5/linux/meson.build | 2 ++ drivers/net/netvsc/meson.build | 2 ++ drivers/net/nfp/meson.build | 2 ++ drivers/net/ngbe/base/meson.build | 1 + drivers/net/ntnic/meson.build | 2 ++ drivers/net/octeontx/meson.build | 2 ++ drivers/net/sfc/meson.build | 1 + drivers/net/softnic/meson.build | 1 + drivers/net/tap/meson.build | 1 + drivers/net/txgbe/meson.build | 2 ++ drivers/net/vdev_netvsc/meson.build | 2 ++ drivers/net/virtio/meson.build | 2 ++ drivers/vdpa/mlx5/meson.build | 3 +++ 39 files changed, 70 insertions(+) diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build index 9e3fd44317..00a352dc55 100644 --- a/drivers/common/cnxk/meson.build +++ b/drivers/common/cnxk/meson.build @@ -92,6 +92,8 @@ sources += files('cnxk_telemetry_bphy.c', 'cnxk_telemetry_sso.c', ) +cflags += no_wvla_cflag + if meson.is_cross_build() soc_type = meson.get_external_property('platform', '') else diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build index 1eefc02f06..f572b12ae3 100644 --- a/drivers/common/mlx5/meson.build +++ b/drivers/common/mlx5/meson.build @@ -24,6 +24,8 @@ sources += files( 'mlx5_common_utils.c', ) +cflags += no_wvla_cflag + cflags_options = [ '-std=c11', '-Wno-strict-prototypes', diff --git a/drivers/common/qat/meson.build b/drivers/common/qat/meson.build index 5a8de16fe0..68290ef152 100644 --- a/drivers/common/qat/meson.build +++ b/drivers/common/qat/meson.build @@ -103,6 +103,8 @@ if qat_compress endforeach endif +cflags += no_wvla_cflag + if qat_crypto foreach f: ['qat_sym.c', 'qat_sym_session.c', 'qat_asym.c', 'qat_crypto.c', diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build index a9abaa4da0..a19c77a8d1 100644 --- a/drivers/crypto/ccp/meson.build +++ b/drivers/crypto/ccp/meson.build @@ -22,3 +22,5 @@ sources = files( ) ext_deps += dep + +cflags += no_wvla_cflag diff --git a/drivers/crypto/cnxk/meson.build b/drivers/crypto/cnxk/meson.build index aa840fb7bb..e9b67b4a14 100644 --- a/drivers/crypto/cnxk/meson.build +++ b/drivers/crypto/cnxk/meson.build @@ -28,6 +28,8 @@ headers = files('rte_pmd_cnxk_crypto.h') deps += ['bus_pci', 'common_cnxk', 'security', 'eventdev'] includes += include_directories('../../../lib/net', '../../event/cnxk') +cflags += no_wvla_cflag + if get_option('buildtype').contains('debug') cflags += [ '-DLA_IPSEC_DEBUG','-DCNXK_CRYPTODEV_DEBUG' ] else diff --git a/drivers/crypto/ipsec_mb/meson.build b/drivers/crypto/ipsec_mb/meson.build index 89ee03454b..5fcff5b04b 100644 --- a/drivers/crypto/ipsec_mb/meson.build +++ b/drivers/crypto/ipsec_mb/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + IMB_required_ver = '1.4.0' IMB_header = '#include' if arch_subdir == 'arm' diff --git a/drivers/crypto/octeontx/meson.build b/drivers/crypto/octeontx/meson.build index 387727c6ab..ec26aa65e7 100644 --- a/drivers/crypto/octeontx/meson.build +++ b/drivers/crypto/octeontx/meson.build @@ -32,3 +32,5 @@ includes += include_directories('../../common/octeontx') includes += include_directories('../../event/octeontx') includes += include_directories('../../mempool/octeontx') includes += include_directories('../../net/octeontx') + +cflags += no_wvla_cflag diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build index 1ec63c216d..c56e4678bb 100644 --- a/drivers/crypto/openssl/meson.build +++ b/drivers/crypto/openssl/meson.build @@ -16,3 +16,4 @@ deps += 'bus_vdev' sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c') ext_deps += dep require_iova_in_mbuf = false +cflags += no_wvla_cflag diff --git a/drivers/crypto/scheduler/meson.build b/drivers/crypto/scheduler/meson.build index 752d655415..b7c47d18b5 100644 --- a/drivers/crypto/scheduler/meson.build +++ b/drivers/crypto/scheduler/meson.build @@ -22,3 +22,5 @@ headers = files( 'rte_cryptodev_scheduler.h', 'rte_cryptodev_scheduler_operations.h', ) + +cflags += no_wvla_cflag diff --git a/drivers/dma/dpaa/meson.build b/drivers/dma/dpaa/meson.build index c31a6d91fe..aac5ffb36d 100644 --- a/drivers/dma/dpaa/meson.build +++ b/drivers/dma/dpaa/meson.build @@ -9,6 +9,8 @@ endif deps += ['dmadev', 'bus_dpaa'] sources = files('dpaa_qdma.c') +cflags += no_wvla_cflag + if cc.has_argument('-Wno-pointer-arith') cflags += '-Wno-pointer-arith' endif diff --git a/drivers/event/cnxk/meson.build b/drivers/event/cnxk/meson.build index 8aaf8116f7..9461ae33e4 100644 --- a/drivers/event/cnxk/meson.build +++ b/drivers/event/cnxk/meson.build @@ -299,6 +299,8 @@ sources += files( endif endif +cflags += no_wvla_cflag + extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing'] if cc.get_id() == 'clang' extra_flags += ['-Wno-asm-operand-widths'] diff --git a/drivers/event/dsw/meson.build b/drivers/event/dsw/meson.build index 01af94165f..190281314d 100644 --- a/drivers/event/dsw/meson.build +++ b/drivers/event/dsw/meson.build @@ -2,6 +2,7 @@ # Copyright(c) 2018 Ericsson AB deps += ['bus_vdev'] +cflags += no_wvla_cflag if cc.has_argument('-Wno-format-nonliteral') cflags += '-Wno-format-nonliteral' endif diff --git a/drivers/event/opdl/meson.build b/drivers/event/opdl/meson.build index 8613b2a746..7a53965ace 100644 --- a/drivers/event/opdl/meson.build +++ b/drivers/event/opdl/meson.build @@ -10,3 +10,4 @@ sources = files( ) deps += ['bus_vdev'] require_iova_in_mbuf = false +cflags += no_wvla_cflag diff --git a/drivers/event/sw/meson.build b/drivers/event/sw/meson.build index 3a3ebd72a3..c0c559ebc4 100644 --- a/drivers/event/sw/meson.build +++ b/drivers/event/sw/meson.build @@ -10,3 +10,4 @@ sources = files( ) deps += ['hash', 'bus_vdev'] require_iova_in_mbuf = false +cflags += no_wvla_cflag diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build index 69d109ff46..2d37bcc869 100644 --- a/drivers/net/af_xdp/meson.build +++ b/drivers/net/af_xdp/meson.build @@ -22,6 +22,8 @@ if not bpf_dep.found() bpf_dep = cc.find_library('bpf', required: false) endif +cflags += no_wvla_cflag + if cc.has_header('linux/if_xdp.h') if xdp_dep.found() and cc.has_header('xdp/xsk.h') cflags += ['-DRTE_NET_AF_XDP_LIBXDP'] diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build index 575f4c2add..e26cf13a65 100644 --- a/drivers/net/bnxt/meson.build +++ b/drivers/net/bnxt/meson.build @@ -12,6 +12,8 @@ if dpdk_conf.get('RTE_IOVA_IN_MBUF') == 0 subdir_done() endif +cflags += no_wvla_cflag + headers = files('rte_pmd_bnxt.h') cflags_options = [ '-DSUPPORT_CFA_HW_P70=1', diff --git a/drivers/net/bonding/meson.build b/drivers/net/bonding/meson.build index 87c567b149..d87e7a2522 100644 --- a/drivers/net/bonding/meson.build +++ b/drivers/net/bonding/meson.build @@ -24,3 +24,5 @@ deps += ['ip_frag'] headers = files('rte_eth_bond.h', 'rte_eth_bond_8023ad.h') require_iova_in_mbuf = false + +cflags += no_wvla_cflag diff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build index 32ff8aadc0..0efb298db2 100644 --- a/drivers/net/cnxk/meson.build +++ b/drivers/net/cnxk/meson.build @@ -324,6 +324,8 @@ endif deps += ['bus_pci', 'cryptodev', 'eventdev', 'security'] deps += ['common_cnxk', 'mempool_cnxk'] +cflags += no_wvla_cflag + # Allow implicit vector conversions and strict aliasing warning extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing'] if cc.get_id() == 'clang' diff --git a/drivers/net/cxgbe/meson.build b/drivers/net/cxgbe/meson.build index 6ed32774c9..95cb58ab44 100644 --- a/drivers/net/cxgbe/meson.build +++ b/drivers/net/cxgbe/meson.build @@ -23,3 +23,5 @@ sources = files( 'base/t4vf_hw.c', ) includes += include_directories('base') + +cflags += no_wvla_cflag diff --git a/drivers/net/dpaa/meson.build b/drivers/net/dpaa/meson.build index 239858adda..b1e4bbafb5 100644 --- a/drivers/net/dpaa/meson.build +++ b/drivers/net/dpaa/meson.build @@ -17,6 +17,8 @@ sources = files( 'dpaa_ptp.c', ) +cflags += no_wvla_cflag + if cc.has_argument('-Wno-pointer-arith') cflags += '-Wno-pointer-arith' endif diff --git a/drivers/net/dpaa2/meson.build b/drivers/net/dpaa2/meson.build index 51598c048c..89932b3037 100644 --- a/drivers/net/dpaa2/meson.build +++ b/drivers/net/dpaa2/meson.build @@ -27,3 +27,5 @@ sources = files( includes += include_directories('base', 'mc') headers = files('rte_pmd_dpaa2.h') + +cflags += no_wvla_cflag diff --git a/drivers/net/failsafe/meson.build b/drivers/net/failsafe/meson.build index c1d361083b..90c965b705 100644 --- a/drivers/net/failsafe/meson.build +++ b/drivers/net/failsafe/meson.build @@ -7,6 +7,7 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag cflags += '-D_DEFAULT_SOURCE' cflags += '-D_XOPEN_SOURCE=700' cflags += '-pedantic' diff --git a/drivers/net/gve/meson.build b/drivers/net/gve/meson.build index 6da13a8406..ed5ef0a1fc 100644 --- a/drivers/net/gve/meson.build +++ b/drivers/net/gve/meson.build @@ -18,3 +18,5 @@ sources = files( 'gve_rss.c', ) includes += include_directories('base') + +cflags += no_wvla_cflag diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build index 33f61f9883..53a9dd6f39 100644 --- a/drivers/net/hns3/meson.build +++ b/drivers/net/hns3/meson.build @@ -39,6 +39,8 @@ annotate_locks = false deps += ['hash'] +cflags += no_wvla_cflag + if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64') sources += files('hns3_rxtx_vec.c') diff --git a/drivers/net/mana/meson.build b/drivers/net/mana/meson.build index 4d163fc0f2..e320da7fc4 100644 --- a/drivers/net/mana/meson.build +++ b/drivers/net/mana/meson.build @@ -18,6 +18,8 @@ sources += files( 'tx.c', ) +cflags += no_wvla_cflag + libnames = ['ibverbs', 'mana'] libs = [] foreach libname:libnames diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 3c5ee24186..869d2895c8 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -8,6 +8,8 @@ if not is_linux subdir_done() endif +cflags += no_wvla_cflag + static_ibverbs = (get_option('ibverbs_link') == 'static') dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_net_mlx4_glue.so' diff --git a/drivers/net/mlx5/linux/meson.build b/drivers/net/mlx5/linux/meson.build index e541d25c18..e45ea988db 100644 --- a/drivers/net/mlx5/linux/meson.build +++ b/drivers/net/mlx5/linux/meson.build @@ -11,3 +11,5 @@ sources += files( 'mlx5_vlan_os.c', 'mlx5_flow_os.c', ) + +cflags += no_wvla_cflag diff --git a/drivers/net/netvsc/meson.build b/drivers/net/netvsc/meson.build index bb6225d05a..ca94d97989 100644 --- a/drivers/net/netvsc/meson.build +++ b/drivers/net/netvsc/meson.build @@ -15,3 +15,5 @@ sources = files( 'hn_rxtx.c', 'hn_vf.c', ) + +cflags += no_wvla_cflag diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build index 58a066c2e3..4052846dc2 100644 --- a/drivers/net/nfp/meson.build +++ b/drivers/net/nfp/meson.build @@ -49,6 +49,8 @@ sources = files( 'nfp_service.c', ) +cflags += no_wvla_cflag + if arch_subdir == 'x86' includes += include_directories('../../common/nfp') diff --git a/drivers/net/ngbe/base/meson.build b/drivers/net/ngbe/base/meson.build index dd68100bf8..86e78d4024 100644 --- a/drivers/net/ngbe/base/meson.build +++ b/drivers/net/ngbe/base/meson.build @@ -15,6 +15,7 @@ sources = [ error_cflags = [] +cflags += no_wvla_cflag c_args = cflags base_lib = static_library('ngbe_base', sources, diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 3c05ad1d87..7279d5590c 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -107,3 +107,5 @@ sources = files( 'ntnic_vfio.c', 'ntnic_ethdev.c', ) + +cflags += no_wvla_cflag diff --git a/drivers/net/octeontx/meson.build b/drivers/net/octeontx/meson.build index a5a6c9661c..541d2d9d0b 100644 --- a/drivers/net/octeontx/meson.build +++ b/drivers/net/octeontx/meson.build @@ -19,3 +19,5 @@ sources = files( deps += ['mempool_octeontx', 'eventdev'] includes += include_directories('base') + +cflags += no_wvla_cflag diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build index 5adde68517..90c38231e1 100644 --- a/drivers/net/sfc/meson.build +++ b/drivers/net/sfc/meson.build @@ -18,6 +18,7 @@ if (arch_subdir != 'x86' and arch_subdir != 'arm') or (not dpdk_conf.get('RTE_AR subdir_done() endif +cflags += no_wvla_cflag extra_flags = [] # Strict-aliasing rules are violated by rte_eth_link to uint64_t casts diff --git a/drivers/net/softnic/meson.build b/drivers/net/softnic/meson.build index 5dfbd16c77..e8d7290062 100644 --- a/drivers/net/softnic/meson.build +++ b/drivers/net/softnic/meson.build @@ -16,3 +16,4 @@ sources = files( 'rte_eth_softnic_thread.c', ) deps += ['pipeline', 'port', 'table'] +cflags += no_wvla_cflag diff --git a/drivers/net/tap/meson.build b/drivers/net/tap/meson.build index fa4e6cbec9..7160e9e98d 100644 --- a/drivers/net/tap/meson.build +++ b/drivers/net/tap/meson.build @@ -16,6 +16,7 @@ deps = ['bus_vdev', 'gso', 'hash'] max_queues = '-DTAP_MAX_QUEUES=64' cflags += max_queues +cflags += no_wvla_cflag require_iova_in_mbuf = false diff --git a/drivers/net/txgbe/meson.build b/drivers/net/txgbe/meson.build index ba7167a511..d9ca3743e2 100644 --- a/drivers/net/txgbe/meson.build +++ b/drivers/net/txgbe/meson.build @@ -24,6 +24,8 @@ sources = files( deps += ['hash', 'security'] +cflags += no_wvla_cflag + if arch_subdir == 'x86' sources += files('txgbe_rxtx_vec_sse.c') elif arch_subdir == 'arm' diff --git a/drivers/net/vdev_netvsc/meson.build b/drivers/net/vdev_netvsc/meson.build index 2228250b6c..bd35a13f3d 100644 --- a/drivers/net/vdev_netvsc/meson.build +++ b/drivers/net/vdev_netvsc/meson.build @@ -7,6 +7,8 @@ if not is_linux endif sources = files('vdev_netvsc.c') +cflags += no_wvla_cflag + cflags_options = [ '-D_BSD_SOURCE', '-D_DEFAULT_SOURCE', diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build index 02742da5c2..c708ea5258 100644 --- a/drivers/net/virtio/meson.build +++ b/drivers/net/virtio/meson.build @@ -23,6 +23,8 @@ sources += files( ) deps += ['kvargs', 'bus_pci'] +cflags += no_wvla_cflag + if arch_subdir == 'x86' if cc_has_avx512 cflags += ['-DCC_AVX512_SUPPORT'] diff --git a/drivers/vdpa/mlx5/meson.build b/drivers/vdpa/mlx5/meson.build index e224d1bcc9..7be11fda6d 100644 --- a/drivers/vdpa/mlx5/meson.build +++ b/drivers/vdpa/mlx5/meson.build @@ -22,6 +22,9 @@ sources = files( 'mlx5_vdpa_lm.c', 'mlx5_vdpa_cthread.c', ) + +cflags += no_wvla_cflag + cflags_options = [ '-std=c11', '-Wno-strict-prototypes', From patchwork Tue Feb 4 16:22:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150879 X-Patchwork-Delegate: david.marchand@redhat.com 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 C78D54618E; Tue, 4 Feb 2025 17:24:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8E9341060; Tue, 4 Feb 2025 17:23:04 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A33C54060A for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 68356210D0C8; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 68356210D0C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=mbbtVwfgzb11vdz0XrZeWyhnAAjs7Fl/I0JR7/q09n0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8gKf39PJWCsLzdjzRQkk+wx4WEe0VtIsUTBdBq4WRgk+34hk7R4vZaiSUxU0E9n4 d3z5/neDI9KxN0o6GGFtg0i+QRo9FTDJ29XCxbc/9k1IZ8Jg0aoy6lPLV0plkuN0J5 MZ1e920G2jRj/OzQTWQgqRPuPNhNhcm89norLfAg= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 24/27] lib: add no_wvla_cflag to directories that are not VLA-free Date: Tue, 4 Feb 2025 08:22:01 -0800 Message-Id: <1738686124-16173-25-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 The no_wvla_cflag is added to meson.build files in directories that are not yet VLA-free. Signed-off-by: Andre Muezerie --- lib/acl/meson.build | 2 ++ lib/bpf/meson.build | 2 ++ lib/dispatcher/meson.build | 2 ++ lib/eventdev/meson.build | 2 ++ lib/ipsec/meson.build | 2 ++ lib/member/meson.build | 2 ++ lib/metrics/meson.build | 2 ++ lib/pdcp/meson.build | 2 ++ lib/pdump/meson.build | 2 ++ lib/pipeline/meson.build | 2 ++ lib/power/meson.build | 3 +++ lib/table/meson.build | 2 ++ lib/vhost/meson.build | 11 ++++++++++- 13 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/acl/meson.build b/lib/acl/meson.build index 9cba08321a..fefe131a48 100644 --- a/lib/acl/meson.build +++ b/lib/acl/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c', 'rte_acl.c', 'tb_mem.c') headers = files('rte_acl.h', 'rte_acl_osdep.h') diff --git a/lib/bpf/meson.build b/lib/bpf/meson.build index aa258a9061..28df7f469a 100644 --- a/lib/bpf/meson.build +++ b/lib/bpf/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + if arch_subdir == 'x86' and dpdk_conf.get('RTE_ARCH_32') build = false reason = 'not supported on 32-bit x86' diff --git a/lib/dispatcher/meson.build b/lib/dispatcher/meson.build index ffaef26a6d..5e269b2d40 100644 --- a/lib/dispatcher/meson.build +++ b/lib/dispatcher/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + sources = files('rte_dispatcher.c') headers = files('rte_dispatcher.h') diff --git a/lib/eventdev/meson.build b/lib/eventdev/meson.build index a04bb86f0f..71dea91727 100644 --- a/lib/eventdev/meson.build +++ b/lib/eventdev/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + sources = files( 'eventdev_private.c', 'eventdev_trace_points.c', diff --git a/lib/ipsec/meson.build b/lib/ipsec/meson.build index 5c5a4aae78..02d18f5829 100644 --- a/lib/ipsec/meson.build +++ b/lib/ipsec/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + sources = files('esp_inb.c', 'esp_outb.c', 'sa.c', 'ses.c', 'ipsec_sad.c', 'ipsec_telemetry.c') diff --git a/lib/member/meson.build b/lib/member/meson.build index 02ef59795e..f92cbb7f25 100644 --- a/lib/member/meson.build +++ b/lib/member/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + headers = files('rte_member.h') sources = files( diff --git a/lib/metrics/meson.build b/lib/metrics/meson.build index 8c1c4b4b49..6722f666d2 100644 --- a/lib/metrics/meson.build +++ b/lib/metrics/meson.build @@ -9,3 +9,5 @@ if dpdk_conf.has('RTE_HAS_JANSSON') endif deps += ['ethdev', 'telemetry'] + +cflags += no_wvla_cflag diff --git a/lib/pdcp/meson.build b/lib/pdcp/meson.build index f4f9246bcb..eef46dd55a 100644 --- a/lib/pdcp/meson.build +++ b/lib/pdcp/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + sources = files( 'pdcp_cnt.c', 'pdcp_crypto.c', diff --git a/lib/pdump/meson.build b/lib/pdump/meson.build index da8d51b616..553dfdd5e6 100644 --- a/lib/pdump/meson.build +++ b/lib/pdump/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + sources = files('rte_pdump.c') headers = files('rte_pdump.h') deps += ['ethdev', 'bpf', 'pcapng'] diff --git a/lib/pipeline/meson.build b/lib/pipeline/meson.build index fd5e0dc6bb..823c7929a7 100644 --- a/lib/pipeline/meson.build +++ b/lib/pipeline/meson.build @@ -7,6 +7,8 @@ if is_windows subdir_done() endif +cflags += no_wvla_cflag + sources = files( 'rte_pipeline.c', 'rte_port_in_action.c', diff --git a/lib/power/meson.build b/lib/power/meson.build index b3a7bc7b2e..56b59071ea 100644 --- a/lib/power/meson.build +++ b/lib/power/meson.build @@ -11,6 +11,9 @@ if not is_linux build = false reason = 'only supported on Linux' endif + +cflags += no_wvla_cflag + sources = files( 'power_common.c', 'rte_power_cpufreq.c', diff --git a/lib/table/meson.build b/lib/table/meson.build index 9b3d9ac759..e27957fe89 100644 --- a/lib/table/meson.build +++ b/lib/table/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation +cflags += no_wvla_cflag + sources = files( 'rte_swx_keycmp.c', 'rte_swx_table_em.c', diff --git a/lib/vhost/meson.build b/lib/vhost/meson.build index 51bcf17244..af22f66793 100644 --- a/lib/vhost/meson.build +++ b/lib/vhost/meson.build @@ -16,11 +16,20 @@ elif (toolchain == 'icc' and cc.version().version_compare('>=16.0.0')) cflags += '-DVHOST_ICC_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h')) -cflags += [ + +cflags += no_wvla_cflag + +extra_flags = [ '-fno-strict-aliasing', '-Wno-address-of-packed-member', ] +foreach arg: extra_flags + if cc.has_argument(arg) + cflags += arg + endif +endforeach + sources = files( 'fd_man.c', 'iotlb.c', From patchwork Tue Feb 4 16:22:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150890 X-Patchwork-Delegate: david.marchand@redhat.com 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 89F174618E; Tue, 4 Feb 2025 17:25:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BFF942790; Tue, 4 Feb 2025 17:23:15 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3B0834066F for ; Tue, 4 Feb 2025 17:22:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 74A39210D0C9; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 74A39210D0C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=aPloZmRzPS81A3gM1BB1XitT4l4LD+nrXd/fISGnZUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZwH8acyMvqGu6GlkUyZfhJSFxP/vMinjmlHMMN/s4gC2P3QyUWUHpRiwezB91O4Nw b8cZVJAroqoS/oROxjT9B0fACjCVG6MihiQBdVHcuYKY5w17mZ3cwzMPNoXwxEAQdZ et9/C0h5pkXjCTScX37W86fobSsEizaIL4U062JE= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 25/27] examples: add no_wvla_cflag to directories that are not VLA-free Date: Tue, 4 Feb 2025 08:22:02 -0800 Message-Id: <1738686124-16173-26-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 The no_wvla_cflag is added to meson.build files in directories that are not yet VLA-free. Signed-off-by: Andre Muezerie --- examples/fips_validation/meson.build | 2 ++ examples/ip_fragmentation/meson.build | 1 + examples/ipsec-secgw/meson.build | 3 +++ examples/l2fwd-crypto/meson.build | 1 + examples/l2fwd-jobstats/meson.build | 1 + examples/l3fwd-power/meson.build | 1 + examples/l3fwd/meson.build | 1 + examples/pipeline/meson.build | 1 + examples/qos_sched/meson.build | 1 + examples/vhost/meson.build | 1 + 10 files changed, 13 insertions(+) diff --git a/examples/fips_validation/meson.build b/examples/fips_validation/meson.build index 7d4e440c6c..6c29b535cb 100644 --- a/examples/fips_validation/meson.build +++ b/examples/fips_validation/meson.build @@ -25,6 +25,8 @@ sources = files( 'main.c', ) +cflags += no_wvla_cflag + if dpdk_conf.has('RTE_HAS_JANSSON') ext_deps += jansson_dep cflags += '-DUSE_JANSSON' diff --git a/examples/ip_fragmentation/meson.build b/examples/ip_fragmentation/meson.build index cd84e9b143..750c3e4149 100644 --- a/examples/ip_fragmentation/meson.build +++ b/examples/ip_fragmentation/meson.build @@ -11,3 +11,4 @@ deps += ['ip_frag', 'lpm'] sources = files( 'main.c', ) +cflags += no_wvla_cflag diff --git a/examples/ipsec-secgw/meson.build b/examples/ipsec-secgw/meson.build index 023d9cf039..e6a0e18a73 100644 --- a/examples/ipsec-secgw/meson.build +++ b/examples/ipsec-secgw/meson.build @@ -23,6 +23,9 @@ sources = files( 'sp4.c', 'sp6.c', ) + +cflags += no_wvla_cflag + app_cflags = ['-Wno-address-of-packed-member'] foreach flag:app_cflags if cc.has_argument(flag) diff --git a/examples/l2fwd-crypto/meson.build b/examples/l2fwd-crypto/meson.build index bb44c88882..c21722b85c 100644 --- a/examples/l2fwd-crypto/meson.build +++ b/examples/l2fwd-crypto/meson.build @@ -14,3 +14,4 @@ allow_experimental_apis = true sources = files( 'main.c', ) +cflags += no_wvla_cflag diff --git a/examples/l2fwd-jobstats/meson.build b/examples/l2fwd-jobstats/meson.build index bffcf35e8c..d59d3d6555 100644 --- a/examples/l2fwd-jobstats/meson.build +++ b/examples/l2fwd-jobstats/meson.build @@ -11,3 +11,4 @@ deps += ['jobstats', 'timer'] sources = files( 'main.c', ) +cflags += no_wvla_cflag diff --git a/examples/l3fwd-power/meson.build b/examples/l3fwd-power/meson.build index 624ef5e947..5ff4466cac 100644 --- a/examples/l3fwd-power/meson.build +++ b/examples/l3fwd-power/meson.build @@ -12,3 +12,4 @@ sources = files( 'main.c', 'perf_core.c', ) +cflags += no_wvla_cflag diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build index c25de77bba..74144c7979 100644 --- a/examples/l3fwd/meson.build +++ b/examples/l3fwd/meson.build @@ -21,3 +21,4 @@ sources = files( if dpdk_conf.has('RTE_LIB_EVENTDEV') deps += 'eventdev' endif +cflags += no_wvla_cflag diff --git a/examples/pipeline/meson.build b/examples/pipeline/meson.build index 50103f2e01..01f14dc2ae 100644 --- a/examples/pipeline/meson.build +++ b/examples/pipeline/meson.build @@ -20,3 +20,4 @@ sources = files( 'obj.c', 'thread.c', ) +cflags += no_wvla_cflag diff --git a/examples/qos_sched/meson.build b/examples/qos_sched/meson.build index dc103e9556..92657ce8a5 100644 --- a/examples/qos_sched/meson.build +++ b/examples/qos_sched/meson.build @@ -17,3 +17,4 @@ sources = files( 'main.c', 'stats.c', ) +cflags += no_wvla_cflag diff --git a/examples/vhost/meson.build b/examples/vhost/meson.build index 87a637f83f..e938be8f45 100644 --- a/examples/vhost/meson.build +++ b/examples/vhost/meson.build @@ -18,3 +18,4 @@ sources = files( 'main.c', 'virtio_net.c', ) +cflags += no_wvla_cflag From patchwork Tue Feb 4 16:22:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150887 X-Patchwork-Delegate: david.marchand@redhat.com 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 B78914618E; Tue, 4 Feb 2025 17:24:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2484140EDD; Tue, 4 Feb 2025 17:23:12 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AA2C340615 for ; Tue, 4 Feb 2025 17:22:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 80D07210D0CA; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 80D07210D0CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=qoVQi9cS5sgnREgnU+YagZgmpgnf/GB1Wpawy3/JFjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bY3tFchgJ++ZNSn7kYhEU1nj+CQmOh4e8ftSuBaeMrlkzkrK6r7LX6HgfkM0jIo3g M7Y3aVQrA2LzFhrNB4MmLm6bQw53WHBZIFY66qrNdAQjpAVP8OxEaR9k+CIO52L1y3 FJJzonfr7uK7i/haxLGxlCHwM9QXIP/prEWu10+M= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 26/27] buildtools: add no_wvla_cflag to directories that are not VLA-free Date: Tue, 4 Feb 2025 08:22:03 -0800 Message-Id: <1738686124-16173-27-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 The no_wvla_cflag is added to meson.build files in directories that are not yet VLA-free. Signed-off-by: Andre Muezerie --- buildtools/chkincs/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index ed65105599..49dbc55254 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -12,6 +12,7 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args +cflags += no_wvla_cflag sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) From patchwork Tue Feb 4 16:22:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150889 X-Patchwork-Delegate: david.marchand@redhat.com 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 875B04618E; Tue, 4 Feb 2025 17:25:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 28CE0402F1; Tue, 4 Feb 2025 17:23:14 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 31B604066D for ; Tue, 4 Feb 2025 17:22:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 8E3CC210D0CB; Tue, 4 Feb 2025 08:22:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8E3CC210D0CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738686168; bh=aU95CxSQ32eGwxTs9PzkQr4sApQZ2NfhPJCOkkqcfpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLI6/OPH+CRduu6OK3xuRYEmzpBQ3iLzV7WwVKniA3WPWq10KI3cpMlaopZcN24Aw 4N5LA4Mm9vMtwW1ZpWA2JXsW23rr7+QZTGTSNUZ3lVKwtHfacHwjPGK3sn9RTqIyG/ ZFQNfHqoypxxtJs647BwjU/8KxyvBc7GRbFT6GhE= From: Andre Muezerie To: dev@dpdk.org Cc: konstantin.ananyev@huawei.com, thomas@monjalon.net, david.marchand@redhat.com, Andre Muezerie Subject: [PATCH v20 27/27] config: add -Wvla project-wide Date: Tue, 4 Feb 2025 08:22:04 -0800 Message-Id: <1738686124-16173-28-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738686124-16173-1-git-send-email-andremue@linux.microsoft.com> References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1738686124-16173-1-git-send-email-andremue@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 Add -Wvla project-wide so that VLAs are not allowed by default. This is to avoid new VLAs from being introduced. Meson files in directories which are not yet VLA-free have already been updated with -Wno-vla to avoid build breaks. Signed-off-by: Andre Muezerie --- config/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/config/meson.build b/config/meson.build index a251ce49b1..710206095b 100644 --- a/config/meson.build +++ b/config/meson.build @@ -345,6 +345,7 @@ endif no_wvla_cflag = [] if cc.has_argument('-Wvla') + add_project_arguments('-Wvla', language: 'c') if not is_windows no_wvla_cflag = '-Wno-vla' endif