Re: [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function
From: Thomas Monjalon <hidden>
Date: 2021-03-01 09:53:55
From: Thomas Monjalon <hidden>
Date: 2021-03-01 09:53:55
01/03/2021 10:41, Bruce Richardson:
On Sun, Feb 28, 2021 at 01:53:42PM +0100, Thomas Monjalon wrote:quoted
The page size is often retrieved from the macro PAGE_SIZE. If PAGE_SIZE is not defined, it is either using hard coded default, or getting the system value from the UNIX-only function sysconf(). Such definitions are replaced with the generic function rte_mem_page_size() defined for each supported OS. Removing PAGE_SIZE definitions will fix dlb drivers for musl libc, because #ifdef checks were missing, causing redefinition errors. Signed-off-by: Thomas Monjalon <redacted> ---Is the header file with the rte_mem_page_size() function missing from this patch?
No, the function exists since DPDK 20.08.
Also, rather than a function for this, would it not be better to keep it as a macro as RTE_PAGE_SIZE, to keep it more in line with the macro people expect to have available?
No because the size is not always known at compilation time. See the implementation: https://git.dpdk.org/dpdk/commit/?id=c4b89ecb64eae