summaryrefslogtreecommitdiff
path: root/lib/cmap.h
diff options
context:
space:
mode:
authorYipeng Wang <yipeng1.wang@intel.com>2018-07-10 03:14:06 -0700
committerIan Stokes <ian.stokes@intel.com>2018-07-24 17:01:03 +0100
commit60d8ccae135f046a313a64d5f71822177b3c2371 (patch)
treee5c152d2677e17bfa521f27dccc165fd65b923d8 /lib/cmap.h
parent1ac690899592f97520aa1c959a623175e642f0a4 (diff)
downloadopenvswitch-60d8ccae135f046a313a64d5f71822177b3c2371.tar.gz
dpif-netdev: Add SMC cache after EMC cache
This patch adds a signature match cache (SMC) after exact match cache (EMC). The difference between SMC and EMC is SMC only stores a signature of a flow thus it is much more memory efficient. With same memory space, EMC can store 8k flows while SMC can store 1M flows. It is generally beneficial to turn on SMC but turn off EMC when traffic flow count is much larger than EMC size. SMC cache will map a signature to an dp_netdev_flow index in flow_table. Thus, we add two new APIs in cmap for lookup key by index and lookup index by key. For now, SMC is an experimental feature that it is turned off by default. One can turn it on using ovsdb options. Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com> Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Acked-by: Billy O'Mahony <billy.o.mahony@intel.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Diffstat (limited to 'lib/cmap.h')
-rw-r--r--lib/cmap.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/cmap.h b/lib/cmap.h
index 8bfb6c094..d9db3c915 100644
--- a/lib/cmap.h
+++ b/lib/cmap.h
@@ -145,6 +145,17 @@ size_t cmap_replace(struct cmap *, struct cmap_node *old_node,
const struct cmap_node *cmap_find(const struct cmap *, uint32_t hash);
struct cmap_node *cmap_find_protected(const struct cmap *, uint32_t hash);
+/* Find node by index or find index by hash. The 'index' of a cmap entry is a
+ * way to combine the specific bucket and the entry of the bucket into a
+ * convenient single integer value. In other words, it is the index of the
+ * entry and each entry has an unique index. It is not used internally by
+ * cmap.
+ * Currently the functions assume index will not be larger than uint32_t. In
+ * OvS table size is usually much smaller than this size.*/
+const struct cmap_node * cmap_find_by_index(const struct cmap *,
+ uint32_t index);
+uint32_t cmap_find_index(const struct cmap *, uint32_t hash);
+
/* Looks up multiple 'hashes', when the corresponding bit in 'map' is 1,
* and sets the corresponding pointer in 'nodes', if the hash value was
* found from the 'cmap'. In other cases the 'nodes' values are not changed,