Skip to contentSkip to conversation

eal/windows: definition for ETOOMANYREFS errno

PATCH Superseded Tal Shnaiderman 4 participants 14 messages Nov 14, 2020 – Nov 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal/windows: definition for ETOOMANYREFS errno

The ETOOMANYREFS errno is missing from the Windows clang build is it used in initialization of flow error structures.

The commit will define it as it is done in the minGW Windows build.

---
 lib/librte_eal/windows/include/rte_os.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/windows/include/rte_os.h +1 -0
index 569ed92d51..2a91ebf6a1 100644
@@ -90,6 +90,7 @@ eal_strerror(int code)
 }
 
 #define strerror eal_strerror
+#define ETOOMANYREFS WSAETOOMANYREFS
 
 #endif /* RTE_TOOLCHAIN_GCC */
 
Signature · 1 line
2.16.1.windows.4
#1 lore raw
Quoted 2 lines · Tal Shnaiderman

The ETOOMANYREFS errno is missing from the Windows clang build is it used in initialization of flow error structures.

"is it" -> "it is"

Quoted 1 line

The commit will define it as it is done in the minGW Windows build.

"The commit will" is unnecessary.

"minGW" -> "MinGW"

Quoted 10 lines
---
 lib/librte_eal/windows/include/rte_os.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/windows/include/rte_os.h +0 -0
index 569ed92d51..2a91ebf6a1 100644

lib/librte_eal/windows/include/rte_os.h eal_strerror(int code) · line 95

Quoted 6 lines
lib/librte_eal/windows/include/rte_os.h +1 -0
@@ -90,6 +90,7 @@ eal_strerror(int code)
 }
 
 #define strerror eal_strerror
+#define ETOOMANYREFS WSAETOOMANYREFS
 
 #endif /* RTE_TOOLCHAIN_GCC */

Should be #define ETOOMANYREFS 10059 /* WSAETOOMANYREFS */ for all toolchains:

1. Users of librte_ethdev, who check for ETOOMANYREFS, may not wish to include <winsock2.h> because of its defines that break librte_net headers.

2. Now that I looked closely, MinGW-w64's #define ETOOMANYREFS WSAETOOMANYREFS is under #if 0 clause (for documentation?). Apologies for earlier misinformation.

#2 lore raw
Quoted 37 lines

Subject: Re: [PATCH] eal/windows: definition for ETOOMANYREFS errno

External email: Use caution opening links or attachments

Quoted 2 lines · Tal Shnaiderman

The ETOOMANYREFS errno is missing from the Windows clang build is it used in initialization of flow error structures.

"is it" -> "it is"

Quoted 1 line

The commit will define it as it is done in the minGW Windows build.

"The commit will" is unnecessary.

"minGW" -> "MinGW"

Quoted 11 lines
---
 lib/librte_eal/windows/include/rte_os.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/windows/include/rte_os.h +0 -0
index 569ed92d51..2a91ebf6a1 100644

lib/librte_eal/windows/include/rte_os.h eal_strerror(int code) } · line 94

Quoted 5 lines
lib/librte_eal/windows/include/rte_os.h +1 -0
@@ -90,6 +90,7 @@ eal_strerror(int code)  }
 
 #define strerror eal_strerror
+#define ETOOMANYREFS WSAETOOMANYREFS
 
 #endif /* RTE_TOOLCHAIN_GCC */

Should be #define ETOOMANYREFS 10059 /* WSAETOOMANYREFS */ for all toolchains:

Quoted 6 lines

1. Users of librte_ethdev, who check for ETOOMANYREFS, may not wish to include <winsock2.h> because of its defines that break librte_net headers.

2. Now that I looked closely, MinGW-w64's #define ETOOMANYREFS WSAETOOMANYREFS is under #if 0 clause (for documentation?). Apologies for earlier misinformation.

Thank you for the comments Dmitry, will send a v2 promptly.

#3 lore raw

