From patchwork Wed Mar 6 22:14:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138066 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 A7EBB43C62; Wed, 6 Mar 2024 23:14:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F1F442EBF; Wed, 6 Mar 2024 23:14:53 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 583E9402C0 for ; Wed, 6 Mar 2024 23:14:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9E23720B74C1; Wed, 6 Mar 2024 14:14:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9E23720B74C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709763288; bh=hAKbgOjdKYIa1/KjHMhX3WLtW2lNQL2mcyBs/3WsV/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=blR2TyW1GM36tHU0k+aVnIb1V6NQLRHH+1u83i24ozJbuKqz4WLaD221jWHhUjA/5 CYkSVg5KPB+PafXhXbcYsrAoA6eepT1LTBAYARY0TSKYuS0HgWpCZOKU7jXEi8TiOg I3S1KUl4SwmzLBvjAgqPZrQl+yGkqLCifiLbEhV8= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v3 1/5] eal: add rte pure attribute macro Date: Wed, 6 Mar 2024 14:14:43 -0800 Message-Id: <1709763287-10713-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709763287-10713-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709763287-10713-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 298a5c6..b15a5b2 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -137,6 +137,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 Mar 6 22:14:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138068 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 08C3243C62; Wed, 6 Mar 2024 23:15:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B33E42ED8; Wed, 6 Mar 2024 23:14:56 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8193342E2A for ; Wed, 6 Mar 2024 23:14:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id AB20D20B74C2; Wed, 6 Mar 2024 14:14:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AB20D20B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709763288; bh=jV1+Nf6v8KlLnkO5OyqNl2l2GkiGGSyeaoY/QFSmUz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWsiIx3SAvvguhtOJXXQJNhfLJJQ1wOjbHRn1EZhlQlM3pogUYmVb+hgd+v5042oL Df7tIXT/NT/5qFpbBiwzM0bwM3BTxoP5WkqxLC5nxfnC6PWAkOW7E0TpPoPQcLbzQR CnRHSVx7ZYW/5Y/8mKuxtSsPKduXLW/pp+hNL808= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v3 2/5] lpm: use rte macro instead of GCC attribute Date: Wed, 6 Mar 2024 14:14:44 -0800 Message-Id: <1709763287-10713-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709763287-10713-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709763287-10713-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 --- 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 46d8f71..42828a1 100644 --- a/lib/lpm/rte_lpm6.c +++ b/lib/lpm/rte_lpm6.c @@ -1128,7 +1128,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 Mar 6 22:14:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138069 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 10FA443C62; Wed, 6 Mar 2024 23:15:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64EDE42EDD; Wed, 6 Mar 2024 23:14:57 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9DD3242E33 for ; Wed, 6 Mar 2024 23:14:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id B8B3320B74C3; Wed, 6 Mar 2024 14:14:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B8B3320B74C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709763288; bh=GyzmCJZG+220f0L05IVTdH4J7ajuO4kkENAgr2dT6yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0RK1x+9qHpPMbv1U8skuPsIOrEQpy10vzfAOo1LDm1+d8du5Mdmonmio/QoOlFOm LNHwuXtrbph54RhThHriKG0H2PSYT7KGhN3WYElx+3iWbr/fHTkzVLVEzLuKDi2SZe sj/61VCyyrhn++ahHLXMKogoKGSOZTFzCvubdSjw= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v3 3/5] rcu: use rte macro instead of GCC attribute Date: Wed, 6 Mar 2024 14:14:45 -0800 Message-Id: <1709763287-10713-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709763287-10713-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709763287-10713-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_ */ From patchwork Wed Mar 6 22:14:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138067 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 31A5B43C62; Wed, 6 Mar 2024 23:15:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB1E942ECF; Wed, 6 Mar 2024 23:14:54 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 77E5A42DBD for ; Wed, 6 Mar 2024 23:14:49 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id C61DF20B74C4; Wed, 6 Mar 2024 14:14:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C61DF20B74C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709763288; bh=egNl7GP6L08rChXF5v9IVyvDZdgu53/a8xQw8mc29fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RTYXui8755VIbqvFWV2h8hMxv5w6AACtVRtU6FVI1dqkpjUMyB18qC3VthqKtIV6+ h9rylXI11nstvlQu1mHopbbF7xH2dLrPcfRWiVr2r1AIdiBLR9DGTf0OG3YpsxoJul gy6H+qw4QfnkF8VGX/R/GpjJq6R0oUgUwYX+AtvE= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v3 4/5] app/test: use rte macro instead of GCC attribute Date: Wed, 6 Mar 2024 14:14:46 -0800 Message-Id: <1709763287-10713-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709763287-10713-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709763287-10713-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- app/test-fib/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-fib/main.c b/app/test-fib/main.c index 75a5613..c49bfe8 100644 --- a/app/test-fib/main.c +++ b/app/test-fib/main.c @@ -137,13 +137,13 @@ struct rt_rule_6 { return (rte_rand() % (u - l) + l); } -static __rte_always_inline __attribute__((pure)) uint8_t +static __rte_always_inline __rte_pure uint8_t bits_in_nh(uint8_t nh_sz) { return 8 * (1 << nh_sz); } -static __rte_always_inline __attribute__((pure)) uint64_t +static __rte_always_inline __rte_pure uint64_t get_max_nh(uint8_t nh_sz) { /* min between fib and lpm6 which is 21 bits */ From patchwork Wed Mar 6 22:14:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138070 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 8777F43C62; Wed, 6 Mar 2024 23:15:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 952C142EE4; Wed, 6 Mar 2024 23:14:58 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3E15B400EF for ; Wed, 6 Mar 2024 23:14:50 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D369F20B74C5; Wed, 6 Mar 2024 14:14:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D369F20B74C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709763288; bh=HIO5cH5O8UnvZ0dU71S6+fFz+/infiZ0fdKnx4aOUnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVfSa8c+kG1HcI158SgAd1Pel4TEe7LsQFSipjAIejkffAX59BTZZTQMewP/kb6H/ 01vUGXM6J0vAni4Wi9UqgzhCRMxns1zgHGRHt3QmXDFuT33FdPdxmUfrNunJ+F2Tep nVMjNcOVsAN/Y2dI4t9zjM3XTbyCHFHxeLnMpQ2g= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Honnappa Nagarahalli , Vladimir Medvedkin , mb@smartsharesystems.com, david.marchand@redhat.com, Tyler Retzlaff Subject: [PATCH v3 5/5] net/cxgbe: use rte macro instead of GCC attribute Date: Wed, 6 Mar 2024 14:14:47 -0800 Message-Id: <1709763287-10713-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709763287-10713-1-git-send-email-roretzla@linux.microsoft.com> References: <1709075273-6885-1-git-send-email-roretzla@linux.microsoft.com> <1709763287-10713-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Reviewed-by: Potnuri Bharat Teja Reviewed-by: Morten Brørup Reviewed-by: Potnuri Bharat Teja --- drivers/net/cxgbe/base/common.h | 2 +- drivers/net/cxgbe/base/t4_hw.c | 2 +- drivers/net/cxgbe/base/t4vf_hw.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 4482ddb..8dc7fab 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -428,7 +428,7 @@ static inline unsigned int core_ticks_to_us(const struct adapter *adapter, int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd, int size, void *rpl, bool sleep_ok, int timeout); int t4_wr_mbox_meat(struct adapter *adap, int mbox, - const void __attribute__((__may_alias__)) *cmd, int size, + const void __rte_may_alias *cmd, int size, void *rpl, bool sleep_ok); static inline int t4_wr_mbox_timeout(struct adapter *adap, int mbox, diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index bed755f..d02da39 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -291,7 +291,7 @@ static void fw_asrt(struct adapter *adap, u32 mbox_addr) * the return value is the error code indicated by FW (negated). */ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, - const void __attribute__((__may_alias__)) *cmd, + const void __rte_may_alias *cmd, int size, void *rpl, bool sleep_ok, int timeout) { /* diff --git a/drivers/net/cxgbe/base/t4vf_hw.c b/drivers/net/cxgbe/base/t4vf_hw.c index 46d24a6..573ccb1 100644 --- a/drivers/net/cxgbe/base/t4vf_hw.c +++ b/drivers/net/cxgbe/base/t4vf_hw.c @@ -68,7 +68,7 @@ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, * the return value is the error code indicated by FW (negated). */ int t4vf_wr_mbox_core(struct adapter *adapter, - const void __attribute__((__may_alias__)) *cmd, + const void __rte_may_alias *cmd, int size, void *rpl, bool sleep_ok) { /*