DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows
       [not found] <'20200610112326.18576-1-fady@mellanox.com'>
@ 2020-06-10 12:00 ` Fady Bader
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 1/3] net: fix s_addr redefinition in Windows Fady Bader
                     ` (4 more replies)
  0 siblings, 5 replies; 35+ messages in thread
From: Fady Bader @ 2020-06-10 12:00 UTC (permalink / raw)
  To: dev
  Cc: fady, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, anand.rawat, ranjit.menon,
	olivier.matz

Addded needed files and fixes for windows in order to get 
librte_net compiling under Windows.

Depends-on: series-10282 ("build mempool on Windows")

Fady Bader (3):
  net: fix s_addr redefinition in Windows
  net: add htons to minGW for Windows
  eal/windows: librte_net build on Windows

 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/librte_eal/windows/include/rte_os.h     |  4 ++++
 lib/librte_net/rte_arp.c                    |  2 ++
 lib/librte_net/rte_ether.h                  |  9 +++++++++
 lib/meson.build                             |  2 +-
 8 files changed, 54 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

-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v2 1/3] net: fix s_addr redefinition in Windows
  2020-06-10 12:00 ` [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows Fady Bader
@ 2020-06-10 12:00   ` Fady Bader
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows Fady Bader
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-06-10 12:00 UTC (permalink / raw)
  To: dev
  Cc: fady, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, anand.rawat, ranjit.menon,
	olivier.matz

