[v4,1/3] net: fix s_addr redefinition in Windows

Message ID 20200723070825.6448-2-fady@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series compile librte_net for windows |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Fady Bader July 23, 2020, 7:08 a.m. UTC
  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(+)
  

Patch

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