* [dpdk-dev] [PATCH 0/4] net: replace Windows networking shim
@ 2021-03-13 1:56 Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
` (4 more replies)
0 siblings, 5 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 1:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk
Networking header shim in Windows EAL conflicts with system headers and
tries to provide POSIX compatibility out of scope for DPDK.
Remove dependency on POSIX headers from libraries supported on Windows,
then replace shim with librte_net with workarounds.
A proposed deprecation notice is assumed:
http://patchwork.dpdk.org/project/dpdk/list/?series=15595
Depends-on: series-15513 ("eal/windows: do not expose POSIX symbols")
Dmitry Kozlyuk (4):
cmdline: remove POSIX dependency
ethdev: remove POSIX dependency
net/mlx5: remove POSIX dependency
net: replace Windows networking shim
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_flow.c | 4 +--
drivers/net/mlx5/mlx5_flow.h | 4 +--
drivers/net/mlx5/mlx5_mac.c | 1 -
examples/cmdline/commands.c | 1 -
examples/cmdline/parse_obj_list.c | 2 --
lib/librte_cmdline/cmdline.c | 1 -
lib/librte_cmdline/cmdline_parse.c | 2 --
lib/librte_cmdline/cmdline_parse_etheraddr.c | 6 ----
lib/librte_cmdline/cmdline_parse_ipaddr.c | 6 ----
lib/librte_cmdline/cmdline_parse_ipaddr.h | 2 +-
lib/librte_eal/windows/include/arpa/inet.h | 30 ----------------
lib/librte_eal/windows/include/netinet/in.h | 38 --------------------
lib/librte_eal/windows/include/netinet/ip.h | 10 ------
lib/librte_eal/windows/include/sys/socket.h | 24 -------------
lib/librte_ethdev/rte_ethdev.c | 13 +++----
lib/librte_ethdev/rte_ethdev_core.h | 1 -
lib/librte_net/rte_ether.h | 26 ++++++++++----
lib/librte_net/rte_ip.h | 18 +++++++++-
19 files changed, 48 insertions(+), 143 deletions(-)
delete mode 100644 lib/librte_eal/windows/include/arpa/inet.h
delete mode 100644 lib/librte_eal/windows/include/netinet/in.h
delete mode 100644 lib/librte_eal/windows/include/netinet/ip.h
delete mode 100644 lib/librte_eal/windows/include/sys/socket.h
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH 1/4] cmdline: remove POSIX dependency
2021-03-13 1:56 [dpdk-dev] [PATCH 0/4] net: replace Windows networking shim Dmitry Kozlyuk
@ 2021-03-13 1:56 ` Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 2/4] ethdev: " Dmitry Kozlyuk
` (3 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 1:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Olivier Matz
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
examples/cmdline/commands.c | 1 -
examples/cmdline/parse_obj_list.c | 2 --
lib/librte_cmdline/cmdline.c | 1 -
lib/librte_cmdline/cmdline_parse.c | 2 --
lib/librte_cmdline/cmdline_parse_etheraddr.c | 6 ------
lib/librte_cmdline/cmdline_parse_ipaddr.c | 6 ------
lib/librte_cmdline/cmdline_parse_ipaddr.h | 2 +-
lib/librte_net/rte_ip.h | 3 ++-
8 files changed, 3 insertions(+), 20 deletions(-)
diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
index f43eacfbad..2c62d04fb0 100644
--- a/examples/cmdline/commands.c
+++ b/examples/cmdline/commands.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
-#include <netinet/in.h>
#ifdef RTE_EXEC_ENV_FREEBSD
#include <sys/socket.h>
#endif
diff --git a/examples/cmdline/parse_obj_list.c b/examples/cmdline/parse_obj_list.c
index b04adbea58..959bcd1452 100644
--- a/examples/cmdline/parse_obj_list.c
+++ b/examples/cmdline/parse_obj_list.c
@@ -6,11 +6,9 @@
#include <stdio.h>
#include <inttypes.h>
-#include <stdarg.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
-#include <netinet/in.h>
#include <cmdline_parse.h>
#include <cmdline_parse_ipaddr.h>
diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index 49770869bb..a176d15130 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -12,7 +12,6 @@
#include <inttypes.h>
#include <fcntl.h>
#include <errno.h>
-#include <netinet/in.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index fe366841cd..f5cc934782 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -11,8 +11,6 @@
#include <inttypes.h>
#include <ctype.h>
-#include <netinet/in.h>
-
#include <rte_string_fns.h>
#include "cmdline_private.h"
diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c
index 5cb10de321..433b828a72 100644
--- a/lib/librte_cmdline/cmdline_parse_etheraddr.c
+++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c
@@ -5,13 +5,7 @@
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <ctype.h>
#include <string.h>
-#include <sys/types.h>
#include <rte_string_fns.h>
#include <rte_ether.h>
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c
index f8dbdf204c..5e278c963f 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.c
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c
@@ -6,14 +6,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
-#include <inttypes.h>
-#include <ctype.h>
#include <string.h>
#include <errno.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.h b/lib/librte_cmdline/cmdline_parse_ipaddr.h
index 0ba81647bc..0118c31d44 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.h
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.h
@@ -8,7 +8,7 @@
#define _PARSE_IPADDR_H_
#include <cmdline_parse.h>
-#include <netinet/in.h>
+#include <rte_ip.h>
#ifdef __cplusplus
extern "C" {
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 212ff2c4fd..f8a08deed5 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -16,7 +16,8 @@
*/
#include <stdint.h>
-#include <sys/types.h>
+
+#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH 2/4] ethdev: remove POSIX dependency
2021-03-13 1:56 [dpdk-dev] [PATCH 0/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
@ 2021-03-13 1:56 ` Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 3/4] net/mlx5: " Dmitry Kozlyuk
` (2 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 1:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Keep <sys/queue.h>, because it is incorporated into DPDK.
Cleanup, group, and sort remaining includes per coding style.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_ethdev/rte_ethdev.c | 13 +++++--------
lib/librte_ethdev/rte_ethdev_core.h | 1 -
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 6f514c388b..f363794369 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2,18 +2,15 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/types.h>
-#include <sys/queue.h>
#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
-#include <inttypes.h>
-#include <netinet/in.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/queue.h>
#include <rte_byteorder.h>
#include <rte_log.h>
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 918a34ed1f..4679d948fa 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -6,7 +6,6 @@
#define _RTE_ETHDEV_CORE_H_
#include <pthread.h>
-#include <sys/types.h>
/**
* @file
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH 3/4] net/mlx5: remove POSIX dependency
2021-03-13 1:56 [dpdk-dev] [PATCH 0/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 2/4] ethdev: " Dmitry Kozlyuk
@ 2021-03-13 1:56 ` Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 4/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 1:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Matan Azrad, Shahaf Shuler,
Viacheslav Ovsiienko
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Keep <sys/queue.h>, because it is incorporated into DPDK.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_flow.c | 4 ++--
drivers/net/mlx5/mlx5_flow.h | 4 ++--
drivers/net/mlx5/mlx5_mac.c | 1 -
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index a281fd20ea..f04da06abd 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -10,7 +10,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
-#include <netinet/in.h>
+
#include <sys/queue.h>
#include <rte_pci.h>
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ab5be3dacc..73253bd39e 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3,13 +3,13 @@
* Copyright 2016 Mellanox Technologies, Ltd
*/
-#include <netinet/in.h>
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
+#include <sys/queue.h>
+
#include <rte_common.h>
#include <rte_ether.h>
#include <ethdev_driver.h>
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 8324e188e1..c4e5f19faa 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -5,12 +5,12 @@
#ifndef RTE_PMD_MLX5_FLOW_H_
#define RTE_PMD_MLX5_FLOW_H_
-#include <netinet/in.h>
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
+#include <sys/queue.h>
+
#include <rte_alarm.h>
#include <rte_mtr.h>
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 6ffcfcd97a..f0450735e2 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <inttypes.h>
#include <errno.h>
-#include <netinet/in.h>
#include <rte_ether.h>
#include <ethdev_driver.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH 4/4] net: replace Windows networking shim
2021-03-13 1:56 [dpdk-dev] [PATCH 0/4] net: replace Windows networking shim Dmitry Kozlyuk
` (2 preceding siblings ...)
2021-03-13 1:56 ` [dpdk-dev] [PATCH 3/4] net/mlx5: " Dmitry Kozlyuk
@ 2021-03-13 1:56 ` Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 1:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Olivier Matz
Remove networking shim from Windows EAL.
Replace it with system headers with two workarounds:
1. Windows Sockets headers contain `#define s_addr S_un.S_addr`, which
conflicts with `s_addr` field of `struct rte_ether_hdr`. Undefining
this macro in <rte_ether.h> had been breaking some usages of DPDK
and Windows headers in one file.
Renaming is planned:
https://mails.dpdk.org/archives/dev/2021-March/201444.html
Temporarily disable `s_addr` macro around `struct rte_ether_hdr`
definition to avoid conflict. Place source MAC address in both
`s_addr` and `S_un.S_addr` fields, so that access works either
directly or through the macro.
2. Provide some IPPROTO_* constants and IPVERSION, missing on Windows.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_eal/windows/include/arpa/inet.h | 30 ----------------
lib/librte_eal/windows/include/netinet/in.h | 38 ---------------------
lib/librte_eal/windows/include/netinet/ip.h | 10 ------
lib/librte_eal/windows/include/sys/socket.h | 24 -------------
lib/librte_net/rte_ether.h | 26 ++++++++++----
lib/librte_net/rte_ip.h | 15 ++++++++
6 files changed, 35 insertions(+), 108 deletions(-)
delete mode 100644 lib/librte_eal/windows/include/arpa/inet.h
delete mode 100644 lib/librte_eal/windows/include/netinet/in.h
delete mode 100644 lib/librte_eal/windows/include/netinet/ip.h
delete mode 100644 lib/librte_eal/windows/include/sys/socket.h
diff --git a/lib/librte_eal/windows/include/arpa/inet.h b/lib/librte_eal/windows/include/arpa/inet.h
deleted file mode 100644
index 96b6984383..0000000000
--- a/lib/librte_eal/windows/include/arpa/inet.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2020 Dmitry Kozlyuk
- */
-
-#ifndef _ARPA_INET_H_
-#define _ARPA_INET_H_
-
-/**
- * @file
- *
- * Compatibility header
- *
- * Although symbols declared here are present on Windows,
- * including <winsock2.h> would expose too much macros breaking common code.
- */
-
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-/* defined in ws2_32.dll */
-__attribute__((stdcall))
-int
-inet_pton(int af, const char *src, void *dst);
-
-/* defined in ws2_32.dll */
-__attribute__((stdcall))
-const char *
-inet_ntop(int af, const void *src, char *dst, socklen_t size);
-
-#endif /* _ARPA_INET_H_ */
diff --git a/lib/librte_eal/windows/include/netinet/in.h b/lib/librte_eal/windows/include/netinet/in.h
deleted file mode 100644
index 6455b9ba51..0000000000
--- a/lib/librte_eal/windows/include/netinet/in.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020 Mellanox Technologies, Ltd
- */
-
-#ifndef _IN_H_
-#define _IN_H_
-
-#include <stdint.h>
-#include <sys/socket.h>
-
-#define IPPROTO_IP 0
-#define IPPROTO_HOPOPTS 0
-#define IPPROTO_ICMP 1
-#define IPPROTO_IPIP 4
-#define IPPROTO_TCP 6
-#define IPPROTO_UDP 17
-#define IPPROTO_IPV6 41
-#define IPPROTO_ROUTING 43
-#define IPPROTO_FRAGMENT 44
-#define IPPROTO_GRE 47
-#define IPPROTO_ESP 50
-#define IPPROTO_AH 51
-#define IPPROTO_ICMPV6 58
-#define IPPROTO_NONE 59
-#define IPPROTO_DSTOPTS 60
-#define IPPROTO_SCTP 132
-
-#define INET6_ADDRSTRLEN 46
-
-struct in_addr {
- uint32_t s_addr;
-};
-
-struct in6_addr {
- uint8_t s6_addr[16];
-};
-
-#endif
diff --git a/lib/librte_eal/windows/include/netinet/ip.h b/lib/librte_eal/windows/include/netinet/ip.h
deleted file mode 100644
index 2126498797..0000000000
--- a/lib/librte_eal/windows/include/netinet/ip.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* 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_eal/windows/include/sys/socket.h b/lib/librte_eal/windows/include/sys/socket.h
deleted file mode 100644
index 9536cf8e62..0000000000
--- a/lib/librte_eal/windows/include/sys/socket.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2020 Dmitry Kozlyuk
- */
-
-#ifndef _SYS_SOCKET_H_
-#define _SYS_SOCKET_H_
-
-/**
- * @file
- *
- * Compatibility header
- *
- * Although symbols declared here are present on Windows,
- * including <winsock2.h> would expose too much macros breaking common code.
- */
-
-#include <stddef.h>
-
-#define AF_INET 2
-#define AF_INET6 23
-
-typedef size_t socklen_t;
-
-#endif /* _SYS_SOCKET_H_ */
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 060b63fc9b..a303c24a8c 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -23,10 +23,6 @@ extern "C" {
#include <rte_mbuf.h>
#include <rte_byteorder.h>
-#ifdef RTE_EXEC_ENV_WINDOWS /* Workaround conflict with rte_ether_hdr. */
-#undef s_addr /* Defined in winsock2.h included in windows.h. */
-#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. */
@@ -257,16 +253,34 @@ __rte_experimental
int
rte_ether_unformat_addr(const char *str, struct rte_ether_addr *eth_addr);
+/* Windows Sockets headers contain `#define s_addr S_un.S_addr`.
+ * Temporarily disable this macro to avoid conflict at definition.
+ * Place source MAC address in both `s_addr` and `S_un.S_addr` fields,
+ * so that access works either directly or through the macro.
+ */
+#pragma push_macro("s_addr")
+#ifdef s_addr
+#undef s_addr
+#endif
+
/**
* Ethernet header: Contains the destination address, source address
* and frame type.
*/
struct rte_ether_hdr {
struct rte_ether_addr d_addr; /**< Destination address. */
- struct rte_ether_addr s_addr; /**< Source address. */
- uint16_t ether_type; /**< Frame type. */
+ RTE_STD_C11
+ union {
+ struct rte_ether_addr s_addr; /**< Source address. */
+ struct {
+ struct rte_ether_addr S_addr;
+ } S_un; /**< Do not use directly; use s_addr instead.*/
+ };
+ uint16_t ether_type; /**< Frame type. */
} __rte_aligned(2);
+#pragma pop_macro("s_addr")
+
/**
* Ethernet VLAN Header.
* Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index f8a08deed5..6c9904698a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -17,10 +17,25 @@
#include <stdint.h>
+#ifndef RTE_EXEC_ENV_WINDOWS
+
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
+#else
+
+#include <ws2tcpip.h>
+
+#ifdef RTE_BUILD_INTERNAL
+#define IPVERSION 4 /* missing from Windows SDK */
+#define IPPROTO_IPIP 4 /* missing from Windows SDK and MinGW */
+#define IPPROTO_GRE 47 /* ditto */
+#define IPPROTO_SCTP 132 /* missing from MinGW */
+#endif
+
+#endif /* RTE_EXEC_ENV_WINDOWS */
+
#include <rte_byteorder.h>
#include <rte_mbuf.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v2 0/4] net: replace Windows networking shim
2021-03-13 1:56 [dpdk-dev] [PATCH 0/4] net: replace Windows networking shim Dmitry Kozlyuk
` (3 preceding siblings ...)
2021-03-13 1:56 ` [dpdk-dev] [PATCH 4/4] net: replace Windows networking shim Dmitry Kozlyuk
@ 2021-03-13 2:56 ` Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
` (4 more replies)
4 siblings, 5 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 2:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk
Networking header shim in Windows EAL conflicts with system headers and
tries to provide POSIX compatibility out of scope for DPDK.
Remove dependency on POSIX headers from libraries supported on Windows,
then replace shim with librte_net with workarounds.
A proposed deprecation notice is assumed:
http://patchwork.dpdk.org/project/dpdk/list/?series=15595
v2:
* Fix build on FreeBSD (CI).
Depends-on: series-15513 ("eal/windows: do not expose POSIX symbols")
Dmitry Kozlyuk (4):
cmdline: remove POSIX dependency
ethdev: remove POSIX dependency
net/mlx5: remove POSIX dependency
net: replace Windows networking shim
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_flow.c | 4 +--
drivers/net/mlx5/mlx5_flow.h | 4 +--
drivers/net/mlx5/mlx5_mac.c | 1 -
examples/cmdline/commands.c | 1 -
examples/cmdline/parse_obj_list.c | 2 --
lib/librte_cmdline/cmdline.c | 1 -
lib/librte_cmdline/cmdline_parse.c | 2 --
lib/librte_cmdline/cmdline_parse_etheraddr.c | 6 ----
lib/librte_cmdline/cmdline_parse_ipaddr.c | 6 ----
lib/librte_cmdline/cmdline_parse_ipaddr.h | 2 +-
lib/librte_eal/windows/include/arpa/inet.h | 30 ----------------
lib/librte_eal/windows/include/netinet/in.h | 38 --------------------
lib/librte_eal/windows/include/netinet/ip.h | 10 ------
lib/librte_eal/windows/include/sys/socket.h | 24 -------------
lib/librte_ethdev/rte_ethdev.c | 13 +++----
lib/librte_ethdev/rte_ethdev_core.h | 1 -
lib/librte_net/rte_ether.h | 26 ++++++++++----
lib/librte_net/rte_ip.h | 17 +++++++++
19 files changed, 48 insertions(+), 142 deletions(-)
delete mode 100644 lib/librte_eal/windows/include/arpa/inet.h
delete mode 100644 lib/librte_eal/windows/include/netinet/in.h
delete mode 100644 lib/librte_eal/windows/include/netinet/ip.h
delete mode 100644 lib/librte_eal/windows/include/sys/socket.h
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v2 1/4] cmdline: remove POSIX dependency
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
@ 2021-03-13 2:56 ` Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 2/4] ethdev: " Dmitry Kozlyuk
` (3 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 2:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Olivier Matz
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
examples/cmdline/commands.c | 1 -
examples/cmdline/parse_obj_list.c | 2 --
lib/librte_cmdline/cmdline.c | 1 -
lib/librte_cmdline/cmdline_parse.c | 2 --
lib/librte_cmdline/cmdline_parse_etheraddr.c | 6 ------
lib/librte_cmdline/cmdline_parse_ipaddr.c | 6 ------
lib/librte_cmdline/cmdline_parse_ipaddr.h | 2 +-
lib/librte_net/rte_ip.h | 2 ++
8 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
index f43eacfbad..2c62d04fb0 100644
--- a/examples/cmdline/commands.c
+++ b/examples/cmdline/commands.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
-#include <netinet/in.h>
#ifdef RTE_EXEC_ENV_FREEBSD
#include <sys/socket.h>
#endif
diff --git a/examples/cmdline/parse_obj_list.c b/examples/cmdline/parse_obj_list.c
index b04adbea58..959bcd1452 100644
--- a/examples/cmdline/parse_obj_list.c
+++ b/examples/cmdline/parse_obj_list.c
@@ -6,11 +6,9 @@
#include <stdio.h>
#include <inttypes.h>
-#include <stdarg.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
-#include <netinet/in.h>
#include <cmdline_parse.h>
#include <cmdline_parse_ipaddr.h>
diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index 49770869bb..a176d15130 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -12,7 +12,6 @@
#include <inttypes.h>
#include <fcntl.h>
#include <errno.h>
-#include <netinet/in.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index fe366841cd..f5cc934782 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -11,8 +11,6 @@
#include <inttypes.h>
#include <ctype.h>
-#include <netinet/in.h>
-
#include <rte_string_fns.h>
#include "cmdline_private.h"
diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c
index 5cb10de321..433b828a72 100644
--- a/lib/librte_cmdline/cmdline_parse_etheraddr.c
+++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c
@@ -5,13 +5,7 @@
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <ctype.h>
#include <string.h>
-#include <sys/types.h>
#include <rte_string_fns.h>
#include <rte_ether.h>
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c
index f8dbdf204c..5e278c963f 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.c
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c
@@ -6,14 +6,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
-#include <inttypes.h>
-#include <ctype.h>
#include <string.h>
#include <errno.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.h b/lib/librte_cmdline/cmdline_parse_ipaddr.h
index 0ba81647bc..0118c31d44 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.h
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.h
@@ -8,7 +8,7 @@
#define _PARSE_IPADDR_H_
#include <cmdline_parse.h>
-#include <netinet/in.h>
+#include <rte_ip.h>
#ifdef __cplusplus
extern "C" {
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 212ff2c4fd..3ab4de2ec0 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -16,7 +16,9 @@
*/
#include <stdint.h>
+
#include <sys/types.h>
+#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v2 2/4] ethdev: remove POSIX dependency
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
@ 2021-03-13 2:56 ` Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: " Dmitry Kozlyuk
` (2 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 2:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Keep <sys/queue.h>, because it is incorporated into DPDK.
Cleanup, group, and sort remaining includes per coding style.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_ethdev/rte_ethdev.c | 13 +++++--------
lib/librte_ethdev/rte_ethdev_core.h | 1 -
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 6f514c388b..f363794369 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2,18 +2,15 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/types.h>
-#include <sys/queue.h>
#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
-#include <inttypes.h>
-#include <netinet/in.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/queue.h>
#include <rte_byteorder.h>
#include <rte_log.h>
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 918a34ed1f..4679d948fa 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -6,7 +6,6 @@
#define _RTE_ETHDEV_CORE_H_
#include <pthread.h>
-#include <sys/types.h>
/**
* @file
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] net/mlx5: remove POSIX dependency
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 2/4] ethdev: " Dmitry Kozlyuk
@ 2021-03-13 2:56 ` Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 4/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 2:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Matan Azrad, Shahaf Shuler,
Viacheslav Ovsiienko
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Keep <sys/queue.h>, because it is incorporated into DPDK.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_flow.c | 4 ++--
drivers/net/mlx5/mlx5_flow.h | 4 ++--
drivers/net/mlx5/mlx5_mac.c | 1 -
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index a281fd20ea..f04da06abd 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -10,7 +10,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
-#include <netinet/in.h>
+
#include <sys/queue.h>
#include <rte_pci.h>
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ab5be3dacc..73253bd39e 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3,13 +3,13 @@
* Copyright 2016 Mellanox Technologies, Ltd
*/
-#include <netinet/in.h>
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
+#include <sys/queue.h>
+
#include <rte_common.h>
#include <rte_ether.h>
#include <ethdev_driver.h>
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 8324e188e1..c4e5f19faa 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -5,12 +5,12 @@
#ifndef RTE_PMD_MLX5_FLOW_H_
#define RTE_PMD_MLX5_FLOW_H_
-#include <netinet/in.h>
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
+#include <sys/queue.h>
+
#include <rte_alarm.h>
#include <rte_mtr.h>
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 6ffcfcd97a..f0450735e2 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <inttypes.h>
#include <errno.h>
-#include <netinet/in.h>
#include <rte_ether.h>
#include <ethdev_driver.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] net: replace Windows networking shim
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
` (2 preceding siblings ...)
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: " Dmitry Kozlyuk
@ 2021-03-13 2:56 ` Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
4 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 2:56 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Olivier Matz
Remove networking shim from Windows EAL.
Replace it with system headers with two workarounds:
1. Windows Sockets headers contain `#define s_addr S_un.S_addr`, which
conflicts with `s_addr` field of `struct rte_ether_hdr`. Undefining
this macro in <rte_ether.h> had been breaking some usages of DPDK
and Windows headers in one file.
Renaming is planned:
https://mails.dpdk.org/archives/dev/2021-March/201444.html
Temporarily disable `s_addr` macro around `struct rte_ether_hdr`
definition to avoid conflict. Place source MAC address in both
`s_addr` and `S_un.S_addr` fields, so that access works either
directly or through the macro.
2. Provide some IPPROTO_* constants and IPVERSION, missing on Windows.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_eal/windows/include/arpa/inet.h | 30 ----------------
lib/librte_eal/windows/include/netinet/in.h | 38 ---------------------
lib/librte_eal/windows/include/netinet/ip.h | 10 ------
lib/librte_eal/windows/include/sys/socket.h | 24 -------------
lib/librte_net/rte_ether.h | 26 ++++++++++----
lib/librte_net/rte_ip.h | 15 ++++++++
6 files changed, 35 insertions(+), 108 deletions(-)
delete mode 100644 lib/librte_eal/windows/include/arpa/inet.h
delete mode 100644 lib/librte_eal/windows/include/netinet/in.h
delete mode 100644 lib/librte_eal/windows/include/netinet/ip.h
delete mode 100644 lib/librte_eal/windows/include/sys/socket.h
diff --git a/lib/librte_eal/windows/include/arpa/inet.h b/lib/librte_eal/windows/include/arpa/inet.h
deleted file mode 100644
index 96b6984383..0000000000
--- a/lib/librte_eal/windows/include/arpa/inet.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2020 Dmitry Kozlyuk
- */
-
-#ifndef _ARPA_INET_H_
-#define _ARPA_INET_H_
-
-/**
- * @file
- *
- * Compatibility header
- *
- * Although symbols declared here are present on Windows,
- * including <winsock2.h> would expose too much macros breaking common code.
- */
-
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-/* defined in ws2_32.dll */
-__attribute__((stdcall))
-int
-inet_pton(int af, const char *src, void *dst);
-
-/* defined in ws2_32.dll */
-__attribute__((stdcall))
-const char *
-inet_ntop(int af, const void *src, char *dst, socklen_t size);
-
-#endif /* _ARPA_INET_H_ */
diff --git a/lib/librte_eal/windows/include/netinet/in.h b/lib/librte_eal/windows/include/netinet/in.h
deleted file mode 100644
index 6455b9ba51..0000000000
--- a/lib/librte_eal/windows/include/netinet/in.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020 Mellanox Technologies, Ltd
- */
-
-#ifndef _IN_H_
-#define _IN_H_
-
-#include <stdint.h>
-#include <sys/socket.h>
-
-#define IPPROTO_IP 0
-#define IPPROTO_HOPOPTS 0
-#define IPPROTO_ICMP 1
-#define IPPROTO_IPIP 4
-#define IPPROTO_TCP 6
-#define IPPROTO_UDP 17
-#define IPPROTO_IPV6 41
-#define IPPROTO_ROUTING 43
-#define IPPROTO_FRAGMENT 44
-#define IPPROTO_GRE 47
-#define IPPROTO_ESP 50
-#define IPPROTO_AH 51
-#define IPPROTO_ICMPV6 58
-#define IPPROTO_NONE 59
-#define IPPROTO_DSTOPTS 60
-#define IPPROTO_SCTP 132
-
-#define INET6_ADDRSTRLEN 46
-
-struct in_addr {
- uint32_t s_addr;
-};
-
-struct in6_addr {
- uint8_t s6_addr[16];
-};
-
-#endif
diff --git a/lib/librte_eal/windows/include/netinet/ip.h b/lib/librte_eal/windows/include/netinet/ip.h
deleted file mode 100644
index 2126498797..0000000000
--- a/lib/librte_eal/windows/include/netinet/ip.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* 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_eal/windows/include/sys/socket.h b/lib/librte_eal/windows/include/sys/socket.h
deleted file mode 100644
index 9536cf8e62..0000000000
--- a/lib/librte_eal/windows/include/sys/socket.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2020 Dmitry Kozlyuk
- */
-
-#ifndef _SYS_SOCKET_H_
-#define _SYS_SOCKET_H_
-
-/**
- * @file
- *
- * Compatibility header
- *
- * Although symbols declared here are present on Windows,
- * including <winsock2.h> would expose too much macros breaking common code.
- */
-
-#include <stddef.h>
-
-#define AF_INET 2
-#define AF_INET6 23
-
-typedef size_t socklen_t;
-
-#endif /* _SYS_SOCKET_H_ */
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 060b63fc9b..a303c24a8c 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -23,10 +23,6 @@ extern "C" {
#include <rte_mbuf.h>
#include <rte_byteorder.h>
-#ifdef RTE_EXEC_ENV_WINDOWS /* Workaround conflict with rte_ether_hdr. */
-#undef s_addr /* Defined in winsock2.h included in windows.h. */
-#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. */
@@ -257,16 +253,34 @@ __rte_experimental
int
rte_ether_unformat_addr(const char *str, struct rte_ether_addr *eth_addr);
+/* Windows Sockets headers contain `#define s_addr S_un.S_addr`.
+ * Temporarily disable this macro to avoid conflict at definition.
+ * Place source MAC address in both `s_addr` and `S_un.S_addr` fields,
+ * so that access works either directly or through the macro.
+ */
+#pragma push_macro("s_addr")
+#ifdef s_addr
+#undef s_addr
+#endif
+
/**
* Ethernet header: Contains the destination address, source address
* and frame type.
*/
struct rte_ether_hdr {
struct rte_ether_addr d_addr; /**< Destination address. */
- struct rte_ether_addr s_addr; /**< Source address. */
- uint16_t ether_type; /**< Frame type. */
+ RTE_STD_C11
+ union {
+ struct rte_ether_addr s_addr; /**< Source address. */
+ struct {
+ struct rte_ether_addr S_addr;
+ } S_un; /**< Do not use directly; use s_addr instead.*/
+ };
+ uint16_t ether_type; /**< Frame type. */
} __rte_aligned(2);
+#pragma pop_macro("s_addr")
+
/**
* Ethernet VLAN Header.
* Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 3ab4de2ec0..8c138c1b91 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -17,11 +17,26 @@
#include <stdint.h>
+#ifndef RTE_EXEC_ENV_WINDOWS
+
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
+#else
+
+#include <ws2tcpip.h>
+
+#ifdef RTE_BUILD_INTERNAL
+#define IPVERSION 4 /* missing from Windows SDK */
+#define IPPROTO_IPIP 4 /* missing from Windows SDK and MinGW */
+#define IPPROTO_GRE 47 /* ditto */
+#define IPPROTO_SCTP 132 /* missing from MinGW */
+#endif
+
+#endif /* RTE_EXEC_ENV_WINDOWS */
+
#include <rte_byteorder.h>
#include <rte_mbuf.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v3 0/4] net: replace Windows networking shim
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
` (3 preceding siblings ...)
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 4/4] net: replace Windows networking shim Dmitry Kozlyuk
@ 2021-03-13 22:22 ` Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
` (5 more replies)
4 siblings, 6 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 22:22 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk
Networking header shim in Windows EAL conflicts with system headers and
tries to provide POSIX compatibility out of scope for DPDK.
Remove dependency on POSIX headers from libraries supported on Windows,
then replace shim with librte_net with workarounds.
A proposed deprecation notice is assumed:
http://patchwork.dpdk.org/project/dpdk/list/?series=15595
v3: Fix build on FreeBSD for real (CI).
v2: Fix build on FreeBSD (CI).
Depends-on: series-15513 ("eal/windows: do not expose POSIX symbols")
Dmitry Kozlyuk (4):
cmdline: remove POSIX dependency
ethdev: remove POSIX dependency
net/mlx5: remove POSIX dependency
net: replace Windows networking shim
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_flow.c | 4 +--
drivers/net/mlx5/mlx5_flow.h | 4 +--
drivers/net/mlx5/mlx5_mac.c | 1 -
examples/cmdline/commands.c | 1 -
examples/cmdline/parse_obj_list.c | 2 --
lib/librte_cmdline/cmdline.c | 1 -
lib/librte_cmdline/cmdline_parse.c | 2 --
lib/librte_cmdline/cmdline_parse_etheraddr.c | 6 ----
lib/librte_cmdline/cmdline_parse_ipaddr.c | 6 ----
lib/librte_cmdline/cmdline_parse_ipaddr.h | 2 +-
lib/librte_eal/windows/include/arpa/inet.h | 30 ----------------
lib/librte_eal/windows/include/netinet/in.h | 38 --------------------
lib/librte_eal/windows/include/netinet/ip.h | 10 ------
lib/librte_eal/windows/include/sys/socket.h | 24 -------------
lib/librte_ethdev/rte_ethdev.c | 13 +++----
lib/librte_ethdev/rte_ethdev_core.h | 1 -
lib/librte_net/rte_ether.h | 26 ++++++++++----
lib/librte_net/rte_ip.h | 18 ++++++++++
19 files changed, 49 insertions(+), 142 deletions(-)
delete mode 100644 lib/librte_eal/windows/include/arpa/inet.h
delete mode 100644 lib/librte_eal/windows/include/netinet/in.h
delete mode 100644 lib/librte_eal/windows/include/netinet/ip.h
delete mode 100644 lib/librte_eal/windows/include/sys/socket.h
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v3 1/4] cmdline: remove POSIX dependency
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
@ 2021-03-13 22:22 ` Dmitry Kozlyuk
2021-03-17 17:22 ` Tyler Retzlaff
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 2/4] ethdev: " Dmitry Kozlyuk
` (4 subsequent siblings)
5 siblings, 1 reply; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 22:22 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Olivier Matz
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
Depends-on: series-15513 ("eal/windows: do not expose POSIX symbols")
examples/cmdline/commands.c | 1 -
examples/cmdline/parse_obj_list.c | 2 --
lib/librte_cmdline/cmdline.c | 1 -
lib/librte_cmdline/cmdline_parse.c | 2 --
lib/librte_cmdline/cmdline_parse_etheraddr.c | 6 ------
lib/librte_cmdline/cmdline_parse_ipaddr.c | 6 ------
lib/librte_cmdline/cmdline_parse_ipaddr.h | 2 +-
lib/librte_net/rte_ip.h | 3 +++
8 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c
index f43eacfbad..2c62d04fb0 100644
--- a/examples/cmdline/commands.c
+++ b/examples/cmdline/commands.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
-#include <netinet/in.h>
#ifdef RTE_EXEC_ENV_FREEBSD
#include <sys/socket.h>
#endif
diff --git a/examples/cmdline/parse_obj_list.c b/examples/cmdline/parse_obj_list.c
index b04adbea58..959bcd1452 100644
--- a/examples/cmdline/parse_obj_list.c
+++ b/examples/cmdline/parse_obj_list.c
@@ -6,11 +6,9 @@
#include <stdio.h>
#include <inttypes.h>
-#include <stdarg.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
-#include <netinet/in.h>
#include <cmdline_parse.h>
#include <cmdline_parse_ipaddr.h>
diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index 49770869bb..a176d15130 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -12,7 +12,6 @@
#include <inttypes.h>
#include <fcntl.h>
#include <errno.h>
-#include <netinet/in.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index fe366841cd..f5cc934782 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -11,8 +11,6 @@
#include <inttypes.h>
#include <ctype.h>
-#include <netinet/in.h>
-
#include <rte_string_fns.h>
#include "cmdline_private.h"
diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c
index 5cb10de321..433b828a72 100644
--- a/lib/librte_cmdline/cmdline_parse_etheraddr.c
+++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c
@@ -5,13 +5,7 @@
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <ctype.h>
#include <string.h>
-#include <sys/types.h>
#include <rte_string_fns.h>
#include <rte_ether.h>
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c
index f8dbdf204c..5e278c963f 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.c
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c
@@ -6,14 +6,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
-#include <inttypes.h>
-#include <ctype.h>
#include <string.h>
#include <errno.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.h b/lib/librte_cmdline/cmdline_parse_ipaddr.h
index 0ba81647bc..0118c31d44 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.h
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.h
@@ -8,7 +8,7 @@
#define _PARSE_IPADDR_H_
#include <cmdline_parse.h>
-#include <netinet/in.h>
+#include <rte_ip.h>
#ifdef __cplusplus
extern "C" {
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 212ff2c4fd..2cf7b0bd28 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -16,7 +16,10 @@
*/
#include <stdint.h>
+
+#include <sys/socket.h>
#include <sys/types.h>
+#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v3 2/4] ethdev: remove POSIX dependency
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
@ 2021-03-13 22:22 ` Dmitry Kozlyuk
2021-03-17 17:22 ` Tyler Retzlaff
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: " Dmitry Kozlyuk
` (3 subsequent siblings)
5 siblings, 1 reply; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 22:22 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Thomas Monjalon, Ferruh Yigit,
Andrew Rybchenko
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Keep <sys/queue.h>, because it is incorporated into DPDK.
Cleanup, group, and sort remaining includes per coding style.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_ethdev/rte_ethdev.c | 13 +++++--------
lib/librte_ethdev/rte_ethdev_core.h | 1 -
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 6f514c388b..f363794369 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2,18 +2,15 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
-#include <sys/types.h>
-#include <sys/queue.h>
#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
#include <errno.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
-#include <inttypes.h>
-#include <netinet/in.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/queue.h>
#include <rte_byteorder.h>
#include <rte_log.h>
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 918a34ed1f..4679d948fa 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -6,7 +6,6 @@
#define _RTE_ETHDEV_CORE_H_
#include <pthread.h>
-#include <sys/types.h>
/**
* @file
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v3 3/4] net/mlx5: remove POSIX dependency
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 2/4] ethdev: " Dmitry Kozlyuk
@ 2021-03-13 22:22 ` Dmitry Kozlyuk
2021-03-17 17:22 ` Tyler Retzlaff
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 4/4] net: replace Windows networking shim Dmitry Kozlyuk
` (2 subsequent siblings)
5 siblings, 1 reply; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 22:22 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Matan Azrad, Shahaf Shuler,
Viacheslav Ovsiienko
Use <rte_ip.h> for IP-related defines instead of POSIX headers.
Keep <sys/queue.h>, because it is incorporated into DPDK.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
drivers/net/mlx5/mlx5.h | 2 +-
drivers/net/mlx5/mlx5_flow.c | 4 ++--
drivers/net/mlx5/mlx5_flow.h | 4 ++--
drivers/net/mlx5/mlx5_mac.c | 1 -
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index a281fd20ea..f04da06abd 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -10,7 +10,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
-#include <netinet/in.h>
+
#include <sys/queue.h>
#include <rte_pci.h>
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ab5be3dacc..73253bd39e 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3,13 +3,13 @@
* Copyright 2016 Mellanox Technologies, Ltd
*/
-#include <netinet/in.h>
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
+#include <sys/queue.h>
+
#include <rte_common.h>
#include <rte_ether.h>
#include <ethdev_driver.h>
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 8324e188e1..c4e5f19faa 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -5,12 +5,12 @@
#ifndef RTE_PMD_MLX5_FLOW_H_
#define RTE_PMD_MLX5_FLOW_H_
-#include <netinet/in.h>
-#include <sys/queue.h>
#include <stdalign.h>
#include <stdint.h>
#include <string.h>
+#include <sys/queue.h>
+
#include <rte_alarm.h>
#include <rte_mtr.h>
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 6ffcfcd97a..f0450735e2 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <inttypes.h>
#include <errno.h>
-#include <netinet/in.h>
#include <rte_ether.h>
#include <ethdev_driver.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [dpdk-dev] [PATCH v3 4/4] net: replace Windows networking shim
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
` (2 preceding siblings ...)
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: " Dmitry Kozlyuk
@ 2021-03-13 22:22 ` Dmitry Kozlyuk
2021-03-15 13:03 ` [dpdk-dev] [PATCH v3 0/4] " Ferruh Yigit
2021-03-17 19:19 ` Ranjit Menon
5 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-13 22:22 UTC (permalink / raw)
To: dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff, Dmitry Kozlyuk, Olivier Matz
Remove networking shim from Windows EAL.
Replace it with system headers with two workarounds:
1. Windows Sockets headers contain `#define s_addr S_un.S_addr`, which
conflicts with `s_addr` field of `struct rte_ether_hdr`. Undefining
this macro in <rte_ether.h> had been breaking some usages of DPDK
and Windows headers in one file.
Renaming is planned:
https://mails.dpdk.org/archives/dev/2021-March/201444.html
Temporarily disable `s_addr` macro around `struct rte_ether_hdr`
definition to avoid conflict. Place source MAC address in both
`s_addr` and `S_un.S_addr` fields, so that access works either
directly or through the macro.
2. Provide some IPPROTO_* constants and IPVERSION, missing on Windows.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_eal/windows/include/arpa/inet.h | 30 ----------------
lib/librte_eal/windows/include/netinet/in.h | 38 ---------------------
lib/librte_eal/windows/include/netinet/ip.h | 10 ------
lib/librte_eal/windows/include/sys/socket.h | 24 -------------
lib/librte_net/rte_ether.h | 26 ++++++++++----
lib/librte_net/rte_ip.h | 15 ++++++++
6 files changed, 35 insertions(+), 108 deletions(-)
delete mode 100644 lib/librte_eal/windows/include/arpa/inet.h
delete mode 100644 lib/librte_eal/windows/include/netinet/in.h
delete mode 100644 lib/librte_eal/windows/include/netinet/ip.h
delete mode 100644 lib/librte_eal/windows/include/sys/socket.h
diff --git a/lib/librte_eal/windows/include/arpa/inet.h b/lib/librte_eal/windows/include/arpa/inet.h
deleted file mode 100644
index 96b6984383..0000000000
--- a/lib/librte_eal/windows/include/arpa/inet.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2020 Dmitry Kozlyuk
- */
-
-#ifndef _ARPA_INET_H_
-#define _ARPA_INET_H_
-
-/**
- * @file
- *
- * Compatibility header
- *
- * Although symbols declared here are present on Windows,
- * including <winsock2.h> would expose too much macros breaking common code.
- */
-
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-/* defined in ws2_32.dll */
-__attribute__((stdcall))
-int
-inet_pton(int af, const char *src, void *dst);
-
-/* defined in ws2_32.dll */
-__attribute__((stdcall))
-const char *
-inet_ntop(int af, const void *src, char *dst, socklen_t size);
-
-#endif /* _ARPA_INET_H_ */
diff --git a/lib/librte_eal/windows/include/netinet/in.h b/lib/librte_eal/windows/include/netinet/in.h
deleted file mode 100644
index 6455b9ba51..0000000000
--- a/lib/librte_eal/windows/include/netinet/in.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020 Mellanox Technologies, Ltd
- */
-
-#ifndef _IN_H_
-#define _IN_H_
-
-#include <stdint.h>
-#include <sys/socket.h>
-
-#define IPPROTO_IP 0
-#define IPPROTO_HOPOPTS 0
-#define IPPROTO_ICMP 1
-#define IPPROTO_IPIP 4
-#define IPPROTO_TCP 6
-#define IPPROTO_UDP 17
-#define IPPROTO_IPV6 41
-#define IPPROTO_ROUTING 43
-#define IPPROTO_FRAGMENT 44
-#define IPPROTO_GRE 47
-#define IPPROTO_ESP 50
-#define IPPROTO_AH 51
-#define IPPROTO_ICMPV6 58
-#define IPPROTO_NONE 59
-#define IPPROTO_DSTOPTS 60
-#define IPPROTO_SCTP 132
-
-#define INET6_ADDRSTRLEN 46
-
-struct in_addr {
- uint32_t s_addr;
-};
-
-struct in6_addr {
- uint8_t s6_addr[16];
-};
-
-#endif
diff --git a/lib/librte_eal/windows/include/netinet/ip.h b/lib/librte_eal/windows/include/netinet/ip.h
deleted file mode 100644
index 2126498797..0000000000
--- a/lib/librte_eal/windows/include/netinet/ip.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* 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_eal/windows/include/sys/socket.h b/lib/librte_eal/windows/include/sys/socket.h
deleted file mode 100644
index 9536cf8e62..0000000000
--- a/lib/librte_eal/windows/include/sys/socket.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2020 Dmitry Kozlyuk
- */
-
-#ifndef _SYS_SOCKET_H_
-#define _SYS_SOCKET_H_
-
-/**
- * @file
- *
- * Compatibility header
- *
- * Although symbols declared here are present on Windows,
- * including <winsock2.h> would expose too much macros breaking common code.
- */
-
-#include <stddef.h>
-
-#define AF_INET 2
-#define AF_INET6 23
-
-typedef size_t socklen_t;
-
-#endif /* _SYS_SOCKET_H_ */
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 060b63fc9b..a303c24a8c 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -23,10 +23,6 @@ extern "C" {
#include <rte_mbuf.h>
#include <rte_byteorder.h>
-#ifdef RTE_EXEC_ENV_WINDOWS /* Workaround conflict with rte_ether_hdr. */
-#undef s_addr /* Defined in winsock2.h included in windows.h. */
-#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. */
@@ -257,16 +253,34 @@ __rte_experimental
int
rte_ether_unformat_addr(const char *str, struct rte_ether_addr *eth_addr);
+/* Windows Sockets headers contain `#define s_addr S_un.S_addr`.
+ * Temporarily disable this macro to avoid conflict at definition.
+ * Place source MAC address in both `s_addr` and `S_un.S_addr` fields,
+ * so that access works either directly or through the macro.
+ */
+#pragma push_macro("s_addr")
+#ifdef s_addr
+#undef s_addr
+#endif
+
/**
* Ethernet header: Contains the destination address, source address
* and frame type.
*/
struct rte_ether_hdr {
struct rte_ether_addr d_addr; /**< Destination address. */
- struct rte_ether_addr s_addr; /**< Source address. */
- uint16_t ether_type; /**< Frame type. */
+ RTE_STD_C11
+ union {
+ struct rte_ether_addr s_addr; /**< Source address. */
+ struct {
+ struct rte_ether_addr S_addr;
+ } S_un; /**< Do not use directly; use s_addr instead.*/
+ };
+ uint16_t ether_type; /**< Frame type. */
} __rte_aligned(2);
+#pragma pop_macro("s_addr")
+
/**
* Ethernet VLAN Header.
* Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 2cf7b0bd28..87fbc26431 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -17,12 +17,27 @@
#include <stdint.h>
+#ifndef RTE_EXEC_ENV_WINDOWS
+
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
+#else
+
+#include <ws2tcpip.h>
+
+#ifdef RTE_BUILD_INTERNAL
+#define IPVERSION 4 /* missing from Windows SDK */
+#define IPPROTO_IPIP 4 /* missing from Windows SDK and MinGW */
+#define IPPROTO_GRE 47 /* ditto */
+#define IPPROTO_SCTP 132 /* missing from MinGW */
+#endif
+
+#endif /* RTE_EXEC_ENV_WINDOWS */
+
#include <rte_byteorder.h>
#include <rte_mbuf.h>
--
2.29.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/4] net: replace Windows networking shim
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
` (3 preceding siblings ...)
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 4/4] net: replace Windows networking shim Dmitry Kozlyuk
@ 2021-03-15 13:03 ` Ferruh Yigit
2021-03-15 13:23 ` Dmitry Kozlyuk
2021-03-17 19:19 ` Ranjit Menon
5 siblings, 1 reply; 21+ messages in thread
From: Ferruh Yigit @ 2021-03-15 13:03 UTC (permalink / raw)
To: Dmitry Kozlyuk, dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile, Tyler Retzlaff
On 3/13/2021 10:22 PM, Dmitry Kozlyuk wrote:
> Networking header shim in Windows EAL conflicts with system headers and
> tries to provide POSIX compatibility out of scope for DPDK.
> Remove dependency on POSIX headers from libraries supported on Windows,
> then replace shim with librte_net with workarounds.
>
> A proposed deprecation notice is assumed:
> http://patchwork.dpdk.org/project/dpdk/list/?series=15595
>
> v3: Fix build on FreeBSD for real (CI).
> v2: Fix build on FreeBSD (CI).
>
> Depends-on: series-15513 ("eal/windows: do not expose POSIX symbols")
>
> Dmitry Kozlyuk (4):
> cmdline: remove POSIX dependency
> ethdev: remove POSIX dependency
> net/mlx5: remove POSIX dependency
> net: replace Windows networking shim
>
Hi Dmitry,
Have you seen the CI reported build errors:
http://mails.dpdk.org/archives/test-report/2021-March/182361.html
Briefly:
./lib/librte_net/rte_net.c:132:7: error: 'IPPROTO_GRE' undeclared
./lib/librte_net/rte_net.c:163:7: error: 'IPPROTO_IPIP' undeclared
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/4] net: replace Windows networking shim
2021-03-15 13:03 ` [dpdk-dev] [PATCH v3 0/4] " Ferruh Yigit
@ 2021-03-15 13:23 ` Dmitry Kozlyuk
0 siblings, 0 replies; 21+ messages in thread
From: Dmitry Kozlyuk @ 2021-03-15 13:23 UTC (permalink / raw)
To: Ferruh Yigit
Cc: dpdk-dev, Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Tyler Retzlaff
>
>
>
Hi Ferruh,
>
Have you seen the CI reported build errors:
> http://mails.dpdk.org/archives/test-report/2021-March/182361.html
>
> Briefly:
> ./lib/librte_net/rte_net.c:132:7: error: 'IPPROTO_GRE' undeclared
> ./lib/librte_net/rte_net.c:163:7: error: 'IPPROTO_IPIP' undeclared
>
This is because CI doesn't apply patches in Depends-on. In this case,
missing constants would be defined when RTE_BUILD_INTERNAL is defined (so
that symbols are only visible to DPDK), and it is introduced by dependency
series.
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/4] cmdline: remove POSIX dependency
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
@ 2021-03-17 17:22 ` Tyler Retzlaff
0 siblings, 0 replies; 21+ messages in thread
From: Tyler Retzlaff @ 2021-03-17 17:22 UTC (permalink / raw)
To: Dmitry Kozlyuk
Cc: dev, Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Olivier Matz
On Sun, Mar 14, 2021 at 01:22:13AM +0300, Dmitry Kozlyuk wrote:
> Use <rte_ip.h> for IP-related defines instead of POSIX headers.
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/4] ethdev: remove POSIX dependency
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 2/4] ethdev: " Dmitry Kozlyuk
@ 2021-03-17 17:22 ` Tyler Retzlaff
0 siblings, 0 replies; 21+ messages in thread
From: Tyler Retzlaff @ 2021-03-17 17:22 UTC (permalink / raw)
To: Dmitry Kozlyuk
Cc: dev, Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
On Sun, Mar 14, 2021 at 01:22:14AM +0300, Dmitry Kozlyuk wrote:
> Use <rte_ip.h> for IP-related defines instead of POSIX headers.
> Keep <sys/queue.h>, because it is incorporated into DPDK.
> Cleanup, group, and sort remaining includes per coding style.
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v3 3/4] net/mlx5: remove POSIX dependency
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: " Dmitry Kozlyuk
@ 2021-03-17 17:22 ` Tyler Retzlaff
0 siblings, 0 replies; 21+ messages in thread
From: Tyler Retzlaff @ 2021-03-17 17:22 UTC (permalink / raw)
To: Dmitry Kozlyuk
Cc: dev, Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile,
Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko
On Sun, Mar 14, 2021 at 01:22:15AM +0300, Dmitry Kozlyuk wrote:
> Use <rte_ip.h> for IP-related defines instead of POSIX headers.
> Keep <sys/queue.h>, because it is incorporated into DPDK.
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/4] net: replace Windows networking shim
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
` (4 preceding siblings ...)
2021-03-15 13:03 ` [dpdk-dev] [PATCH v3 0/4] " Ferruh Yigit
@ 2021-03-17 19:19 ` Ranjit Menon
5 siblings, 0 replies; 21+ messages in thread
From: Ranjit Menon @ 2021-03-17 19:19 UTC (permalink / raw)
To: Dmitry Kozlyuk, dev
Cc: Pallavi Kadam, Dmitry Malloy, Narcisa Ana Maria Vasile, Tyler Retzlaff
On 3/13/2021 2:22 PM, Dmitry Kozlyuk wrote:
> Networking header shim in Windows EAL conflicts with system headers and
> tries to provide POSIX compatibility out of scope for DPDK.
> Remove dependency on POSIX headers from libraries supported on Windows,
> then replace shim with librte_net with workarounds.
>
> A proposed deprecation notice is assumed:
> http://patchwork.dpdk.org/project/dpdk/list/?series=15595
>
> v3: Fix build on FreeBSD for real (CI).
> v2: Fix build on FreeBSD (CI).
>
> Depends-on: series-15513 ("eal/windows: do not expose POSIX symbols")
>
> Dmitry Kozlyuk (4):
> cmdline: remove POSIX dependency
> ethdev: remove POSIX dependency
> net/mlx5: remove POSIX dependency
> net: replace Windows networking shim
>
> drivers/net/mlx5/mlx5.h | 2 +-
> drivers/net/mlx5/mlx5_flow.c | 4 +--
> drivers/net/mlx5/mlx5_flow.h | 4 +--
> drivers/net/mlx5/mlx5_mac.c | 1 -
> examples/cmdline/commands.c | 1 -
> examples/cmdline/parse_obj_list.c | 2 --
> lib/librte_cmdline/cmdline.c | 1 -
> lib/librte_cmdline/cmdline_parse.c | 2 --
> lib/librte_cmdline/cmdline_parse_etheraddr.c | 6 ----
> lib/librte_cmdline/cmdline_parse_ipaddr.c | 6 ----
> lib/librte_cmdline/cmdline_parse_ipaddr.h | 2 +-
> lib/librte_eal/windows/include/arpa/inet.h | 30 ----------------
> lib/librte_eal/windows/include/netinet/in.h | 38 --------------------
> lib/librte_eal/windows/include/netinet/ip.h | 10 ------
> lib/librte_eal/windows/include/sys/socket.h | 24 -------------
> lib/librte_ethdev/rte_ethdev.c | 13 +++----
> lib/librte_ethdev/rte_ethdev_core.h | 1 -
> lib/librte_net/rte_ether.h | 26 ++++++++++----
> lib/librte_net/rte_ip.h | 18 ++++++++++
> 19 files changed, 49 insertions(+), 142 deletions(-)
> delete mode 100644 lib/librte_eal/windows/include/arpa/inet.h
> delete mode 100644 lib/librte_eal/windows/include/netinet/in.h
> delete mode 100644 lib/librte_eal/windows/include/netinet/ip.h
> delete mode 100644 lib/librte_eal/windows/include/sys/socket.h
>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2021-03-17 19:19 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-13 1:56 [dpdk-dev] [PATCH 0/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 2/4] ethdev: " Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 3/4] net/mlx5: " Dmitry Kozlyuk
2021-03-13 1:56 ` [dpdk-dev] [PATCH 4/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 0/4] " Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 2/4] ethdev: " Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: " Dmitry Kozlyuk
2021-03-13 2:56 ` [dpdk-dev] [PATCH v2 4/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 0/4] " Dmitry Kozlyuk
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 1/4] cmdline: remove POSIX dependency Dmitry Kozlyuk
2021-03-17 17:22 ` Tyler Retzlaff
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 2/4] ethdev: " Dmitry Kozlyuk
2021-03-17 17:22 ` Tyler Retzlaff
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: " Dmitry Kozlyuk
2021-03-17 17:22 ` Tyler Retzlaff
2021-03-13 22:22 ` [dpdk-dev] [PATCH v3 4/4] net: replace Windows networking shim Dmitry Kozlyuk
2021-03-15 13:03 ` [dpdk-dev] [PATCH v3 0/4] " Ferruh Yigit
2021-03-15 13:23 ` Dmitry Kozlyuk
2021-03-17 19:19 ` Ranjit Menon
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).