[v2,3/3] eal/windows: librte_net build on Windows

Message ID 20200610120040.17968-4-fady@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series compile librte_net for windows |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Fady Bader June 10, 2020, noon UTC
  librte_net wasn't compiling under Windows.
To solve this, needed exports and files were added for Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_eal/common/meson.build           |  1 +
 lib/librte_eal/rte_eal_exports.def          |  1 +
 lib/librte_eal/windows/include/netinet/in.h | 25 +++++++++++++++++++++++++
 lib/librte_eal/windows/include/netinet/ip.h | 11 +++++++++++
 lib/meson.build                             |  2 +-
 5 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/windows/include/netinet/in.h
 create mode 100644 lib/librte_eal/windows/include/netinet/ip.h
  

Comments

Thomas Monjalon June 16, 2020, 9:04 a.m. UTC | #1
10/06/2020 14:00, Fady Bader:
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2020 Mellanox Technologies, Ltd
> + */

Isn't it a different copyright?
Where does it come from?

> +
> +#ifndef _IN_H_
> +#define _IN_H_
> +
> +#define IPPROTO_IP 0
> +#define IPPROTO_HOPOPTS 0
> +#define	IPPROTO_IPV4 4             /* IPv4 encapsulation */
> +#define	IPPROTO_IPIP IPPROTO_IPV4  /* for compatibility */
> +#define IPPROTO_TCP 6
> +#define IPPROTO_UDP 17
> +#define	IPPROTO_IPV6 41	           /* IP6 header */
> +#define	IPPROTO_ROUTING 43         /* IP6 routing header */
> +#define	IPPROTO_FRAGMENT 44        /* IP6 fragmentation header */
> +#define	IPPROTO_GRE 47             /* General Routing Encap. */
> +#define	IPPROTO_ESP 50             /* IP6 Encap Sec. Payload */
> +#define	IPPROTO_AH 51              /* IP6 Auth Header */
> +#define IPPROTO_NONE 59            /* IPv6 no next header */
> +#define	IPPROTO_DSTOPTS 60         /* IP6 destination option */
> +#define IPPROTO_SCTP 132           /* Stream Control Transmission Protocol */

There are some tabs instead of space. Please double check.
  
Dmitry Kozlyuk June 20, 2020, 7:22 p.m. UTC | #2
> diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
> index e1bdaf024..05e40a26b 100644
> --- a/lib/librte_eal/common/meson.build
> +++ b/lib/librte_eal/common/meson.build
> @@ -28,6 +28,7 @@ if is_windows
>  		'malloc_elem.c',
>  		'malloc_heap.c',
>  		'rte_malloc.c',
> +		'rte_random.c',

Hitting an error when building on Windows (SDK 10.0.18362) with Clang 9.0.1:

[7/72] Compiling C object lib/76b5a35@@rte_eal@sta/librte_eal_common_rte_random.c.obj.
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:20:
In file included from ..\..\..\..\lib/librte_eal/windows/include\rte_windows.h:22:
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\9.0.1\include\prfchwintrin.h:50:1: note: previous definition is here
_m_prefetchw(void *__P)

Similar issue was seen before:

	https://patches.dpdk.org/patch/59912/#101780
  
Fady Bader June 28, 2020, 9:48 a.m. UTC | #3
> Subject: Re: [PATCH v2 3/3] eal/windows: librte_net build on Windows
> 
> > diff --git a/lib/librte_eal/common/meson.build
> > b/lib/librte_eal/common/meson.build
> > index e1bdaf024..05e40a26b 100644
> > --- a/lib/librte_eal/common/meson.build
> > +++ b/lib/librte_eal/common/meson.build
> > @@ -28,6 +28,7 @@ if is_windows
> >  		'malloc_elem.c',
> >  		'malloc_heap.c',
> >  		'rte_malloc.c',
> > +		'rte_random.c',
> 
> Hitting an error when building on Windows (SDK 10.0.18362) with Clang 9.0.1:

Hi Dmitry,
I'm trying to reproduce the error you had, I installed the latest SDK (10.0.19041.0) but I can't find the clang v9.0.1 for Windows. Can you redirect/instruct me how did you get it for Windows ?

