* Routine that allocates space for this node and recursively calls * to allocate space for each child. Once all the children are allocated, * then resolve all transitions for this node. */
| 328 | * then resolve all transitions for this node. |
| 329 | */ |
| 330 | static void |
| 331 | acl_gen_node(struct rte_acl_node *node, uint64_t *node_array, |
| 332 | uint64_t no_match, struct rte_acl_indices *index, int num_categories) |
| 333 | { |
| 334 | uint32_t n, sz, *qtrp; |
| 335 | uint64_t *array_ptr; |
| 336 | struct rte_acl_match_results *match; |
| 337 | |
| 338 | if (node->node_index != RTE_ACL_NODE_UNDEFINED) |
| 339 | return; |
| 340 | |
| 341 | array_ptr = NULL; |
| 342 | |
| 343 | switch (node->node_type) { |
| 344 | case RTE_ACL_NODE_DFA: |
| 345 | array_ptr = &node_array[index->dfa_index]; |
| 346 | node->node_index = acl_dfa_gen_idx(node, index->dfa_index); |
| 347 | sz = node->fanout * RTE_ACL_DFA_GR64_SIZE; |
| 348 | index->dfa_index += sz; |
| 349 | for (n = 0; n < sz; n++) |
| 350 | array_ptr[n] = no_match; |
| 351 | break; |
| 352 | case RTE_ACL_NODE_SINGLE: |
| 353 | node->node_index = RTE_ACL_QUAD_SINGLE | index->single_index | |
| 354 | node->node_type; |
| 355 | array_ptr = &node_array[index->single_index]; |
| 356 | index->single_index += 1; |
| 357 | array_ptr[0] = no_match; |
| 358 | break; |
| 359 | case RTE_ACL_NODE_QRANGE: |
| 360 | array_ptr = &node_array[index->quad_index]; |
| 361 | acl_add_ptrs(node, array_ptr, no_match, 0); |
| 362 | qtrp = (uint32_t *)node->transitions; |
| 363 | node->node_index = qtrp[0]; |
| 364 | node->node_index <<= sizeof(index->quad_index) * CHAR_BIT; |
| 365 | node->node_index |= index->quad_index | node->node_type; |
| 366 | index->quad_index += node->fanout; |
| 367 | break; |
| 368 | case RTE_ACL_NODE_MATCH: |
| 369 | match = ((struct rte_acl_match_results *) |
| 370 | (node_array + index->match_start)); |
| 371 | for (n = 0; n != RTE_DIM(match->results); n++) |
| 372 | RTE_ACL_VERIFY(match->results[0] == 0); |
| 373 | memcpy(match + index->match_index, node->mrt, |
| 374 | sizeof(*node->mrt)); |
| 375 | node->node_index = index->match_index | node->node_type; |
| 376 | index->match_index += 1; |
| 377 | break; |
| 378 | case RTE_ACL_NODE_UNDEFINED: |
| 379 | RTE_ACL_VERIFY(node->node_type != |
| 380 | (uint32_t)RTE_ACL_NODE_UNDEFINED); |
| 381 | break; |
| 382 | } |
| 383 | |
| 384 | /* recursively allocate space for all children */ |
| 385 | for (n = 0; n < node->num_ptrs; n++) { |
| 386 | if (node->ptrs[n].ptr != NULL) |
| 387 | acl_gen_node(node->ptrs[n].ptr, |
no test coverage detected