summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorjaszha03 <jason.zhang2@arm.com>2019-06-12 16:01:19 -0500
committerDave Barach <openvpp@barachs.net>2019-07-30 16:22:03 +0000
commitf25e7cfa5c615e1972d5823b65ca579f951d68a5 (patch)
tree47c4e91b45710d861081d1933e2e8cbe3f56fe42 /src/plugins
parent6b03ab73116a7746f9480ea00c3924dcecb2799f (diff)
vppinfra: refactor use of CLIB_MEMORY_BARRIER ()
All instances of test_and_set locks used the following sequence to release the locks: CLIB_MEMORY_BARRIER (); p->lock = 0; // p is a generic struct with a TAS lock Use clib_atomic_release to generate more efficient assembly code. Type: refactor Change-Id: Idca3a38b1cf43578108bdd1afe83b6ebc17a4c68 Signed-off-by: Jason Zhang <jason.zhang2@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/map/map.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h
index d96c7b88cb7..6dc5232bf43 100644
--- a/src/plugins/map/map.h
+++ b/src/plugins/map/map.h
@@ -503,7 +503,7 @@ void
map_ip4_reass_free(map_ip4_reass_t *r, u32 **pi_to_drop);
#define map_ip4_reass_lock() while (clib_atomic_test_and_set (map_main.ip4_reass_lock)) { CLIB_PAUSE (); }
-#define map_ip4_reass_unlock() do {CLIB_MEMORY_BARRIER(); *map_main.ip4_reass_lock = 0;} while(0)
+#define map_ip4_reass_unlock() clib_atomic_release (map_main.ip4_reass_lock)
static_always_inline void
map_ip4_reass_get_fragments(map_ip4_reass_t *r, u32 **pi)
@@ -528,7 +528,7 @@ void
map_ip6_reass_free(map_ip6_reass_t *r, u32 **pi_to_drop);
#define map_ip6_reass_lock() while (clib_atomic_test_and_set (map_main.ip6_reass_lock)) { CLIB_PAUSE (); }
-#define map_ip6_reass_unlock() do {CLIB_MEMORY_BARRIER(); *map_main.ip6_reass_lock = 0;} while(0)
+#define map_ip6_reass_unlock() clib_atomic_release (map_main.ip6_reass_lock)
int
map_ip6_reass_add_fragment(map_ip6_reass_t *r, u32 pi,