Thanks,
Fady

> 
> [7/72] Compiling C object
> lib/76b5a35@@rte_eal@sta/librte_eal_common_rte_random.c.obj.
> 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:20:
> In file included from ..\..\..\..\lib/librte_eal/windows/include\rte_windows.h:22:
> 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\9.0.1\include\prfchwintrin.h:50:1: note:
> previous definition is here _m_prefetchw(void *__P)
> 
> Similar issue was seen before:
> 
> 	https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fp
> atches.dpdk.org%2Fpatch%2F59912%2F%23101780&amp;data=02%7C01%7Cfady
> %40mellanox.com%7Ce7e40349f14c4dbf43a408d8154f3bd1%7Ca652971c7d2e4d9
> ba6a4d149256f461b%7C0%7C0%7C637282777343746975&amp;sdata=CsPof2eM3
> 32uC9pyDsOaeiR6voScjsbmLA0euAQHw5U%3D&amp;reserved=0
> 
> --
> Dmitry Kozlyuk
  
Fady Bader July 6, 2020, 8:44 a.m. UTC | #4
Hi Microsoft team,

Can you please check Thomas's comment below regarding header licensing (of ip.h and in.h) and verify that it can be used in the dpdk project or do I need to change anything?

Headers are taken from: 
Ip.h: https://code.woboq.org/qt5/include/netinet/ip.h.html
In.h: https://code.woboq.org/qt5/include/netinet/in.h.html

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, June 16, 2020 12:04 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev@dpdk.org; Tasnim Bashar <tbashar@mellanox.com>; Tal Shnaiderman
> <talshn@mellanox.com>; Yohad Tor <yohadt@mellanox.com>;
> dmitry.kozliuk@gmail.com; harini.ramakrishnan@microsoft.com;
> ocardona@microsoft.com; ranjit.menon@intel.com; olivier.matz@6wind.com
> Subject: Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on
> Windows
> 
> 10/06/2020 14:00, Fady Bader:
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright 2020 Mellanox Technologies, Ltd  */
> 
> Isn't it a different copyright?
> Where does it come from?
> 
> > +
> > +#ifndef _IN_H_
> > +#define _IN_H_
> > +
> > +#define IPPROTO_IP 0
> > +#define IPPROTO_HOPOPTS 0
> > +#define	IPPROTO_IPV4 4             /* IPv4 encapsulation */
> > +#define	IPPROTO_IPIP IPPROTO_IPV4  /* for compatibility */
> > +#define IPPROTO_TCP 6
> > +#define IPPROTO_UDP 17
> > +#define	IPPROTO_IPV6 41	           /* IP6 header */
> > +#define	IPPROTO_ROUTING 43         /* IP6 routing header */
> > +#define	IPPROTO_FRAGMENT 44        /* IP6 fragmentation header */
> > +#define	IPPROTO_GRE 47             /* General Routing Encap. */
> > +#define	IPPROTO_ESP 50             /* IP6 Encap Sec. Payload */
> > +#define	IPPROTO_AH 51              /* IP6 Auth Header */
> > +#define IPPROTO_NONE 59            /* IPv6 no next header */
> > +#define	IPPROTO_DSTOPTS 60         /* IP6 destination option */
> > +#define IPPROTO_SCTP 132           /* Stream Control Transmission Protocol */
> 
> There are some tabs instead of space. Please double check.
>
  
Narcisa Ana Maria Vasile July 17, 2020, 10:22 p.m. UTC | #5
On Sun, Jun 28, 2020 at 09:48:25AM +0000, Fady Bader wrote:
> > Subject: Re: [PATCH v2 3/3] eal/windows: librte_net build on Windows
> > 
> > > diff --git a/lib/librte_eal/common/meson.build
> > > b/lib/librte_eal/common/meson.build
> > > index e1bdaf024..05e40a26b 100644
> > > --- a/lib/librte_eal/common/meson.build
> > > +++ b/lib/librte_eal/common/meson.build
> > > @@ -28,6 +28,7 @@ if is_windows
> > >  		'malloc_elem.c',
> > >  		'malloc_heap.c',
> > >  		'rte_malloc.c',
> > > +		'rte_random.c',
> > 
> > Hitting an error when building on Windows (SDK 10.0.18362) with Clang 9.0.1:
> 
> Hi Dmitry,
> I'm trying to reproduce the error you had, I installed the latest SDK (10.0.19041.0) but I can't find the clang v9.0.1 for Windows. Can you redirect/instruct me how did you get it for Windows ?
> 
> Thanks,
> Fady
> 
Hi Fady, 