14/11/2020 23:11, Tal Shnaiderman:

Quoted 11 lines
Quoted 11 lines · Tal Shnaiderman
Quoted 2 lines

The ETOOMANYREFS errno is missing from the Windows clang build is it used in initialization of flow error structures.

"is it" -> "it is"

Quoted 1 line

The commit will define it as it is done in the minGW Windows build.

"The commit will" is unnecessary.

"minGW" -> "MinGW"

[...]

Quoted 1 line

Thank you for the comments Dmitry, will send a v2 promptly.

Just a detail, I see you missed this comment in v2:
"The commit will" is unnecessary.

#4 lore raw
Quoted 16 lines

Subject: Re: [PATCH] eal/windows: definition for ETOOMANYREFS errno

External email: Use caution opening links or attachments

14/11/2020 23:11, Tal Shnaiderman:

Quoted 10 lines
Quoted 10 lines · Tal Shnaiderman
Quoted 2 lines

The ETOOMANYREFS errno is missing from the Windows clang build is it used in initialization of flow error structures.

"is it" -> "it is"

Quoted 1 line

The commit will define it as it is done in the minGW Windows build.

"The commit will" is unnecessary.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

"minGW" -> "MinGW"

[...]

Quoted 1 line

Thank you for the comments Dmitry, will send a v2 promptly.

Just a detail, I see you missed this comment in v2:
"The commit will" is unnecessary.

Yes I missed it, Thanks for noticing Thomas.

Quoted 1 line
#5 lore raw

PATCH v2 1/1 eal/windows: definition for ETOOMANYREFS errno

In reply to Tal Shnaiderman

The ETOOMANYREFS errno is missing from the Windows build. it is used in initialization of flow error structures.

The commit will define it with the same error code used by WSAETOOMANYREFS.

---
v2: log message fix, apply errno to both Windows builds and remove dependency on winsock2.h [DmitryK]
---

---
 lib/librte_eal/windows/include/rte_os.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_eal/windows/include/rte_os.h +2 -0