s_addr in Windows is defined in windows.h so its
undefined in order to be defined as part of rte_ether_hdr.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_net/rte_ether.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 0ae4e75b6..f6e37d9e5 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -23,6 +23,15 @@ extern "C" {
 #include <rte_mbuf.h>
 #include <rte_byteorder.h>
 
+/*
+ * s_addr in windows is defined in windows.h
+ * it is undefined here to be defined as part of rte_ether_hdr
+ */
+#ifdef RTE_EXEC_ENV_WINDOWS
+#undef s_addr
+#endif
+
+
 #define RTE_ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */
 #define RTE_ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */
 #define RTE_ETHER_CRC_LEN   4 /**< Length of Ethernet CRC. */
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows
  2020-06-10 12:00 ` [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows Fady Bader
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 1/3] net: fix s_addr redefinition in Windows Fady Bader
@ 2020-06-10 12:00   ` Fady Bader
  2020-06-10 12:33     ` Jerin Jacob
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows Fady Bader
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 35+ messages in thread
From: Fady Bader @ 2020-06-10 12:00 UTC (permalink / raw)
  To: dev
  Cc: fady, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, anand.rawat, ranjit.menon,
	olivier.matz

htons wasnt defined in Windows for the minGW compiler.
Definition of htons was added in order to use htons.

Signed-off-by: Fady Bader <fady@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
 
 #include <rte_arp.h>
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-06-10 12:00 ` [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows Fady Bader
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 1/3] net: fix s_addr redefinition in Windows Fady Bader
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows Fady Bader
@ 2020-06-10 12:00   ` Fady Bader
  2020-06-16  9:04     ` Thomas Monjalon
  2020-06-20 19:22     ` Dmitry Kozlyuk
  2020-07-08  8:25   ` [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows Fady Bader
  2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
  4 siblings, 2 replies; 35+ messages in thread
From: Fady Bader @ 2020-06-10 12:00 UTC (permalink / raw)
  To: dev
  Cc: fady, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, anand.rawat, ranjit.menon,
	olivier.matz

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

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
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows Fady Bader
@ 2020-06-10 12:33     ` Jerin Jacob
  0 siblings, 0 replies; 35+ messages in thread
From: Jerin Jacob @ 2020-06-10 12:33 UTC (permalink / raw)
  To: Fady Bader
  Cc: dpdk-dev, Thomas Monjalon, tbashar, Tal Shnaiderman, yohadt,
	Dmitry Kozlyuk, Harini Ramakrishnan, Omar Cardona, Anand Rawat,
	Menon, Ranjit, Olivier Matz

On Wed, Jun 10, 2020 at 5:31 PM Fady Bader <fady@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 <fady@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
>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows Fady Bader
@ 2020-06-16  9:04     ` Thomas Monjalon
  2020-07-06  8:44       ` Fady Bader
  2020-06-20 19:22     ` Dmitry Kozlyuk
  1 sibling, 1 reply; 35+ messages in thread
From: Thomas Monjalon @ 2020-06-16  9:04 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, ranjit.menon, olivier.matz

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.



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows Fady Bader
  2020-06-16  9:04     ` Thomas Monjalon
@ 2020-06-20 19:22     ` Dmitry Kozlyuk
  2020-06-28  9:48       ` Fady Bader
  1 sibling, 1 reply; 35+ messages in thread
From: Dmitry Kozlyuk @ 2020-06-20 19:22 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, harini.ramakrishnan,
	ocardona, anand.rawat, ranjit.menon, olivier.matz

> 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

-- 
Dmitry Kozlyuk

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-06-20 19:22     ` Dmitry Kozlyuk
@ 2020-06-28  9:48       ` Fady Bader
  2020-07-17 22:22         ` Narcisa Ana Maria Vasile
  0 siblings, 1 reply; 35+ messages in thread
From: Fady Bader @ 2020-06-28  9:48 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: dev, Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman, Yohad Tor,
	harini.ramakrishnan, ocardona, anand.rawat, ranjit.menon,
	olivier.matz

> 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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-06-16  9:04     ` Thomas Monjalon
@ 2020-07-06  8:44       ` Fady Bader
  0 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-06  8:44 UTC (permalink / raw)
  To: harini.ramakrishnan, Omar Cardona, Narcisa Ana Maria Vasile
  Cc: dev, Tasnim Bashar, Tal Shnaiderman, Yohad Tor, dmitry.kozliuk,
	ranjit.menon, olivier.matz, Thomas Monjalon, Ophir Munk

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.
> 


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows
  2020-06-10 12:00 ` [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows Fady Bader
                     ` (2 preceding siblings ...)
  2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows Fady Bader
@ 2020-07-08  8:25   ` Fady Bader
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows Fady Bader
                       ` (2 more replies)
  2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
  4 siblings, 3 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-08  8:25 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

Addded needed files and fixes for windows in order to get 
librte_net compiling under Windows.

v3:
    * replaced htons with rte_cpu_to_be_16.
    * rebased to current master.

Fady Bader (3):
  net: fix s_addr redefinition in Windows
  net: replace htons with rte_cpu_to_be_16
  eal/windows: librte_net build on Windows

 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 | 12 ++++++++++++
 lib/librte_net/rte_arp.c                    | 11 +++++++----
 lib/librte_net/rte_ether.h                  |  9 +++++++++
 lib/meson.build                             |  2 +-
 7 files changed, 56 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_eal/windows/include/netinet/in.h
 create mode 100644 lib/librte_eal/windows/include/netinet/ip.h

-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows
  2020-07-08  8:25   ` [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows Fady Bader
@ 2020-07-08  8:25     ` Fady Bader
  2020-07-13 14:38       ` Olivier Matz
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16 Fady Bader
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows Fady Bader
  2 siblings, 1 reply; 35+ messages in thread
From: Fady Bader @ 2020-07-08  8:25 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

s_addr in Windows is defined in windows.h so its
undefined in order to be defined as part of rte_ether_hdr.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_net/rte_ether.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 0ae4e75b6c..f6e37d9e5e 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -23,6 +23,15 @@ extern "C" {
 #include <rte_mbuf.h>
 #include <rte_byteorder.h>
 
+/*
+ * s_addr in windows is defined in windows.h
+ * it is undefined here to be defined as part of rte_ether_hdr
+ */
+#ifdef RTE_EXEC_ENV_WINDOWS
+#undef s_addr
+#endif
+
+
 #define RTE_ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */
 #define RTE_ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */
 #define RTE_ETHER_CRC_LEN   4 /**< Length of Ethernet CRC. */
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16
  2020-07-08  8:25   ` [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows Fady Bader
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows Fady Bader
@ 2020-07-08  8:25     ` Fady Bader
  2020-07-09 13:39       ` Morten Brørup
  2020-07-13 14:38       ` Olivier Matz
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows Fady Bader
  2 siblings, 2 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-08  8:25 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

htons wasn't defined in Windows for the minGW compiler.
htons was replaced with rte_cpu_to_be_16 in order to compile
under Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_net/rte_arp.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c
index 784b7f48fa..227a6396de 100644
--- a/lib/librte_net/rte_arp.c
+++ b/lib/librte_net/rte_arp.c
@@ -2,9 +2,12 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#ifndef RTE_EXEC_ENV_WINDOWS
 #include <arpa/inet.h>
+#endif
 
 #include <rte_arp.h>
+#include <rte_byteorder.h>
 
 #define RARP_PKT_SIZE	64
 struct rte_mbuf *
@@ -32,15 +35,15 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool,
 	/* Ethernet header. */
 	memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
 	rte_ether_addr_copy(mac, &eth_hdr->s_addr);
-	eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP);
+	eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_RARP);
 
 	/* RARP header. */
 	rarp = (struct rte_arp_hdr *)(eth_hdr + 1);
-	rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER);
-	rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPV4);
+	rarp->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER);
+	rarp->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
 	rarp->arp_hlen = RTE_ETHER_ADDR_LEN;
 	rarp->arp_plen = 4;
-	rarp->arp_opcode  = htons(RTE_ARP_OP_REVREQUEST);
+	rarp->arp_opcode  = rte_cpu_to_be_16(RTE_ARP_OP_REVREQUEST);
 
 	rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha);
 	rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha);
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows
  2020-07-08  8:25   ` [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows Fady Bader
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows Fady Bader
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16 Fady Bader
@ 2020-07-08  8:25     ` Fady Bader
  2020-07-08  9:10       ` Thomas Monjalon
  2 siblings, 1 reply; 35+ messages in thread
From: Fady Bader @ 2020-07-08  8:25 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

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 | 12 ++++++++++++
 lib/meson.build                             |  2 +-
 5 files changed, 40 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

diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index c1d9f21488..f7a2f798e3 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -31,6 +31,7 @@ if is_windows
 		'malloc_heap.c',
 		'rte_malloc.c',
 		'eal_common_timer.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 69204a92c6..cb53f2427b 100644
--- a/lib/librte_eal/rte_eal_exports.def
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -145,3 +145,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 0000000000..489b587c39
--- /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 0000000000..4f212961ff
--- /dev/null
+++ b/lib/librte_eal/windows/include/netinet/ip.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ * this needs to be changed waiting for Microsoft team to respond
+ */
+
+#ifndef _IP_H_
+#define _IP_H_
+
+#define	IPVERSION 4
+
+
+#endif
diff --git a/lib/meson.build b/lib/meson.build
index 3852c01564..6bbaf242a9 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -40,7 +40,7 @@ if is_windows
 		'kvargs',
 		'eal',
 		'ring',
-		'mempool', 'mbuf', 'pci',
+		'mempool', 'mbuf', 'pci', 'net',
 	] # only supported libraries for windows
 endif
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows Fady Bader
@ 2020-07-08  9:10       ` Thomas Monjalon
  2020-07-08 10:19         ` Fady Bader
  0 siblings, 1 reply; 35+ messages in thread
From: Thomas Monjalon @ 2020-07-08  9:10 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

08/07/2020 10:25, Fady Bader:
> --- /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
> + */

As said previously, the license and copyright are not correct.
Please keep the original copyright.
Given there is no invention here, can we consider it can be
re-licensed as BSD with your copyright?
I think we can, but I prefer having this discussion openly.


> +#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 */

Why IP6 for ESP and AH. Isn't it IPsec?

> +#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 strange tabs above.

Please replace IP6 with IPv6.

Which values are really used currently in DPDK? Or which ones are not?



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows
  2020-07-08  9:10       ` Thomas Monjalon
@ 2020-07-08 10:19         ` Fady Bader
  0 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-08 10:19 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Tasnim Bashar, Tal Shnaiderman, Yohad Tor, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, July 8, 2020 12:10 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; pallavi.kadam@intel.com; ranjit.menon@intel.com;
> olivier.matz@6wind.com
> Subject: Re: [PATCH v3 3/3] eal/windows: librte_net build on Windows
> 
> 08/07/2020 10:25, Fady Bader:
> > --- /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  */
> 
> As said previously, the license and copyright are not correct.
> Please keep the original copyright.

I'll change this.

> Given there is no invention here, can we consider it can be re-licensed as BSD
> with your copyright?
> I think we can, but I prefer having this discussion openly.

Ok.

> 
> 
> > +#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 */
> 
> Why IP6 for ESP and AH. Isn't it IPsec?

You are correct. I'll change accordingly.

> 
> > +#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 strange tabs above.

I will change this.

> 
> Please replace IP6 with IPv6.

Ok.

> 
> Which values are really used currently in DPDK? Or which ones are not?

I'll check for each value and send a new "in.h" having only the used values.

> 


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16 Fady Bader
@ 2020-07-09 13:39       ` Morten Brørup
  2020-07-13 14:38       ` Olivier Matz
  1 sibling, 0 replies; 35+ messages in thread
From: Morten Brørup @ 2020-07-09 13:39 UTC (permalink / raw)
  To: Fady Bader, dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fady Bader
> Sent: Wednesday, July 8, 2020 10:25 AM
> 
> htons wasn't defined in Windows for the minGW compiler.
> htons was replaced with rte_cpu_to_be_16 in order to compile
> under Windows.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  lib/librte_net/rte_arp.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c
> index 784b7f48fa..227a6396de 100644
> --- a/lib/librte_net/rte_arp.c
> +++ b/lib/librte_net/rte_arp.c
> @@ -2,9 +2,12 @@
>   * Copyright(c) 2018 Intel Corporation
>   */
> 
> +#ifndef RTE_EXEC_ENV_WINDOWS
>  #include <arpa/inet.h>
> +#endif
> 
>  #include <rte_arp.h>
> +#include <rte_byteorder.h>
> 
>  #define RARP_PKT_SIZE	64
>  struct rte_mbuf *
> @@ -32,15 +35,15 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool,
>  	/* Ethernet header. */
>  	memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
>  	rte_ether_addr_copy(mac, &eth_hdr->s_addr);
> -	eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP);
> +	eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_RARP);
> 
>  	/* RARP header. */
>  	rarp = (struct rte_arp_hdr *)(eth_hdr + 1);
> -	rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER);
> -	rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPV4);
> +	rarp->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER);
> +	rarp->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
>  	rarp->arp_hlen = RTE_ETHER_ADDR_LEN;
>  	rarp->arp_plen = 4;
> -	rarp->arp_opcode  = htons(RTE_ARP_OP_REVREQUEST);
> +	rarp->arp_opcode  = rte_cpu_to_be_16(RTE_ARP_OP_REVREQUEST);
> 
>  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha);
>  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha);
> --
> 2.16.1.windows.4
> 

