From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75819A0C50; Fri, 23 Jul 2021 17:45:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE14D40040; Fri, 23 Jul 2021 17:45:51 +0200 (CEST) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mails.dpdk.org (Postfix) with ESMTP id 96B7D4003C for ; Fri, 23 Jul 2021 17:45:50 +0200 (CEST) Received: by mail-pl1-f176.google.com with SMTP id a14so3681042plh.5 for ; Fri, 23 Jul 2021 08:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=urA5RqIQ16k6urH7FMjrox7txOr4o+MrClR5sR+fEPs=; b=cp+Dx3OZteG8rReiDOood+FYROdc9pAh3CC7+lFpc/NiozIgG50prWeOovnjxhvG5D M1piEOObr/IRSBY3SjanQh3CpHuyCZ3SWsA4kvYc37XCXuMbtlVnFknbQMoCCVia0BWV MUPJSe97OScE/XfQTHHGowTRR4k3SpR4rjFcqtEKO7W8RUIkn/dinJbLrCOyDFVk/5Fd XcgHkIArSXcZibEkCOWKXFZve70LBTylG7fhRB8xg8Cpiknp+wPZDlmNTFkGVFBletZQ WWytAN3rvLNq5o4KGkYBRpfdt/4qrWV//7MF9BsDN/d6C501hB8gz6ILnGw7bhNACtQ7 dJBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=urA5RqIQ16k6urH7FMjrox7txOr4o+MrClR5sR+fEPs=; b=iJpoTGfP+z5N8aFJF7zvUM5MLquPX1dhbH9TFmbuEahpATUPVKth/9Z3P/jA0+E8nw YN9GAEwYL4J18Dwd5crcwGK1PpuGfHDYQQDMxpTw/O4EFKkU1gE+isMIgnM2Hbj2/YVc RqfdmMJBDk4MCBA3YRVW85I2bYJ3adFAG/do6HGdowtv5Xk45HPShAz2VC7e/n16/xJ+ YaZTwdmorQFbkb2LPe0TKabzr/2qBENRULbaHzw7IJAQV6ECuAHltv3f6WW3UETitCjb 5LAzLvjEYEjP4zqfW4ZIQ+9i1SMr4NK1pesiJ5irKxXbX7AQ6CM/5FweQsr0eSGuv+Fr 9xNA== X-Gm-Message-State: AOAM5327ok+e+DdP+HsOtyWRo1o6XrcdjJIxGDP6DNKBQinJDd7+m86e Qusxb+uvsoY/3vVqvussBEXkAG/BF0CwTA== X-Google-Smtp-Source: ABdhPJzFM+41JqTtrV3bPNc7AxR6jjCTJGC8WdyKKOcVLCY8q27R26WEFqpBh+hWoXodhJYd9MISVA== X-Received: by 2002:a63:807:: with SMTP id 7mr5400036pgi.122.1627055149070; Fri, 23 Jul 2021 08:45:49 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id q21sm15619144pgk.71.2021.07.23.08.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jul 2021 08:45:48 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , anatoly.burakov@intel.com, Tyler Retzlaff Date: Fri, 23 Jul 2021 08:45:46 -0700 Message-Id: <20210723154546.7958-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210713201221.301248-1-stephen@networkplumber.org> References: <20210713201221.301248-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3] eal: fix argument to rte_bsf32_safe 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 Sender: "dev" The first argument to rte_bsf32_safe was incorrectly declared as a 64 bit value. The code only works on 32 bit values and the underlying function rte_bsf32 only accepts 32 bit values. This was a mistake introduced when the safe version was added and probably cause by copy/paste from the 64 bit version. The bug passed silently under the radar until some other code was built with -Wall and -Wextra in C++ and C++ complains about the missing cast. Yes, this is a API signature change, but the original code was wrong. It is an inline so not an ABI change. Fixes: 4e261f551986 ("eal: add 64-bit bsf and 32-bit safe bsf functions") Cc: anatoly.burakov@intel.com Signed-off-by: Stephen Hemminger Acked-by: Tyler Retzlaff --- v3 - reword commit description for checkpatch doc/guides/rel_notes/release_21_08.rst | 4 ++++ lib/eal/include/rte_common.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_21_08.rst b/doc/guides/rel_notes/release_21_08.rst index e2c5ccbf7d90..148405891fcb 100644 --- a/doc/guides/rel_notes/release_21_08.rst +++ b/doc/guides/rel_notes/release_21_08.rst @@ -196,6 +196,10 @@ API Changes to be thread safe; all Rx queues affected by the API will now need to be stopped before making any changes to the power management scheme. +* eal: ``rte_bsf32_safe`` now takes a 32 bit value for its first + argument. This fixes warnings about loss of precision when used + with some compilers settings. + ABI Changes ----------- diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index d5a32c66a5fe..99eb5f1820ae 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -623,7 +623,7 @@ rte_bsf32(uint32_t v) * Returns 0 if ``v`` was 0, otherwise returns 1. */ static inline int -rte_bsf32_safe(uint64_t v, uint32_t *pos) +rte_bsf32_safe(uint32_t v, uint32_t *pos) { if (v == 0) return 0; -- 2.30.2