Getting the same error with a setup similar to Dmitry's. My setup: SDK 10.0.18362, clang 9.0.0. What version of clang are you using on your system?
You can try installing LLVM 9.0.0 from https://releases.llvm.org/download.html
  
Fady Bader July 20, 2020, 12:54 p.m. UTC | #6
> > > Subject: Re: [PATCH v2 3/3] eal/windows: librte_net build on Windows
> > >
> > > > diff --git a/lib/librte_eal/common/meson.build
> > > > b/lib/librte_eal/common/meson.build
> > > > index e1bdaf024..05e40a26b 100644
> > > > --- a/lib/librte_eal/common/meson.build
> > > > +++ b/lib/librte_eal/common/meson.build
> > > > @@ -28,6 +28,7 @@ if is_windows
> > > >  		'malloc_elem.c',
> > > >  		'malloc_heap.c',
> > > >  		'rte_malloc.c',
> > > > +		'rte_random.c',
> > >
> > > Hitting an error when building on Windows (SDK 10.0.18362) with Clang 9.0.1:
> >
> > Hi Dmitry,
> > I'm trying to reproduce the error you had, I installed the latest SDK
> (10.0.19041.0) but I can't find the clang v9.0.1 for Windows. Can you
> redirect/instruct me how did you get it for Windows ?
> >
> > Thanks,
> > Fady
> >
> Hi Fady,
> 
> Getting the same error with a setup similar to Dmitry's. My setup: SDK 10.0.18362,

I'm sending v4 patch that should resolve this.

> clang 9.0.0. What version of clang are you using on your system?
> You can try installing LLVM 9.0.0 from
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Freleases.ll
> vm.org%2Fdownload.html&amp;data=02%7C01%7Cfady%40mellanox.com%7C0b
> 29fed755494b55361d08d82a9ff2b4%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0
> %7C0%7C637306213753996879&amp;sdata=5lPQtvt8EO7q8OAYN60J8rIdYdNJHjsS
> Pp%2B6P9PL3N0%3D&amp;reserved=0

Thanks for the link, even with clang and SDK version same as yours and Dmitry's I'm still
passing compilation and not getting the error described. 
That's because the _m_prefetchw function that is defined in Clang's prfchwintrin.h is an
intrinsic function corresponding to the instruction PREFETCHW that is part of the 
instruction set extension 3DNOW, my processor doesn't support this instruction set 
extension, so my compiler isn't reaching the part where it defines _m_prefetchw. 
I think your processor does support the 3DNOW instruction set extension and that why 
you are reaching this part and I'm not.

Regard,
Fady
  
Dmitry Kozlyuk July 20, 2020, 4:26 p.m. UTC | #7
On Mon, 20 Jul 2020 12:54:08 +0000, Fady Bader wrote:
[snip]
> > Getting the same error with a setup similar to Dmitry's. My setup: SDK 10.0.18362,  
> 
> I'm sending v4 patch that should resolve this.
> 
> > clang 9.0.0. What version of clang are you using on your system?
> > You can try installing LLVM 9.0.0 from
> > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Freleases.ll
> > vm.org%2Fdownload.html&amp;data=02%7C01%7Cfady%40mellanox.com%7C0b
> > 29fed755494b55361d08d82a9ff2b4%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0
> > %7C0%7C637306213753996879&amp;sdata=5lPQtvt8EO7q8OAYN60J8rIdYdNJHjsS
> > Pp%2B6P9PL3N0%3D&amp;reserved=0  
> 
> Thanks for the link, even with clang and SDK version same as yours and Dmitry's I'm still
> passing compilation and not getting the error described. 
> That's because the _m_prefetchw function that is defined in Clang's prfchwintrin.h is an
> intrinsic function corresponding to the instruction PREFETCHW that is part of the 
> instruction set extension 3DNOW, my processor doesn't support this instruction set 
> extension, so my compiler isn't reaching the part where it defines _m_prefetchw. 
> I think your processor does support the 3DNOW instruction set extension and that why 
> you are reaching this part and I'm not.

