Sets up rte_config structure with the pointer to shared memory config.*/
| 373 | |
| 374 | /* Sets up rte_config structure with the pointer to shared memory config.*/ |
| 375 | static int |
| 376 | rte_config_init(void) |
| 377 | { |
| 378 | struct rte_config *config = rte_eal_get_configuration(); |
| 379 | const struct internal_config *internal_conf = |
| 380 | eal_get_internal_configuration(); |
| 381 | |
| 382 | config->process_type = internal_conf->process_type; |
| 383 | |
| 384 | switch (config->process_type) { |
| 385 | case RTE_PROC_PRIMARY: |
| 386 | if (rte_eal_config_create() < 0) |
| 387 | return -1; |
| 388 | eal_mcfg_update_from_internal(); |
| 389 | break; |
| 390 | case RTE_PROC_SECONDARY: |
| 391 | if (rte_eal_config_attach() < 0) |
| 392 | return -1; |
| 393 | eal_mcfg_wait_complete(); |
| 394 | if (eal_mcfg_check_version() < 0) { |
| 395 | RTE_LOG(ERR, EAL, "Primary and secondary process DPDK version mismatch\n"); |
| 396 | return -1; |
| 397 | } |
| 398 | if (rte_eal_config_reattach() < 0) |
| 399 | return -1; |
| 400 | if (!__rte_mp_enable()) { |
| 401 | RTE_LOG(ERR, EAL, "Primary process refused secondary attachment\n"); |
| 402 | return -1; |
| 403 | } |
| 404 | eal_mcfg_update_internal(); |
| 405 | break; |
| 406 | case RTE_PROC_AUTO: |
| 407 | case RTE_PROC_INVALID: |
| 408 | RTE_LOG(ERR, EAL, "Invalid process type %d\n", |
| 409 | config->process_type); |
| 410 | return -1; |
| 411 | } |
| 412 | |
| 413 | return 0; |
| 414 | } |
| 415 | |
| 416 | /* Unlocks hugepage directories that were locked by eal_hugepage_info_init */ |
| 417 | static void |
no test coverage detected