[dpdk-dev] [PATCH v5 3/9] eal: add windows compatible header files

Thomas Monjalon thomas at monjalon.net
Mon Jan 27 23:41:21 CET 2020


13/01/2020 22:55, Pallavi Kadam:
> Modified \common\include\arch\x86\rte_vect.h
> to include SSE4 header for Windows.
> 
> Adding dlfcn.h on Windows to support common code.
> 
> Adding eal_filesystem.h to support functions and
> path defines for files and directories on Windows.

I don't see any relationship between these 3 items,
so I think they should be 3 separate patches.

> --- a/lib/librte_eal/common/include/arch/x86/rte_vect.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_vect.h
> @@ -15,7 +15,9 @@
>  #include <rte_config.h>
>  #include "generic/rte_vect.h"
>  
> -#if (defined(__ICC) || (__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
> +#if (defined(__ICC) || \
> +	(defined(_WIN64)) || \
> +	(__GNUC__ == 4 &&  __GNUC_MINOR__ < 4))
>  
>  #include <smmintrin.h> /* SSE4 */

I trust you on this change :)

> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/include/dlfcn.h
> @@ -0,0 +1,21 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2019 Intel Corporation
> + */
> +
> +#ifndef _DLFCN_H_
> +#define _DLFCN_H_
> +
> +/**
> + * This file is added to support common code in eal_common_options.c
> + * as Microsoft libc does not contain dlfcn.h. This may be removed
> + * in future releases.
> + */
> +
> +/* The windows port does not currently support dynamic loading of libraries,
> + * so fail these calls
> + */
> +#define dlopen(lib, flag)   (0)
> +#define RTLD_NOW 0
> +#define dlerror()           ("Not supported!")

This is only for the function eal_plugins_init().
The plugin logic and directory search might be different on Windows.
I believe it would be better handled directly in eal_plugins_init().
For now, my advice is to not compile this function (and not call it
in Windows init of course):

int
eal_plugins_init(void)
{
#ifndef RTE_EXEC_ENV_WINDOWS

The right fix would be to move this "common" function in an UNIX-only file:
What about creating eal_unix_options.c file?
Could be in lib/librte_eal/unix/ directory?


> --- /dev/null
> +++ b/lib/librte_eal/windows/eal/include/eal_filesystem.h
> @@ -0,0 +1,99 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2019 Intel Corporation
> + */
> +
> +/**
> + * @file
> + * Stores functions and path defines for files and directories
> + * on the filesystem for Windows, that are used by the Windows EAL.
> + */
[...]
> +/** Function to read a single numeric value from a file on the filesystem.
> + * Used to read information from files on /sys
> + */
> +int eal_parse_sysfs_value(const char *filename, unsigned long *val);

Given that sysfs is a Linux system, I guess you don't need this function at all.




More information about the dev mailing list