eal/windows: add random function
authorPallavi Kadam <pallavi.kadam@intel.com>
Tue, 22 Dec 2020 00:45:10 +0000 (16:45 -0800)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 14 Jan 2021 22:21:40 +0000 (23:21 +0100)
The file rte_random.c is required to build i40e PMD on Windows.
Add rte_rand variable to export file.

Redefine _m_prefetchw for Clang toolchain due to following error
with respect to conflicting types:

FAILED: lib/76b5a35@@rte_eal@sta/librte_eal_common_rte_random.c.obj
clang @lib/76b5a35@@rte_eal@sta/librte_eal_common_rte_random.c.obj.rsp
In file included from ../lib/librte_eal/common/rte_random.c:13:
In file included from ..\lib/librte_eal/include\rte_eal.h:20:
In file included from ..\lib/librte_eal/include\rte_per_lcore.h:25:
In file included from ..\lib/librte_eal/windows/include\pthread.h:21:
In file included from ..\lib/librte_eal/windows/include\rte_windows.h:27:
In file included from C:\Program Files (x86)\Windows Kits\10\include\
10.0.18362.0\um\windows.h:171:
In file included from C:\Program Files (x86)\Windows Kits\10\include\
10.0.18362.0\shared\windef.h:24:
In file included from C:\Program Files (x86)\Windows Kits\10\include\
10.0.18362.0\shared\minwindef.h:182:
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\
winnt.h:3324:1: error: conflicting types for '_m_prefetchw'
_m_prefetchw (
^
C:\Program Files\LLVM\lib\clang\10.0.0\include\prfchwintrin.h:50:1:
note: previous definition is here
_m_prefetchw(void *__P)
^
1 error generated.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
lib/librte_eal/common/meson.build
lib/librte_eal/rte_eal_exports.def
lib/librte_eal/windows/include/rte_windows.h

index 39abf7a..98e8fff 100644 (file)
@@ -33,6 +33,7 @@ if is_windows
                'malloc_heap.c',
                'rte_malloc.c',
                'eal_common_timer.c',
+               'rte_random.c',
                'rte_service.c',
        )
        subdir_done()
index f12832c..fe27bff 100644 (file)
@@ -127,6 +127,7 @@ EXPORTS
        rte_memzone_reserve_bounded
        rte_memzone_walk
        rte_openlog_stream
+       rte_rand
        rte_realloc
        rte_rtm_supported
        rte_service_attr_get
index b82af34..0063b5d 100644 (file)
 #define WIN32_LEAN_AND_MEAN
 #endif
 
+/* Override Windows SDK definition of _m_prefetchw to avoid conflicting types */
+#ifdef RTE_TOOLCHAIN_CLANG
+#undef _m_prefetchw
+#define _m_prefetchw __m_prefetchw
+#endif
+
 /* Must come first. */
 #include <windows.h>