acl: simplify match nodes allocation
[dpdk.git] / lib / librte_acl / acl.h
index 102fa51..96bb318 100644 (file)
@@ -47,6 +47,11 @@ extern"C" {
 #define RTE_ACL_DFA_MAX                UINT8_MAX
 #define RTE_ACL_DFA_SIZE       (UINT8_MAX + 1)
 
+#define        RTE_ACL_DFA_GR64_SIZE   64
+#define        RTE_ACL_DFA_GR64_NUM    (RTE_ACL_DFA_SIZE / RTE_ACL_DFA_GR64_SIZE)
+#define        RTE_ACL_DFA_GR64_BIT    \
+       (CHAR_BIT * sizeof(uint32_t) / RTE_ACL_DFA_GR64_NUM)
+
 typedef int bits_t;
 
 #define        RTE_ACL_BIT_SET_SIZE    ((UINT8_MAX + 1) / (sizeof(bits_t) * CHAR_BIT))
@@ -100,8 +105,11 @@ struct rte_acl_node {
        /* number of ranges (transitions w/ consecutive bits) */
        int32_t                 id;
        struct rte_acl_match_results *mrt; /* only valid when match_flag != 0 */
-       char                         transitions[RTE_ACL_QUAD_SIZE];
-       /* boundaries for ranged node */
+       union {
+               char            transitions[RTE_ACL_QUAD_SIZE];
+               /* boundaries for ranged node */
+               uint8_t         dfa_gr64[RTE_ACL_DFA_GR64_NUM];
+       };
        struct rte_acl_node     *next;
        /* free list link or pointer to duplicate node during merge */
        struct rte_acl_node     *prev;
@@ -138,7 +146,6 @@ enum {
 struct rte_acl_trie {
        uint32_t        type;
        uint32_t        count;
-       int32_t         smallest;  /* smallest rule in this trie */
        uint32_t        root_index;
        const uint32_t *data_index;
        uint32_t        num_data_indexes;
@@ -173,7 +180,7 @@ struct rte_acl_ctx {
 
 int rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,
        struct rte_acl_bld_trie *node_bld_trie, uint32_t num_tries,
-       uint32_t num_categories, uint32_t data_index_sz, int match_num);
+       uint32_t num_categories, uint32_t data_index_sz);
 
 typedef int (*rte_acl_classify_t)
 (const struct rte_acl_ctx *, const uint8_t **, uint32_t *, uint32_t, uint32_t);