All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Yuying Zhang <Yuying.Zhang@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Subject: [PATCH v3 3/5] net/i40e: avoid using const variable in assertion
Date: Tue, 16 Jan 2024 10:41:13 -0800	[thread overview]
Message-ID: <20240116184307.162882-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20240116184307.162882-1-stephen@networkplumber.org>

Clang does not allow const variable in a static_assert
expression.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 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
 
-- 
2.43.0


  parent reply	other threads:[~2024-01-16 18:43 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-11 17:21 [RFC] eal: use _Static_assert() for RTE_BUILD_BUG_ON Stephen Hemminger
2023-11-11 17:52 ` Morten Brørup
2023-11-13 16:30   ` Tyler Retzlaff
2023-11-13 16:28 ` Tyler Retzlaff
2023-11-13 17:06 ` [PATCH v2 0/3] use static_assertion for build errors Stephen Hemminger
2023-11-13 17:06   ` [PATCH v2 1/3] event/opdl: fix non-constant compile time assertion Stephen Hemminger
2023-11-13 17:10     ` Bruce Richardson
2023-11-13 17:54     ` Tyler Retzlaff
2023-11-13 17:06   ` [PATCH v2 2/3] net/sfc: fix non-constant expression inr RTE_BUILD_BUG_ON() Stephen Hemminger
2023-11-13 17:55     ` Tyler Retzlaff
2023-11-13 22:13     ` Stephen Hemminger
2023-11-13 22:28       ` Tyler Retzlaff
2023-11-14  0:00         ` Stephen Hemminger
2023-11-14  0:16         ` Stephen Hemminger
2023-11-14  0:22           ` Stephen Hemminger
2023-11-14  5:50             ` Morten Brørup
2023-11-13 17:06   ` [PATCH v2 3/3] eal: replace out of bounds VLA with static_assert Stephen Hemminger
2023-11-13 17:12     ` Bruce Richardson
2023-11-13 17:57       ` Tyler Retzlaff
2024-02-16  0:33     ` Tyler Retzlaff
2024-02-16  7:48       ` Morten Brørup
2024-02-16  8:02       ` David Marchand
2024-02-16 20:30         ` Tyler Retzlaff
2023-11-13 18:13   ` [PATCH v2 0/3] use static_assertion for build errors Ferruh Yigit
2023-11-13 18:28     ` Morten Brørup
2023-11-13 18:57     ` Tyler Retzlaff
2023-11-17 16:18 ` [PATCH v3 00/10] replace uses of zero length array Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 01/10] member: replace zero length array with flex array Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 02/10] cryptodev: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 03/10] security: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 04/10] pipeline: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 05/10] net/nfp: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 06/10] net/enic: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 07/10] net/mlx5: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 08/10] pdcp: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 09/10] net/cpfl: " Stephen Hemminger
2023-11-17 16:18   ` [PATCH v3 10/10] common/dpaxx: remove zero length array Stephen Hemminger
2024-01-16 18:41 ` [PATCH v3 0/5] use static_assert to catch build errors Stephen Hemminger
2024-01-16 18:41   ` [PATCH v3 1/5] event/opdl: fix non-constant compile time assertion Stephen Hemminger
2024-01-17  7:58     ` Andrew Rybchenko
2024-01-17  9:26       ` Bruce Richardson
2024-01-17  9:57         ` Morten Brørup
2024-01-16 18:41   ` [PATCH v3 2/5] net/sfc: fix non-constant expression in RTE_BUILD_BUG_ON() Stephen Hemminger
2024-01-17  7:57     ` Andrew Rybchenko
2024-01-16 18:41   ` Stephen Hemminger [this message]
2024-01-16 18:41   ` [PATCH v3 4/5] mempool: avoid floating point expression in static assertion Stephen Hemminger
2024-01-17  8:06     ` Andrew Rybchenko
2024-01-16 18:41   ` [PATCH v3 5/5] eal: replace out of bounds VLA with static_assert Stephen Hemminger
2024-01-17  7:52     ` Andrew Rybchenko
2024-01-17 17:12       ` Stephen Hemminger
2024-01-17  7:53     ` Mattias Rönnblom
2024-01-17 17:11       ` Stephen Hemminger
2024-01-17 18:19 ` [PATCH v4 0/6] use static assert to cathc build errors Stephen Hemminger
2024-01-17 18:19   ` [PATCH v4 1/6] eal: introduce RTE_MIN_T() and RTE_MAX_T() macros Stephen Hemminger
2024-01-18  9:35     ` Konstantin Ananyev
2024-01-18  9:44     ` Andrew Rybchenko
2024-01-19 20:58     ` Tyler Retzlaff
2024-01-19 22:39       ` Stephen Hemminger
2024-01-17 18:19   ` [PATCH v4 2/6] event/opdl: fix non-constant compile time assertion Stephen Hemminger
2024-01-18  9:43     ` Andrew Rybchenko
2024-01-17 18:19   ` [PATCH v4 3/6] net/sfc: fix non-constant expression in RTE_BUILD_BUG_ON() Stephen Hemminger
2024-01-18  9:40     ` Andrew Rybchenko
2024-01-17 18:19   ` [PATCH v4 4/6] net/i40e: avoid using const variable in assertion Stephen Hemminger
2024-01-18  8:57     ` Bruce Richardson
2024-01-18  9:34     ` Konstantin Ananyev
2024-01-17 18:19   ` [PATCH v4 5/6] mempool: avoid floating point expression in static assertion Stephen Hemminger
2024-01-17 18:32     ` Morten Brørup
2024-01-18  9:41       ` Andrew Rybchenko
2024-01-18  9:32     ` Konstantin Ananyev
2024-01-17 18:20   ` [PATCH v4 6/6] eal: replace out of bounds VLA with static_assert Stephen Hemminger
2024-01-18 16:50 ` [PATCH v5 0/6] use static_assert for build error reports Stephen Hemminger
2024-01-18 16:50   ` [PATCH v5 1/6] eal: introduce RTE_MIN_T() and RTE_MAX_T() macros Stephen Hemminger
2024-01-19  1:30     ` fengchengwen
2024-01-18 16:50   ` [PATCH v5 2/6] event/opdl: fix non-constant compile time assertion Stephen Hemminger
2024-01-18 16:50   ` [PATCH v5 3/6] net/sfc: fix non-constant expression in RTE_BUILD_BUG_ON() Stephen Hemminger
2024-01-18 16:50   ` [PATCH v5 4/6] net/i40e: avoid using const variable in assertion Stephen Hemminger
2024-01-18 16:51   ` [PATCH v5 5/6] mempool: avoid floating point expression in static assertion Stephen Hemminger
2024-01-18 18:46     ` Morten Brørup
2024-01-19 10:07     ` Slava Ovsiienko
2024-01-18 16:51   ` [PATCH v5 6/6] eal: replace out of bounds VLA with static_assert Stephen Hemminger
2024-01-18 18:42     ` Morten Brørup
2024-01-19 13:10       ` Ferruh Yigit
2024-02-16  9:14   ` [PATCH v5 0/6] use static_assert for build error reports David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116184307.162882-4-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=Yuying.Zhang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.