On Wed, Jun 10, 2020 at 5:31 PM Fady Bader <f...@mellanox.com> wrote:
>
> htons wasnt defined in Windows for the minGW compiler.
> Definition of htons was added in order to use htons.
>
> Signed-off-by: Fady Bader <f...@mellanox.com>
> ---
>  lib/librte_eal/windows/include/rte_os.h | 4 ++++
>  lib/librte_net/rte_arp.c                | 2 ++
>  2 files changed, 6 insertions(+)
>
> diff --git a/lib/librte_eal/windows/include/rte_os.h 
> b/lib/librte_eal/windows/include/rte_os.h
> index bab011a5c..95525123f 100644
> --- a/lib/librte_eal/windows/include/rte_os.h
> +++ b/lib/librte_eal/windows/include/rte_os.h
> @@ -28,6 +28,10 @@ extern "C" {
>
>  #define strerror_r(a, b, c) strerror_s(b, c, a)
>
> +#ifdef RTE_TOOLCHAIN_GCC
> +#define htons(x) (rte_cpu_to_be_16(x))
> +#endif
> +
>  /* strdup is deprecated in Microsoft libc and _strdup is preferred */
>  #define strdup(str) _strdup(str)
>
> diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c
> index 784b7f48f..8fd431c54 100644
> --- a/lib/librte_net/rte_arp.c
> +++ b/lib/librte_net/rte_arp.c
> @@ -2,7 +2,9 @@
>   * Copyright(c) 2018 Intel Corporation
>   */
>
> +#ifndef RTE_EXEC_ENV_WINDOWS
>  #include <arpa/inet.h>
> +#endif

I think, replacing  htons() with rte_cpu_to_be_16() in rte_arp.c will
the clean solution to avoid #ifndef.


>
>  #include <rte_arp.h>
>
> --
> 2.16.1.windows.4
>

Reply via email to