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

Function eal_parse_huge_worker_stack

dpdk/lib/eal/linux/eal.c:588–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588static int
589eal_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 */
626static int

Callers 1

eal_parse_argsFunction · 0.85

Calls 2

strtoulFunction · 0.85

Tested by

no test coverage detected