summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan Moats <rmoats@us.ibm.com>2016-07-18 16:21:16 -0500
committerBen Pfaff <blp@ovn.org>2016-07-18 22:45:51 -0700
commitfdbdb5956f636d2c9077c47662783945a6859c0a (patch)
tree3f2f928eb9a1687145996141924df211e2b52336 /lib
parent0643a78b74cdada22061168bad5757a7ba523878 (diff)
downloadopenvswitch-fdbdb5956f636d2c9077c47662783945a6859c0a.tar.gz
ovn-controller: Persist ovn flow tables
Ensure that ovn flow tables are persisted so that changes to them chan be applied incrementally - this is a prereq for making lflow_run and physical_run incremental. As part of this change, add a one-to-many hindex for finding desired flows by their parent's UUID. Also extend the mapping by match from one-to-one to one-to-many. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> [blp@ovn.org adjusted style and comments and added HINDEX_FOR_EACH_WITH_HASH_SAFE] Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/hindex.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/hindex.h b/lib/hindex.h
index 416da0540..876c5a9e3 100644
--- a/lib/hindex.h
+++ b/lib/hindex.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 Nicira, Inc.
+ * Copyright (c) 2013, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -132,6 +132,15 @@ void hindex_remove(struct hindex *, struct hindex_node *);
NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER); \
ASSIGN_CONTAINER(NODE, (NODE)->MEMBER.s, MEMBER))
+/* Safe when NODE may be freed (not needed when NODE may be removed from the
+ * hash map but its members remain accessible and intact). */
+#define HINDEX_FOR_EACH_WITH_HASH_SAFE(NODE, NEXT, MEMBER, HASH, HINDEX) \
+ for (INIT_CONTAINER(NODE, hindex_node_with_hash(HINDEX, HASH), MEMBER); \
+ (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER) \
+ ? INIT_CONTAINER(NEXT, (NODE)->MEMBER.s, MEMBER), 1 \
+ : 0); \
+ (NODE) = (NEXT))
+
/* Returns the head node in 'hindex' with the given 'hash', or a null pointer
* if no nodes have that hash value. */
static inline struct hindex_node *