17 #define CNE_ACL_QUAD_MAX 5
18 #define CNE_ACL_QUAD_SIZE 4
19 #define CNE_ACL_QUAD_SINGLE UINT64_C(0x7f7f7f7f00000000)
21 #define CNE_ACL_SINGLE_TRIE_SIZE 2000
23 #define CNE_ACL_DFA_MAX UINT8_MAX
24 #define CNE_ACL_DFA_SIZE (UINT8_MAX + 1)
26 #define CNE_ACL_DFA_GR64_SIZE 64
27 #define CNE_ACL_DFA_GR64_NUM (CNE_ACL_DFA_SIZE / CNE_ACL_DFA_GR64_SIZE)
28 #define CNE_ACL_DFA_GR64_BIT (CHAR_BIT * sizeof(uint32_t) / CNE_ACL_DFA_GR64_NUM)
32 #define CNE_ACL_BIT_SET_SIZE ((UINT8_MAX + 1) / (sizeof(bits_t) * CHAR_BIT))
34 struct cne_acl_bitset {
35 bits_t bits[CNE_ACL_BIT_SET_SIZE];
38 #define CNE_ACL_NODE_DFA (0 << CNE_ACL_TYPE_SHIFT)
39 #define CNE_ACL_NODE_SINGLE (1U << CNE_ACL_TYPE_SHIFT)
40 #define CNE_ACL_NODE_QRANGE (3U << CNE_ACL_TYPE_SHIFT)
41 #define CNE_ACL_NODE_MATCH (4U << CNE_ACL_TYPE_SHIFT)
42 #define CNE_ACL_NODE_TYPE (7U << CNE_ACL_TYPE_SHIFT)
48 #define CNE_ACL_IDLE_NODE (CNE_ACL_DFA_SIZE | CNE_ACL_NODE_SINGLE)
50 #define CNE_ACL_NODE_UNDEFINED UINT32_MAX
94 struct cne_acl_ptr_set {
95 struct cne_acl_bitset values;
96 struct cne_acl_node *ptr;
99 struct cne_acl_classifier_results {
100 int results[CNE_ACL_MAX_CATEGORIES];
103 struct cne_acl_match_results {
104 uint32_t results[CNE_ACL_MAX_CATEGORIES];
105 int32_t priority[CNE_ACL_MAX_CATEGORIES];
108 struct cne_acl_node {
112 struct cne_acl_bitset values;
119 struct cne_acl_ptr_set *ptrs;
126 struct cne_acl_match_results *mrt;
128 char transitions[CNE_ACL_QUAD_SIZE];
130 uint8_t dfa_gr64[CNE_ACL_DFA_GR64_NUM];
132 struct cne_acl_node *next;
134 struct cne_acl_node *prev;
142 CNE_ACL_FULL_TRIE = 0,
143 CNE_ACL_NOSRC_TRIE = 1,
144 CNE_ACL_NODST_TRIE = 2,
145 CNE_ACL_NOPORTS_TRIE = 4,
146 CNE_ACL_NOVLAN_TRIE = 8,
147 CNE_ACL_UNUSED_TRIE = 0x80000000
151 #define CNE_ACL_MAX_TRIES 8
154 #define CNE_ACL_NAMESIZE 32
156 struct cne_acl_trie {
160 const uint32_t *data_index;
161 uint32_t num_data_indexes;
164 struct cne_acl_bld_trie {
165 struct cne_acl_node *trie;
172 uint32_t first_load_sz;
177 uint32_t num_categories;
179 uint32_t match_index;
182 uint64_t *trans_table;
183 uint32_t *data_indexes;
190 int cne_acl_gen(
struct cne_acl_ctx *ctx,
struct cne_acl_trie *trie,
191 struct cne_acl_bld_trie *node_bld_trie, uint32_t num_tries, uint32_t
num_categories,
192 uint32_t data_index_sz,
size_t max_size);
194 typedef int (*cne_acl_classify_t)(
const struct cne_acl_ctx *,
const uint8_t **, uint32_t *,
200 int cne_acl_classify_scalar(
const struct cne_acl_ctx *ctx,
const uint8_t **data, uint32_t *results,
201 uint32_t num, uint32_t categories);
203 int cne_acl_classify_sse(
const struct cne_acl_ctx *ctx,
const uint8_t **data, uint32_t *results,
204 uint32_t num, uint32_t categories);
206 int cne_acl_classify_avx2(
const struct cne_acl_ctx *ctx,
const uint8_t **data, uint32_t *results,
207 uint32_t num, uint32_t categories);
209 int cne_acl_classify_avx512x16(
const struct cne_acl_ctx *ctx,
const uint8_t **data,
210 uint32_t *results, uint32_t num, uint32_t categories);
212 int cne_acl_classify_avx512x32(
const struct cne_acl_ctx *ctx,
const uint8_t **data,
213 uint32_t *results, uint32_t num, uint32_t categories);
215 int cne_acl_classify_neon(
const struct cne_acl_ctx *ctx,
const uint8_t **data, uint32_t *results,
216 uint32_t num, uint32_t categories);
218 int cne_acl_classify_altivec(
const struct cne_acl_ctx *ctx,
const uint8_t **data, uint32_t *results,
219 uint32_t num, uint32_t categories);
#define CNE_ACL_MAX_TRIES