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 875D643200; Thu, 26 Oct 2023 02:32:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BA2040EAB; Thu, 26 Oct 2023 02:32:04 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 851B1402BE for ; Thu, 26 Oct 2023 02:32:00 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5AF9E20B74C2; Wed, 25 Oct 2023 17:31:59 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5AF9E20B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1698280319; bh=ufDzWYOAhAMaCO0qqB3PeY409Oc60bfdcRYGyGGst8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KC2myxWLQmW6swF9Nw7HBCRggGfJnPlWJI1AMrGc/Ul9Zt8JBuht7uIoUJGZkGiXp F+0/LM4XyG27rhpIaD0D/RUJYW1YNZre6gDRBknti5UldoAUQ03cAaiIjpjwIxvf5D LP98tLSZ6U+qPdkTkTSzHhKhLP7wLKa313RdIp64= 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 v3 02/19] bbdev: use rte optional stdatomic API Date: Wed, 25 Oct 2023 17:31:37 -0700 Message-Id: <1698280314-25861-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698280314-25861-1-git-send-email-roretzla@linux.microsoft.com> References: <1697497745-20664-1-git-send-email-roretzla@linux.microsoft.com> <1698280314-25861-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