git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit '9dc63482bbeae23dd57b0f885a3fd26b44656844'
[sliver-openvswitch.git]
/
lib
/
ofp-msgs.c
diff --git
a/lib/ofp-msgs.c
b/lib/ofp-msgs.c
index
af4178e
..
d136f73
100644
(file)
--- a/
lib/ofp-msgs.c
+++ b/
lib/ofp-msgs.c
@@
-23,6
+23,7
@@
#include "ofpbuf.h"
#include "openflow/nicira-ext.h"
#include "openflow/openflow.h"
#include "ofpbuf.h"
#include "openflow/nicira-ext.h"
#include "openflow/openflow.h"
+#include "ovs-thread.h"
#include "vlog.h"
VLOG_DEFINE_THIS_MODULE(ofp_msgs);
#include "vlog.h"
VLOG_DEFINE_THIS_MODULE(ofp_msgs);
@@
-109,8
+110,11
@@
static enum ofperr ofpraw_from_ofphdrs(enum ofpraw *, const struct ofphdrs *);
static ovs_be32
alloc_xid(void)
{
static ovs_be32
alloc_xid(void)
{
- static uint32_t next_xid = 1;
- return htonl(next_xid++);
+ static atomic_uint32_t next_xid = ATOMIC_VAR_INIT(1);
+ uint32_t xid;
+
+ atomic_add(&next_xid, 1, &xid);
+ return htonl(xid);
}
\f
static uint32_t
}
\f
static uint32_t
@@
-988,9
+992,10
@@
ofpraw_from_ofphdrs(enum ofpraw *raw, const struct ofphdrs *hdrs)
static void
ofpmsgs_init(void)
{
static void
ofpmsgs_init(void)
{
+ static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
const struct raw_info *info;
const struct raw_info *info;
- if (
raw_instance_map.buckets
) {
+ if (
!ovsthread_once_start(&once)
) {
return;
}
return;
}
@@
-1008,4
+1013,6
@@
ofpmsgs_init(void)
ofphdrs_hash(&inst->hdrs));
}
}
ofphdrs_hash(&inst->hdrs));
}
}
+
+ ovsthread_once_done(&once);
}
}