From 0455c435af501889de51c79a223883b3c2003b20 Mon Sep 17 00:00:00 2001 From: jaszha03 Date: Wed, 12 Jun 2019 16:01:19 -0500 Subject: vppinfra: conformed spinlocks to use CLIB_PAUSE Modified test-and-set spin locks to call CLIB_PAUSE () when spinning for code consistency. Decreases the memory bandwidth consumed. Type: fix Change-Id: I1cca4f87f44f23f257c7a35466cd2e7767072f51 Signed-off-by: Jason Zhang Reviewed-by: Honnappa Nagarahalli Reviewed-by: Lijian Zhang --- src/plugins/map/map.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/map') diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h index abafb4e21fe..d96c7b88cb7 100644 --- a/src/plugins/map/map.h +++ b/src/plugins/map/map.h @@ -22,6 +22,7 @@ #include #include #include "lpm.h" +#include #define MAP_SKIP_IP6_LOOKUP 1 @@ -501,7 +502,7 @@ map_ip4_reass_get(u32 src, u32 dst, u16 fragment_id, 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)) {} +#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) static_always_inline void @@ -526,7 +527,7 @@ map_ip6_reass_get(ip6_address_t *src, ip6_address_t *dst, u32 fragment_id, 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)) {} +#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) int -- cgit 1.2.3-korg