doc: announce renaming of rte_ether_hdr fields
PATCH 1/1 doc: announce renaming of rte_ether_hdr fields
It is proposed to rename fields of struct rte_ether_hdr, s_addr tp src_addr and d_addr to dst_addr, due to the clash with system macro on Windows. Until remaining is done in 21.11, a workaround can be used.
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> is breaking some usages of DPDK and Windows headers in one file.
Example 1:
#include <winsock2.h>
#include <rte_ether.h>
struct in_addr addr;
/* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */Example 2:
#include <rte_ether.h>
#include <winsock2.h>
struct rte_ether_hdr eh;
/* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */It is not mandatory to rename d_addr, this is for consistency only. Naming in rte_ether_hdr will also resemble rte_ipv4/6_hdr.
Workaround is to define struct rte_ether_hdr in such a away that it can be used with or without s_addr macro (as defined on Windows) This can be done for Windows only or for all platforms to save space.
#pragma push_macro("s_addr")
#ifdef s_addr
#undef s_addr
#endif
struct rte_ether_hdr {
struct rte_ether_addr d_addr; /**< Destination address. */
RTE_STD_C11
union {
struct rte_ether_addr s_addr; /**< Source address. */
struct {
struct rte_ether_addr S_un;
/**< MUST NOT be used directly, only via s_addr */
} S_addr;
/*< MUST NOT be used directly, only via s_addr */
};
uint16_t ether_type; /**< Frame type. */
} __rte_aligned(2);
#pragma pop_macro("s_addr")--- doc/guides/rel_notes/deprecation.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/deprecation.rst +4 -0
@@ -125,3 +125,7 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed to ``src_addr`` and ``dst_addr`` respectively in DPDK 20.11 + in order to avoid conflict with Windows Sockets headers.
Signature · 1 line
2.29.2
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 131
Quoted 5 lines
doc/guides/rel_notes/deprecation.rst +4
-0+ +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed to ``src_addr`` and ``dst_addr`` respectively in DPDK 20.11 + in order to avoid conflict with Windows Sockets headers.
If those fields were a problem now, there might be others in future. Don't use src_addr and dst_addr because those are already used in rte_ipv4_hdr.
Linux and FreeBSD use:
struct ether_header
{
uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
uint16_t ether_type; /* packet type ID field */
} __attribute__ ((__packed__));
So why not ether_dhost/ether_shost?
2021-03-03 15:54, Stephen Hemminger:
Quoted 6 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 131
Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +4
-0+ +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed to ``src_addr`` and ``dst_addr`` respectively in DPDK 20.11 + in order to avoid conflict with Windows Sockets headers.If those fields were a problem now, there might be others in future.
One I can think of is min and max macros from windows.h: they are used as field names in rte_compressdev.h and rte_cryptodev.h (and more than once have they been worked around in PMD code, see i40e and ice patches). Do you prefer a single notice for all such conflicts we can identify now?
Quoted 1 line
Don't use
src_addranddst_addrbecause those are already used inrte_ipv4_hdr.
Not sure what DPDK policy is: rte_ipv4/6_hdr use completely custom names, while rte_arp_hdr uses traditional names with arp_ prefix. Coming from C++, I chose the former approach, but it's not a strong opinion.
Quoted 10 lines
Linux and FreeBSD use:
struct
ether_header
{
uint8_tether_dhost[ETH_ALEN]; /* destination eth addr */
uint8_tether_shost[ETH_ALEN]; /* source ether addr */
uint16_tether_type; /* packet type ID field */
}__attribute__((__packed__));So why not ether_dhost/ether_shost?
Works for me, let's see what others think.
Quoted 8 lines · Dmitry Kozlyuk
2021-03-03 15:54, Stephen Hemminger:
Quoted 6 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 131
Quoted 4 lines
doc/guides/rel_notes/deprecation.rst +4
-0+ +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed to ``src_addr`` and ``dst_addr`` respectively in DPDK 20.11 + in order to avoid conflict with Windows Sockets headers.If those fields were a problem now, there might be others in future.
Quoted 7 lines
One I can think of is
minandmaxmacros fromwindows.h: they are used as field names inrte_compressdev.handrte_cryptodev.h(and more than once have they been worked around in PMD code, see i40e and ice patches). Do you prefer a single notice for all such conflicts we can identify now?Quoted 1 line
Don't use
src_addranddst_addrbecause those are already used inrte_ipv4_hdr.
Why src_addr being used in rte_ipv4_hdr is a problem?
Quoted 4 lines
Not sure what DPDK policy is:
rte_ipv4/6_hdruse completely custom names, whilerte_arp_hdruses traditional names witharp_prefix. Coming from C++, I chose the former approach, but it's not a strong opinion.
I am now aware of a DPDK policy for it, but +1 to former approach.
Quoted 13 lines
Quoted 10 lines
Linux and FreeBSD use:
struct
ether_header
{
uint8_tether_dhost[ETH_ALEN]; /* destination eth addr */
uint8_tether_shost[ETH_ALEN]; /* source ether addr */
uint16_tether_type; /* packet type ID field */
}__attribute__((__packed__));So why not ether_dhost/ether_shost?
Works for me, let's see what others think.
PATCH v2 1/1 doc: announce API changes for Windows compatibility
In reply to Dmitry KozlyukWindows socket headers define s_addr, min, and max macros which break structure definitions containing fields with one of these names. Undefining those macros would break some consumers as well.
Example 1:
#include <winsock2.h>
#include <rte_ether.h>
struct in_addr addr;
/* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */Example 2:
#include <rte_ether.h>
#include <winsock2.h>
struct rte_ether_hdr eh;
/* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */It is proposed to rename the conflicting fields on DPDK side, because Win32 API has wider use and is slower and harder to change.
New names are left unspecified, open suggestions:
* struct rte_ether_hdr (by Stephen Hemminger):
* s_addr -> ether_shost
* d_addr -> ether_dhost (for consistency)
* struct rte_param_log2_range, struct rte_crypto_param_range:
* min -> minimum
* max -> maximum
For s_addr, a workaround is possible to use it until 21.11. For min and max, no workaround seems available. If cryptodev or compressdev is going to be enabled on Windows before 21.11, the only option seems to use a new name on Windows (using #ifdef).
Workaround for s_addr is to define struct rte_ether_hdr in such a away that it can be used with or without s_addr macro (as defined on Windows):
#pragma push_macro("s_addr")
#ifdef s_addr
#undef s_addr
#endif
struct rte_ether_hdr {
struct rte_ether_addr d_addr; /**< Destination address. */
RTE_STD_C11
union {
struct rte_ether_addr s_addr; /**< Source address. */
struct {
struct rte_ether_addr S_un;
/**< MUST NOT be used directly, only via s_addr */
} S_addr;
/**< MUST NOT be used directly, only via s_addr */
};
uint16_t ether_type; /**< Frame type. */
} __rte_aligned(2);
#pragma pop_macro("s_addr")---
v2: * Propose to rename all problematic fields identified so far.
* Leave future names unspecified, no need to promise now.
* Propose better names for MAC addresses (Stephen Hemminger).
Thread about s_addr workaround:
https://mails.dpdk.org/archives/dev/2021-March/200700.html
Tyler Retzlaff confirmed offline that Microsoft took similar approach.
doc/guides/rel_notes/deprecation.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
doc/guides/rel_notes/deprecation.rst +9 -0
@@ -130,3 +130,12 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 20.11 to avoid conflict with Windows Sockets headers. + +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range`` structure + will be renamed in DPDK 20.11 to avoid conflict with Windows Sockets headers. + +* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range`` structure + will be renamed in DPDK 20.11 to avoid conflict with Windows Sockets headers.
Signature · 1 line
2.29.2
Re: [dpdk-dev] [PATCH v2] doc: announce API changes for Windows compatibility
Quoted 46 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Dmitry Kozlyuk
Sent: 10 March 2021 23:54
To: [email protected]
Cc: Ferruh Yigit <[email protected]>; Pallavi Kadam <[email protected]>; Dmitry Malloy <[email protected]>; Narcisa Ana Maria Vasile <[email protected]>; Stephen Hemminger <[email protected]>; Tyler Retzlaff <[email protected]>; Declan Doherty <[email protected]>; Fiona Trahe <[email protected]>; Ashish Gupta <[email protected]>; Dmitry Kozlyuk <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: [dpdk-dev] [PATCH v2] doc: announce API changes for Windows compatibilityCAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Windows socket headers define
s_addr,min, andmaxmacros which break structure definitions containing fields with one of these names. Undefining those macros would break some consumers as well.Example 1:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; /* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */It is proposed to rename the conflicting fields on DPDK side, because Win32 API has wider use and is slower and harder to change.
New names are left unspecified, open suggestions:
*
struct rte_ether_hdr(by Stephen Hemminger):
Quoted 7 lines
*
s_addr->ether_shost
*d_addr->ether_dhost(for consistency)*
struct rte_param_log2_range,struct rte_crypto_param_range:*
min->minimum
*max->maximum
The min/max macros in the Windows headers cause issues with C++ projects also (breaks std::min/std::max). The fix there is to "#define NOMINMAX" prior to including windows.h, maybe that's appropriate here too?
Quoted 69 lines
For
s_addr, a workaround is possible to use it until 21.11. Forminandmax, no workaround seems available. If cryptodev or compressdev is going to be enabled on Windows before 21.11, the only option seems to use a new name on Windows (using #ifdef).Workaround for
s_addris to definestruct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows):#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un; /**< MUST NOT be used directly, only via s_addr */ } S_addr; /**< MUST NOT be used directly, only via s_addr */ }; uint16_t ether_type; /**< Frame type. */ } __rte_aligned(2); #pragma pop_macro("s_addr")Signed-off-by Dmitry Kozlyuk <[email protected]>---
v2: * Propose to rename all problematic fields identified so far.
* Leave future names unspecified, no need to promise now.
* Propose better names for MAC addresses (Stephen Hemminger).Thread about
s_addrworkaround:
https://mails.dpdk.org/archives/dev/2021-March/200700.html
Tyler Retzlaff confirmed offline that Microsoft took similar approach.doc/guides/rel_notes/deprecation.rst | 9 +++++++++ 1 file changed, 9 insertions(+)doc/guides/rel_notes/deprecation.rst +0
-0@@ -130,3 +130,12 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific
content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11.doc/guides/rel_notes/deprecation.rst +3
-0+ +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 20.11 to avoid conflict with Windows Socketsheaders.
doc/guides/rel_notes/deprecation.rst +4
-0+ +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range`` +structure + will be renamed in DPDK 20.11 to avoid conflict with Windows Socketsheaders.
doc/guides/rel_notes/deprecation.rst +4
-0+ +* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range`` +structure + will be renamed in DPDK 20.11 to avoid conflict with Windows Socketsheaders.
--
2.29.2
Re: [dpdk-dev] [PATCH v2] doc: announce API changes for Windows compatibility
2021-03-11 16:19 (UTC+0000), John Alexander:
[...]
Quoted 7 lines
Quoted 4 lines
*
struct rte_param_log2_range,struct rte_crypto_param_range:*
min->minimum
*max->maximumThe min/max macros in the Windows headers cause issues with C++ projects also (breaks std::min/std::max). The fix there is to "#define NOMINMAX" prior to including
windows.h, maybe that's appropriate here too?
We don't control include order in user code and we shouldn't #undef system macros in public headers. We could push_macro/pop_macro around structure definition and have min/max undefined in DPDK internal code, so that including this header always works. Then, if user wants to access the fields, they should take care of macros themselves.
Re: [dpdk-dev] [PATCH v2] doc: announce API changes for Windows compatibility
Quoted 8 lines · Dmitry Kozlyuk
2021-03-11 16:19 (UTC+0000), John Alexander:
[...]Quoted 6 lines
Quoted 4 lines
*
struct rte_param_log2_range,struct rte_crypto_param_range:*
min->minimum
*max->maximum
Quoted 7 lines
Quoted 1 line
The min/max macros in the Windows headers cause issues with C++ projects also (breaks std::min/std::max). The fix there is to "#define NOMINMAX" prior to including
windows.h, maybe that's appropriate here too?We don't control include order in user code and we shouldn't #undef system macros in public headers. We could push_macro/pop_macro around structure definition and have min/max undefined in DPDK internal code, so that including this header always works. Then, if user wants to access the fields, they should take care of macros themselves.
agreed, nothing stops an application from including windows.h before dpdk includes windows.h and similarly the application shouldn't have visibility of min/max (broken as they are) disappear from the application namespace after including dpdk headers.
the approach of altering what appears in the namespace for the scope of the dpdk header preprocessing is about the best that can be achieved.
Re: [dpdk-dev] [PATCH v2] doc: announce API changes for Windows compatibility
In reply to Dmitry Kozlyuk11/03/2021 00:54, Dmitry Kozlyuk:
Quoted 21 lines
Windows socket headers define
s_addr,min, andmaxmacros which break structure definitions containing fields with one of these names. Undefining those macros would break some consumers as well.Example 1:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; /* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */It is proposed to rename the conflicting fields on DPDK side, because Win32 API has wider use and is slower and harder to change.
Quoted 6 lines
New names are left unspecified, open suggestions:
*
struct rte_ether_hdr(by Stephen Hemminger):*
s_addr->ether_shost
*d_addr->ether_dhost(for consistency)
I prefer "addr" over "host".
Quoted 9 lines
*
struct rte_param_log2_range,struct rte_crypto_param_range:*
min->minimum
*max->maximumFor
s_addr, a workaround is possible to use it until 21.11. Forminandmax, no workaround seems available. If cryptodev or compressdev is going to be enabled on Windows before 21.11, the only option seems to use a new name on Windows (using #ifdef).
I think we have enough work on ethdev until 21.11.
PATCH v3 1/1 doc: announce API changes for Windows compatibility
In reply to Dmitry KozlyukWindows system headers define s_addr, min, and max macros which break structure definitions containing fields with one of these names. Undefining those macros would break consumer code that relies on them.
Example 1:
#include <winsock2.h>
#include <rte_ether.h>
struct in_addr addr;
/* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */Example 2:
#include <rte_ether.h>
#include <winsock2.h>
struct rte_ether_hdr eh;
/* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */Commit 6c068dbd9fea ("net: work around s_addr macro on Windows") modified definition of struct rte_ether_hdr to avoid the issue. However, the workaround assumes #define s_addr S_addr.S_un in Windows headers, which is not a part of official API. It also complicates the definition of struct rte_ether_hdr.
For min and max, no workaround seems available. If cryptodev or compressdev is going to be enabled on Windows before 21.11, the only option seems to use a new name on Windows (using #ifdef).
It is proposed to rename the conflicting fields on DPDK side, because Win32 API has wider use and is slower and harder to change. Exact new names are left for further discussion.
---
v3: fix typos (Ferruh), remove naming speculation,
replace workaround snippet with commit reference.
doc/guides/rel_notes/deprecation.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
doc/guides/rel_notes/deprecation.rst +9 -0
@@ -147,3 +147,12 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. + +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. + +* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.
Signature · 1 line
2.29.3
Re: [dpdk-dev] [EXT] [PATCH v3] doc: announce API changes for Windows compatibility
Quoted 4 lines
Windows system headers define
s_addr,min, andmaxmacros which break structure definitions containing fields with one of these names. Undefining those macros would break consumer code that relies on them.
From the commit message the requirement for changing the structure definitions Is not clear. Please note that 'min' - 'max' are not macros. These are variables of a structure which should not break any other structure/Macro in windows.
Quoted 63 lines
Example 1:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; /* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */Commit
6c068dbd9fea("net: work arounds_addrmacro on Windows") modified definition ofstruct rte_ether_hdrto avoid the issue. However, the workaround assumes#define s_addr S_addr.S_unin Windows headers, which is not a part of official API. It also complicates the definition ofstruct rte_ether_hdr.For
minandmax, no workaround seems available. If cryptodev or compressdev is going to be enabled on Windows before 21.11, the only option seems to use a new name on Windows (using #ifdef).It is proposed to rename the conflicting fields on DPDK side, because Win32 API has wider use and is slower and harder to change. Exact new names are left for further discussion.
Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Khoa To <[email protected]>---
v3: fix typos (Ferruh), remove naming speculation,
replace workaround snippet with commit reference.doc/guides/rel_notes/deprecation.rst | 9 +++++++++ 1 file changed, 9 insertions(+)doc/guides/rel_notes/deprecation.rst +0
-0@@ -147,3 +147,12 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific
content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11.doc/guides/rel_notes/deprecation.rst +3
-0+ +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Socketsheaders.
doc/guides/rel_notes/deprecation.rst +2
-0+ +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range``structure
+ will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.doc/guides/rel_notes/deprecation.rst +2
-0+ +* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range``structure
+ will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.
--
2.29.3
Re: [dpdk-dev] [EXT] [PATCH v3] doc: announce API changes for Windows compatibility
2021-05-20 18:59 (UTC+0000), Akhil Goyal:
Quoted 8 lines
Quoted 4 lines
Windows system headers define
s_addr,min, andmaxmacros which break structure definitions containing fields with one of these names. Undefining those macros would break consumer code that relies on them.From the commit message the requirement for changing the structure definitions Is not clear. Please note that 'min' - 'max' are not macros. These are variables of a structure which should not break any other structure/Macro in windows.
Err, yes, that's what the commit message says.
Structure fields of course break nothing; they are broken by Windows macros. Would this make more sense?
Windows headers define s_addr, min, and max as macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken. If DPDK headers undefined these macros, it could break consumer code relying on these macros. It is proposed to rename structure fields in DPDK, because Win32 headers are more widely used and harder to fix.
Re: [dpdk-dev] [EXT] [PATCH v3] doc: announce API changes for Windows compatibility
Quoted 20 lines
2021-05-20 18:59 (UTC+0000), Akhil Goyal:
Quoted 3 lines
Quoted 3 lines
Windows system headers define
s_addr,min, andmaxmacros which break structure definitions containing fields with one of these names. Undefining those macros would break consumer code that relies onthem.
Quoted 3 lines
Quoted 1 line
From the commit message the requirement for changing the structure
definitions
Quoted 1 line
Is not clear. Please note that 'min' - 'max' are not macros. These are
variables of a
Quoted 1 line
structure which should not break any other structure/Macro in windows.
Err, yes, that's what the commit message says.
Structure fields of course break nothing; they are broken by Windows macros.
Would this make more sense?
Quoted 8 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken. If DPDK headers undefined these macros, it could break consumer
code
relying on these macros. It is proposed to rename structure fields in DPDK, because Win32 headers are more widely used and harder
to fix.
Yes it makes more sense now. But ideally it should be fixed in windows. This may be just one such issue, there may be many more. Will this also mean that nobody can define a local variable 'min'? Is this acceptable?
Any macro definition in a subsystem should have a prefix to denote that, Just like in DPDK 'RTE_' is added.
Macros with generic names should be avoided so that we do not get into these issues.
Adding more people for comments. I don't have a good feeling about this change.
Re: [dpdk-dev] [EXT] [PATCH v3] doc: announce API changes for Windows compatibility
2021-05-20 20:17 (UTC+0000), Akhil Goyal:
Quoted 29 lines
Quoted 20 lines
2021-05-20 18:59 (UTC+0000), Akhil Goyal:
Quoted 3 lines
Quoted 3 lines
Windows system headers define
s_addr,min, andmaxmacros which break structure definitions containing fields with one of these names. Undefining those macros would break consumer code that relies onthem.
Quoted 3 lines
Quoted 1 line
From the commit message the requirement for changing the structure
definitions
Quoted 1 line
Is not clear. Please note that 'min' - 'max' are not macros. These are
variables of a
Quoted 1 line
structure which should not break any other structure/Macro in windows.
Err, yes, that's what the commit message says.
Structure fields of course break nothing; they are broken by Windows macros.
Would this make more sense?Quoted 8 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken. If DPDK headers undefined these macros, it could break consumer
code
relying on these macros. It is proposed to rename structure fields in DPDK, because Win32 headers are more widely used and harder
to fix.
Quoted 4 lines
Yes it makes more sense now. But ideally it should be fixed in windows. This may be just one such issue, there may be many more. Will this also mean that nobody can define a local variable 'min'? Is this acceptable?
Only in public headers. There happens to be one such, rte_lru_x86.h.
Quoted 7 lines
Any macro definition in a subsystem should have a prefix to denote that, Just like in DPDK '
RTE_' is added.
Macros with generic names should be avoided so that we do not get into these issues.Adding more people for comments. I don't have a good feeling about this change.
Friendly ping to everyone Akhil cc'ed.
As far as I understand, if we want to fix it in 21.11, deprecation notice should make it into 21.08.
Re: [dpdk-dev] [EXT] [PATCH v3] doc: announce API changes for Windows compatibility
2021-06-09 18:52 (UTC+0300), Dmitry Kozlyuk:
Quoted 42 lines
2021-05-20 20:17 (UTC+0000), Akhil Goyal:
Quoted 29 lines
Quoted 20 lines
2021-05-20 18:59 (UTC+0000), Akhil Goyal:
Quoted 3 lines
Quoted 3 lines
Windows system headers define
s_addr,min, andmaxmacros which break structure definitions containing fields with one of these names. Undefining those macros would break consumer code that relies onthem.
Quoted 3 lines
Quoted 1 line
From the commit message the requirement for changing the structure
definitions
Quoted 1 line
Is not clear. Please note that 'min' - 'max' are not macros. These are
variables of a
Quoted 1 line
structure which should not break any other structure/Macro in windows.
Err, yes, that's what the commit message says.
Structure fields of course break nothing; they are broken by Windows macros.
Would this make more sense?Quoted 8 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken. If DPDK headers undefined these macros, it could break consumer
code
relying on these macros. It is proposed to rename structure fields in DPDK, because Win32 headers are more widely used and harder
to fix.Quoted 4 lines
Yes it makes more sense now. But ideally it should be fixed in windows. This may be just one such issue, there may be many more. Will this also mean that nobody can define a local variable 'min'? Is this acceptable?
Only in public headers. There happens to be one such,
rte_lru_x86.h.Quoted 5 lines
Any macro definition in a subsystem should have a prefix to denote that, Just like in DPDK '
RTE_' is added.
Macros with generic names should be avoided so that we do not get into these issues.
Quoted 6 lines
Quoted 2 lines
Adding more people for comments. I don't have a good feeling about this change.
Friendly ping to everyone Akhil cc'ed.
As far as I understand, if we want to fix it in 21.11, deprecation notice should make it into 21.08.
Friendly ping v2.
Hopefully Tyler's answer will help with the decision.
Re: [dpdk-dev] [EXT] [PATCH v3] doc: announce API changes for Windows compatibility
In reply to Akhil GoyalQuoted 3 lines · Akhil Goyal
Quoted 1 line
Yes it makes more sense now. But ideally it should be fixed in windows.
they won't be fixed in windows. it is extremely rare to withdraw something from a platform headers namespace and is avoided to maintain API compatibility no matter how horrible these macros are.
Quoted 2 lines
This may be just one such issue, there may be many more. Will this also mean that nobody can define a local variable 'min'?
that is correct. As well as a long list of other commonly used names not only from windows but other platform headers, standard library headers and keywords.
Quoted 2 lines
Any macro definition in a subsystem should have a prefix to denote that, Just like in DPDK '
RTE_' is added.
completely agree, best practice would be to avoid contaminating the applications namespace.
Quoted 5 lines
Macros with generic names should be avoided so that we do not get into these issues.
Adding more people for comments. I don't have a good feeling about this change.
there is no real choice, the platform header won't be "fixed" so it has to be dealt with and even thinking you can avoid it by just not including windows.h here keep in mind the consuming application will have to anyway so it's difficult to avoid.
PATCH v3 1/1 doc: announce API changes for Windows compatibility
In reply to Dmitry KozlyukWindows system headers define s_addr, min, and max macros which break structure definitions containing fields with one of these names. Undefining those macros would break consumer code that relies on them.
Example 1:
#include <winsock2.h>
#include <rte_ether.h>
struct in_addr addr;
/* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */Example 2:
#include <rte_ether.h>
#include <winsock2.h>
struct rte_ether_hdr eh;
/* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */Commit 6c068dbd9fea ("net: work around s_addr macro on Windows") modified definition of struct rte_ether_hdr to avoid the issue. However, the workaround assumes #define s_addr S_addr.S_un in Windows headers, which is not a part of official API. It also complicates the definition of struct rte_ether_hdr.
For min and max, no workaround seems available. If cryptodev or compressdev is going to be enabled on Windows before 21.11, the only option seems to use a new name on Windows (using #ifdef).
It is proposed to rename the conflicting fields on DPDK side, because Win32 API has wider use and is slower and harder to change. Exact new names are left for further discussion.
---
v3: fix typos (Ferruh), remove naming speculation,
replace workaround snippet with commit reference.
doc/guides/rel_notes/deprecation.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
doc/guides/rel_notes/deprecation.rst +9 -0
@@ -147,3 +147,12 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. + +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. + +* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.
Signature · 1 line
2.29.3
PATCH v4 1/1 doc: announce API changes for Windows compatibility
Windows headers define s_addr, min, and max as macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken (example 1), as well as any usage of such fields (example 2). If DPDK headers undefined these macros, it could break consumer code (example 3). It is proposed to rename structure fields in DPDK, because Win32 headers are used more widely than DPDK, as a general-purpose platform compared to domain-specific kit, and are harder to fix because of that. Exact new names are left for further discussion.
Example 1:
/* in DPDK public header included after windows.h */
struct rte_type {
int min; /* ERROR: `min` is a macro */
};Example 2:
#include <rte_ether.h>
#include <winsock2.h>
struct rte_ether_hdr eh;
eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */Example 3:
#include <winsock2.h>
#include <rte_ether.h>
struct in_addr addr;
addr.s_addr = 0; /* ERROR: there is no `s_addr` field,
and `s_addr` macro is undefined by DPDK. */Commit 6c068dbd9fea ("net: work around s_addr macro on Windows") modified definition of struct rte_ether_hdr to avoid the issue. However, the workaround assumes #define s_addr S_addr.S_un in Windows headers, which is not a part of official API. It also complicates the definition of struct rte_ether_hdr.
---
v4: improve wording (Akhil).
v3: fix typos (Ferruh), remove naming speculation,
replace workaround snippet with commit reference.
doc/guides/rel_notes/deprecation.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
doc/guides/rel_notes/deprecation.rst +9 -0
@@ -147,3 +147,12 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. + +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. + +* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.
Signature · 1 line
2.29.3
Re: [dpdk-dev] [PATCH v4] doc: announce API changes for Windows compatibility
21/07/2021 21:55, Dmitry Kozlyuk:
Quoted 41 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken (example 1), as well as any usage of such fields (example 2). If DPDK headers undefined these macros, it could break consumer code (example 3). It is proposed to rename structure fields in DPDK, because Win32 headers are used more widely than DPDK, as a general-purpose platform compared to domain-specific kit, and are harder to fix because of that. Exact new names are left for further discussion.Example 1:
/* in DPDK public header included after windows.h */ struct rte_type { int min; /* ERROR: `min` is a macro */ };Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */Example 3:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; addr.s_addr = 0; /* ERROR: there is no `s_addr` field, and `s_addr` macro is undefined by DPDK. */Commit
6c068dbd9fea("net: work arounds_addrmacro on Windows") modified definition ofstruct rte_ether_hdrto avoid the issue. However, the workaround assumes#define s_addr S_addr.S_unin Windows headers, which is not a part of official API. It also complicates the definition ofstruct rte_ether_hdr.Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Khoa To <[email protected]>---
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 155
Quoted 5 lines
doc/guides/rel_notes/deprecation.rst +5
-0+* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers. + +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.
The struct rte_param_log2_range should also be renamed to include "compress" prefix. But as we break the struct API, it is not an issue I guess.
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 158
Quoted 2 lines
doc/guides/rel_notes/deprecation.rst +2
-0+* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets headers.
Re: [dpdk-dev] [EXT] Re: [PATCH v4] doc: announce API changes for Windows compatibility
Quoted 55 lines
21/07/2021 21:55, Dmitry Kozlyuk:
Quoted 41 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken (example 1), as well as any usage of such fields (example 2). If DPDK headers undefined these macros, it could break consumer code (example 3). It is proposed to rename structure fields in DPDK, because Win32 headers are used more widely than DPDK, as a general-purpose platform compared to domain-specific kit, and are harder to fix because of that. Exact new names are left for further discussion.Example 1:
/* in DPDK public header included after windows.h */ struct rte_type { int min; /* ERROR: `min` is a macro */ };Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */Example 3:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; addr.s_addr = 0; /* ERROR: there is no `s_addr` field, and `s_addr` macro is undefined by DPDK. */Commit
6c068dbd9fea("net: work arounds_addrmacro on Windows") modified definition ofstruct rte_ether_hdrto avoid the issue. However, the workaround assumes#define s_addr S_addr.S_unin Windows headers, which is not a part of official API. It also complicates the definition ofstruct rte_ether_hdr.Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Khoa To <[email protected]>---
Review
Quoted 2 lines
(quoted diff) +2
-0+* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Socketsheaders.
Review
Quoted 2 lines
(quoted diff) +2
-0+ +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range``structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets
headers.
The struct
rte_param_log2_rangeshould also be renamed to include "compress" prefix.
But as we break the struct API, it is not an issue I guess.
Quoted 7 lines
Quoted 1 line
+* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range``
structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets
headers.
Acked-by Thomas Monjalon <[email protected]>
Can we have a local variable named as min/max?
If not, then I believe it is not a good idea.
Re: [dpdk-dev] [EXT] Re: [PATCH v4] doc: announce API changes for Windows compatibility
2021-08-02 12:45 (UTC+0000), Akhil Goyal:
Quoted 56 lines
Quoted 56 lines
21/07/2021 21:55, Dmitry Kozlyuk:
Quoted 41 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken (example 1), as well as any usage of such fields (example 2). If DPDK headers undefined these macros, it could break consumer code (example 3). It is proposed to rename structure fields in DPDK, because Win32 headers are used more widely than DPDK, as a general-purpose platform compared to domain-specific kit, and are harder to fix because of that. Exact new names are left for further discussion.Example 1:
/* in DPDK public header included after windows.h */ struct rte_type { int min; /* ERROR: `min` is a macro */ };Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */Example 3:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; addr.s_addr = 0; /* ERROR: there is no `s_addr` field, and `s_addr` macro is undefined by DPDK. */Commit
6c068dbd9fea("net: work arounds_addrmacro on Windows") modified definition ofstruct rte_ether_hdrto avoid the issue. However, the workaround assumes#define s_addr S_addr.S_unin Windows headers, which is not a part of official API. It also complicates the definition ofstruct rte_ether_hdr.Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Khoa To <[email protected]>---
Review
Quoted 2 lines
(quoted diff) +2
-0+* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with Windows Socketsheaders.
Review
Quoted 2 lines
(quoted diff) +2
-0+ +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range``structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets
headers.
The struct
rte_param_log2_rangeshould also be renamed to include "compress" prefix.
But as we break the struct API, it is not an issue I guess.Quoted 1 line
+* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range``
Quoted 8 lines
Quoted 6 lines
structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows Sockets
headers.
Acked-by Thomas Monjalon <[email protected]>Can we have a local variable named as min/max?
If not, then I believe it is not a good idea.
Yes, except for inline functions in public headers. The only problematic one I know of is this (rte_lru_x86.h):
static inline intf_lru_pos(uint64_t lru_list)
{
__m128i lst = _mm_set_epi64x((uint64_t)-1, lru_list);
__m128i min = _mm_minpos_epu16(lst); /* <<< */
return _mm_extract_epi16(min, 1);
}Fixing it breaks neither API nor ABI, thus no explicit deprecation notice.
Akhil Goyal
Acked-byRe: [dpdk-dev] [EXT] Re: [PATCH v4] doc: announce API changes for Windows compatibility
Quoted 76 lines
2021-08-02 12:45 (UTC+0000), Akhil Goyal:
Quoted 7 lines
Quoted 7 lines
21/07/2021 21:55, Dmitry Kozlyuk:
Quoted 6 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken (example 1), as well as any usage of such fields (example 2). If DPDK headers undefined these macros, it could break consumer code (example 3). It is proposed to rename structure fields in DPDK, because Win32headers
Quoted 1 line
Quoted 1 line
Quoted 1 line
are used more widely than DPDK, as a general-purpose platform
compared
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
to domain-specific kit, and are harder to fix because of that. Exact new names are left for further discussion.
Example 1:
/* in DPDK public header included after windows.h */ struct rte_type { int min; /* ERROR: `min` is a macro */ };Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */Example 3:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; addr.s_addr = 0; /* ERROR: there is no `s_addr` field, and `s_addr` macro is undefined by DPDK. */Commit
6c068dbd9fea("net: work arounds_addrmacro on Windows") modified definition ofstruct rte_ether_hdrto avoid the issue. However, the workaround assumes#define s_addr S_addr.S_unin Windows headers, which is not a part of official API. It also complicates the definition ofstruct rte_ether_hdr.Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Khoa To <[email protected]>---
(quoted diff) +2
-0+* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed in DPDK 21.11 to avoid conflict with WindowsSockets
Quoted 5 lines
Quoted 5 lines
headers.
Review
Quoted 2 lines
(quoted diff) +2
-0+ +* compressdev: ``min`` and ``max`` fields of ``rte_param_log2_range``structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows
Sockets
Quoted 9 lines
Quoted 9 lines
headers.
The struct
rte_param_log2_rangeshould also be renamed to include "compress" prefix.
But as we break the struct API, it is not an issue I guess.Quoted 1 line
+* cryptodev: ``min`` and ``max`` fields of ``rte_crypto_param_range``
structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows
Sockets
Quoted 6 lines
Quoted 4 lines
headers.
Acked-by Thomas Monjalon <[email protected]>Can we have a local variable named as min/max?
If not, then I believe it is not a good idea.Yes, except for inline functions in public headers. The only problematic one I know of is this (
rte_lru_x86.h):static inline int
f_lru_pos(uint64_t lru_list)
Quoted 7 lines
{ __m128i lst = _mm_set_epi64x((uint64_t)-1, lru_list); __m128i min = _mm_minpos_epu16(lst); /* <<< */ return _mm_extract_epi16(min, 1); }Fixing it breaks neither API nor ABI, thus no explicit deprecation notice.
OK,
I hope when windows compilation is enabled, it will be part of CI and it will run on each patch which goes to patchworks.
Re: [dpdk-dev] [EXT] Re: [PATCH v4] doc: announce API changes for Windows compatibility
Quoted 93 lines
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v4] doc: announce API changes for Windows compatibility
External email: Use caution opening links or attachments
Quoted 7 lines
2021-08-02 12:45 (UTC+0000), Akhil Goyal:
Quoted 6 lines
Quoted 6 lines
21/07/2021 21:55, Dmitry Kozlyuk:
Quoted 5 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken (example 1), as well as any usage of such fields (example 2). If DPDK headers undefined these macros, it could break consumer code(example 3).
Quoted 31 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
It is proposed to rename structure fields in DPDK, because Win32
headers
Quoted 1 line
Quoted 1 line
Quoted 1 line
are used more widely than DPDK, as a general-purpose platform
compared
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
to domain-specific kit, and are harder to fix because of that. Exact new names are left for further discussion.
Example 1:
/* in DPDK public header included after windows.h */ struct rte_type { int min; /* ERROR: `min` is a macro */ };Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */Example 3:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; addr.s_addr = 0; /* ERROR: there is no `s_addr` field, and `s_addr` macro is undefined byDPDK. */
Commit
6c068dbd9fea("net: work arounds_addrmacro onWindows")
Quoted 47 lines
Quoted 11 lines
Quoted 11 lines
Review
Quoted 11 lines
modified definition of
struct rte_ether_hdrto avoid the issue. However, the workaround assumes#define s_addr S_addr.S_unin Windows headers, which is not a part of official API. It also complicates the definition ofstruct rte_ether_hdr.Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Khoa To <[email protected]>---
(quoted diff) +3
-0+* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` +structure + will be renamed in DPDK 21.11 to avoid conflict with WindowsSockets
Quoted 6 lines
Quoted 6 lines
headers.
Review
Quoted 3 lines
(quoted diff) +3
-0+ +* compressdev: ``min`` and ``max`` fields of +``rte_param_log2_range``structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows
Sockets
Quoted 10 lines
Quoted 10 lines
headers.
The struct
rte_param_log2_rangeshould also be renamed to include "compress" prefix.
But as we break the struct API, it is not an issue I guess.Quoted 2 lines
+* cryptodev: ``min`` and ``max`` fields of
+``rte_crypto_param_range``structure
Quoted 1 line
+ will be renamed in DPDK 21.11 to avoid conflict with Windows
Sockets
Quoted 6 lines
Quoted 4 lines
headers.
Acked-by Thomas Monjalon <[email protected]>Can we have a local variable named as min/max?
If not, then I believe it is not a good idea.Yes, except for inline functions in public headers. The only problematic one I know of is this (
rte_lru_x86.h):static inline int
f_lru_pos(uint64_t lru_list){ __m128i lst = _mm_set_epi64x((uint64_t)-1, lru_list); __m128i min = _mm_minpos_epu16(lst); /* <<< */ return _mm_extract_epi16(min, 1); }
Quoted 6 lines
Quoted 1 line
Fixing it breaks neither API nor ABI, thus no explicit deprecation notice.
OK,
Acked-by Akhil Goyal <[email protected]>I hope when windows compilation is enabled, it will be part of CI and it will run on each patch which goes to patchworks.
Windows compilation is already part of CI in ci/iol-testing and ci/Intel-compilation.
Thomas Monjalon
AppliedRe: [dpdk-dev] [EXT] Re: [PATCH v4] doc: announce API changes for Windows compatibility
In reply to Akhil Goyal02/08/2021 15:48, Akhil Goyal:
Quoted 44 lines
Quoted 44 lines
2021-08-02 12:45 (UTC+0000), Akhil Goyal:
Quoted 7 lines
Quoted 7 lines
21/07/2021 21:55, Dmitry Kozlyuk:
Quoted 6 lines
Windows headers define
s_addr,min, andmaxas macros. If DPDK headers are included after Windows ones, DPDK structure definitions containing fields with these names get broken (example 1), as well as any usage of such fields (example 2). If DPDK headers undefined these macros, it could break consumer code (example 3). It is proposed to rename structure fields in DPDK, because Win32headers
Quoted 1 line
Quoted 1 line
Quoted 1 line
are used more widely than DPDK, as a general-purpose platform
compared
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
to domain-specific kit, and are harder to fix because of that. Exact new names are left for further discussion.
Example 1:
/* in DPDK public header included after windows.h */ struct rte_type { int min; /* ERROR: `min` is a macro */ };Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; eh.s_addr.addr_bytes[0] = 0; /* ERROR: `addr_s` is a macro */Example 3:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; addr.s_addr = 0; /* ERROR: there is no `s_addr` field, and `s_addr` macro is undefined by DPDK. */Commit
6c068dbd9fea("net: work arounds_addrmacro on Windows") modified definition ofstruct rte_ether_hdrto avoid the issue. However, the workaround assumes#define s_addr S_addr.S_unin Windows headers, which is not a part of official API. It also complicates the definition ofstruct rte_ether_hdr.Signed-off-by Dmitry Kozlyuk <[email protected]>Acked-by Khoa To <[email protected]>
[...]
Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
Quoted 2 lines
Acked-by Thomas Monjalon <[email protected]>Can we have a local variable named as min/max?
If not, then I believe it is not a good idea.Yes, except for inline functions in public headers. The only problematic one I know of is this (
rte_lru_x86.h):static inline int
f_lru_pos(uint64_t lru_list){ __m128i lst = _mm_set_epi64x((uint64_t)-1, lru_list); __m128i min = _mm_minpos_epu16(lst); /* <<< */ return _mm_extract_epi16(min, 1); }
Quoted 3 lines
Quoted 1 line
Fixing it breaks neither API nor ABI, thus no explicit deprecation notice.
OK,
Acked-by Akhil Goyal <[email protected]>
Applied, thanks.
Quoted 2 lines · Dmitry Kozlyuk
It is proposed to rename fields of
struct rte_ether_hdr,s_addrtpsrc_addrandd_addrtodst_addr,
s/tp/to/
Quoted 2 lines
due to the clash with system macro on Windows. Until remaining is done in 21.11, a workaround can be used.
s/remaining/renaming/ ??
Quoted 13 lines
Windows Sockets headers contain
#define s_addr S_un.S_addr, which conflicts withs_addrfield ofstruct rte_ether_hdr. Undefining this macro in <rte_ether.h> is breaking some usages of DPDK and Windows headers in one file.Example 1:
#include <winsock2.h> #include <rte_ether.h> struct in_addr addr; /* addr.s_addr = 0; ERROR: s_addr undefined by DPDK */
Quoted 6 lines
Example 2:
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0; ERROR: `addr_s` is a macro */
s/addr_s/s_addr/ ??
Quoted 20 lines
It is not mandatory to rename
d_addr, this is for consistency only. Naming inrte_ether_hdrwill also resemblerte_ipv4/6_hdr.Workaround is to define
struct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows) This can be done for Windows only or for all platforms to save space.#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un;
Quoted 9 lines
/**< MUST NOT be used directly, only via s_addr */
} S_addr;
/*< MUST NOT be used directly, only via s_addr */
};
uint16_t ether_type; /**< Frame type. */
} __rte_aligned(2);
#pragma pop_macro("s_addr")What is the problem with the workaround, why we can't live with it?
It requires an order in include files, right?
Quoted 10 lines
Signed-off-by Dmitry Kozlyuk <[email protected]>--- doc/guides/rel_notes/deprecation.rst | 4 ++++ 1 file changed, 4 insertions(+)doc/guides/rel_notes/deprecation.rst +0
-0
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 130
Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +3
-0@@ -125,3 +125,7 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* net: ``s_addr`` and ``d_addr`` fields of ``rte_ether_hdr`` structure + will be renamed to ``src_addr`` and ``dst_addr`` respectively in DPDK 20.11
v21.11
Quoted 2 lines
doc/guides/rel_notes/deprecation.rst +1
-0+ in order to avoid conflict with Windows Sockets headers.
2021-05-20 15:24 (UTC+0100), Ferruh Yigit:
Quoted 1 line · Dmitry Kozlyuk
[...]
Quoted 27 lines
Quoted 27 lines
It is not mandatory to rename
d_addr, this is for consistency only. Naming inrte_ether_hdrwill also resemblerte_ipv4/6_hdr.Workaround is to define
struct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows) This can be done for Windows only or for all platforms to save space.#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un; /**< MUST NOT be used directly, only via s_addr */ } S_addr; /*< MUST NOT be used directly, only via s_addr */ }; uint16_t ether_type; /**< Frame type. */ } __rte_aligned(2);
Quoted 6 lines
Quoted 2 lines
#pragma pop_macro("s_addr")What is the problem with the workaround, why we can't live with it?
It requires an order in include files, right?
There's no problem except a tricky structure definition with fields that violate DPDK coding rules. It works with any include order.
Will fix typos in v3, thanks.
Quoted 33 lines · Dmitry Kozlyuk
2021-05-20 15:24 (UTC+0100), Ferruh Yigit:
Quoted 1 line · Dmitry Kozlyuk
[...]
Quoted 30 lines
Quoted 29 lines
It is not mandatory to rename
d_addr, this is for consistency only. Naming inrte_ether_hdrwill also resemblerte_ipv4/6_hdr.Workaround is to define
struct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows) This can be done for Windows only or for all platforms to save space.#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un; /**< MUST NOT be used directly, only via s_addr */ } S_addr; /*< MUST NOT be used directly, only via s_addr */ }; uint16_t ether_type; /**< Frame type. */ } __rte_aligned(2); #pragma pop_macro("s_addr")
Quoted 9 lines
Quoted 3 lines
What is the problem with the workaround, why we can't live with it?
It requires an order in include files, right?
There's no problem except a tricky structure definition with fields that violate DPDK coding rules. It works with any include order.
Will fix typos in v3, thanks.
For following case, won't compiler take 's_addr' as macro?
#include <rte_ether.h>
#include <winsock2.h>
struct rte_ether_hdr eh;
/* eh.s_addr.addr_bytes[0] = 0;2021-05-20 16:27 (UTC+0100), Ferruh Yigit:
Quoted 44 lines · Dmitry Kozlyuk
Quoted 33 lines
2021-05-20 15:24 (UTC+0100), Ferruh Yigit:
Quoted 1 line · Dmitry Kozlyuk
[...]
Quoted 30 lines
Quoted 29 lines
It is not mandatory to rename
d_addr, this is for consistency only. Naming inrte_ether_hdrwill also resemblerte_ipv4/6_hdr.Workaround is to define
struct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows) This can be done for Windows only or for all platforms to save space.#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un; /**< MUST NOT be used directly, only via s_addr */ } S_addr; /*< MUST NOT be used directly, only via s_addr */ }; uint16_t ether_type; /**< Frame type. */ } __rte_aligned(2); #pragma pop_macro("s_addr")Quoted 9 lines
Quoted 3 lines
What is the problem with the workaround, why we can't live with it?
It requires an order in include files, right?
There's no problem except a tricky structure definition with fields that violate DPDK coding rules. It works with any include order.
Will fix typos in v3, thanks.
Quoted 7 lines
For following case, won't compiler take '
s_addr' as macro?#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0;
Yes, it will. The macro will expand to S_addr.S_un and compile successfully. In theory, Microsoft can change the definition of s_addr, and while I doubt they will, it's a valid concern and a reason to remove workaround in 21.11.
Quoted 47 lines · Dmitry Kozlyuk
2021-05-20 16:27 (UTC+0100), Ferruh Yigit:
Quoted 46 lines · Dmitry Kozlyuk
Quoted 33 lines
2021-05-20 15:24 (UTC+0100), Ferruh Yigit:
Quoted 1 line · Dmitry Kozlyuk
[...]
Quoted 30 lines
Quoted 29 lines
It is not mandatory to rename
d_addr, this is for consistency only. Naming inrte_ether_hdrwill also resemblerte_ipv4/6_hdr.Workaround is to define
struct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows) This can be done for Windows only or for all platforms to save space.#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un; /**< MUST NOT be used directly, only via s_addr */ } S_addr; /*< MUST NOT be used directly, only via s_addr */ }; uint16_t ether_type; /**< Frame type. */ } __rte_aligned(2); #pragma pop_macro("s_addr")Quoted 9 lines
Quoted 3 lines
What is the problem with the workaround, why we can't live with it?
It requires an order in include files, right?
There's no problem except a tricky structure definition with fields that violate DPDK coding rules. It works with any include order.
Will fix typos in v3, thanks.
For following case, won't compiler take '
s_addr' as macro?
Quoted 7 lines
Quoted 5 lines
#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0;Yes, it will. The macro will expand to
S_addr.S_unand compile successfully.
will 'eh.S_addr.S_un.addr_bytes[0] = 0;' compile successfully?
Quoted 3 lines
In theory, Microsoft can change the definition of
s_addr, and while I doubt they will, it's a valid concern and a reason to remove workaround in 21.11.
2021-05-20 17:04 (UTC+0100), Ferruh Yigit:
Quoted 54 lines · Dmitry Kozlyuk
Quoted 53 lines
2021-05-20 16:27 (UTC+0100), Ferruh Yigit:
Quoted 51 lines · Dmitry Kozlyuk
Quoted 33 lines
2021-05-20 15:24 (UTC+0100), Ferruh Yigit:
Quoted 1 line · Dmitry Kozlyuk
[...]
Quoted 30 lines
Quoted 29 lines
It is not mandatory to rename
d_addr, this is for consistency only. Naming inrte_ether_hdrwill also resemblerte_ipv4/6_hdr.Workaround is to define
struct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows) This can be done for Windows only or for all platforms to save space.#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un; /**< MUST NOT be used directly, only via s_addr */ } S_addr; /*< MUST NOT be used directly, only via s_addr */ }; uint16_t ether_type; /**< Frame type. */ } __rte_aligned(2); #pragma pop_macro("s_addr")Quoted 9 lines
Quoted 3 lines
What is the problem with the workaround, why we can't live with it?
It requires an order in include files, right?
There's no problem except a tricky structure definition with fields that violate DPDK coding rules. It works with any include order.
Will fix typos in v3, thanks.
For following case, won't compiler take '
s_addr' as macro?#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0;
Quoted 3 lines
Quoted 1 line
Yes, it will. The macro will expand to
S_addr.S_unand compile successfully.will 'eh.S_addr.S_un.addr_bytes[0] = 0;' compile successfully?
Yes, only it's S_un.S_addr, sorry for the typo in my explanation. Both code snippets from commit message compile successfully.
Quoted 5 lines
Quoted 4 lines
In theory, Microsoft can change the definition of
s_addr, and while I doubt they will, it's a valid concern and a reason to remove workaround in 21.11.
Quoted 55 lines · Dmitry Kozlyuk
2021-05-20 17:04 (UTC+0100), Ferruh Yigit:
Quoted 54 lines · Dmitry Kozlyuk
Quoted 53 lines
2021-05-20 16:27 (UTC+0100), Ferruh Yigit:
Quoted 51 lines · Dmitry Kozlyuk
Quoted 33 lines
2021-05-20 15:24 (UTC+0100), Ferruh Yigit:
Quoted 1 line · Dmitry Kozlyuk
[...]
Quoted 30 lines
Quoted 29 lines
It is not mandatory to rename
d_addr, this is for consistency only. Naming inrte_ether_hdrwill also resemblerte_ipv4/6_hdr.Workaround is to define
struct rte_ether_hdrin such a away that it can be used with or withouts_addrmacro (as defined on Windows) This can be done for Windows only or for all platforms to save space.#pragma push_macro("s_addr") #ifdef s_addr #undef s_addr #endif struct rte_ether_hdr { struct rte_ether_addr d_addr; /**< Destination address. */ RTE_STD_C11 union { struct rte_ether_addr s_addr; /**< Source address. */ struct { struct rte_ether_addr S_un; /**< MUST NOT be used directly, only via s_addr */ } S_addr; /*< MUST NOT be used directly, only via s_addr */ }; uint16_t ether_type; /**< Frame type. */ } __rte_aligned(2); #pragma pop_macro("s_addr")Quoted 9 lines
Quoted 3 lines
What is the problem with the workaround, why we can't live with it?
It requires an order in include files, right?
There's no problem except a tricky structure definition with fields that violate DPDK coding rules. It works with any include order.
Will fix typos in v3, thanks.
For following case, won't compiler take '
s_addr' as macro?#include <rte_ether.h> #include <winsock2.h> struct rte_ether_hdr eh; /* eh.s_addr.addr_bytes[0] = 0;
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Yes, it will. The macro will expand to
S_addr.S_unand compile successfully.will 'eh.S_addr.S_un.addr_bytes[0] = 0;' compile successfully?
Yes, only it's
S_un.S_addr, sorry for the typo in my explanation. Both code snippets from commit message compile successfully.
Ah, I was missing the union on the struct, yes it will build,
And +1 to deprecation notice and clean the "struct rte_ether_hdr" whenever possible.
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
In theory, Microsoft can change the definition of
s_addr, and while I doubt they will, it's a valid concern and a reason to remove workaround in 21.11.