summaryrefslogtreecommitdiffstats
path: root/src/vnet
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 11:46:19 +0000
commit0455c435af501889de51c79a223883b3c2003b20 (patch)
treec869cd21043469888ee2a23e563e958ce05e3a96 /src/vnet
parentd56550c2b669558aa38d93f44a9a3b31e0b9370f (diff)
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 <jason.zhang2@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
Diffstat (limited to 'src/vnet')
-rwxr-xr-xsrc/vnet/classify/vnet_classify.c3
-rw-r--r--src/vnet/dns/dns.h3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c
index 90086f0e62f..64549a6e0d5 100755
--- a/src/vnet/classify/vnet_classify.c
+++ b/src/vnet/classify/vnet_classify.c
@@ -18,6 +18,7 @@
#include <vnet/api_errno.h> /* for API error numbers */
#include <vnet/l2/l2_classify.h> /* for L2_INPUT_CLASSIFY_NEXT_xxx */
#include <vnet/fib/fib_table.h>
+#include <vppinfra/lock.h>
vnet_classify_main_t vnet_classify_main;
@@ -447,7 +448,7 @@ vnet_classify_add_del (vnet_classify_table_t * t,
hash >>= t->log2_nbuckets;
while (clib_atomic_test_and_set (t->writer_lock))
- ;
+ CLIB_PAUSE ();
/* First elt in the bucket? */
if (b->offset == 0)
diff --git a/src/vnet/dns/dns.h b/src/vnet/dns/dns.h
index b2e3e9b90cb..19de69cc248 100644
--- a/src/vnet/dns/dns.h
+++ b/src/vnet/dns/dns.h
@@ -23,6 +23,7 @@
#include <vppinfra/hash.h>
#include <vnet/dns/dns_packet.h>
#include <vnet/ip/ip.h>
+#include <vppinfra/lock.h>
typedef struct
{
@@ -196,7 +197,7 @@ dns_cache_lock (dns_main_t * dm)
if (dm->cache_lock)
{
while (clib_atomic_test_and_set (dm->cache_lock))
- ;
+ CLIB_PAUSE ();
}
}