From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@amd.com,
stephen@networkplumber.org, mattias.ronnblom@ericsson.com,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@nxp.com>,
Devendra Singh Rawat <dsinghrawat@marvell.com>,
Alok Prasad <palok@marvell.com>,
Jochen Behrens <jochen.behrens@broadcom.com>
Subject: [PATCH 5/6] drivers: use branch prediction macros
Date: Thu, 24 Oct 2024 14:05:34 +0200 [thread overview]
Message-ID: <20241024120535.2722316-6-david.marchand@redhat.com> (raw)
In-Reply-To: <20241024120535.2722316-1-david.marchand@redhat.com>
Prefer EAL macros over __builtin_ helpers.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/fslmc/qbman/include/compat.h | 6 ++----
drivers/net/qede/base/bcm_osal.h | 4 +++-
drivers/net/vmxnet3/base/vmxnet3_osdep.h | 4 +++-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index ece5da5906..4ac3254bc7 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -16,7 +16,9 @@
#include <malloc.h>
#include <unistd.h>
#include <linux/types.h>
+
#include <rte_atomic.h>
+#include <rte_branch_prediction.h>
/* The following definitions are primarily to allow the single-source driver
* interfaces to be included by arbitrary program code. Ie. for interfaces that
@@ -24,10 +26,6 @@
* with certain attributes and types used in those interfaces.
*/
-/* Required compiler attributes */
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-
/* Required types */
typedef uint64_t dma_addr_t;
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 7869103c63..357981f63d 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -10,7 +10,9 @@
#include <stdbool.h>
#include <pthread.h>
#include <time.h>
+
#include <rte_bitops.h>
+#include <rte_branch_prediction.h>
#include <rte_byteorder.h>
#include <rte_spinlock.h>
#include <rte_malloc.h>
@@ -442,7 +444,7 @@ u32 qede_osal_log2(u32);
#define OSAL_CACHE_LINE_SIZE RTE_CACHE_LINE_SIZE
#define OSAL_IOMEM volatile
#define OSAL_UNUSED __rte_unused
-#define OSAL_UNLIKELY(x) __builtin_expect(!!(x), 0)
+#define OSAL_UNLIKELY(x) unlikely(x)
#define OSAL_MIN_T(type, __min1, __min2) RTE_MIN_T(__min1, __min2, type)
#define OSAL_MAX_T(type, __max1, __max2) RTE_MAX_T(__max1, __max2, type)
diff --git a/drivers/net/vmxnet3/base/vmxnet3_osdep.h b/drivers/net/vmxnet3/base/vmxnet3_osdep.h
index 381a68db69..b1cd9ed056 100644
--- a/drivers/net/vmxnet3/base/vmxnet3_osdep.h
+++ b/drivers/net/vmxnet3/base/vmxnet3_osdep.h
@@ -7,13 +7,15 @@
#include <stdbool.h>
+#include <rte_branch_prediction.h>
+
typedef uint64_t uint64;
typedef uint32_t uint32;
typedef uint16_t uint16;
typedef uint8_t uint8;
#ifndef UNLIKELY
-#define UNLIKELY(x) __builtin_expect((x),0)
+#define UNLIKELY(x) unlikely(x)
#endif /* unlikely */
#endif /* _VMXNET3_OSDEP_H */
--
2.46.2
next prev parent reply other threads:[~2024-10-24 12:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 12:05 [PATCH 0/6] Clean up many __builtin_* in drivers David Marchand
2024-10-24 12:05 ` [PATCH 1/6] devtools: handle multiple pattern for skipping files David Marchand
2024-10-24 12:05 ` [PATCH 2/6] devtools: forbid use of builtin helpers David Marchand
2024-10-24 16:40 ` Stephen Hemminger
2024-10-24 12:05 ` [PATCH 3/6] common/dpaax: use prefetch macros David Marchand
2024-10-24 16:40 ` Stephen Hemminger
2024-10-24 12:05 ` [PATCH 4/6] crypto/openssl: fix 3DES-CTR with big endian CPUs David Marchand
2024-10-24 12:54 ` Morten Brørup
2024-10-24 13:10 ` David Marchand
2024-10-24 13:17 ` David Marchand
2024-10-24 13:30 ` David Marchand
2024-10-24 14:21 ` Morten Brørup
2024-10-24 12:05 ` David Marchand [this message]
2024-10-24 16:41 ` [PATCH 5/6] drivers: use branch prediction macros Stephen Hemminger
2024-10-24 12:05 ` [PATCH 6/6] drivers: use bitops API instead of compiler builtins David Marchand
2024-10-24 12:25 ` Morten Brørup
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=20241024120535.2722316-6-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=dsinghrawat@marvell.com \
--cc=ferruh.yigit@amd.com \
--cc=hemant.agrawal@nxp.com \
--cc=jochen.behrens@broadcom.com \
--cc=mattias.ronnblom@ericsson.com \
--cc=palok@marvell.com \
--cc=sachin.saxena@nxp.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).