[ovs-dev] [PATCH v4 6/9] classifier: Do not use mf_value.

Joe Stringer joestringer at nicira.com
Wed Aug 12 21:18:03 UTC 2015


On 7 August 2015 at 16:57, Jarno Rajahalme <jrajahalme at nicira.com> wrote:
> mf_value has grown bigger than needed for storing the biggest
> supported prefix (IPv6 address length).  Define a new type to be used
> instead of mf_value.
>
> This makes classifier lookups a bit faster.
>
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> ---
>  lib/classifier.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/lib/classifier.c b/lib/classifier.c
> index 4adee2d..040d04f 100644
> --- a/lib/classifier.c
> +++ b/lib/classifier.c
> @@ -138,12 +138,18 @@ next_visible_rule_in_list(const struct cls_match *rule, cls_version_t version)
>      return rule;
>  }
>
> +/* Type with maximum supported prefix length. */
> +typedef union {
> +    struct in6_addr ipv6;  /* For sizing. */
> +    ovs_be32 be32;         /* For access. */
> +} trie_prefix_t;

Typically I believe that we try to avoid typedefs, instead using the
expanded "union trie_prefix" so that the actual type can be determined
at a glance (See CodingStyle.md for more explanation).

Other than that, this change seems to make sense.



More information about the dev mailing list