The way I read rte_byteorder.h, you should use RTE_BE16() for compile time integers and rte_cpu_to_be_16() for runtime variable integers.

<rant>
I guess that the resulting compiler output is the same with a modern compiler; but since the API exposes different functions for different purposes, we should use them as instructed by the documentation.

Otherwise the obsolete (duplicate) functions should be deprecated and eventually removed.
</rant>


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16 Fady Bader
  2020-07-09 13:39       ` Morten Brørup
@ 2020-07-13 14:38       ` Olivier Matz
  2020-07-15  6:04         ` Fady Bader
  1 sibling, 1 reply; 35+ messages in thread
From: Olivier Matz @ 2020-07-13 14:38 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon

On Wed, Jul 08, 2020 at 11:25:24AM +0300, Fady Bader wrote:
> htons wasn't defined in Windows for the minGW compiler.
> htons was replaced with rte_cpu_to_be_16 in order to compile
> under Windows.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  lib/librte_net/rte_arp.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c
> index 784b7f48fa..227a6396de 100644
> --- a/lib/librte_net/rte_arp.c
> +++ b/lib/librte_net/rte_arp.c
> @@ -2,9 +2,12 @@
>   * Copyright(c) 2018 Intel Corporation
>   */
>  
> +#ifndef RTE_EXEC_ENV_WINDOWS
>  #include <arpa/inet.h>
> +#endif

Is arpa/inet.h still needed if you remove htons?

>  
>  #include <rte_arp.h>
> +#include <rte_byteorder.h>
>  
>  #define RARP_PKT_SIZE	64
>  struct rte_mbuf *
> @@ -32,15 +35,15 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool,
>  	/* Ethernet header. */
>  	memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
>  	rte_ether_addr_copy(mac, &eth_hdr->s_addr);
> -	eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP);
> +	eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_RARP);
>  
>  	/* RARP header. */
>  	rarp = (struct rte_arp_hdr *)(eth_hdr + 1);
> -	rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER);
> -	rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPV4);
> +	rarp->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER);
> +	rarp->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
>  	rarp->arp_hlen = RTE_ETHER_ADDR_LEN;
>  	rarp->arp_plen = 4;
> -	rarp->arp_opcode  = htons(RTE_ARP_OP_REVREQUEST);
> +	rarp->arp_opcode  = rte_cpu_to_be_16(RTE_ARP_OP_REVREQUEST);
>  
>  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha);
>  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha);
> -- 
> 2.16.1.windows.4
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows
  2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows Fady Bader
@ 2020-07-13 14:38       ` Olivier Matz
  2020-07-15  6:26         ` Fady Bader
  0 siblings, 1 reply; 35+ messages in thread
From: Olivier Matz @ 2020-07-13 14:38 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon

Hi,

On Wed, Jul 08, 2020 at 11:25:23AM +0300, Fady Bader wrote:
> s_addr in Windows is defined in windows.h so its

Is it windows.h, or is it winsock.h or winsock2.h instead?

> undefined in order to be defined as part of rte_ether_hdr.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  lib/librte_net/rte_ether.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
> index 0ae4e75b6c..f6e37d9e5e 100644
> --- a/lib/librte_net/rte_ether.h
> +++ b/lib/librte_net/rte_ether.h
> @@ -23,6 +23,15 @@ extern "C" {
>  #include <rte_mbuf.h>
>  #include <rte_byteorder.h>
>  
> +/*
> + * s_addr in windows is defined in windows.h
> + * it is undefined here to be defined as part of rte_ether_hdr
> + */
> +#ifdef RTE_EXEC_ENV_WINDOWS
> +#undef s_addr
> +#endif
> +
> +
>  #define RTE_ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */
>  #define RTE_ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */
>  #define RTE_ETHER_CRC_LEN   4 /**< Length of Ethernet CRC. */
> -- 
> 2.16.1.windows.4
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16
  2020-07-13 14:38       ` Olivier Matz
