DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] compile librte_net for windows
@ 2020-06-10 11:23 Fady Bader
  2020-06-10 11:23 ` [dpdk-dev] [PATCH 1/3] net: fix s_addr redefinition in Windows Fady Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fady Bader @ 2020-06-10 11:23 UTC (permalink / raw)
  To: dev
  Cc: fady, thomasm, 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.

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 | 23 +++++++++++++++++++++++
 lib/librte_eal/windows/include/netinet/ip.h |  9 +++++++++
 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, 50 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] 4+ messages in thread

* [dpdk-dev] [PATCH 1/3] net: fix s_addr redefinition in Windows
  2020-06-10 11:23 [dpdk-dev] [PATCH 0/3] compile librte_net for windows Fady Bader
@ 2020-06-10 11:23 ` Fady Bader
  2020-06-10 11:23 ` [dpdk-dev] [PATCH 2/3] net: add htons to minGW for Windows Fady Bader
  2020-06-10 11:23 ` [dpdk-dev] [PATCH 3/3] eal/windows: librte_net build on Windows Fady Bader
  2 siblings, 0 replies; 4+ messages in thread
From: Fady Bader @ 2020-06-10 11:23 UTC (permalink / raw)
  To: dev
  Cc: fady, thomasm, 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] 4+ messages in thread

* [dpdk-dev] [PATCH 2/3] net: add htons to minGW for Windows
  2020-06-10 11:23 [dpdk-dev] [PATCH 0/3] compile librte_net for windows Fady Bader
  2020-06-10 11:23 ` [dpdk-dev] [PATCH 1/3] net: fix s_addr redefinition in Windows Fady Bader
@ 2020-06-10 11:23 ` Fady Bader
  2020-06-10 11:23 ` [dpdk-dev] [PATCH 3/3] eal/windows: librte_net build on Windows Fady Bader
  2 siblings, 0 replies; 4+ messages in thread
From: Fady Bader @ 2020-06-10 11:23 UTC (permalink / raw)
  To: dev
  Cc: fady, thomasm, 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] 4+ messages in thread

* [dpdk-dev] [PATCH 3/3] eal/windows: librte_net build on Windows
  2020-06-10 11:23 [dpdk-dev] [PATCH 0/3] compile librte_net for windows Fady Bader
  2020-06-10 11:23 ` [dpdk-dev] [PATCH 1/3] net: fix s_addr redefinition in Windows Fady Bader
  2020-06-10 11:23 ` [dpdk-dev] [PATCH 2/3] net: add htons to minGW for Windows Fady Bader
@ 2020-06-10 11:23 ` Fady Bader
  2 siblings, 0 replies; 4+ messages in thread
From: Fady Bader @ 2020-06-10 11:23 UTC (permalink / raw)
  To: dev
  Cc: fady, thomasm, 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 | 23 +++++++++++++++++++++++
 lib/librte_eal/windows/include/netinet/ip.h |  9 +++++++++
 lib/meson.build                             |  2 +-
 5 files changed, 35 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..6b38d9d73
--- /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
+#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
\ No newline at end of file
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..d0c14d8c7
--- /dev/null
+++ b/lib/librte_eal/windows/include/netinet/ip.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+* Copyright 2020 Mellanox Technologies, Ltd  */
+
+#ifndef _IP_H_
+#define _IP_H_
+
+#define	IPVERSION	4
+
+#endif
\ No newline at end of file
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] 4+ messages in thread

end of thread, other threads:[~2020-06-10 11:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 11:23 [dpdk-dev] [PATCH 0/3] compile librte_net for windows Fady Bader
2020-06-10 11:23 ` [dpdk-dev] [PATCH 1/3] net: fix s_addr redefinition in Windows Fady Bader
2020-06-10 11:23 ` [dpdk-dev] [PATCH 2/3] net: add htons to minGW for Windows Fady Bader
2020-06-10 11:23 ` [dpdk-dev] [PATCH 3/3] eal/windows: librte_net build on Windows Fady Bader

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git