| 62 | } |
| 63 | |
| 64 | static void |
| 65 | graph_nodes_populate(struct graph *_graph) |
| 66 | { |
| 67 | rte_graph_off_t off = _graph->nodes_start; |
| 68 | struct rte_graph *graph = _graph->graph; |
| 69 | struct graph_node *graph_node; |
| 70 | rte_edge_t count, nb_edges; |
| 71 | const char *parent; |
| 72 | rte_node_t pid; |
| 73 | |
| 74 | STAILQ_FOREACH(graph_node, &_graph->node_list, next) { |
| 75 | struct rte_node *node = RTE_PTR_ADD(graph, off); |
| 76 | memset(node, 0, sizeof(*node)); |
| 77 | node->fence = RTE_GRAPH_FENCE; |
| 78 | node->off = off; |
| 79 | if (graph_pcap_is_enable()) { |
| 80 | node->process = graph_pcap_dispatch; |
| 81 | node->original_process = graph_node->node->process; |
| 82 | } else |
| 83 | node->process = graph_node->node->process; |
| 84 | memcpy(node->name, graph_node->node->name, RTE_GRAPH_NAMESIZE); |
| 85 | pid = graph_node->node->parent_id; |
| 86 | if (pid != RTE_NODE_ID_INVALID) { /* Cloned node */ |
| 87 | parent = rte_node_id_to_name(pid); |
| 88 | memcpy(node->parent, parent, RTE_GRAPH_NAMESIZE); |
| 89 | } |
| 90 | node->id = graph_node->node->id; |
| 91 | node->parent_id = pid; |
| 92 | node->dispatch.lcore_id = graph_node->node->lcore_id; |
| 93 | nb_edges = graph_node->node->nb_edges; |
| 94 | node->nb_edges = nb_edges; |
| 95 | off += sizeof(struct rte_node); |
| 96 | /* Copy the name in first pass to replace with rte_node* later*/ |
| 97 | for (count = 0; count < nb_edges; count++) |
| 98 | node->nodes[count] = (struct rte_node *)&graph_node |
| 99 | ->adjacency_list[count] |
| 100 | ->node->name[0]; |
| 101 | |
| 102 | off += sizeof(struct rte_node *) * nb_edges; |
| 103 | off = RTE_ALIGN(off, RTE_CACHE_LINE_SIZE); |
| 104 | node->next = off; |
| 105 | __rte_node_stream_alloc(graph, node); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | struct rte_node * |
| 110 | graph_node_id_to_ptr(const struct rte_graph *graph, rte_node_t id) |
no test coverage detected