@ 2020-07-15  6:04         ` Fady Bader
  0 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-15  6:04 UTC (permalink / raw)
  To: Olivier Matz
  Cc: dev, Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman, Yohad Tor,
	dmitry.kozliuk, harini.ramakrishnan, ocardona, pallavi.kadam,
	ranjit.menon



> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Monday, July 13, 2020 5:39 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; 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;
> pallavi.kadam@intel.com; ranjit.menon@intel.com
> Subject: Re: [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16
> 
> On Wed, Jul 08, 2020 at 11:25:24AM +0300, Fady Bader wrote:
> > htons wasn't defined in Windows for the minGW compiler.
> > htons was replaced with rte_cpu_to_be_16 in order to compile under
> > Windows.
> >
> > Signed-off-by: Fady Bader <fady@mellanox.com>
> > ---
> >  lib/librte_net/rte_arp.c | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index
> > 784b7f48fa..227a6396de 100644
> > --- a/lib/librte_net/rte_arp.c
> > +++ b/lib/librte_net/rte_arp.c
> > @@ -2,9 +2,12 @@
> >   * Copyright(c) 2018 Intel Corporation
> >   */
> >
> > +#ifndef RTE_EXEC_ENV_WINDOWS
> >  #include <arpa/inet.h>
> > +#endif
> 
> Is arpa/inet.h still needed if you remove htons?

No its no longer needed, I'll remove these lines in the new patch.

> 
> >
> >  #include <rte_arp.h>
> > +#include <rte_byteorder.h>
> >
> >  #define RARP_PKT_SIZE	64
> >  struct rte_mbuf *
> > @@ -32,15 +35,15 @@ rte_net_make_rarp_packet(struct rte_mempool
> *mpool,
> >  	/* Ethernet header. */
> >  	memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
> >  	rte_ether_addr_copy(mac, &eth_hdr->s_addr);
> > -	eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP);
> > +	eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_RARP);
> >
> >  	/* RARP header. */
> >  	rarp = (struct rte_arp_hdr *)(eth_hdr + 1);
> > -	rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER);
> > -	rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPV4);
> > +	rarp->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER);
> > +	rarp->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
> >  	rarp->arp_hlen = RTE_ETHER_ADDR_LEN;
> >  	rarp->arp_plen = 4;
> > -	rarp->arp_opcode  = htons(RTE_ARP_OP_REVREQUEST);
> > +	rarp->arp_opcode  = rte_cpu_to_be_16(RTE_ARP_OP_REVREQUEST);
> >
> >  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha);
> >  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha);
> > --
> > 2.16.1.windows.4
> >

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows
  2020-07-13 14:38       ` Olivier Matz
@ 2020-07-15  6:26         ` Fady Bader
  0 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-15  6:26 UTC (permalink / raw)
  To: Olivier Matz
  Cc: dev, Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman, Yohad Tor,
	dmitry.kozliuk, harini.ramakrishnan, ocardona, pallavi.kadam,
	ranjit.menon



> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Monday, July 13, 2020 5:39 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; 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;
> pallavi.kadam@intel.com; ranjit.menon@intel.com
> Subject: Re: [PATCH v3 1/3] net: fix s_addr redefinition in Windows
> 
> Hi,
> 
> On Wed, Jul 08, 2020 at 11:25:23AM +0300, Fady Bader wrote:
> > s_addr in Windows is defined in windows.h so its
> 
> Is it windows.h, or is it winsock.h or winsock2.h instead?

S_addr is defined in winsock2.h which is included by windows.h.

> 
> > undefined in order to be defined as part of rte_ether_hdr.
> >
> > Signed-off-by: Fady Bader <fady@mellanox.com>
> > ---
> >  lib/librte_net/rte_ether.h | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
> > index 0ae4e75b6c..f6e37d9e5e 100644
> > --- a/lib/librte_net/rte_ether.h
> > +++ b/lib/librte_net/rte_ether.h
> > @@ -23,6 +23,15 @@ extern "C" {
> >  #include <rte_mbuf.h>
> >  #include <rte_byteorder.h>
> >
> > +/*
> > + * s_addr in windows is defined in windows.h
> > + * it is undefined here to be defined as part of rte_ether_hdr  */
> > +#ifdef RTE_EXEC_ENV_WINDOWS #undef s_addr #endif
> > +
> > +
> >  #define RTE_ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */
> > #define RTE_ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */
> >  #define RTE_ETHER_CRC_LEN   4 /**< Length of Ethernet CRC. */
> > --
> > 2.16.1.windows.4
> >

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-06-28  9:48       ` Fady Bader
@ 2020-07-17 22:22         ` Narcisa Ana Maria Vasile
  2020-07-20 12:54           ` Fady Bader
  0 siblings, 1 reply; 35+ messages in thread
