| 586 | } |
| 587 | |
| 588 | static int |
| 589 | eal_parse_huge_worker_stack(const char *arg) |
| 590 | { |
| 591 | struct internal_config *cfg = eal_get_internal_configuration(); |
| 592 | |
| 593 | if (arg == NULL || arg[0] == '\0') { |
| 594 | pthread_attr_t attr; |
| 595 | int ret; |
| 596 | |
| 597 | if (pthread_attr_init(&attr) != 0) { |
| 598 | RTE_LOG(ERR, EAL, "Could not retrieve default stack size\n"); |
| 599 | return -1; |
| 600 | } |
| 601 | ret = pthread_attr_getstacksize(&attr, &cfg->huge_worker_stack_size); |
| 602 | pthread_attr_destroy(&attr); |
| 603 | if (ret != 0) { |
| 604 | RTE_LOG(ERR, EAL, "Could not retrieve default stack size\n"); |
| 605 | return -1; |
| 606 | } |
| 607 | } else { |
| 608 | unsigned long stack_size; |
| 609 | char *end; |
| 610 | |
| 611 | errno = 0; |
| 612 | stack_size = strtoul(arg, &end, 10); |
| 613 | if (errno || end == NULL || stack_size == 0 || |
| 614 | stack_size >= (size_t)-1 / 1024) |
| 615 | return -1; |
| 616 | |
| 617 | cfg->huge_worker_stack_size = stack_size * 1024; |
| 618 | } |
| 619 | |
| 620 | RTE_LOG(DEBUG, EAL, "Each worker thread will use %zu kB of DPDK memory as stack\n", |
| 621 | cfg->huge_worker_stack_size / 1024); |
| 622 | return 0; |
| 623 | } |
| 624 | |
| 625 | /* Parse the argument given in the command line of the application */ |
| 626 | static int |
no test coverage detected