You can try building DPDK for a machine with RDSEED like so:

	meson -Dmachine=broadwell -Dexamples=helloworld build

FWIW, replacing <x86intrin.h> with <immintrin.h> in rte_random.c resolves the
issue on my setup and also looks valid as per [1]. I checked LLVM 10.0.0, and
both native and cross MinGW-w64 (GCC 9.2.0).

[1]:
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rdseed32_step&expand=4541
  
Fady Bader July 22, 2020, 10:20 a.m. UTC | #8
> -----Original Message-----
> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Sent: Monday, July 20, 2020 7:27 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>; dev@dpdk.org;
> Thomas Monjalon <thomas@monjalon.net>; Tasnim Bashar
> <tbashar@mellanox.com>; Tal Shnaiderman <talshn@mellanox.com>; Yohad Tor
> <yohadt@mellanox.com>; harini.ramakrishnan@microsoft.com;
> ocardona@microsoft.com; anand.rawat@intel.com; ranjit.menon@intel.com;
> olivier.matz@6wind.com
> Subject: Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on
> Windows
> 
> On Mon, 20 Jul 2020 12:54:08 +0000, Fady Bader wrote:
> [snip]
> > > Getting the same error with a setup similar to Dmitry's. My setup:
> > > SDK 10.0.18362,
> >
> > I'm sending v4 patch that should resolve this.
> >
> > > clang 9.0.0. What version of clang are you using on your system?
> > > You can try installing LLVM 9.0.0 from
> > > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fre
> > > leases.ll
> > >
> vm.org%2Fdownload.html&amp;data=02%7C01%7Cfady%40mellanox.com%7C0b
> > >
> 29fed755494b55361d08d82a9ff2b4%7Ca652971c7d2e4d9ba6a4d149256f461b%7C
> > > 0
> > >
> %7C0%7C637306213753996879&amp;sdata=5lPQtvt8EO7q8OAYN60J8rIdYdNJHjsS
> > > Pp%2B6P9PL3N0%3D&amp;reserved=0
> >
> > Thanks for the link, even with clang and SDK version same as yours and
> > Dmitry's I'm still passing compilation and not getting the error described.
> > That's because the _m_prefetchw function that is defined in Clang's
> > prfchwintrin.h is an intrinsic function corresponding to the
> > instruction PREFETCHW that is part of the instruction set extension
> > 3DNOW, my processor doesn't support this instruction set extension, so my
> compiler isn't reaching the part where it defines _m_prefetchw.
> > I think your processor does support the 3DNOW instruction set
> > extension and that why you are reaching this part and I'm not.
> 
> You can try building DPDK for a machine with RDSEED like so:
> 
> 	meson -Dmachine=broadwell -Dexamples=helloworld build

Even with this option I still don't get the error. With this option RDSEED is enabled
but the reason I'm not getting the error is that 3DNOW is not supported by my 
machine and its disabled.
Do you know of such way that I can enable instruction set extenuations for the 
project compilation?

> 
> FWIW, replacing <x86intrin.h> with <immintrin.h> in rte_random.c resolves the
> issue on my setup and also looks valid as per [1]. I checked LLVM 10.0.0, and both
> native and cross MinGW-w64 (GCC 9.2.0).
> 
> [1]:
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsoftware.
> intel.com%2Fsites%2Flandingpage%2FIntrinsicsGuide%2F%23text%3D_rdseed32
> _step%26expand%3D4541&amp;data=02%7C01%7Cfady%40mellanox.com%7Cd
> e059e4538474040e05e08d82cc9b058%7Ca652971c7d2e4d9ba6a4d149256f461b%7
> C0%7C0%7C637308592047834349&amp;sdata=5mzK66A1IF4n2KKhRSzbZxOYi0vhj
> D4AZlBWyW1oxD8%3D&amp;reserved=0

