[dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows
Fady Bader
fady at mellanox.com
Wed Jun 10 14:00:39 CEST 2020
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 at 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
More information about the dev
mailing list