+#include "odp-util.h"
+#include "ofp-util.h"
+#include "ovs-thread.h"
+#include "packets.h"
+#include "vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(classifier);
+
+struct trie_ctx;
+static struct cls_subtable *find_subtable(const struct classifier *,
+ const struct minimask *);
+static struct cls_subtable *insert_subtable(struct classifier *,
+ const struct minimask *);
+
+static void destroy_subtable(struct classifier *, struct cls_subtable *);
+
+static void update_subtables_after_insertion(struct classifier *,
+ struct cls_subtable *,
+ unsigned int new_priority);
+static void update_subtables_after_removal(struct classifier *,
+ struct cls_subtable *,
+ unsigned int del_priority);
+
+static struct cls_rule *find_match_wc(const struct cls_subtable *,
+ const struct flow *, struct trie_ctx *,
+ unsigned int n_tries,
+ struct flow_wildcards *);
+static struct cls_rule *find_equal(struct cls_subtable *,
+ const struct miniflow *, uint32_t hash);
+static struct cls_rule *insert_rule(struct classifier *,
+ struct cls_subtable *, struct cls_rule *);
+
+/* Iterates RULE over HEAD and all of the cls_rules on HEAD->list. */
+#define FOR_EACH_RULE_IN_LIST(RULE, HEAD) \
+ for ((RULE) = (HEAD); (RULE) != NULL; (RULE) = next_rule_in_list(RULE))
+#define FOR_EACH_RULE_IN_LIST_SAFE(RULE, NEXT, HEAD) \
+ for ((RULE) = (HEAD); \
+ (RULE) != NULL && ((NEXT) = next_rule_in_list(RULE), true); \
+ (RULE) = (NEXT))
+
+static struct cls_rule *next_rule_in_list__(struct cls_rule *);
+static struct cls_rule *next_rule_in_list(struct cls_rule *);
+
+static unsigned int minimask_get_prefix_len(const struct minimask *,
+ const struct mf_field *);
+static void trie_init(struct classifier *, int trie_idx,
+ const struct mf_field *);
+static unsigned int trie_lookup(const struct cls_trie *, const struct flow *,
+ unsigned int *checkbits);
+
+static void trie_destroy(struct trie_node *);
+static void trie_insert(struct cls_trie *, const struct cls_rule *, int mlen);
+static void trie_remove(struct cls_trie *, const struct cls_rule *, int mlen);
+static void mask_set_prefix_bits(struct flow_wildcards *, uint8_t be32ofs,
+ unsigned int nbits);
+static bool mask_prefix_bits_set(const struct flow_wildcards *,
+ uint8_t be32ofs, unsigned int nbits);
+\f
+/* cls_rule. */