I also think this is a valid solution, this should be considered when adding the 
rte_random support for windows. As for now I didn't use rte_random in the V4 patch.
  
Bruce Richardson July 22, 2020, 10:30 a.m. UTC | #9
On Wed, Jul 22, 2020 at 10:20:48AM +0000, Fady Bader wrote:
> 
> 
> > -----Original Message-----
> > From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > Sent: Monday, July 20, 2020 7:27 PM
> > To: Fady Bader <fady@mellanox.com>
> > Cc: Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>; dev@dpdk.org;
> > Thomas Monjalon <thomas@monjalon.net>; Tasnim Bashar
> > <tbashar@mellanox.com>; Tal Shnaiderman <talshn@mellanox.com>; Yohad Tor
> > <yohadt@mellanox.com>; harini.ramakrishnan@microsoft.com;
> > ocardona@microsoft.com; anand.rawat@intel.com; ranjit.menon@intel.com;
> > olivier.matz@6wind.com
> > Subject: Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on
> > Windows
> > 
> > On Mon, 20 Jul 2020 12:54:08 +0000, Fady Bader wrote:
> > [snip]
> > > > Getting the same error with a setup similar to Dmitry's. My setup:
> > > > SDK 10.0.18362,
> > >
> > > I'm sending v4 patch that should resolve this.
> > >
> > > > clang 9.0.0. What version of clang are you using on your system?
> > > > You can try installing LLVM 9.0.0 from
> > > > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fre
> > > > leases.ll
> > > >
> > vm.org%2Fdownload.html&amp;data=02%7C01%7Cfady%40mellanox.com%7C0b
> > > >
> > 29fed755494b55361d08d82a9ff2b4%7Ca652971c7d2e4d9ba6a4d149256f461b%7C
> > > > 0
> > > >
> > %7C0%7C637306213753996879&amp;sdata=5lPQtvt8EO7q8OAYN60J8rIdYdNJHjsS
> > > > Pp%2B6P9PL3N0%3D&amp;reserved=0
> > >
> > > Thanks for the link, even with clang and SDK version same as yours and
> > > Dmitry's I'm still passing compilation and not getting the error described.
> > > That's because the _m_prefetchw function that is defined in Clang's
> > > prfchwintrin.h is an intrinsic function corresponding to the
> > > instruction PREFETCHW that is part of the instruction set extension
> > > 3DNOW, my processor doesn't support this instruction set extension, so my
> > compiler isn't reaching the part where it defines _m_prefetchw.
> > > I think your processor does support the 3DNOW instruction set
> > > extension and that why you are reaching this part and I'm not.
> > 
> > You can try building DPDK for a machine with RDSEED like so:
> > 
> > 	meson -Dmachine=broadwell -Dexamples=helloworld build
> 
> Even with this option I still don't get the error. With this option RDSEED is enabled
> but the reason I'm not getting the error is that 3DNOW is not supported by my 
> machine and its disabled.
> Do you know of such way that I can enable instruction set extenuations for the 
> project compilation?
> 
The prefetchw should be available for broadwell and later machine types,
even without 3dnow - which AFAIK is unsupported by all modern x86
processors. I am using a machine of type "skylake-avx512" (using the
compiler name for it!), and proc/cpuinfo shows "3dnowprefetch" in the
supported CPU flags.

Regards,
/Bruce
  
