mem: fix initialization with --no-huge option

After code rework from bellow commit, logic expects hugepage_sz field to
always be set (ie. not zero value).
When using --no-huge, this field was left unset defaulting to zero.

Set hugepage_sz to RTE_PGSIZE_4K when using --no-huge.

Fixes: b3dfffd962 ("mem: allow multiple page sizes to be requested")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
This commit is contained in:
Sergio Gonzalez Monroy 2015-07-15 11:12:00 +01:00 committed by Thomas Monjalon
parent 184abcf525
commit fc060aa614
2 changed files with 2 additions and 0 deletions

View File

@ -75,6 +75,7 @@ rte_eal_contigmem_init(void)
addr = malloc(internal_config.memory);
mcfg->memseg[0].phys_addr = (phys_addr_t)(uintptr_t)addr;
mcfg->memseg[0].addr = addr;
mcfg->memseg[0].hugepage_sz = RTE_PGSIZE_4K;
mcfg->memseg[0].len = internal_config.memory;
mcfg->memseg[0].socket_id = 0;
return 0;

View File

@ -1069,6 +1069,7 @@ rte_eal_hugepage_init(void)
}
mcfg->memseg[0].phys_addr = (phys_addr_t)(uintptr_t)addr;
mcfg->memseg[0].addr = addr;
mcfg->memseg[0].hugepage_sz = RTE_PGSIZE_4K;
mcfg->memseg[0].len = internal_config.memory;
mcfg->memseg[0].socket_id = SOCKET_ID_ANY;
return 0;