summaryrefslogtreecommitdiff
path: root/lib/dpif-netdev-private.h
diff options
context:
space:
mode:
authorHarry van Haaren <harry.van.haaren@intel.com>2019-07-18 14:03:05 +0100
committerIan Stokes <ian.stokes@intel.com>2019-07-19 12:22:23 +0100
commita0b36b3924c7c7033ebecc2ad79f6fcee2b2e66d (patch)
tree42ed0953a36b479fdf161114d9d9a13f8a0fe355 /lib/dpif-netdev-private.h
parent92c7c870d69a1c433768fc7746c573bc0c4bd5fa (diff)
downloadopenvswitch-a0b36b3924c7c7033ebecc2ad79f6fcee2b2e66d.tar.gz
dpif-netdev: Refactor generic implementation
This commit refactors the generic implementation. The goal of this refactor is to simplify the code to enable "specialization" of the functions at compile time. Given compile-time optimizations, the compiler is able to unroll loops, and create optimized code sequences due to compile time knowledge of loop-trip counts. In order to enable these compiler optimizations, we must refactor the code to pass the loop-trip counts to functions as compile time constants. This patch allows the number of miniflow-bits set per "unit" in the miniflow to be passed around as a function argument. Note that this patch does NOT yet take advantage of doing so, this is only a refactor to enable it in the next patches. Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com> Tested-by: Malvika Gupta <malvika.gupta@arm.com> Acked-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Diffstat (limited to 'lib/dpif-netdev-private.h')
-rw-r--r--lib/dpif-netdev-private.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/dpif-netdev-private.h b/lib/dpif-netdev-private.h
index 555856482..610851a10 100644
--- a/lib/dpif-netdev-private.h
+++ b/lib/dpif-netdev-private.h
@@ -60,7 +60,7 @@ uint32_t (*dpcls_subtable_lookup_func)(struct dpcls_subtable *subtable,
const struct netdev_flow_key *keys[],
struct dpcls_rule **rules);
-/* Prototype for generic lookup func, using same code path as before. */
+/* Prototype for generic lookup func, using generic scalar code path. */
uint32_t
dpcls_subtable_lookup_generic(struct dpcls_subtable *subtable,
uint32_t keys_map,
@@ -77,12 +77,22 @@ struct dpcls_subtable {
uint32_t hit_cnt; /* Number of match hits in subtable in current
optimization interval. */
+ /* Miniflow fingerprint that the subtable matches on. The miniflow "bits"
+ * are used to select the actual dpcls lookup implementation at subtable
+ * creation time.
+ */
+ uint8_t mf_bits_set_unit0;
+ uint8_t mf_bits_set_unit1;
+
/* The lookup function to use for this subtable. If there is a known
* property of the subtable (eg: only 3 bits of miniflow metadata is
* used for the lookup) then this can point at an optimized version of
* the lookup function for this particular subtable. */
dpcls_subtable_lookup_func lookup_func;
+ /* Caches the masks to match a packet to, reducing runtime calculations. */
+ uint64_t *mf_masks;
+
struct netdev_flow_key mask; /* Wildcards for fields (const). */
/* 'mask' must be the last field, additional space is allocated here. */
};