From patchwork Tue Jan 16 18:41:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 135896 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88139438E3; Tue, 16 Jan 2024 19:43:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8757D40A87; Tue, 16 Jan 2024 19:43:15 +0100 (CET) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 24C8E402EE for ; Tue, 16 Jan 2024 19:43:13 +0100 (CET) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d3f29fea66so57824035ad.3 for ; Tue, 16 Jan 2024 10:43:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705430592; x=1706035392; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1SWSIFusGLFhG/6i4J5g4k7EjSwAUH/UQr+4g4W+7kw=; b=KjxgAQqQ+5t6vbBAzGqLYFTTEn1GiHwV5QoBp1ZgZyVf/ev15CxbsB6RGBP7XMpJ/E z7hPEVF+SG+NtdkydBN3WHqe95QTMq/4sjhUL0OM9n+me0lqK4UPks+2x8PQKgEC7+9k 4okYb4864g2DsHlEKeJBXdlq6SPdUBuozuTJpGSvGDrWHcpnfe5ux4QzTOvDmLv9cYP1 GTbygYYpSFKbBYgrcamXOexcH8muEOKAQUdH5BSBTV6iatt2+vwA1PRslkBsztPcnN3u 6NMap9Vge/2n2tknNcxtwz+Fe0MaxdP0T5QUO8BePriEiy20BpJwofHx/vWiUbWlIq8r Ap9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705430592; x=1706035392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1SWSIFusGLFhG/6i4J5g4k7EjSwAUH/UQr+4g4W+7kw=; b=ABTweoBUNYjgBiA+/zADhLuAE/f4jI8oQqYjsBn4zkz+UMbQJvN99cGP0xdbLabTO3 pt/p6LiatA7JnUohIoSe0dIajrI5sVfSOJOBaQ148iO80V0pD+Kdx1dheDTYHw+vtCLt OCXSeSWPc8DO3CJPIoDrkGhgb0KJb2+Iik1pSXAjPfCsQnHSQqtlpsRPEwlYLWE18I2p vo4qTaTCQS83SZXK8Ap0ArSDJfPxkUxkUSlkFy9bbGBiZofBkK7CFwHRH72zgWhzrgQZ WF+HHYXV6B9o2RGjliXYaBEd5iO+HHTu1qLiSUm9LoqKA+fixxvx0nf0QbU+Br+OPZ0G AIxQ== X-Gm-Message-State: AOJu0Yxmu2gPDaByhbD7N+HjIjBxPsd1SAVIlvgsCPdjT8qIkKZHHuWC eL4pXcosL27qZSWme6kFyOcgEhTC2h8w/6CDseQxE+yQCML3eg== X-Google-Smtp-Source: AGHT+IHqOONUP9+y5HuzY47yF51/yGEbErLNp41H9TjNFdZGQys/oSk7ilpiQuOtK90cMtl48s1pxg== X-Received: by 2002:a17:903:60f:b0:1d4:47ea:639c with SMTP id kg15-20020a170903060f00b001d447ea639cmr3694889plb.33.1705430592271; Tue, 16 Jan 2024 10:43:12 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id m8-20020a1709026bc800b001d60a70809bsm379238plt.168.2024.01.16.10.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:43:11 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , liang.j.ma@intel.com, Bruce Richardson , Tyler Retzlaff , Liang Ma , Peter Mccarthy , =?utf-8?q?Se=C3=A1n_Harte?= Subject: [PATCH v3 1/5] event/opdl: fix non-constant compile time assertion Date: Tue, 16 Jan 2024 10:41:11 -0800 Message-ID: <20240116184307.162882-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116184307.162882-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240116184307.162882-1-stephen@networkplumber.org> 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 RTE_BUILD_BUG_ON() was being used with a non-constant value. The inline function rte_is_power_of_2() is not constant since inline expansion happens later in the compile process. Replace it with macro which will be constant. Fixes: 4236ce9bf5bf ("event/opdl: add OPDL ring infrastructure library") Cc: liang.j.ma@intel.com Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson Acked-by: Tyler Retzlaff --- drivers/event/opdl/opdl_ring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c index 69392b56bbec..24e0bbe3222d 100644 --- a/drivers/event/opdl/opdl_ring.c +++ b/drivers/event/opdl/opdl_ring.c @@ -31,6 +31,9 @@ #define OPDL_OPA_MASK (0xFF) #define OPDL_OPA_OFFSET (0x38) +/* Equivalent to rte_is_power_of_2() but as macro. */ +#define IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0) + /* Types of dependency between stages */ enum dep_type { DEP_NONE = 0, /* no dependency */ @@ -910,7 +913,7 @@ opdl_ring_create(const char *name, uint32_t num_slots, uint32_t slot_size, RTE_CACHE_LINE_MASK) != 0); RTE_BUILD_BUG_ON((offsetof(struct opdl_ring, slots) & RTE_CACHE_LINE_MASK) != 0); - RTE_BUILD_BUG_ON(!rte_is_power_of_2(OPDL_DISCLAIMS_PER_LCORE)); + RTE_BUILD_BUG_ON(!IS_POWER_OF_2(OPDL_DISCLAIMS_PER_LCORE)); /* Parameter checking */ if (name == NULL) { From patchwork Tue Jan 16 18:41:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 135897 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9EF67438E3; Tue, 16 Jan 2024 19:43:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B14F440DCB; Tue, 16 Jan 2024 19:43:16 +0100 (CET) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id C459B40685 for ; Tue, 16 Jan 2024 19:43:13 +0100 (CET) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d427518d52so74509575ad.0 for ; Tue, 16 Jan 2024 10:43:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705430593; x=1706035393; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XXOGgNHbQSerctOtBdqy+t/ORx8Hir/GEtXkPqLeiU4=; b=Qwd+ZtJCrIAthNZGDJuHJJQNWX2qe3tR6ONrSKBicghPDiB8+PKT82cTkKP+HFh/IH /6mriNRnBVryop+dJ7iGaRwf4FNOFX5c2gDrE2WYouMeX4wlYFpT8OdWM/L725Hs3nUM CLVYdZvMaOL2l3ZSttBOgX/byUh0AfWOwKmRkB3WPuKeD/eABvNQM5a7VLSUij+6ypZv a9pS9J0vKNV/QfajkBwUO2fYILTZ6KzyCxv9Ba5qsnLxRiTSLS+F4bNs8pesgZmNwWjl FO8c4qGHBiguguawJyiGHea+q/riThMpbfoPSktL83pYffpaU7mub0Ekc3vwEGX+zzmC af4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705430593; x=1706035393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XXOGgNHbQSerctOtBdqy+t/ORx8Hir/GEtXkPqLeiU4=; b=gSN24QSwGikNFydr2D61XiNLidL6rV5eL5B0O1lBPyvc6wMWoIZx7cTvwg1vIEljy9 PR0Ul7Db6KHHqPL4jHVcl9dvSCeoPi5I77dkstTfxs+rVU4htvlh1UPXC8Y0mnlT5qX/ OKPR8FWiZqhTnHJOj7ddytAY12tRymJg9ro51CWkNmGtn5suXgni0w7kzYeMdV9PhIVi BmdtWkN2OYE1lAaBQKqkH8eRTS2eRXXGUuanObi9bOoCKQ8nY+CU52d25GVqHOX4uA3f 4pTA9ZL/RHgGdsJkIO2USmBu4/CrK+5d2eArp1Z1YL+RYQsfmleMo/pNTi9dAy9lx00k TswA== X-Gm-Message-State: AOJu0YxoYf+8LKl8csR0RwU+vsODipMZygJOsFTtUpb5aPPcBhYuiZtV i9gZSulMkUSw7pU5y7SmJdFbk0Qs3xL/fSmmekaQjAMbqrsqLQ== X-Google-Smtp-Source: AGHT+IH2udjOayg9wsn1hf/MPy7Ug3e6Y+xwtdbYE7qqY3KfmK/B8+d1ZT6Zlz2SpgwXAnLwbXd0qg== X-Received: by 2002:a17:902:e74e:b0:1d5:63c5:e17a with SMTP id p14-20020a170902e74e00b001d563c5e17amr10460113plf.43.1705430593009; Tue, 16 Jan 2024 10:43:13 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id m8-20020a1709026bc800b001d60a70809bsm379238plt.168.2024.01.16.10.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:43:12 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , ivan.malov@oktetlabs.ru, Tyler Retzlaff , Andrew Rybchenko , Ivan Malov Subject: [PATCH v3 2/5] net/sfc: fix non-constant expression in RTE_BUILD_BUG_ON() Date: Tue, 16 Jan 2024 10:41:12 -0800 Message-ID: <20240116184307.162882-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116184307.162882-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240116184307.162882-1-stephen@networkplumber.org> 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 The macro RTE_MIN has some hidden assignments to provide type safety which means the statement can not be fully evaluated in first pass of compiler. Replace RTE_MIN() with equivalent macro. This will cause errors from checkpatch about multiple evaluations of same expression in macro but it is ok in this case. Fixes: 4f936666d790 ("net/sfc: support TSO for EF100 native datapath") Cc: ivan.malov@oktetlabs.ru Signed-off-by: Stephen Hemminger Acked-by: Tyler Retzlaff --- drivers/net/sfc/sfc_ef100_tx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/sfc/sfc_ef100_tx.c b/drivers/net/sfc/sfc_ef100_tx.c index 1b6374775f07..f4bcadc1e8e0 100644 --- a/drivers/net/sfc/sfc_ef100_tx.c +++ b/drivers/net/sfc/sfc_ef100_tx.c @@ -26,6 +26,10 @@ #include "sfc_ef100.h" #include "sfc_nic_dma_dp.h" +#ifndef MIN +/* not typesafe but is a constant */ +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +#endif #define sfc_ef100_tx_err(_txq, ...) \ SFC_DP_LOG(SFC_KVARG_DATAPATH_EF100, ERR, &(_txq)->dp.dpq, __VA_ARGS__) @@ -563,8 +567,7 @@ sfc_ef100_tx_pkt_descs_max(const struct rte_mbuf *m) * (split into many Tx descriptors). */ RTE_BUILD_BUG_ON(SFC_EF100_TX_SEND_DESC_LEN_MAX < - RTE_MIN((unsigned int)EFX_MAC_PDU_MAX, - SFC_MBUF_SEG_LEN_MAX)); + MIN((unsigned int)EFX_MAC_PDU_MAX, SFC_MBUF_SEG_LEN_MAX)); } if (m->ol_flags & sfc_dp_mport_override) { From patchwork Tue Jan 16 18:41:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 135898 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED452438E3; Tue, 16 Jan 2024 19:43:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C60D240DDA; Tue, 16 Jan 2024 19:43:17 +0100 (CET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id A5D9E40A84 for ; Tue, 16 Jan 2024 19:43:14 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1d41bb4da91so56618915ad.0 for ; Tue, 16 Jan 2024 10:43:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705430594; x=1706035394; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qcapsTAS2FrBqtvBRyu1/qQWJzr7RLLy4mS98JGu2bE=; b=2hLyBA6DdX4T2UX7QnKZyjQ/KtV/RQRHVmkCjsqdcpdntdvz7ZY9cZTiNW44016Dcw 5t6qKCTVDW+r8M6lotilFi1HE3O8H+tgxtiJa244HjJyF7CAjuiAhBKU4/LtySxkA3mw 92+MUK61eHUDQCp+QyvCldBVlNgCosBU+h6SQm/uGWe9tCR16bYaQkX+b4EfWpWtMKbm D+CcpOqRm1m8yJeeqdf0j/g89Bud8YIuH6gdT0LWqUY1Jk1BFvD+gpMJ/Xl6wzM50Xl+ 00XfFtjUEQ0e152HTtIRt8zCgScJ/pfIIqFMf0nCW5rIe/mL2rM6dyvJUoEVbntQrVS5 TwSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705430594; x=1706035394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qcapsTAS2FrBqtvBRyu1/qQWJzr7RLLy4mS98JGu2bE=; b=mO4f132xwP49/srElPZlrkLbvfncKe+dzDjcTxYrEn79Zu2VVgQD7XTv0pPKmmZ3Iu 2sOwVlJARz7pN/zSxaKuQgp81joGAf5BAclO/aldvCvyQYCWEM9JphuYvPfrultuAE7y W5LvFHrbO+Khn3jUfAibFpWgPlv/R7dichdaPLfh/G6qAR8fxaq255gxfXP3wdxwiXpX SSJtCVH6WNx6tkP438wkqIlUgHAIGevWUfK121BWhAbsYLyq1A7mXmOh4gBRDuZMzCvx lrqJUShhYDEAQmM7TeIlKWr+jclcQHOkIdChiEcr4D8gTkp+CaWOUimmG+WVT54vgpAc aNZA== X-Gm-Message-State: AOJu0Yw39QwVtuM3u2ORg3p3Ln4Ddup3p/wWI1+r4JPYGmqbUTIda0tZ qUPo40UzmnkfiV8/sa6uOv/3GaCseFQzIM9yi4Lijveulkso5g== X-Google-Smtp-Source: AGHT+IEubuCvfoCqyDWf22vaT8RKO/5FDfKrnOxl6jTXyAQSLquhB3XCucaZoeIuA1+ao81CQqimsQ== X-Received: by 2002:a17:903:41c3:b0:1d4:8d6:159 with SMTP id u3-20020a17090341c300b001d408d60159mr5057313ple.100.1705430593873; Tue, 16 Jan 2024 10:43:13 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id m8-20020a1709026bc800b001d60a70809bsm379238plt.168.2024.01.16.10.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:43:13 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yuying Zhang , Beilei Xing , Bruce Richardson , Konstantin Ananyev Subject: [PATCH v3 3/5] net/i40e: avoid using const variable in assertion Date: Tue, 16 Jan 2024 10:41:13 -0800 Message-ID: <20240116184307.162882-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116184307.162882-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240116184307.162882-1-stephen@networkplumber.org> 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 Clang does not allow const variable in a static_assert expression. Signed-off-by: Stephen Hemminger --- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_rxtx_vec_sse.c | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 1bbe7ad37600..445e1c0b381f 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -278,6 +278,7 @@ enum i40e_flxpld_layer_idx { #define I40E_DEFAULT_DCB_APP_PRIO 3 #define I40E_FDIR_PRG_PKT_CNT 128 +#define I40E_FDIR_ID_BIT_SHIFT 13 /* * Struct to store flow created. diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c index 9200a23ff662..2d4480a7651b 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c @@ -143,10 +143,9 @@ descs_to_fdir_32b(volatile union i40e_rx_desc *rxdp, struct rte_mbuf **rx_pkt) /* convert fdir_id_mask into a single bit, then shift as required for * correct location in the mbuf->olflags */ - const uint32_t FDIR_ID_BIT_SHIFT = 13; - RTE_BUILD_BUG_ON(RTE_MBUF_F_RX_FDIR_ID != (1 << FDIR_ID_BIT_SHIFT)); + RTE_BUILD_BUG_ON(RTE_MBUF_F_RX_FDIR_ID != (1 << I40E_FDIR_ID_BIT_SHIFT)); v_fd_id_mask = _mm_srli_epi32(v_fd_id_mask, 31); - v_fd_id_mask = _mm_slli_epi32(v_fd_id_mask, FDIR_ID_BIT_SHIFT); + v_fd_id_mask = _mm_slli_epi32(v_fd_id_mask, I40E_FDIR_ID_BIT_SHIFT); /* The returned value must be combined into each mbuf. This is already * being done for RSS and VLAN mbuf olflags, so return bits to OR in. @@ -205,10 +204,9 @@ descs_to_fdir_16b(__m128i fltstat, __m128i descs[4], struct rte_mbuf **rx_pkt) descs[0] = _mm_blendv_epi8(descs[0], _mm_setzero_si128(), v_desc0_mask); /* Shift to 1 or 0 bit per u32 lane, then to RTE_MBUF_F_RX_FDIR_ID offset */ - const uint32_t FDIR_ID_BIT_SHIFT = 13; - RTE_BUILD_BUG_ON(RTE_MBUF_F_RX_FDIR_ID != (1 << FDIR_ID_BIT_SHIFT)); + RTE_BUILD_BUG_ON(RTE_MBUF_F_RX_FDIR_ID != (1 << I40E_FDIR_ID_BIT_SHIFT)); __m128i v_mask_one_bit = _mm_srli_epi32(v_fdir_id_mask, 31); - return _mm_slli_epi32(v_mask_one_bit, FDIR_ID_BIT_SHIFT); + return _mm_slli_epi32(v_mask_one_bit, I40E_FDIR_ID_BIT_SHIFT); } #endif From patchwork Tue Jan 16 18:41:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 135899 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE6D0438E3; Tue, 16 Jan 2024 19:43:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED85940DF8; Tue, 16 Jan 2024 19:43:18 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id 84F86406BC for ; Tue, 16 Jan 2024 19:43:15 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d5f388407bso3993295ad.0 for ; Tue, 16 Jan 2024 10:43:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705430595; x=1706035395; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YRy986OZMTK8UPIJueTsaB8x4SlAGbHlq6aruIRYKf4=; b=kTmGbv+KzkqiSYoWkCO9YCR6u3cbX3JQal51Icr//GEx6j7taSNe9S3U4LsAy+JrKY UUuQissmaDCP+uYo2PTEUjnl7kaYJVykxo7V4Dpo9+sJLAfPEKQX+Y1R3igP2QlX0Hxc QWSUoXzfUIWPlgxYWXHVaRugYkfk49ont5YgAEGip4Nimfh2Z+5f4XgK174QxD+lkAMy s4dhuiqj7vLcLaZZV1Q3/JbSYx+G+L0DNV4MLOTk5BFKR9Qtov+1stN68r6ipdNNf8em XfGSNrjrn1ozkk4WrM7Rh7ETZJiZOT07rQKfFntn/cVTMDZbQVYsasVI+KMyVKQsphx9 0rIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705430595; x=1706035395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YRy986OZMTK8UPIJueTsaB8x4SlAGbHlq6aruIRYKf4=; b=Elign9MblJJ1a4gZcY5e0FBcaVif/UOjTFL0nQVHYGc5XCY3rHFjB6IHigeEfwEOZ6 UDYpxQnIcfo5GEAouzNROpPLvuG9XXXZOPsnFDPO47pcsggObg+whGquoOLK3AZazCc0 T+mR4OUSp5h8S/TD6bu2ZUGom821PO+3YUcvA6zx1g5oghzfhNQmHGT/7/Xeb0vsHf90 jpISOA65ln9xNuo7frdmCpGvxoAQCq1mcZo1z3vwC9DB3/0GlLP4sa8a3ERyZcib1pCp 4yLo3ibrwpB9LerfChu7s8zDdj4mwKExVKsKAl/ArdPQr+cnJwHyrg6vRtpEAnSgvGK6 cRyg== X-Gm-Message-State: AOJu0YxXR7wIB253fo60fFkySFJb7B5XYZCEcm2bv+XMReesn7Rn4GOr PNUwSaPXHNhnS0ZTvSD4JUUBw6ILkOsTm1duAmKNTKq8momHzg== X-Google-Smtp-Source: AGHT+IFajDVer8Qfy8021aHtr+hr+FIgT4b9xe6lTbO2GDq+WVOhLduGQnFbAFyJtNEvmMreMlWexg== X-Received: by 2002:a17:902:7d82:b0:1d5:36f2:f2f3 with SMTP id a2-20020a1709027d8200b001d536f2f2f3mr4241911plm.33.1705430594795; Tue, 16 Jan 2024 10:43:14 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id m8-20020a1709026bc800b001d60a70809bsm379238plt.168.2024.01.16.10.43.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:43:14 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Andrew Rybchenko , =?utf-8?q?Morten_Br=C3=B8?= =?utf-8?q?rup?= Subject: [PATCH v3 4/5] mempool: avoid floating point expression in static assertion Date: Tue, 16 Jan 2024 10:41:14 -0800 Message-ID: <20240116184307.162882-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116184307.162882-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240116184307.162882-1-stephen@networkplumber.org> 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 Clang does not handle casts in static_assert() expressions. It doesn't like use of floating point to calculate threshold. Use a different expression with same effect; yes this will cause checkpatch nag. Signed-off-by: Stephen Hemminger --- lib/mempool/rte_mempool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c index b7a19bea7185..ba3a54cfc298 100644 --- a/lib/mempool/rte_mempool.c +++ b/lib/mempool/rte_mempool.c @@ -50,9 +50,7 @@ static void mempool_event_callback_invoke(enum rte_mempool_event event, struct rte_mempool *mp); -#define CACHE_FLUSHTHRESH_MULTIPLIER 1.5 -#define CALC_CACHE_FLUSHTHRESH(c) \ - ((typeof(c))((c) * CACHE_FLUSHTHRESH_MULTIPLIER)) +#define CALC_CACHE_FLUSHTHRESH(c) ((c) + (c) / 2) #if defined(RTE_ARCH_X86) /* From patchwork Tue Jan 16 18:41:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 135900 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EDA60438E3; Tue, 16 Jan 2024 19:43:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1424640E13; Tue, 16 Jan 2024 19:43:20 +0100 (CET) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 38C6540685 for ; Tue, 16 Jan 2024 19:43:16 +0100 (CET) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d5f56912daso3734685ad.2 for ; Tue, 16 Jan 2024 10:43:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705430595; x=1706035395; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bz99mPUMcHch/2QjkxDzWw1aV3kO8SqE6GDE5Wl5hFQ=; b=kwELVWNMsRjyKHYdgtxEJ6c7QSbY6433murMI/V9zd0BHTYudt1eWqLbildJ7Z6QUc EY+EifDcln+LiVyeop0gHOQSdC6a2b0VW5FPg8hAvpZj5ik69RBki1EFUNb2Lpv63TtY hG3fx1Shwy9UMidqSbIF6vzf73MmFsOgxeLx+IN4Wwywjfmx9UdeL3XPVtdY71o2tYaO T6Ft+h+xKPzGJNMnMEoanDw+BzIGHXB4zgZvwJMyShwKiiOlGHhenUr9vSOMg87lz/AE /EDgyS6/DNMpqHWMHPg2zilmy/mC2b3TMEwYyVFHvmZlfVwbO01Z/P7OMY1+DFmkVikG hT9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705430595; x=1706035395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bz99mPUMcHch/2QjkxDzWw1aV3kO8SqE6GDE5Wl5hFQ=; b=UqRTpc6QfbvF1yZNZujtr4n84dV8VnIgqcWk+RO+VnetsR4Rmi9xSgJTL69SCfhw8n t+N9qzptynsoxFdHuyYM9l0x1thqnm1o5WtJdxQqNFDPMH3Lto1oeEVKXxZpuRvFZtGH vXM1E14S64zSIiVi8YJDmNkTNqvUSOgAYtkIOV3HCcN1EZ65PtvxzEELeGCUis5c7bFE arPGYtwzcOf1RGv+BqUVlQhhRlFxFOdRRHP5u3yHY5zuTp8ce4yNB32umOgZhTPdf7HL o96tfhYBWXttlD1wAEwoqIyQnaVi1KsUp1yz0cGkcFPOiOgOg9kpinBYViAnquaTSsqL ShaQ== X-Gm-Message-State: AOJu0YxKOlhVNdEQ76BmVdlqX8okLqFpiocOWqdHXPz1iKzZ/NzG4tGi glf726Yxj6EORhsGSIivJTUEA1E4nZV7rhN732ePaEd4oRAf8w== X-Google-Smtp-Source: AGHT+IEwZ3x+S08G9b3N7qJ1oP6jSqHp7cv8OtBbRwgwPr8pGC8rCE6lDLjwcGb/iBBr/2P2OfjJSg== X-Received: by 2002:a17:902:dacc:b0:1d4:4768:5f with SMTP id q12-20020a170902dacc00b001d44768005fmr9257692plx.37.1705430595530; Tue, 16 Jan 2024 10:43:15 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id m8-20020a1709026bc800b001d60a70809bsm379238plt.168.2024.01.16.10.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:43:15 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , =?utf-8?q?Morten_Br?= =?utf-8?q?=C3=B8rup?= , Tyler Retzlaff Subject: [PATCH v3 5/5] eal: replace out of bounds VLA with static_assert Date: Tue, 16 Jan 2024 10:41:15 -0800 Message-ID: <20240116184307.162882-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116184307.162882-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240116184307.162882-1-stephen@networkplumber.org> 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 Both Gcc, clang and MSVC have better way to do compile time assertions rather than using out of bounds array access. The old method would fail if -Wvla is enabled because compiler can't determine size in that code. Also, the use of new _Static_assert will catch broken code that is passing non-constant expression to RTE_BUILD_BUG_ON(). Need to add brackets {} around the static_assert() to workaround a bug in clang. Clang was not handling static_assert() in a switch case properly. Signed-off-by: Stephen Hemminger Acked-by: Morten Brørup Acked-by: Tyler Retzlaff Acked-by: Andrew Rybchenko --- lib/eal/include/rte_common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index c1ba32d00e47..413bed23cb73 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -16,6 +16,7 @@ extern "C" { #endif +#include #include #include @@ -495,7 +496,7 @@ rte_is_aligned(const void * const __rte_restrict ptr, const unsigned int align) /** * Triggers an error at compilation time if the condition is true. */ -#define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) +#define RTE_BUILD_BUG_ON(condition) { static_assert(!(condition), #condition); } /*********** Cache line related macros ********/