Fady Bader July 27, 2020, 8:53 a.m. UTC | #10
> > On Mon, 20 Jul 2020 12:54:08 +0000, Fady Bader wrote:
> > [snip]
> > > > Getting the same error with a setup similar to Dmitry's. My setup:
> > > > SDK 10.0.18362,
> > >
> > > I'm sending v4 patch that should resolve this.
> > >
> > > > clang 9.0.0. What version of clang are you using on your system?
> > > > You can try installing LLVM 9.0.0 from
> > > > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> > > > re
> > > > leases.ll
> > > >
> >
> vm.org%2Fdownload.html&amp;data=02%7C01%7Cfady%40mellanox.com%7C0b
> > > >
> >
> 29fed755494b55361d08d82a9ff2b4%7Ca652971c7d2e4d9ba6a4d149256f461b%7C
> > > > 0
> > > >
> >
> %7C0%7C637306213753996879&amp;sdata=5lPQtvt8EO7q8OAYN60J8rIdYdNJHjsS
> > > > Pp%2B6P9PL3N0%3D&amp;reserved=0
> > >
> > > Thanks for the link, even with clang and SDK version same as yours
> > > and Dmitry's I'm still passing compilation and not getting the error described.
> > > That's because the _m_prefetchw function that is defined in Clang's
> > > prfchwintrin.h is an intrinsic function corresponding to the
> > > instruction PREFETCHW that is part of the instruction set extension
> > > 3DNOW, my processor doesn't support this instruction set extension,
> > > so my
> > compiler isn't reaching the part where it defines _m_prefetchw.
> > > I think your processor does support the 3DNOW instruction set
> > > extension and that why you are reaching this part and I'm not.
> >
> > You can try building DPDK for a machine with RDSEED like so:
> >
> > 	meson -Dmachine=broadwell -Dexamples=helloworld build
> 
> Even with this option I still don't get the error. With this option RDSEED is enabled
> but the reason I'm not getting the error is that 3DNOW is not supported by my
> machine and its disabled.
> Do you know of such way that I can enable instruction set extenuations for the
> project compilation?
> 

Sorry my bad, with the option -Dmachine=Broadwell I do get the error.
Thanks,
Fady
  
Fady Bader July 27, 2020, 8:54 a.m. UTC | #11
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Wednesday, July 22, 2020 1:31 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>; Narcisa Ana Maria Vasile
> <navasile@linux.microsoft.com>; dev@dpdk.org; Thomas Monjalon
> <thomas@monjalon.net>; Tasnim Bashar <tbashar@mellanox.com>; Tal
> Shnaiderman <talshn@mellanox.com>; Yohad Tor <yohadt@mellanox.com>;
> harini.ramakrishnan@microsoft.com; ocardona@microsoft.com;
> ranjit.menon@intel.com; olivier.matz@6wind.com
> Subject: Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on
> Windows
> 
> On Wed, Jul 22, 2020 at 10:20:48AM +0000, Fady Bader wrote:
> >
> >
> > > -----Original Message-----
> > > From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > > Sent: Monday, July 20, 2020 7:27 PM
> > > To: Fady Bader <fady@mellanox.com>
> > > Cc: Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>;
> > > dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Tasnim Bashar
> > > <tbashar@mellanox.com>; Tal Shnaiderman <talshn@mellanox.com>; Yohad
> > > Tor <yohadt@mellanox.com>; harini.ramakrishnan@microsoft.com;
> > > ocardona@microsoft.com; anand.rawat@intel.com;
> > > ranjit.menon@intel.com; olivier.matz@6wind.com
> > > Subject: Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build
> > > on Windows
> > >
> > > On Mon, 20 Jul 2020 12:54:08 +0000, Fady Bader wrote:
> > > [snip]
> > > > > Getting the same error with a setup similar to Dmitry's. My setup:
> > > > > SDK 10.0.18362,
> > > >
> > > > I'm sending v4 patch that should resolve this.
> > > >
> > > > > clang 9.0.0. What version of clang are you using on your system?
> > > > > You can try installing LLVM 9.0.0 from
> > > > > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%
> > > > > 2Fre
> > > > > leases.ll
> > > > >
> > >
> vm.org%2Fdownload.html&amp;data=02%7C01%7Cfady%40mellanox.com%7C0b
> > > > >
> > >
> 29fed755494b55361d08d82a9ff2b4%7Ca652971c7d2e4d9ba6a4d149256f461b%7C
> > > > > 0
> > > > >
> > >
> %7C0%7C637306213753996879&amp;sdata=5lPQtvt8EO7q8OAYN60J8rIdYdNJHjsS
> > > > > Pp%2B6P9PL3N0%3D&amp;reserved=0
> > > >
> > > > Thanks for the link, even with clang and SDK version same as yours
> > > > and Dmitry's I'm still passing compilation and not getting the error
> described.
> > > > That's because the _m_prefetchw function that is defined in
> > > > Clang's prfchwintrin.h is an intrinsic function corresponding to
> > > > the instruction PREFETCHW that is part of the instruction set
> > > > extension 3DNOW, my processor doesn't support this instruction set
> > > > extension, so my
> > > compiler isn't reaching the part where it defines _m_prefetchw.
> > > > I think your processor does support the 3DNOW instruction set
> > > > extension and that why you are reaching this part and I'm not.
> > >
> > > You can try building DPDK for a machine with RDSEED like so:
> > >
> > > 	meson -Dmachine=broadwell -Dexamples=helloworld build
> >
> > Even with this option I still don't get the error. With this option
> > RDSEED is enabled but the reason I'm not getting the error is that
> > 3DNOW is not supported by my machine and its disabled.
> > Do you know of such way that I can enable instruction set extenuations
> > for the project compilation?
> >
> The prefetchw should be available for broadwell and later machine types, even
> without 3dnow - which AFAIK is unsupported by all modern x86 processors. I am
> using a machine of type "skylake-avx512" (using the compiler name for it!), and
> proc/cpuinfo shows "3dnowprefetch" in the supported CPU flags.
> 
> Regards,
> /Bruce

