[ovs-dev] [classifier-opt 20/28] flow: Remove flow_wildcards_is_exact().

Ethan Jackson ethan at nicira.com
Tue Jul 31 01:12:20 UTC 2012


Makes sense, looks good.

Ethan

On Fri, Jul 20, 2012 at 4:25 PM, Ben Pfaff <blp at nicira.com> wrote:
> It's only used in a not-very-useful assertion in some test code.  In
> general, exact-match flows make very little sense anymore, and they're
> basically on their way out.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/flow.c              |   42 ------------------------------------------
>  lib/flow.h              |    1 -
>  tests/test-classifier.c |    2 --
>  3 files changed, 0 insertions(+), 45 deletions(-)
>
> diff --git a/lib/flow.c b/lib/flow.c
> index 2433bec..6747add 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -632,48 +632,6 @@ flow_wildcards_init_exact(struct flow_wildcards *wc)
>      memset(wc->masks.zeros, 0, sizeof wc->masks.zeros);
>  }
>
> -/* Returns true if 'wc' is exact-match, false if 'wc' wildcards any bits or
> - * fields. */
> -bool
> -flow_wildcards_is_exact(const struct flow_wildcards *wc)
> -{
> -    int i;
> -
> -    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17);
> -
> -    if (wc->masks.tun_id != htonll(UINT64_MAX)
> -        || wc->masks.nw_src != htonl(UINT32_MAX)
> -        || wc->masks.nw_dst != htonl(UINT32_MAX)
> -        || wc->masks.tp_src != htons(UINT16_MAX)
> -        || wc->masks.tp_dst != htons(UINT16_MAX)
> -        || wc->masks.in_port != UINT16_MAX
> -        || wc->masks.vlan_tci != htons(UINT16_MAX)
> -        || wc->masks.metadata != htonll(UINT64_MAX)
> -        || wc->masks.dl_type != htons(UINT16_MAX)
> -        || !eth_mask_is_exact(wc->masks.dl_src)
> -        || !eth_mask_is_exact(wc->masks.dl_dst)
> -        || !eth_mask_is_exact(wc->masks.arp_sha)
> -        || !eth_mask_is_exact(wc->masks.arp_tha)
> -        || !ipv6_mask_is_exact(&wc->masks.ipv6_src)
> -        || !ipv6_mask_is_exact(&wc->masks.ipv6_dst)
> -        || wc->masks.ipv6_label != htonl(UINT32_MAX)
> -        || !ipv6_mask_is_exact(&wc->masks.nd_target)
> -        || wc->masks.nw_proto != UINT8_MAX
> -        || wc->masks.nw_frag != UINT8_MAX
> -        || wc->masks.nw_tos != UINT8_MAX
> -        || wc->masks.nw_ttl != UINT8_MAX) {
> -        return false;
> -    }
> -
> -    for (i = 0; i < FLOW_N_REGS; i++) {
> -        if (wc->masks.regs[i] != UINT32_MAX) {
> -            return false;
> -        }
> -    }
> -
> -    return true;
> -}
> -
>  /* Returns true if 'wc' matches every packet, false if 'wc' fixes any bits or
>   * fields. */
>  bool
> diff --git a/lib/flow.h b/lib/flow.h
> index 9393c16..5f248fc 100644
> --- a/lib/flow.h
> +++ b/lib/flow.h
> @@ -145,7 +145,6 @@ struct flow_wildcards {
>  void flow_wildcards_init_catchall(struct flow_wildcards *);
>  void flow_wildcards_init_exact(struct flow_wildcards *);
>
> -bool flow_wildcards_is_exact(const struct flow_wildcards *);
>  bool flow_wildcards_is_catchall(const struct flow_wildcards *);
>
>  void flow_wildcards_set_reg_mask(struct flow_wildcards *,
> diff --git a/tests/test-classifier.c b/tests/test-classifier.c
> index ae1d81f..d4a524d 100644
> --- a/tests/test-classifier.c
> +++ b/tests/test-classifier.c
> @@ -134,8 +134,6 @@ tcls_insert(struct tcls *tcls, const struct test_rule *rule)
>  {
>      size_t i;
>
> -    assert(!flow_wildcards_is_exact(&rule->cls_rule.wc)
> -           || rule->cls_rule.priority == UINT_MAX);
>      for (i = 0; i < tcls->n_rules; i++) {
>          const struct cls_rule *pos = &tcls->rules[i]->cls_rule;
>          if (cls_rule_equal(pos, &rule->cls_rule)) {
> --
> 1.7.2.5
>



More information about the dev mailing list