summaryrefslogtreecommitdiff
path: root/lib/bbdev
diff options
context:
space:
mode:
authorTyler Retzlaff <[email protected]>2023-03-20 12:00:21 -0700
committerDavid Marchand <[email protected]>2023-04-25 11:08:52 +0200
commited090599c8bdcf5788d3459a752f1bbac0cef176 (patch)
treea6b13c90f7142a6c61d65d6180846c99967a3ff4 /lib/bbdev
parentf9eb7a4bc1cb70bca87878a29db1418f13c4f318 (diff)
rework atomic intrinsics fetch operations
Use __atomic_fetch_{add,and,or,sub,xor} instead of __atomic_{add,and,or,sub,xor}_fetch adding the necessary code to allow consumption of the resulting value. Signed-off-by: Tyler Retzlaff <[email protected]> Reviewed-by: Ruifeng Wang <[email protected]> Acked-by: Pavan Nikhilesh <[email protected]> Acked-by: Nithin Dabilpuram <[email protected]> Reviewed-by: David Marchand <[email protected]>
Diffstat (limited to 'lib/bbdev')
-rw-r--r--lib/bbdev/rte_bbdev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 69e099d5bb..581509b5a2 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -250,8 +250,8 @@ rte_bbdev_release(struct rte_bbdev *bbdev)
}
/* clear shared BBDev Data if no process is using the device anymore */
- if (__atomic_sub_fetch(&bbdev->data->process_cnt, 1,
- __ATOMIC_RELAXED) == 0)
+ if (__atomic_fetch_sub(&bbdev->data->process_cnt, 1,
+ __ATOMIC_RELAXED) - 1 == 0)
memset(bbdev->data, 0, sizeof(*bbdev->data));
memset(bbdev, 0, sizeof(*bbdev));