From patchwork Mon Aug 8 21:21:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 114728 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 32934A0540; Mon, 8 Aug 2022 23:21:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE04942BA4; Mon, 8 Aug 2022 23:21:40 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E060B42B83 for ; Mon, 8 Aug 2022 23:21:36 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 13E112109428; Mon, 8 Aug 2022 14:21:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 13E112109428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1659993696; bh=M/P9myIibgAEdjsQiEX2+Ph8cqPxUuVjNGsHh/F3Z5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RjFu+kmc6R5isQ2ioxcpdz6zS6d87QZvB1sgCAWn3OYNo3QtgQG8mqAwAby09ljxC ff+y0gpyIER1UgVabCoj0YKlY1Lr9frWsP0x4ZSlvbf2kFgXJWNExAAzmFZCyEVYI6 UyAIBuQLMzPTmDWG7qzFm7blSoGBF2q9+DmoPFHE= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, anatoly.burakov@intel.com, ranjit.menon@intel.com, mb@smartsharesystems.com, Tyler Retzlaff , Tyler Retzlaff Subject: [PATCH 1/3] doc: announce cleanup of rte_{bsf, fls} inline functions type use Date: Mon, 8 Aug 2022 14:21:30 -0700 Message-Id: <1659993692-17479-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1659993692-17479-1-git-send-email-roretzla@linux.microsoft.com> References: <1615418650-19513-1-git-send-email-roretzla@linux.microsoft.com> <1659993692-17479-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 From: Tyler Retzlaff The cleanup resulted from request to review [1] the following functions where there appeared to be inconsistency in return type or parameter type selections for the following inline functions. rte_bsf32() rte_bsf32_safe() rte_bsf64() rte_bsf64_safe() rte_fls_u32() rte_fls_u64() rte_log2_u32() rte_log2_u64() [1] http://mails.dpdk.org/archives/dev/2021-March/201590.html Signed-off-by: Tyler Retzlaff --- doc/guides/rel_notes/deprecation.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e7583ca..58f4c24 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -17,6 +17,12 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. +* eal: Fix inline function return and parameter types for rte_{bsf,fls} + inline functions to be consistent in DPDK 22.11. + Change ``rte_bsf64`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u32`` return type to ``uint32_t`` instead of ``int``. + Change ``rte_fls_u64`` return type to ``uint32_t`` instead of ``int``. + * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does not allow for writing optimized code for all the CPU architectures supported in DPDK. DPDK has adopted the atomic operations from From patchwork Mon Aug 8 21:21:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 114727 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 29316A0540; Mon, 8 Aug 2022 23:21:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F302042B9C; Mon, 8 Aug 2022 23:21:39 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id DA22640A7E for ; Mon, 8 Aug 2022 23:21:36 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 205D4210942D; Mon, 8 Aug 2022 14:21:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 205D4210942D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1659993696; bh=/LDjnfU1qDiE6sV2RFLWzPWdZiVmRAOzTP9Adaqf6og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kbrur3UDjHFJ3DRBXl3tVokNln5COzRgK1WYSKxlo5kM4H3s5V0YsrnQzTOL0qJKm zfoTqhvpoUZ5c4wzzXcxHE0MgxXmqiEfaDL4ppWWH30SmBcj7VmB5LseewbypfreML tT58OOeoxCARJ9oUOznMPVEt/8b9nFfi8DZLHdqE= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, anatoly.burakov@intel.com, ranjit.menon@intel.com, mb@smartsharesystems.com, Tyler Retzlaff , Tyler Retzlaff Subject: [PATCH 2/3] eal: change rte_fls and rte_bsf to return uint32_t Date: Mon, 8 Aug 2022 14:21:31 -0700 Message-Id: <1659993692-17479-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1659993692-17479-1-git-send-email-roretzla@linux.microsoft.com> References: <1615418650-19513-1-git-send-email-roretzla@linux.microsoft.com> <1659993692-17479-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 From: Tyler Retzlaff return fixed width uint32_t to be consistent with what appears to be the original authors intent. it doesn't make much sense to return signed integers for these functions. Signed-off-by: Tyler Retzlaff --- lib/eal/include/rte_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index a96cc2a..bd4184d 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -707,7 +707,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * @return * The last (most-significant) bit set, or 0 if the input is 0. */ -static inline int +static inline uint32_t rte_fls_u32(uint32_t x) { return (x == 0) ? 0 : 32 - __builtin_clz(x); @@ -724,7 +724,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * @return * least significant set bit in the input parameter. */ -static inline int +static inline uint32_t rte_bsf64(uint64_t v) { return (uint32_t)__builtin_ctzll(v); @@ -766,7 +766,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * @return * The last (most-significant) bit set, or 0 if the input is 0. */ -static inline int +static inline uint32_t rte_fls_u64(uint64_t x) { return (x == 0) ? 0 : 64 - __builtin_clzll(x); From patchwork Mon Aug 8 21:21:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 114726 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 D89A1A0540; Mon, 8 Aug 2022 23:21:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 247F342B91; Mon, 8 Aug 2022 23:21:39 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D4F064014F for ; Mon, 8 Aug 2022 23:21:36 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2C8B52109433; Mon, 8 Aug 2022 14:21:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2C8B52109433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1659993696; bh=tABGPbl2sBZ7A4G13J5UPa/VlH3vxnxvuLBLYRRsVeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ssp7YSbISFAPeoblwNQHC/CazxYDeZCM+xpPkz4NKzEQWYX5Vt31fmzlCqXG1RDPB H3junTh1rd74nqZP3IIpbKmWmh0DLfyRZbRDpEYAUi/L31noh2Ib0WO17Q8agOqnT/ 26tq6La/DT9/pl4alSmV+4ryu5NMYYttuf/BO5Bc= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, anatoly.burakov@intel.com, ranjit.menon@intel.com, mb@smartsharesystems.com, Tyler Retzlaff , Tyler Retzlaff Subject: [PATCH 3/3] test: fix sign compare warning for rte_bsf64 return type change Date: Mon, 8 Aug 2022 14:21:32 -0700 Message-Id: <1659993692-17479-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1659993692-17479-1-git-send-email-roretzla@linux.microsoft.com> References: <1615418650-19513-1-git-send-email-roretzla@linux.microsoft.com> <1659993692-17479-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 From: Tyler Retzlaff rte_bsf64 return type has been changed insert cast to suppress sign-comapre warning with int. Signed-off-by: Tyler Retzlaff --- app/test/test_mbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index e09b254..be4c3ff 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -2677,7 +2677,7 @@ struct test_case { flag3 = rte_mbuf_dynflag_register_bitnum(&dynflag3, rte_bsf64(RTE_MBUF_F_LAST_FREE)); - if (flag3 != rte_bsf64(RTE_MBUF_F_LAST_FREE)) + if ((uint32_t)flag3 != rte_bsf64(RTE_MBUF_F_LAST_FREE)) GOTO_FAIL("failed to register dynamic flag 3, flag3=%d: %s", flag3, strerror(errno));