| 314 | } |
| 315 | |
| 316 | static int |
| 317 | graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks, |
| 318 | uint32_t stages, uint16_t nodes_per_stage, |
| 319 | uint8_t src_map[][nodes_per_stage], uint8_t snk_map[][nb_sinks], |
| 320 | uint8_t edge_map[][nodes_per_stage][nodes_per_stage], |
| 321 | uint8_t burst_one) |
| 322 | { |
| 323 | struct test_graph_perf *graph_data; |
| 324 | char nname[RTE_NODE_NAMESIZE / 2]; |
| 325 | struct test_node_data *node_data; |
| 326 | char *ename[nodes_per_stage]; |
| 327 | struct rte_graph_param gconf = {0}; |
| 328 | const struct rte_memzone *mz; |
| 329 | uint8_t total_percent = 0; |
| 330 | rte_node_t *src_nodes; |
| 331 | rte_node_t *snk_nodes; |
| 332 | rte_node_t **node_map; |
| 333 | char **node_patterns; |
| 334 | rte_graph_t graph_id; |
| 335 | rte_edge_t edges; |
| 336 | rte_edge_t count; |
| 337 | uint32_t i, j, k; |
| 338 | |
| 339 | mz = rte_memzone_reserve(TEST_GRAPH_PERF_MZ, |
| 340 | sizeof(struct test_graph_perf), 0, 0); |
| 341 | if (mz == NULL) { |
| 342 | printf("Failed to allocate graph common memory\n"); |
| 343 | return -ENOMEM; |
| 344 | } |
| 345 | |
| 346 | graph_data = mz->addr; |
| 347 | graph_data->nb_nodes = 0; |
| 348 | graph_data->node_data = |
| 349 | malloc(sizeof(struct test_node_data) * |
| 350 | (nb_srcs + nb_sinks + stages * nodes_per_stage)); |
| 351 | if (graph_data->node_data == NULL) { |
| 352 | printf("Failed to reserve memzone for graph data\n"); |
| 353 | goto memzone_free; |
| 354 | } |
| 355 | |
| 356 | node_patterns = malloc(sizeof(char *) * |
| 357 | (nb_srcs + nb_sinks + stages * nodes_per_stage)); |
| 358 | if (node_patterns == NULL) { |
| 359 | printf("Failed to reserve memory for node patterns\n"); |
| 360 | goto data_free; |
| 361 | } |
| 362 | |
| 363 | src_nodes = malloc(sizeof(rte_node_t) * nb_srcs); |
| 364 | if (src_nodes == NULL) { |
| 365 | printf("Failed to reserve memory for src nodes\n"); |
| 366 | goto pattern_free; |
| 367 | } |
| 368 | |
| 369 | snk_nodes = malloc(sizeof(rte_node_t) * nb_sinks); |
| 370 | if (snk_nodes == NULL) { |
| 371 | printf("Failed to reserve memory for snk nodes\n"); |
| 372 | goto src_free; |
| 373 | } |
no test coverage detected