From: Narcisa Ana Maria Vasile @ 2020-07-17 22:22 UTC (permalink / raw)
  To: Fady Bader
  Cc: Dmitry Kozlyuk, dev, Thomas Monjalon, Tasnim Bashar,
	Tal Shnaiderman, Yohad Tor, harini.ramakrishnan, ocardona,
	anand.rawat, ranjit.menon, olivier.matz

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


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-07-17 22:22         ` Narcisa Ana Maria Vasile
@ 2020-07-20 12:54           ` Fady Bader
  2020-07-20 16:26             ` Dmitry Kozlyuk
  0 siblings, 1 reply; 35+ messages in thread
From: Fady Bader @ 2020-07-20 12:54 UTC (permalink / raw)
  To: Narcisa Ana Maria Vasile
  Cc: Dmitry Kozlyuk, dev, Thomas Monjalon, Tasnim Bashar,
	Tal Shnaiderman, Yohad Tor, harini.ramakrishnan, ocardona,
	anand.rawat, ranjit.menon, olivier.matz


> > > 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



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-07-20 12:54           ` Fady Bader
@ 2020-07-20 16:26             ` Dmitry Kozlyuk
  2020-07-22 10:20               ` Fady Bader
  0 siblings, 1 reply; 35+ messages in thread
From: Dmitry Kozlyuk @ 2020-07-20 16:26 UTC (permalink / raw)
  To: Fady Bader
  Cc: Narcisa Ana Maria Vasile, dev, Thomas Monjalon, Tasnim Bashar,
	Tal Shnaiderman, Yohad Tor, harini.ramakrishnan, ocardona,
	anand.rawat, ranjit.menon, olivier.matz

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-07-20 16:26             ` Dmitry Kozlyuk
@ 2020-07-22 10:20               ` Fady Bader
  2020-07-22 10:30                 ` Bruce Richardson
  2020-07-27  8:53                 ` Fady Bader
  0 siblings, 2 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-22 10:20 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: Narcisa Ana Maria Vasile, dev, Thomas Monjalon, Tasnim Bashar,
	Tal Shnaiderman, Yohad Tor, harini.ramakrishnan, ocardona,
	ranjit.menon, olivier.matz



> -----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.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-07-22 10:20               ` Fady Bader
@ 2020-07-22 10:30                 ` Bruce Richardson
  2020-07-27  8:54                   ` Fady Bader
  2020-07-27  8:53                 ` Fady Bader
  1 sibling, 1 reply; 35+ messages in thread
From: Bruce Richardson @ 2020-07-22 10:30 UTC (permalink / raw)
  To: Fady Bader
  Cc: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, dev, Thomas Monjalon,
	Tasnim Bashar, Tal Shnaiderman, Yohad Tor, harini.ramakrishnan,
	ocardona, ranjit.menon, olivier.matz

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows
  2020-06-10 12:00 ` [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows Fady Bader
                     ` (3 preceding siblings ...)
  2020-07-08  8:25   ` [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows Fady Bader
@ 2020-07-23  7:08   ` Fady Bader
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 1/3] net: fix s_addr redefinition in Windows Fady Bader
                       ` (4 more replies)
  4 siblings, 5 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-23  7:08 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

v2: * fixed style issue.

v3: * replaced htons with rte_cpu_to_be_16.
    * rebased to current master.

v4: * removed the use of rte_random in librte_net.
    * replaced htons with RTE_BE16.

Fady Bader (3):
  net: fix s_addr redefinition in Windows
  net: replace htons with RTE_BE16
  eal/windows: librte_net build on Windows

 lib/librte_eal/windows/include/netinet/in.h | 23 +++++++++++++++++++++++
 lib/librte_eal/windows/include/netinet/ip.h | 10 ++++++++++
 lib/librte_net/rte_arp.c                    | 11 +++++------
 lib/librte_net/rte_ether.c                  |  4 ++++
 lib/librte_net/rte_ether.h                  |  9 +++++++++
 lib/meson.build                             |  2 +-
 6 files changed, 52 insertions(+), 7 deletions(-)
 create mode 100644 lib/librte_eal/windows/include/netinet/in.h
 create mode 100644 lib/librte_eal/windows/include/netinet/ip.h

-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v4 1/3] net: fix s_addr redefinition in Windows
  2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
@ 2020-07-23  7:08     ` Fady Bader
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 2/3] net: replace htons with RTE_BE16 Fady Bader
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-23  7:08 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

s_addr in Windows is defined in defined winsock2.h which is included by
windows.h so its undefined in order to be defined as part of
rte_ether_hdr.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_net/rte_ether.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index a358e88763..6690690b13 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -23,6 +23,15 @@ extern "C" {
 #include <rte_mbuf.h>
 #include <rte_byteorder.h>
 
+/*
+ * s_addr in windows is defined in winsock2.h which is included by windows.h
+ * it is undefined here to be defined as part of rte_ether_hdr
+ */
+#ifdef RTE_EXEC_ENV_WINDOWS
+#undef s_addr
+#endif
+
+
 #define RTE_ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */
 #define RTE_ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */
 #define RTE_ETHER_CRC_LEN   4 /**< Length of Ethernet CRC. */
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v4 2/3] net: replace htons with RTE_BE16
  2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 1/3] net: fix s_addr redefinition in Windows Fady Bader