Thanks now its clear.
  

Patch

diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index e1bdaf024..05e40a26b 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -28,6 +28,7 @@  if is_windows
 		'malloc_elem.c',
 		'malloc_heap.c',
 		'rte_malloc.c',
+		'rte_random.c',
 	)
 	subdir_done()
 endif
diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
index 1cbd00344..c04bfb01b 100644
--- a/lib/librte_eal/rte_eal_exports.def
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -137,3 +137,4 @@  EXPORTS
 	rte_mem_map
 	rte_mem_page_size
 	rte_mem_unmap
+	rte_rand
diff --git a/lib/librte_eal/windows/include/netinet/in.h b/lib/librte_eal/windows/include/netinet/in.h
new file mode 100644
index 000000000..489b587c3
--- /dev/null
+++ b/lib/librte_eal/windows/include/netinet/in.h
@@ -0,0 +1,25 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+
+#ifndef _IN_H_
+#define _IN_H_
+
+#define IPPROTO_IP 0
+#define IPPROTO_HOPOPTS 0
+#define	IPPROTO_IPV4 4             /* IPv4 encapsulation */
+#define	IPPROTO_IPIP IPPROTO_IPV4  /* for compatibility */
+#define IPPROTO_TCP 6
+#define IPPROTO_UDP 17
+#define	IPPROTO_IPV6 41	           /* IP6 header */
+#define	IPPROTO_ROUTING 43         /* IP6 routing header */
+#define	IPPROTO_FRAGMENT 44        /* IP6 fragmentation header */
+#define	IPPROTO_GRE 47             /* General Routing Encap. */
+#define	IPPROTO_ESP 50             /* IP6 Encap Sec. Payload */
+#define	IPPROTO_AH 51              /* IP6 Auth Header */
+#define IPPROTO_NONE 59            /* IPv6 no next header */
+#define	IPPROTO_DSTOPTS 60         /* IP6 destination option */
+#define IPPROTO_SCTP 132           /* Stream Control Transmission Protocol */
+
+
+#endif
diff --git a/lib/librte_eal/windows/include/netinet/ip.h b/lib/librte_eal/windows/include/netinet/ip.h
new file mode 100644
index 000000000..cb9c466ba
--- /dev/null
+++ b/lib/librte_eal/windows/include/netinet/ip.h
@@ -0,0 +1,11 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+
+#ifndef _IP_H_
+#define _IP_H_
+
+#define	IPVERSION 4
+
+
+#endif
diff --git a/lib/meson.build b/lib/meson.build
index 6d31641ba..22c9ab1fe 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -40,7 +40,7 @@  if is_windows
 		'kvargs',
 		'eal',
 		'ring',
-		'mempool', 'pci', 'mbuf',
+		'mempool', 'pci', 'mbuf', 'net',
 	] # only supported libraries for windows
 endif