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

Message ID 20200708082525.28504-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/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Fady Bader July 8, 2020, 8:25 a.m. 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 | 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
  

Comments

Thomas Monjalon July 8, 2020, 9:10 a.m. UTC | #1
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?
  
Fady Bader July 8, 2020, 10:19 a.m. UTC | #2
> -----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.

>
  

Patch

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