@ 2020-07-23  7:08     ` Fady Bader
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on Windows Fady Bader
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-23  7:08 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

htons wasn't defined in Windows for the minGW compiler.
htons was replaced with RTE_BE16 in order to compile
under Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_net/rte_arp.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c
index 784b7f48fa..5c1e27b8c0 100644
--- a/lib/librte_net/rte_arp.c
+++ b/lib/librte_net/rte_arp.c
@@ -2,9 +2,8 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
-#include <arpa/inet.h>
-
 #include <rte_arp.h>
+#include <rte_byteorder.h>
 
 #define RARP_PKT_SIZE	64
 struct rte_mbuf *
@@ -32,15 +31,15 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool,
 	/* Ethernet header. */
 	memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
 	rte_ether_addr_copy(mac, &eth_hdr->s_addr);
-	eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP);
+	eth_hdr->ether_type = RTE_BE16(RTE_ETHER_TYPE_RARP);
 
 	/* RARP header. */
 	rarp = (struct rte_arp_hdr *)(eth_hdr + 1);
-	rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER);
-	rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPV4);
+	rarp->arp_hardware = RTE_BE16(RTE_ARP_HRD_ETHER);
+	rarp->arp_protocol = RTE_BE16(RTE_ETHER_TYPE_IPV4);
 	rarp->arp_hlen = RTE_ETHER_ADDR_LEN;
 	rarp->arp_plen = 4;
-	rarp->arp_opcode  = htons(RTE_ARP_OP_REVREQUEST);
+	rarp->arp_opcode  = RTE_BE16(RTE_ARP_OP_REVREQUEST);
 
 	rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha);
 	rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha);
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on Windows
  2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 1/3] net: fix s_addr redefinition in Windows Fady Bader
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 2/3] net: replace htons with RTE_BE16 Fady Bader
@ 2020-07-23  7:08     ` Fady Bader
  2020-09-08  8:14       ` Ophir Munk
  2020-07-24  1:11     ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Ranjit Menon
  2020-07-24 15:52     ` Kadam, Pallavi
  4 siblings, 1 reply; 35+ messages in thread
From: Fady Bader @ 2020-07-23  7:08 UTC (permalink / raw)
  To: dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, ranjit.menon,
	olivier.matz

librte_net wasn't compiling under Windows.
To solve this, needed header files were added.

Signed-off-by: Fady Bader <fady@mellanox.com>
---
 lib/librte_eal/windows/include/netinet/in.h | 23 +++++++++++++++++++++++
 lib/librte_eal/windows/include/netinet/ip.h | 10 ++++++++++
 lib/librte_net/rte_ether.c                  |  4 ++++
 lib/meson.build                             |  2 +-
 4 files changed, 38 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

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 0000000000..2be25c8bea
--- /dev/null
+++ b/lib/librte_eal/windows/include/netinet/in.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+
+#ifndef _IN_H_
+#define _IN_H_
+
+#define IPPROTO_IP 0               /* Dummy for IP */
+#define IPPROTO_HOPOPTS 0          /* IPv6 Hop-by-Hop options */
+#define IPPROTO_IPIP 4             /* IPIP tunnels (for compatibility) */
+#define IPPROTO_TCP 6              /* Transmission Control Protocol */
+#define IPPROTO_UDP 17             /* User Datagram Protocol */
+#define IPPROTO_IPV6 41            /* IPv6 header */
+#define IPPROTO_ROUTING 43         /* IPv6 routing header */
+#define IPPROTO_FRAGMENT 44        /* IPv6 fragmentation header */
+#define IPPROTO_GRE 47             /* General Routing Encap */
+#define IPPROTO_ESP 50             /* IPsec Encap Sec. Payload */
+#define IPPROTO_AH 51              /* IPsec Auth Header */
+#define IPPROTO_NONE 59            /* IPv6 no next header */
+#define IPPROTO_DSTOPTS 60         /* IPv6 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 0000000000..2126498797
--- /dev/null
+++ b/lib/librte_eal/windows/include/netinet/ip.h
@@ -0,0 +1,10 @@
+/* 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/librte_net/rte_ether.c b/lib/librte_net/rte_ether.c
index ced65ed9f3..6055ae1463 100644
--- a/lib/librte_net/rte_ether.c
+++ b/lib/librte_net/rte_ether.c
@@ -10,12 +10,16 @@
 void
 rte_eth_random_addr(uint8_t *addr)
 {
+#ifdef RTE_EXEC_ENV_WINDOWS
+	RTE_SET_USED(addr); /* random is not supported yet */
+#else
 	uint64_t rand = rte_rand();
 	uint8_t *p = (uint8_t *)&rand;
 
 	rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN);
 	addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR;	/* clear multicast bit */
 	addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR;	/* set local assignment bit */
+#endif
 }
 
 void
diff --git a/lib/meson.build b/lib/meson.build
index 3852c01564..6bbaf242a9 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -40,7 +40,7 @@ if is_windows
 		'kvargs',
 		'eal',
 		'ring',
-		'mempool', 'mbuf', 'pci',
+		'mempool', 'mbuf', 'pci', 'net',
 	] # only supported libraries for windows
 endif
 
-- 
2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows
  2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
                       ` (2 preceding siblings ...)
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on Windows Fady Bader
@ 2020-07-24  1:11     ` Ranjit Menon
  2020-09-10 19:55       ` Thomas Monjalon
  2020-07-24 15:52     ` Kadam, Pallavi
  4 siblings, 1 reply; 35+ messages in thread
From: Ranjit Menon @ 2020-07-24  1:11 UTC (permalink / raw)
  To: Fady Bader, dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, olivier.matz

