Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
ikev2: add support for custom ipsec-over-udp port
[vpp.git]
/
src
/
vppinfra
/
elog.c
diff --git
a/src/vppinfra/elog.c
b/src/vppinfra/elog.c
index
19d86bb
..
caddf6f
100644
(file)
--- a/
src/vppinfra/elog.c
+++ b/
src/vppinfra/elog.c
@@
-41,13
+41,14
@@
#include <vppinfra/format.h>
#include <vppinfra/hash.h>
#include <vppinfra/math.h>
#include <vppinfra/format.h>
#include <vppinfra/hash.h>
#include <vppinfra/math.h>
+#include <vppinfra/lock.h>
static inline void
elog_lock (elog_main_t * em)
{
if (PREDICT_FALSE (em->lock != 0))
while (clib_atomic_test_and_set (em->lock))
static inline void
elog_lock (elog_main_t * em)
{
if (PREDICT_FALSE (em->lock != 0))
while (clib_atomic_test_and_set (em->lock))
- ;
+
CLIB_PAUSE ()
;
}
static inline void
}
static inline void
@@
-55,8
+56,7
@@
elog_unlock (elog_main_t * em)
{
if (PREDICT_FALSE (em->lock != 0))
{
{
if (PREDICT_FALSE (em->lock != 0))
{
- CLIB_MEMORY_BARRIER ();
- *em->lock = 0;
+ clib_atomic_release (em->lock);
}
}
}
}
@@
-572,6
+572,12
@@
elog_string (elog_main_t * em, char *fmt, ...)
em->string_table_tmp = va_format (em->string_table_tmp, fmt, &va);
va_end (va);
em->string_table_tmp = va_format (em->string_table_tmp, fmt, &va);
va_end (va);
+ /* String table entries MUST be NULL terminated */
+ len = vec_len (em->string_table_tmp);
+ ASSERT (len > 0);
+ if (em->string_table_tmp[len - 1] != 0)
+ vec_add1 (em->string_table_tmp, 0);
+
/* See if we already have this string in the string table */
p = hash_get_mem (em->string_table_hash, em->string_table_tmp);
/* See if we already have this string in the string table */
p = hash_get_mem (em->string_table_hash, em->string_table_tmp);
@@
-582,11
+588,7
@@
elog_string (elog_main_t * em, char *fmt, ...)
return (p[0]);
}
return (p[0]);
}
- /* We don't, so add it. String table entries MUST be NULL terminated */
- len = vec_len (em->string_table_tmp);
- ASSERT (len > 0);
- if (em->string_table_tmp[len - 1] != 0)
- vec_add1 (em->string_table_tmp, 0);
+ /* We don't, so add it. */
offset = vec_len (em->string_table);
vec_append (em->string_table, em->string_table_tmp);
offset = vec_len (em->string_table);
vec_append (em->string_table, em->string_table_tmp);