[ovs-dev] [PATCH 1/2] meta-flow: Initialize the whole exact_match_mask.

Jarno Rajahalme jrajahalme at nicira.com
Thu Aug 27 00:42:45 UTC 2015


Initialize the whole 'exact_match_mask' in
mf_mask_field_and_prereqs(), as geneve options can be bigger than 16
bytes.

Requested-by: Jesse Gross <jesse at nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
 lib/meta-flow.c | 5 ++---
 lib/meta-flow.h | 7 +++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 1b7f9ca..400ff49 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -390,12 +390,11 @@ mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow)
 
 /* Set field and it's prerequisities in the mask.
  * This is only ever called for writeable 'mf's, but we do not make the
- * distinction here.
- * The widest field this is ever called for an IPv6 address (16 bytes). */
+ * distinction here. */
 void
 mf_mask_field_and_prereqs(const struct mf_field *mf, struct flow_wildcards *wc)
 {
-    static union mf_value exact_match_mask = { .ipv6 = IN6ADDR_EXACT_INIT };
+    static union mf_value exact_match_mask = MF_VALUE_EXACT_INITIALIZER;
 
     mf_set_flow_value(mf, &exact_match_mask, &wc->masks);
 
diff --git a/lib/meta-flow.h b/lib/meta-flow.h
index 3dc342d..4d7de30 100644
--- a/lib/meta-flow.h
+++ b/lib/meta-flow.h
@@ -1750,6 +1750,13 @@ union mf_value {
 BUILD_ASSERT_DECL(sizeof(union mf_value) == 128);
 BUILD_ASSERT_DECL(sizeof(union mf_value) >= GENEVE_MAX_OPT_SIZE);
 
+#define MF_VALUE_EXACT_8 0xff, 0xff, 0xff, 0xff,  0xff, 0xff, 0xff, 0xff
+#define MF_VALUE_EXACT_16 MF_VALUE_EXACT_8, MF_VALUE_EXACT_8
+#define MF_VALUE_EXACT_32 MF_VALUE_EXACT_16, MF_VALUE_EXACT_16
+#define MF_VALUE_EXACT_64 MF_VALUE_EXACT_32, MF_VALUE_EXACT_32
+#define MF_VALUE_EXACT_128 MF_VALUE_EXACT_64, MF_VALUE_EXACT_64
+#define MF_VALUE_EXACT_INITIALIZER { .tun_metadata = { MF_VALUE_EXACT_128 } }
+
 /* Part of a field. */
 struct mf_subfield {
     const struct mf_field *field;
-- 
2.1.4




More information about the dev mailing list