MCPcopy Create free account
hub / github.com/F-Stack/f-stack / acl_dup_node

Function acl_dup_node

dpdk/lib/acl/acl_bld.c:390–434  ·  view source on GitHub ↗

* Duplicate a node */

Source from the content-addressed store, hash-verified

388 * Duplicate a node
389 */
390static struct rte_acl_node *
391acl_dup_node(struct acl_build_context *context, struct rte_acl_node *node)
392{
393 uint32_t n;
394 struct rte_acl_node *next;
395
396 next = acl_alloc_node(context, node->level);
397
398 /* allocate the pointers */
399 if (node->num_ptrs > 0) {
400 next->ptrs = acl_build_alloc(context,
401 node->max_ptrs,
402 sizeof(struct rte_acl_ptr_set));
403 next->max_ptrs = node->max_ptrs;
404 }
405
406 /* copy over the pointers */
407 for (n = 0; n < node->num_ptrs; n++) {
408 if (node->ptrs[n].ptr != NULL) {
409 next->ptrs[n].ptr = node->ptrs[n].ptr;
410 next->ptrs[n].ptr->ref_count++;
411 acl_include(&next->ptrs[n].values,
412 &node->ptrs[n].values, -1);
413 }
414 }
415
416 next->num_ptrs = node->num_ptrs;
417
418 /* copy over node's match results */
419 if (node->match_flag == 0)
420 next->match_flag = 0;
421 else {
422 next->match_flag = -1;
423 next->mrt = acl_build_alloc(context, 1, sizeof(*next->mrt));
424 memcpy(next->mrt, node->mrt, sizeof(*next->mrt));
425 }
426
427 /* copy over node's bitset */
428 acl_include(&next->values, &node->values, -1);
429
430 node->next = next;
431 next->prev = node;
432
433 return next;
434}
435
436/*
437 * Dereference a pointer from a node

Callers 2

acl_resolve_leafFunction · 0.85
acl_merge_trieFunction · 0.85

Calls 4

acl_alloc_nodeFunction · 0.85
acl_build_allocFunction · 0.85
acl_includeFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected