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

Message ID 20200708082525.28504-2-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/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

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

Comments

Olivier Matz July 13, 2020, 2:38 p.m. UTC | #1
Hi,

On Wed, Jul 08, 2020 at 11:25:23AM +0300, Fady Bader wrote:
> s_addr in Windows is defined in windows.h so its

Is it windows.h, or is it winsock.h or winsock2.h instead?

> 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 0ae4e75b6c..f6e37d9e5e 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
>
  
Fady Bader July 15, 2020, 6:26 a.m. UTC | #2
> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Monday, July 13, 2020 5:39 PM
> To: Fady Bader <fady@mellanox.com>
> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; 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
> Subject: Re: [PATCH v3 1/3] net: fix s_addr redefinition in Windows
> 
> Hi,
> 
> On Wed, Jul 08, 2020 at 11:25:23AM +0300, Fady Bader wrote:
> > s_addr in Windows is defined in windows.h so its
> 
> Is it windows.h, or is it winsock.h or winsock2.h instead?

S_addr is defined in winsock2.h which is included by windows.h.

> 
> > 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 0ae4e75b6c..f6e37d9e5e 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
> >
  

Patch

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 0ae4e75b6c..f6e37d9e5e 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. */