index 569ed92d51..8300ea483a 100644
@@ -51,6 +51,8 @@ extern "C" {
 /* as in <windows.h> */
 typedef long long ssize_t;
 
+#define ETOOMANYREFS 10059 /* WSAETOOMANYREFS */
+
 #ifndef RTE_TOOLCHAIN_GCC
 
 static inline int
Signature · 1 line
2.16.1.windows.4
Acked-by on v2 1/1
#6 lore raw
Quoted 11 lines · Tal Shnaiderman

The ETOOMANYREFS errno is missing from the Windows build. it is used in initialization of flow error structures.

The commit will define it with the same error code used by WSAETOOMANYREFS.

---
v2: log message fix, apply errno to both Windows builds and remove dependency on winsock2.h [DmitryK]

#7 lore raw

15/11/2020 00:13, Dmitry Kozlyuk:

Quoted 7 lines · Tal Shnaiderman
Quoted 6 lines

The ETOOMANYREFS errno is missing from the Windows build. it is used in initialization of flow error structures.

The commit will define it with the same error code used by WSAETOOMANYREFS.

Quoted 7 lines
Quoted 5 lines

---
v2: log message fix, apply errno to both Windows builds and remove dependency on winsock2.h [DmitryK]

Applied, thanks

#8 lore raw

[dpdk-dev] Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

Unfortunately, this change has broken the build for SPDK on Windows.

To use the DPDK libraries, an application needs to include the rte_* header, which includes rte_os.h via rte_common.h.  The definition of ETOOMANYREFS clashes with the value used when building the SPDK on Windows.

The fundamental issue here is how to support missing POSIX/Linux functionality.  If I understand correctly, the EAL should be responsible for providing all such functionality.  The support should be private to the EAL and only exported through rte_* definitions.

This means that rte_os.h should not include POSIX/Linux definitions to avoid clashes such as the one seen with this change.  It's clearly not sustainable if applications have to be modified every time we add more Windows support to the DPDK.

Note that this is not an isolated issue - most of the definitions in rte_os.h (redefining close, unlink, strdup etc) should not be present if other layers (application, other libraries, etc) are to be able to implement their own POSIX/Linux support.

Please can we back this change out until we have a strategy that allows us to make these definitions available for 'internal' use, but prevent them being visible outside of the DPDK tree.  If we can't wrap them with rte_* yet, perhaps the short term solution could be as simple as setting RTE_DEFINE_POSIX when building DPDK code and hiding them if it is not set?

Apologies that I didn't spot the issue earlier.

Thanks,
Nick

Quoted 17 lines · Thomas Monjalon

15/11/2020 00:13, Dmitry Kozlyuk:

Quoted 7 lines · Tal Shnaiderman
Quoted 6 lines

The ETOOMANYREFS errno is missing from the Windows build. it is used in initialization of flow error structures.

The commit will define it with the same error code used by WSAETOOMANYREFS.

Quoted 6 lines
Quoted 5 lines

---
v2: log message fix, apply errno to both Windows builds and remove dependency on winsock2.h [DmitryK]

Applied, thanks

#9 lore raw

Re: [dpdk-dev] Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

Hi Nick,

Quoted 9 lines

This means that rte_os.h should not include POSIX/Linux definitions to avoid clashes such as the one seen with this change.  It's clearly not sustainable if applications have to be modified every time we add more Windows support to the DPDK.

Note that this is not an isolated issue - most of the definitions in rte_os.h (redefining close, unlink, strdup etc) should not be present if other layers (application, other libraries, etc) are to be able to implement their own POSIX/Linux support.

The purpose of rte_os.h must be clarified. It now says:

/**
* This is header should contain any function/macro definition
* which are not supported natively or named differently in the
* ... OS. Functions will be added in future releases. */

This doesn't specify if the file should expose wrappers or POSIX-named bits. Linux and FreeBSD, however, only use it for RTE_CPU_xxx() macros for CPU_xxx() and don't define anything with POSIX names. So should Windows.

Quoted 5 lines

Please can we back this change out until we have a strategy that allows us to make these definitions available for 'internal' use, but prevent them being visible outside of the DPDK tree.  If we can't wrap them with rte_* yet, perhaps the short term solution could be as simple as setting RTE_DEFINE_POSIX when building DPDK code and hiding them if it is not set?

You need the same value both inside DPDK to return it and outside of DPDK to match on it. Returning an unnamed, unspecified code is not an option. RTE_ prefix is a way to go. We can just rename ETOOMANYREFS.

Strictly speaking, C standard defines very few errno, so using POSIX values in API is incorrect anyway. It has to be deprecated and removed eventually, we already had issues with MMAP_FAILED.

#10 lore raw

Re: [dpdk-dev] Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

Quoted 36 lines

Subject: Re: Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

External email: Use caution opening links or attachments

Hi Nick,

Quoted 9 lines

This means that rte_os.h should not include POSIX/Linux definitions to avoid clashes such as the one seen with this change. It's clearly not sustainable if applications have to be modified every time we add more Windows support to the DPDK.

Note that this is not an isolated issue - most of the definitions in rte_os.h (redefining close, unlink, strdup etc) should not be present if other layers (application, other libraries, etc) are to be able to implement their own POSIX/Linux support.

The purpose of rte_os.h must be clarified. It now says:

/**
* This is header should contain any function/macro definition
* which are not supported natively or named differently in the
* ... OS. Functions will be added in future releases. */

This doesn't specify if the file should expose wrappers or POSIX-named bits. Linux and FreeBSD, however, only use it for RTE_CPU_xxx() macros for CPU_xxx() and don't define anything with POSIX names. So should Windows.

Quoted 6 lines

Please can we back this change out until we have a strategy that allows us to make these definitions available for 'internal' use, but prevent them being visible outside of the DPDK tree. If we can't wrap them with
rte_* yet, perhaps the short term solution could be as simple as setting RTE_DEFINE_POSIX when building DPDK code and hiding them if it is

Quoted 5 lines

not set?

You need the same value both inside DPDK to return it and outside of DPDK to match on it. Returning an unnamed, unspecified code is not an option. RTE_ prefix is a way to go. We can just rename ETOOMANYREFS.

Thanks for the info Nick.
Dmitry, If we go with RTE_ETOOMANYREFS, I assume we need to define it for Linux and FreeBSD as well?

Quoted 4 lines

Strictly speaking, C standard defines very few errno, so using POSIX values in API is incorrect anyway. It has to be deprecated and removed eventually, we already had issues with MMAP_FAILED.

#11 lore raw

Re: [dpdk-dev] Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

19/11/2020 14:21, Tal Shnaiderman:

Quoted 36 lines
Quoted 36 lines

Subject: Re: Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

External email: Use caution opening links or attachments

Hi Nick,

Quoted 9 lines

This means that rte_os.h should not include POSIX/Linux definitions to avoid clashes such as the one seen with this change. It's clearly not sustainable if applications have to be modified every time we add more Windows support to the DPDK.

Note that this is not an isolated issue - most of the definitions in rte_os.h (redefining close, unlink, strdup etc) should not be present if other layers (application, other libraries, etc) are to be able to implement their own POSIX/Linux support.

The purpose of rte_os.h must be clarified. It now says:

/**
* This is header should contain any function/macro definition
* which are not supported natively or named differently in the
* ... OS. Functions will be added in future releases. */

This doesn't specify if the file should expose wrappers or POSIX-named bits. Linux and FreeBSD, however, only use it for RTE_CPU_xxx() macros for CPU_xxx() and don't define anything with POSIX names. So should Windows.

Quoted 6 lines

Please can we back this change out until we have a strategy that allows us to make these definitions available for 'internal' use, but prevent them being visible outside of the DPDK tree. If we can't wrap them with
rte_* yet, perhaps the short term solution could be as simple as setting RTE_DEFINE_POSIX when building DPDK code and hiding them if it is

Quoted 8 lines
Quoted 5 lines

not set?

You need the same value both inside DPDK to return it and outside of DPDK to match on it. Returning an unnamed, unspecified code is not an option. RTE_ prefix is a way to go. We can just rename ETOOMANYREFS.

Thanks for the info Nick.
Dmitry, If we go with RTE_ETOOMANYREFS, I assume we need to define it for Linux and FreeBSD as well?

Or we can use a "more standard" error code?

Quoted 3 lines
Quoted 3 lines

Strictly speaking, C standard defines very few errno, so using POSIX values in API is incorrect anyway. It has to be deprecated and removed eventually, we already had issues with MMAP_FAILED.

#12 lore raw

Re: [dpdk-dev] Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

Quoted 50 lines

Subject: Re: Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

External email: Use caution opening links or attachments

19/11/2020 14:21, Tal Shnaiderman:

Quoted 20 lines
Quoted 20 lines

Subject: Re: Windows: A fundamental issue (was eal/windows:
definition for ETOOMANYREFS errno)

External email: Use caution opening links or attachments

Hi Nick,

Quoted 9 lines

This means that rte_os.h should not include POSIX/Linux definitions to avoid clashes such as the one seen with this change. It's clearly not sustainable if applications have to be modified every time we add more Windows support to the DPDK.

Note that this is not an isolated issue - most of the definitions in rte_os.h (redefining close, unlink, strdup etc) should not be present if other layers (application, other libraries, etc) are to be able to implement their own POSIX/Linux support.

The purpose of rte_os.h must be clarified. It now says:

Quoted 7 lines
Quoted 7 lines

/**
* This is header should contain any function/macro definition
* which are not supported natively or named differently in the
* ... OS. Functions will be added in future releases. */

This doesn't specify if the file should expose wrappers or POSIX-named

bits.

Quoted 2 lines
Quoted 2 lines

Linux and FreeBSD, however, only use it for RTE_CPU_xxx() macros for CPU_xxx() and don't define anything with POSIX names. So should

Windows.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Please can we back this change out until we have a strategy that allows us to make these definitions available for 'internal' use, but prevent them being visible outside of the DPDK tree. If we can't wrap them with
rte_* yet, perhaps the short term solution could be as simple as setting RTE_DEFINE_POSIX when building DPDK code and hiding them if it is

Quoted 4 lines
Quoted 4 lines

not set?

You need the same value both inside DPDK to return it and outside of DPDK to match on it. Returning an unnamed, unspecified code is not an

Quoted 9 lines

option.

Quoted 4 lines
Quoted 1 line

RTE_ prefix is a way to go. We can just rename ETOOMANYREFS.

Thanks for the info Nick.
Dmitry, If we go with RTE_ETOOMANYREFS, I assume we need to define it

for Linux and FreeBSD as well?

Or we can use a "more standard" error code?

Right, Since it is used rarely and only in our PMD I'll work with the developer on selecting a different errno and will revert this commit, apologies for the inconvenience.

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

Strictly speaking, C standard defines very few errno, so using POSIX values in API is incorrect anyway. It has to be deprecated and removed eventually, we already had issues with MMAP_FAILED.

#13 lore raw

Re: [dpdk-dev] Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

Thanks Tal.

Quoted 62 lines · Tal Shnaiderman
Quoted 48 lines

Subject: Re: Windows: A fundamental issue (was eal/windows: definition for ETOOMANYREFS errno)

External email: Use caution opening links or attachments

19/11/2020 14:21, Tal Shnaiderman:

Quoted 19 lines
Quoted 19 lines

Subject: Re: Windows: A fundamental issue (was eal/windows:
definition for ETOOMANYREFS errno)

External email: Use caution opening links or attachments

Hi Nick,

Quoted 9 lines

This means that rte_os.h should not include POSIX/Linux definitions to avoid clashes such as the one seen with this change. It's clearly not sustainable if applications have to be modified every time we add more Windows support to the DPDK.

Note that this is not an isolated issue - most of the definitions in rte_os.h (redefining close, unlink, strdup etc) should not be present if other layers (application, other libraries, etc) are to be able to implement their own POSIX/Linux support.

The purpose of rte_os.h must be clarified. It now says:

Quoted 7 lines
Quoted 7 lines

/**
* This is header should contain any function/macro definition
* which are not supported natively or named differently in the
* ... OS. Functions will be added in future releases. */

This doesn't specify if the file should expose wrappers or POSIX-named

bits.

Quoted 2 lines
Quoted 2 lines

Linux and FreeBSD, however, only use it for RTE_CPU_xxx() macros for CPU_xxx() and don't define anything with POSIX names. So should

Windows.

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines

Please can we back this change out until we have a strategy that allows us to make these definitions available for 'internal' use, but prevent them being visible outside of the DPDK tree. If we can't wrap them with
rte_* yet, perhaps the short term solution could be as simple as setting RTE_DEFINE_POSIX when building DPDK code and hiding them if it is

not set?

You need the same value both inside DPDK to return it and outside of DPDK to match on it. Returning an unnamed, unspecified code is not an

Quoted 8 lines

option.

Quoted 3 lines
Quoted 1 line

RTE_ prefix is a way to go. We can just rename ETOOMANYREFS.

Thanks for the info Nick.
Dmitry, If we go with RTE_ETOOMANYREFS, I assume we need to define it

for Linux and FreeBSD as well?

Or we can use a "more standard" error code?

Right, Since it is used rarely and only in our PMD I'll work with the developer on selecting a different errno and will revert this commit, apologies for the inconvenience.

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

Strictly speaking, C standard defines very few errno, so using POSIX values in API is incorrect anyway. It has to be deprecated and removed eventually, we already had issues with MMAP_FAILED.