On 7/23/2020 12:08 AM, Fady Bader wrote:
> v2: * fixed style issue.
>
> v3: * replaced htons with rte_cpu_to_be_16.
>      * rebased to current master.
>
> v4: * removed the use of rte_random in librte_net.
>      * replaced htons with RTE_BE16.
>
> Fady Bader (3):
>    net: fix s_addr redefinition in Windows
>    net: replace htons with RTE_BE16
>    eal/windows: librte_net build on Windows
>
>   lib/librte_eal/windows/include/netinet/in.h | 23 +++++++++++++++++++++++
>   lib/librte_eal/windows/include/netinet/ip.h | 10 ++++++++++
>   lib/librte_net/rte_arp.c                    | 11 +++++------
>   lib/librte_net/rte_ether.c                  |  4 ++++
>   lib/librte_net/rte_ether.h                  |  9 +++++++++
>   lib/meson.build                             |  2 +-
>   6 files changed, 52 insertions(+), 7 deletions(-)
>   create mode 100644 lib/librte_eal/windows/include/netinet/in.h
>   create mode 100644 lib/librte_eal/windows/include/netinet/ip.h

Acked-by: Ranjit Menon <ranjit.menon@intel.com>



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows
  2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
                       ` (3 preceding siblings ...)
  2020-07-24  1:11     ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Ranjit Menon
@ 2020-07-24 15:52     ` Kadam, Pallavi
  4 siblings, 0 replies; 35+ messages in thread
From: Kadam, Pallavi @ 2020-07-24 15:52 UTC (permalink / raw)
  To: Fady Bader, dev
  Cc: thomas, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, ranjit.menon, olivier.matz



On 7/23/2020 12:08 AM, Fady Bader wrote:
> v2: * fixed style issue.
> 
> v3: * replaced htons with rte_cpu_to_be_16.
>      * rebased to current master.
> 
> v4: * removed the use of rte_random in librte_net.
>      * replaced htons with RTE_BE16.
> 
> Fady Bader (3):
>    net: fix s_addr redefinition in Windows
>    net: replace htons with RTE_BE16
>    eal/windows: librte_net build on Windows
> 
>   lib/librte_eal/windows/include/netinet/in.h | 23 +++++++++++++++++++++++
>   lib/librte_eal/windows/include/netinet/ip.h | 10 ++++++++++
>   lib/librte_net/rte_arp.c                    | 11 +++++------
>   lib/librte_net/rte_ether.c                  |  4 ++++
>   lib/librte_net/rte_ether.h                  |  9 +++++++++
>   lib/meson.build                             |  2 +-
>   6 files changed, 52 insertions(+), 7 deletions(-)
>   create mode 100644 lib/librte_eal/windows/include/netinet/in.h
>   create mode 100644 lib/librte_eal/windows/include/netinet/ip.h
> 

Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-07-22 10:20               ` Fady Bader
  2020-07-22 10:30                 ` Bruce Richardson
@ 2020-07-27  8:53                 ` Fady Bader
  1 sibling, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-27  8:53 UTC (permalink / raw)
  To: Fady Bader, Dmitry Kozlyuk
  Cc: Narcisa Ana Maria Vasile, dev, Thomas Monjalon, Tasnim Bashar,
	Tal Shnaiderman, Yohad Tor, harini.ramakrishnan, ocardona,
	ranjit.menon, olivier.matz



> > 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


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows
  2020-07-22 10:30                 ` Bruce Richardson
@ 2020-07-27  8:54                   ` Fady Bader
  0 siblings, 0 replies; 35+ messages in thread
From: Fady Bader @ 2020-07-27  8:54 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, dev, Thomas Monjalon,
	Tasnim Bashar, Tal Shnaiderman, Yohad Tor, harini.ramakrishnan,
	ocardona, ranjit.menon, olivier.matz



> -----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.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on Windows
  2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on Windows Fady Bader
@ 2020-09-08  8:14       ` Ophir Munk
  0 siblings, 0 replies; 35+ messages in thread
From: Ophir Munk @ 2020-09-08  8:14 UTC (permalink / raw)
  To: Fady Bader, dev
  Cc: NBU-Contact-Thomas Monjalon, Tasnim Bashar, Tal Shnaiderman,
	Yohad Tor, dmitry.kozliuk, harini.ramakrishnan, ocardona,
	pallavi.kadam, ranjit.menon, olivier.matz

Please add IPPROTO_ICMP and IPPROTO_ICMPV6 definitions:

#define IPPROTO_IP 0
+#define IPPROTO_ICMP 1             /* Internet Ctrl Message Protocol */
 #define IPPROTO_HOPOPTS 0
