X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fclassifier.h;h=db090225b42cf31127acc76a9374049e6e5ed959;hb=a6d214f0055dc773750295a5db7cc5ca14bc5ce7;hp=0dfb1e7f746e33f1d71d21de6c81d085c8a3ae57;hpb=2d334ac8836a014e88c84dca63145e300d662872;p=openvswitch diff --git a/lib/classifier.h b/lib/classifier.h index 0dfb1e7f..db090225 100644 --- a/lib/classifier.h +++ b/lib/classifier.h @@ -50,6 +50,18 @@ struct cls_table { int n_table_rules; /* Number of rules, including duplicates. */ }; +/* Returns true if 'table' is a "catch-all" table that will match every + * packet (if there is no higher-priority match). */ +static inline bool +cls_table_is_catchall(const struct cls_table *table) +{ + /* A catch-all table can only have one rule, so use hmap_count() as a cheap + * check to rule out other kinds of match before doing the full check with + * flow_wildcards_is_catchall(). */ + return (hmap_count(&table->rules) == 1 + && flow_wildcards_is_catchall(&table->wc)); +} + /* A flow classification rule. * * Use one of the cls_rule_*() functions to initialize a cls_rule. @@ -115,7 +127,7 @@ bool cls_rule_set_ipv6_src_masked(struct cls_rule *, const struct in6_addr *, void cls_rule_set_ipv6_dst(struct cls_rule *, const struct in6_addr *); bool cls_rule_set_ipv6_dst_masked(struct cls_rule *, const struct in6_addr *, const struct in6_addr *); -void cls_rule_set_nd_target(struct cls_rule *, const struct in6_addr); +void cls_rule_set_nd_target(struct cls_rule *, const struct in6_addr *); bool cls_rule_equal(const struct cls_rule *, const struct cls_rule *); uint32_t cls_rule_hash(const struct cls_rule *, uint32_t basis);