uint64_t total_mem = 0;
void *addr;
unsigned int i, j, seg_idx = 0;
+ struct internal_config *internal_conf =
+ eal_get_internal_configuration();
/* get pointer to global configuration */
mcfg = rte_eal_get_configuration()->mem_config;
/* for debug purposes, hugetlbfs can be disabled */
- if (internal_config.no_hugetlbfs) {
+ if (internal_conf->no_hugetlbfs) {
struct rte_memseg_list *msl;
uint64_t mem_sz, page_sz;
int n_segs;
/* create a memseg list */
msl = &mcfg->memsegs[0];
- mem_sz = internal_config.memory;
+ mem_sz = internal_conf->memory;
page_sz = RTE_PGSIZE_4K;
n_segs = mem_sz / page_sz;
}
/* map all hugepages and sort them */
- for (i = 0; i < internal_config.num_hugepage_sizes; i ++){
+ for (i = 0; i < internal_conf->num_hugepage_sizes; i++) {
struct hugepage_info *hpi;
rte_iova_t prev_end = 0;
int prev_ms_idx = -1;
uint64_t page_sz, mem_needed;
unsigned int n_pages, max_pages;
- hpi = &internal_config.hugepage_info[i];
+ hpi = &internal_conf->hugepage_info[i];
page_sz = hpi->hugepage_sz;
max_pages = hpi->num_pages[0];
- mem_needed = RTE_ALIGN_CEIL(internal_config.memory - total_mem,
+ mem_needed = RTE_ALIGN_CEIL(internal_conf->memory - total_mem,
page_sz);
n_pages = RTE_MIN(mem_needed / page_sz, max_pages);
}
if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase %s and/or %s in configuration.\n",
- RTE_STR(CONFIG_RTE_MAX_MEMSEG_PER_TYPE),
- RTE_STR(CONFIG_RTE_MAX_MEM_PER_TYPE));
+ RTE_STR(RTE_MAX_MEMSEG_PER_TYPE),
+ RTE_STR(RTE_MAX_MEM_MB_PER_TYPE));
return -1;
}
arr = &msl->memseg_arr;
total_mem += seg->len;
}
- if (total_mem >= internal_config.memory)
+ if (total_mem >= internal_conf->memory)
break;
}
- if (total_mem < internal_config.memory) {
+ if (total_mem < internal_conf->memory) {
RTE_LOG(ERR, EAL, "Couldn't reserve requested memory, "
"requested: %" PRIu64 "M "
"available: %" PRIu64 "M\n",
- internal_config.memory >> 20, total_mem >> 20);
+ internal_conf->memory >> 20, total_mem >> 20);
return -1;
}
return 0;
int
rte_eal_hugepage_attach(void)
{
- const struct hugepage_info *hpi;
+ struct hugepage_info *hpi;
int fd_hugepage = -1;
unsigned int i;
+ struct internal_config *internal_conf =
+ eal_get_internal_configuration();
- hpi = &internal_config.hugepage_info[0];
+ hpi = &internal_conf->hugepage_info[0];
- for (i = 0; i < internal_config.num_hugepage_sizes; i++) {
+ for (i = 0; i < internal_conf->num_hugepage_sizes; i++) {
const struct hugepage_info *cur_hpi = &hpi[i];
struct attach_walk_args wa;
return RTE_ALIGN(area_sz, page_sz);
}
-static int
-memseg_list_init(struct rte_memseg_list *msl, uint64_t page_sz,
- int n_segs, int socket_id, int type_msl_idx)
-{
- return eal_memseg_list_init(
- msl, page_sz, n_segs, socket_id, type_msl_idx, false);
-}
-
static int
memseg_list_alloc(struct rte_memseg_list *msl)
{
int hpi_idx, msl_idx = 0;
struct rte_memseg_list *msl;
uint64_t max_mem, total_mem;
+ struct internal_config *internal_conf =
+ eal_get_internal_configuration();
/* no-huge does not need this at all */
- if (internal_config.no_hugetlbfs)
+ if (internal_conf->no_hugetlbfs)
return 0;
/* FreeBSD has an issue where core dump will dump the entire memory
total_mem = 0;
/* create memseg lists */
- for (hpi_idx = 0; hpi_idx < (int) internal_config.num_hugepage_sizes;
+ for (hpi_idx = 0; hpi_idx < (int) internal_conf->num_hugepage_sizes;
hpi_idx++) {
uint64_t max_type_mem, total_type_mem = 0;
uint64_t avail_mem;
struct hugepage_info *hpi;
uint64_t hugepage_sz;
- hpi = &internal_config.hugepage_info[hpi_idx];
+ hpi = &internal_conf->hugepage_info[hpi_idx];
hugepage_sz = hpi->hugepage_sz;
/* no NUMA support on FreeBSD */
if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
RTE_LOG(ERR, EAL,
"No more space in memseg lists, please increase %s\n",
- RTE_STR(CONFIG_RTE_MAX_MEMSEG_LISTS));
+ RTE_STR(RTE_MAX_MEMSEG_LISTS));
return -1;
}
cur_max_mem);
n_segs = cur_mem / hugepage_sz;
- if (memseg_list_init(msl, hugepage_sz, n_segs,
- 0, type_msl_idx))
+ if (eal_memseg_list_init(msl, hugepage_sz, n_segs,
+ 0, type_msl_idx, false))
return -1;
total_segs += msl->memseg_arr.len;