From patchwork Wed Feb 28 18:47:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 137455 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 A288843C28; Wed, 28 Feb 2024 19:48:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B24F042F11; Wed, 28 Feb 2024 19:48:03 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 503E54003C for ; Wed, 28 Feb 2024 19:47:58 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8C35220B74C1; Wed, 28 Feb 2024 10:47:57 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8C35220B74C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709146077; bh=5m2t3aU+mt7HgTdWTwCRj6effQsOWh+FVOhNJd0iWzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g+DL2xyuU33CusTUEIyBcFgqQi/rR0qFbOjwtwesD5d/uuc5oi/uCKkh8obLDdGd8 ImnfbWN7jNAI5C0Zg5vNgCgpvTehuIny7Bi1D0nDR6lh5utkxUsSHps14lZVJuzWZl ZX/jzX2j/wvxbudqsnhpmpkaNVGW8KpoKMCWLi28= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v2 1/3] eal: add rte pure attribute macro Date: Wed, 28 Feb 2024 10:47:54 -0800 Message-Id: <1709146076-22254-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709146076-22254-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709146076-22254-1-git-send-email-roretzla@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 Add __rte_pure for __attribute__((pure)) to permit elimination of direct use of __attribute__((pure)) in other libs. Signed-off-by: Tyler Retzlaff Reviewed-by: Morten Brørup --- lib/eal/include/rte_common.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 1cc1222..354b149 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -125,6 +125,15 @@ #define __rte_weak __attribute__((__weak__)) /** + * Mark a function to be pure. + */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_pure +#else +#define __rte_pure __attribute__((pure)) +#endif + +/** * Force symbol to be generated even if it appears to be unused. */ #ifdef RTE_TOOLCHAIN_MSVC From patchwork Wed Feb 28 18:47:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 137453 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 58B6943C28; Wed, 28 Feb 2024 19:48:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E863C40EE4; Wed, 28 Feb 2024 19:47:59 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 53D4040EE4 for ; Wed, 28 Feb 2024 19:47:58 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 98EF020B74C2; Wed, 28 Feb 2024 10:47:57 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 98EF020B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709146077; bh=Aj1hQ+blIKtPnedyXJfZ4sQgonV9tyDCiL0Xvb9pT5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SsWs4P37lTbwc9PD3M6wTPlza7gppRjjJDHqjud37pGz2JtImWVIYWQusD5Hj3Bsf GOUXOYhGnqUzG6GIDoLvHPTmdjzHF9k0NkFHAOgQ7yLQWb0abzatd5PH8rYAuVXxqv 5qnp6IsMYlHgpfr/M2L74HZ/R4Vo5/gXsQURYUds= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v2 2/3] lpm: use rte macro instead of GCC attribute Date: Wed, 28 Feb 2024 10:47:55 -0800 Message-Id: <1709146076-22254-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709146076-22254-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709146076-22254-1-git-send-email-roretzla@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 Use newly added __rte_pure macro from rte_common.h instead of directly using __attribute__((pure)). Signed-off-by: Tyler Retzlaff Reviewed-by: Morten Brørup Acked-by: Vladimir Medvedkin --- lib/lpm/rte_lpm.c | 4 ++-- lib/lpm/rte_lpm6.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c index 9633d63..a5c9e7c 100644 --- a/lib/lpm/rte_lpm.c +++ b/lib/lpm/rte_lpm.c @@ -85,7 +85,7 @@ struct __rte_lpm { * depth (IN) : range = 1 - 32 * mask (OUT) : 32bit mask */ -static uint32_t __attribute__((pure)) +static uint32_t __rte_pure depth_to_mask(uint8_t depth) { VERIFY_DEPTH(depth); @@ -99,7 +99,7 @@ static uint32_t __attribute__((pure)) /* * Converts given depth value to its corresponding range value. */ -static uint32_t __attribute__((pure)) +static uint32_t __rte_pure depth_to_range(uint8_t depth) { VERIFY_DEPTH(depth); diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c index 271bc48..2bdd540 100644 --- a/lib/lpm/rte_lpm6.c +++ b/lib/lpm/rte_lpm6.c @@ -1127,7 +1127,7 @@ struct rte_lpm6 * * Convert a depth to a one byte long mask * Example: 4 will be converted to 0xF0 */ -static uint8_t __attribute__((pure)) +static uint8_t __rte_pure depth_to_mask_1b(uint8_t depth) { /* To calculate a mask start with a 1 on the left hand side and right From patchwork Wed Feb 28 18:47:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 137454 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 7717B43C28; Wed, 28 Feb 2024 19:48:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CD7242EC7; Wed, 28 Feb 2024 19:48:02 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 59442410F1 for ; Wed, 28 Feb 2024 19:47:58 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id A5D7B20B74C3; Wed, 28 Feb 2024 10:47:57 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A5D7B20B74C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709146077; bh=GyzmCJZG+220f0L05IVTdH4J7ajuO4kkENAgr2dT6yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSHNnMnzjJm/MSc2VImqWedzNLfK1wNYvPKWMx8HLXG7HH4ETtGxNC6bxTKYq9T9s jIIvIrhjNXCQaN4r4AysMZ2W19gDIJCNW4ZXGAwswg/xqQfYYFWZrTBFQQXJ5VYupq zkV/ZILcNPKiR4VFGpKugtL1RDRpAqlNMNAifHnI= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v2 3/3] rcu: use rte macro instead of GCC attribute Date: Wed, 28 Feb 2024 10:47:56 -0800 Message-Id: <1709146076-22254-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709146076-22254-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709146076-22254-1-git-send-email-roretzla@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 Use existing __rte_may_alias macro from rte_common.h instead of directly using __attribute__((__may_alias__)). Signed-off-by: Tyler Retzlaff Reviewed-by: Morten Brørup --- lib/rcu/rcu_qsbr_pvt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rcu/rcu_qsbr_pvt.h b/lib/rcu/rcu_qsbr_pvt.h index 5fd7ca2..39b0d50 100644 --- a/lib/rcu/rcu_qsbr_pvt.h +++ b/lib/rcu/rcu_qsbr_pvt.h @@ -53,6 +53,6 @@ struct rte_rcu_qsbr_dq { typedef struct { uint64_t token; /**< Token */ uint8_t elem[0]; /**< Pointer to user element */ -} __attribute__((__may_alias__)) __rte_rcu_qsbr_dq_elem_t; +} __rte_may_alias __rte_rcu_qsbr_dq_elem_t; #endif /* _RTE_RCU_QSBR_PVT_H_ */