@@ -17,6 +18,7 @@
#define IPPROTO_AH 51              /* IP6 Auth Header */
+#define IPPROTO_ICMPV6 58          /* Internet Ctrl Message Protocol V6 */
 #define IPPROTO_NONE 59            /* IPv6 no next header */

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Fady Bader
> Sent: Thursday, July 23, 2020 10:08 AM
> To: dev@dpdk.org
> Cc: Thomas Monjalon <thomas@monjalon.net>; 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;
> pallavi.kadam@intel.com; ranjit.menon@intel.com;
> olivier.matz@6wind.com
> Subject: [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on
> Windows
> 
> librte_net wasn't compiling under Windows.
> To solve this, needed header files were added.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  lib/librte_eal/windows/include/netinet/in.h | 23
> +++++++++++++++++++++++  lib/librte_eal/windows/include/netinet/ip.h |
> 10 ++++++++++
>  lib/librte_net/rte_ether.c                  |  4 ++++
>  lib/meson.build                             |  2 +-
>  4 files changed, 38 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
> 
> 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 0000000000..2be25c8bea
> --- /dev/null
> +++ b/lib/librte_eal/windows/include/netinet/in.h
> @@ -0,0 +1,23 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2020 Mellanox Technologies, Ltd  */
> +
> +#ifndef _IN_H_
> +#define _IN_H_
> +
> +#define IPPROTO_IP 0               /* Dummy for IP */
> +#define IPPROTO_HOPOPTS 0          /* IPv6 Hop-by-Hop options */
> +#define IPPROTO_IPIP 4             /* IPIP tunnels (for compatibility) */
> +#define IPPROTO_TCP 6              /* Transmission Control Protocol */
> +#define IPPROTO_UDP 17             /* User Datagram Protocol */
> +#define IPPROTO_IPV6 41            /* IPv6 header */
> +#define IPPROTO_ROUTING 43         /* IPv6 routing header */
> +#define IPPROTO_FRAGMENT 44        /* IPv6 fragmentation header */
> +#define IPPROTO_GRE 47             /* General Routing Encap */
> +#define IPPROTO_ESP 50             /* IPsec Encap Sec. Payload */
> +#define IPPROTO_AH 51              /* IPsec Auth Header */
> +#define IPPROTO_NONE 59            /* IPv6 no next header */
> +#define IPPROTO_DSTOPTS 60         /* IPv6 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 0000000000..2126498797
> --- /dev/null
> +++ b/lib/librte_eal/windows/include/netinet/ip.h
> @@ -0,0 +1,10 @@
> +/* 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/librte_net/rte_ether.c b/lib/librte_net/rte_ether.c index
> ced65ed9f3..6055ae1463 100644
> --- a/lib/librte_net/rte_ether.c
> +++ b/lib/librte_net/rte_ether.c
> @@ -10,12 +10,16 @@
>  void
>  rte_eth_random_addr(uint8_t *addr)
>  {
> +#ifdef RTE_EXEC_ENV_WINDOWS
> +	RTE_SET_USED(addr); /* random is not supported yet */ #else
>  	uint64_t rand = rte_rand();
>  	uint8_t *p = (uint8_t *)&rand;
> 
>  	rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN);
>  	addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR;	/* clear
> multicast bit */
>  	addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR;	/* set local
> assignment bit */
> +#endif
>  }
> 
>  void
> diff --git a/lib/meson.build b/lib/meson.build index 3852c01564..6bbaf242a9
> 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -40,7 +40,7 @@ if is_windows
>  		'kvargs',
>  		'eal',
>  		'ring',
> -		'mempool', 'mbuf', 'pci',
> +		'mempool', 'mbuf', 'pci', 'net',
>  	] # only supported libraries for windows  endif
> 
> --
> 2.16.1.windows.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows
  2020-07-24  1:11     ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Ranjit Menon
@ 2020-09-10 19:55       ` Thomas Monjalon
  0 siblings, 0 replies; 35+ messages in thread
From: Thomas Monjalon @ 2020-09-10 19:55 UTC (permalink / raw)
  To: Fady Bader
  Cc: dev, tbashar, talshn, yohadt, dmitry.kozliuk,
	harini.ramakrishnan, ocardona, pallavi.kadam, olivier.matz,
	Ranjit Menon

24/07/2020 03:11, Ranjit Menon:
> On 7/23/2020 12:08 AM, Fady Bader wrote:
> > v2: * fixed style issue.
> >
> > v3: * replaced htons with rte_cpu_to_be_16.
> >      * rebased to current master.
> >
> > v4: * removed the use of rte_random in librte_net.
> >      * replaced htons with RTE_BE16.
> >
> > Fady Bader (3):
> >    net: fix s_addr redefinition in Windows
> >    net: replace htons with RTE_BE16
> >    eal/windows: librte_net build on Windows
> >
> >   lib/librte_eal/windows/include/netinet/in.h | 23 +++++++++++++++++++++++
> >   lib/librte_eal/windows/include/netinet/ip.h | 10 ++++++++++
> >   lib/librte_net/rte_arp.c                    | 11 +++++------
> >   lib/librte_net/rte_ether.c                  |  4 ++++
> >   lib/librte_net/rte_ether.h                  |  9 +++++++++
> >   lib/meson.build                             |  2 +-
> >   6 files changed, 52 insertions(+), 7 deletions(-)
> >   create mode 100644 lib/librte_eal/windows/include/netinet/in.h
> >   create mode 100644 lib/librte_eal/windows/include/netinet/ip.h
> 
> Acked-by: Ranjit Menon <ranjit.menon@intel.com>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>

Applied with ICMP added as Ophir requested, and some rewording.



^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2020-09-10 19:55 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <'20200610112326.18576-1-fady@mellanox.com'>
2020-06-10 12:00 ` [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows Fady Bader
2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 1/3] net: fix s_addr redefinition in Windows Fady Bader
2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows Fady Bader
2020-06-10 12:33     ` Jerin Jacob
2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows Fady Bader
2020-06-16  9:04     ` Thomas Monjalon
2020-07-06  8:44       ` Fady Bader
2020-06-20 19:22     ` Dmitry Kozlyuk
2020-06-28  9:48       ` Fady Bader
2020-07-17 22:22         ` Narcisa Ana Maria Vasile
2020-07-20 12:54           ` Fady Bader
2020-07-20 16:26             ` Dmitry Kozlyuk
2020-07-22 10:20               ` Fady Bader
2020-07-22 10:30                 ` Bruce Richardson
2020-07-27  8:54                   ` Fady Bader
2020-07-27  8:53                 ` Fady Bader
2020-07-08  8:25   ` [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows Fady Bader
2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows Fady Bader
2020-07-13 14:38       ` Olivier Matz
2020-07-15  6:26         ` Fady Bader
2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16 Fady Bader
2020-07-09 13:39       ` Morten Brørup
2020-07-13 14:38       ` Olivier Matz
2020-07-15  6:04         ` Fady Bader
2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows Fady Bader
2020-07-08  9:10       ` Thomas Monjalon
2020-07-08 10:19         ` Fady Bader
2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 1/3] net: fix s_addr redefinition in Windows Fady Bader
2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 2/3] net: replace htons with RTE_BE16 Fady Bader
2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on Windows Fady Bader
2020-09-08  8:14       ` Ophir Munk
2020-07-24  1:11     ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Ranjit Menon
2020-09-10 19:55       ` Thomas Monjalon
2020-07-24 15:52     ` Kadam, Pallavi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).