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 BAD8F43183; Tue, 17 Oct 2023 01:09:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96EBF40EAB; Tue, 17 Oct 2023 01:09:13 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E31B940A8B for ; Tue, 17 Oct 2023 01:09:07 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id E932F20B74C4; Mon, 16 Oct 2023 16:09:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E932F20B74C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1697497746; bh=ufDzWYOAhAMaCO0qqB3PeY409Oc60bfdcRYGyGGst8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kSPH4WnZJU8raklswNEOf2U9HRiXVeoJLZBKmqy4ebvNdVxpNUx19TUQMo0NWrmlo rYcmh7Ra0CpTpBC9dLCeJ2Z6Jd0gknwahL4LIjs+m7YmSFu4nLz44YpBP0Ya66bOCn +vt4ZMPJ2vHWK6ZMU4Hw52yf/xpfFJ2CLYGfh2jk= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Anatoly Burakov , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Ciara Power , David Christensen , David Hunt , Dmitry Kozlyuk , Dmitry Malloy , Elena Agostini , Erik Gabriel Carrillo , Fan Zhang , Ferruh Yigit , Harman Kalra , Harry van Haaren , Honnappa Nagarahalli , Jerin Jacob , Konstantin Ananyev , Matan Azrad , Maxime Coquelin , Narcisa Ana Maria Vasile , Nicolas Chautru , Olivier Matz , Ori Kam , Pallavi Kadam , Pavan Nikhilesh , Reshma Pattan , Sameh Gobriel , Shijith Thotton , Sivaprasad Tummala , Stephen Hemminger , Suanming Mou , Sunil Kumar Kori , Thomas Monjalon , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH 04/21] bbdev: use rte optional stdatomic API Date: Mon, 16 Oct 2023 16:08:48 -0700 Message-Id: <1697497745-20664-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1697497745-20664-1-git-send-email-roretzla@linux.microsoft.com> References: <1697497745-20664-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 Replace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional stdatomic API Signed-off-by: Tyler Retzlaff --- lib/bbdev/rte_bbdev.c | 6 +++--- lib/bbdev/rte_bbdev.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index 155323e..cfebea0 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -208,7 +208,7 @@ struct rte_bbdev * return NULL; } - __atomic_fetch_add(&bbdev->data->process_cnt, 1, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit(&bbdev->data->process_cnt, 1, rte_memory_order_relaxed); bbdev->data->dev_id = dev_id; bbdev->state = RTE_BBDEV_INITIALIZED; @@ -250,8 +250,8 @@ struct rte_bbdev * } /* clear shared BBDev Data if no process is using the device anymore */ - if (__atomic_fetch_sub(&bbdev->data->process_cnt, 1, - __ATOMIC_RELAXED) - 1 == 0) + if (rte_atomic_fetch_sub_explicit(&bbdev->data->process_cnt, 1, + rte_memory_order_relaxed) - 1 == 0) memset(bbdev->data, 0, sizeof(*bbdev->data)); memset(bbdev, 0, sizeof(*bbdev)); diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index d12e2e7..e1aee08 100644 --- a/lib/bbdev/rte_bbdev.h +++ b/lib/bbdev/rte_bbdev.h @@ -482,7 +482,7 @@ struct rte_bbdev_data { uint16_t dev_id; /**< Device ID */ int socket_id; /**< NUMA socket that device is on */ bool started; /**< Device run-time state */ - uint16_t process_cnt; /** Counter of processes using the device */ + RTE_ATOMIC(uint16_t) process_cnt; /** Counter of processes using the device */ }; /* Forward declarations */ -- 1.8.3.1