Tunnel metadata can be substantially larger than our existing fields (up to 124 bytes in a single Geneve option) so this extends the size of the data that we can handle with metaflow fields. This also breaks a few tests that assume that their max size is also the maximum that can be handled in a field.
Signed-off-by: Jesse Gross <je...@nicira.com> --- lib/meta-flow.c | 7 +++++-- lib/meta-flow.h | 26 +++++++++++++------------- tests/learn.at | 2 +- tests/ovn.at | 1 - 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/meta-flow.c b/lib/meta-flow.c index 526f88e..c4295c5 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -384,8 +384,9 @@ mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow) void mf_mask_field_and_prereqs(const struct mf_field *mf, struct flow *mask) { - static const union mf_value exact_match_mask = MF_EXACT_MASK_INITIALIZER; + static union mf_value exact_match_mask; + memset(&exact_match_mask, 0xff, sizeof exact_match_mask); mf_set_flow_value(mf, &exact_match_mask, mask); switch (mf->prereqs) { @@ -1000,7 +1001,9 @@ mf_set_value(const struct mf_field *mf, void mf_mask_field(const struct mf_field *mf, struct flow *mask) { - static const union mf_value exact_match_mask = MF_EXACT_MASK_INITIALIZER; + union mf_value exact_match_mask; + + memset(&exact_match_mask, 0xff, sizeof exact_match_mask); /* For MFF_DL_VLAN, we cannot send a all 1's to flow_set_dl_vlan() * as that will be considered as OFP10_VLAN_NONE. So consider it as a diff --git a/lib/meta-flow.h b/lib/meta-flow.h index b04344b..01b129c 100644 --- a/lib/meta-flow.h +++ b/lib/meta-flow.h @@ -1542,6 +1542,7 @@ struct mf_field { /* The representation of a field's value. */ union mf_value { + uint8_t tun_metadata[128]; struct in6_addr ipv6; uint8_t mac[ETH_ADDR_LEN]; ovs_be64 be64; @@ -1549,11 +1550,7 @@ union mf_value { ovs_be16 be16; uint8_t u8; }; -BUILD_ASSERT_DECL(sizeof(union mf_value) == 16); - -/* An all-1-bits mf_value. Needs to be updated if struct mf_value grows.*/ -#define MF_EXACT_MASK_INITIALIZER { IN6ADDR_EXACT_INIT } -BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof(struct in6_addr)); +BUILD_ASSERT_DECL(sizeof(union mf_value) == 128); /* Part of a field. */ struct mf_subfield { @@ -1569,25 +1566,28 @@ struct mf_subfield { * corresponding data in value.be16[7] as the bits in the mask htons(0xfff). */ union mf_subvalue { /* Access to full data. */ - uint8_t u8[16]; - ovs_be16 be16[8]; - ovs_be32 be32[4]; - ovs_be64 be64[2]; + uint8_t u8[128]; + ovs_be16 be16[64]; + ovs_be32 be32[32]; + ovs_be64 be64[16]; /* Convenient access to just least-significant bits in various forms. */ struct { - ovs_be64 dummy_integer; + ovs_be64 dummy_integer[15]; ovs_be64 integer; }; struct { - uint8_t dummy_mac[10]; + uint8_t dummy_mac[122]; uint8_t mac[6]; }; struct { - ovs_be32 dummy_ipv4[3]; + ovs_be32 dummy_ipv4[31]; ovs_be32 ipv4; }; - struct in6_addr ipv6; + struct { + struct in6_addr dummy_ipv6[7]; + struct in6_addr ipv6; + }; }; BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof (union mf_subvalue)); diff --git a/tests/learn.at b/tests/learn.at index 0372e4a..2b2fc28 100644 --- a/tests/learn.at +++ b/tests/learn.at @@ -94,7 +94,7 @@ AT_CLEANUP AT_SETUP([learning action - too-long immediate value]) dnl 129 bits is too long. AT_CHECK([[ovs-ofctl parse-flow 'actions=learn(load:0x1fedbca9876543210fedbca9876543210->NXM_NX_IPV6_DST[])']], - [1], [], [[ovs-ofctl: 0x1fedbca9876543210fedbca9876543210->NXM_NX_IPV6_DST[]: too many bits in immediate value + [1], [], [[ovs-ofctl: 0x1fedbca9876543210fedbca9876543210->NXM_NX_IPV6_DST[]: value does not fit into 128 bits ]]) dnl 128 bits is merely a bad prerequisite. diff --git a/tests/ovn.at b/tests/ovn.at index ed79192..261e32a 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -37,7 +37,6 @@ a/b => a error("`/' is only valid as part of `//' or `/*'.") b 0xfedcba9876543210 0XFEDCBA9876543210 => 0xfedcba9876543210 0xfedcba9876543210fedcba9876543210 -0xfedcba9876543210fedcba98765432100 => error("Hexadecimal constant requires more than 128 bits.") 0x0000fedcba9876543210fedcba9876543210 => 0xfedcba9876543210fedcba9876543210 0x => error("Hex digits expected following 0x.") 0X => error("Hex digits expected following 0X.") -- 2.1.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev