* [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc
@ 2019-03-13 17:06 Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
` (19 more replies)
0 siblings, 20 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
A set of patches to fix build with musl libc. I also did a few cleanups wrt
macros and fixed a few scary compiler warnings while at it.
Please note that those are only compile tested on x86_64 with musl libc.
v2 has some code style fixes reported by checkpatch
v3 is a full reroll of the entire patch set to enable automatted tests
and logic for patchwork patchset.
Natanael Copa (15):
app/testpmd: replace uint with unsigned int
net/cxgbe: replace uint with unsigned int
bus/pci: add fallback for out[lwb]_p for non GNU libc
bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
bus/fslmc: fix compile error with musl libc
bus/fslmc: remove unused include of error.h
net/nfp: build fix for musl libc
app/test: include fcntl.h due to use of O_RDONLY
app/test: fix setting of -D_GNU_SOURCE with meson
bus/dpaa: use warn(3) instead of error(3) to improve portability
bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
crypto/dpaa2_sec: build fix for musl libc
crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
net/netvsc: fix compile warning for fcntl.h include
eal/linux: simplify debug message in sigbus_handler
app/test-pmd/testpmd.h | 2 +-
app/test/meson.build | 2 +-
app/test/test_eal_flags.c | 1 +
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +-
drivers/bus/dpaa/base/qbman/bman_driver.c | 6 +-
drivers/bus/dpaa/base/qbman/qman_driver.c | 12 ++--
drivers/bus/dpaa/include/compat.h | 2 +-
drivers/bus/dpaa/include/fsl_qman.h | 3 +-
drivers/bus/fslmc/qbman/include/compat.h | 2 +-
drivers/bus/pci/linux/pci_uio.c | 82 ++++++++++++++--------
drivers/crypto/dpaa2_sec/hw/compat.h | 36 +++++-----
drivers/net/cxgbe/base/common.h | 18 ++---
drivers/net/netvsc/hn_vf.c | 2 +-
drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 2 +
lib/librte_eal/linux/eal/eal_dev.c | 4 +-
15 files changed, 99 insertions(+), 79 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-26 16:59 ` Iremonger, Bernard
2019-03-30 22:17 ` Thomas Monjalon
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 02/15] net/cxgbe: " Natanael Copa
` (18 subsequent siblings)
19 siblings, 2 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Improve portability by avoid use non-standard 'uint'.
This fixes following build error when building with musl libc:
In file included from ../app/test-pmd/cmdline.c:75:
../app/test-pmd/testpmd.h:809:29: error: unknown type name 'uint'; did you mean 'int'?
uint8_t *hash_key, uint hash_key_len);
^~~~
int
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
app/test-pmd/testpmd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index fa4887853..84ef3fc30 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -806,7 +806,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
void port_rss_hash_key_update(portid_t port_id, char rss_type[],
- uint8_t *hash_key, uint hash_key_len);
+ uint8_t *hash_key, unsigned int hash_key_len);
int rx_queue_id_is_invalid(queueid_t rxq_id);
int tx_queue_id_is_invalid(queueid_t txq_id);
void setup_gro(const char *onoff, portid_t port_id);
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 02/15] net/cxgbe: replace uint with unsigned int
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
` (17 subsequent siblings)
19 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Improve portability and fix build error with musl libc:
In file included from ../drivers/net/cxgbe/cxgbe_filter.c:7:
../drivers/net/cxgbe/base/common.h:201:4: error: unknown type name 'uint'
uint synmapen:1; /* SYN Map Enable */
^~~~
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/net/cxgbe/base/common.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 973d4d7dd..1f52609c6 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -198,15 +198,15 @@ struct rss_params {
unsigned int mode; /* RSS mode */
union {
struct {
- uint synmapen:1; /* SYN Map Enable */
- uint syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
- uint syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
- uint syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
- uint syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
- uint ofdmapen:1; /* Offload Map Enable */
- uint tnlmapen:1; /* Tunnel Map Enable */
- uint tnlalllookup:1; /* Tunnel All Lookup */
- uint hashtoeplitz:1; /* use Toeplitz hash */
+ unsigned int synmapen:1; /* SYN Map Enable */
+ unsigned int syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
+ unsigned int syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
+ unsigned int syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
+ unsigned int syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
+ unsigned int ofdmapen:1; /* Offload Map Enable */
+ unsigned int tnlmapen:1; /* Tunnel Map Enable */
+ unsigned int tnlalllookup:1; /* Tunnel All Lookup */
+ unsigned int hashtoeplitz:1; /* use Toeplitz hash */
} basicvirtual;
} u;
};
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 02/15] net/cxgbe: " Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-30 22:22 ` Thomas Monjalon
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
` (16 subsequent siblings)
19 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Add a fallback for non-GNU libc systems like musl libc for the
non-standard functions outl_p, outw_p and outb_p.
This ifixes the following buildtime errors when building with musl libc:
pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
fixes https://bugs.dpdk.org/show_bug.cgi?id=35
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/pci/linux/pci_uio.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 09ecbb7aa..e1dd8c875 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -14,6 +14,32 @@
#if defined(RTE_ARCH_X86)
#include <sys/io.h>
+#if defined(__GLIBC__)
+#define pci_uio_outl_p outl_p
+#define pci_uio_outw_p outw_p
+#define pci_uio_outb_p outb_p
+#else
+static inline void
+pci_uio_outl_p(unsigned int value, unsigned short int port)
+{
+ __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+}
+
+static inline void
+pci_uio_outw_p(unsigned short int value, unsigned short int port)
+{
+ __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+}
+
+static inline void
+pci_uio_outb_p(unsigned char value, unsigned short int port)
+{
+ __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+}
+#endif
#endif
#include <rte_log.h>
@@ -527,21 +553,21 @@ pci_uio_ioport_write(struct rte_pci_ioport *p,
if (len >= 4) {
size = 4;
#if defined(RTE_ARCH_X86)
- outl_p(*(const uint32_t *)s, reg);
+ pci_uio_outl_p(*(const uint32_t *)s, reg);
#else
*(volatile uint32_t *)reg = *(const uint32_t *)s;
#endif
} else if (len >= 2) {
size = 2;
#if defined(RTE_ARCH_X86)
- outw_p(*(const uint16_t *)s, reg);
+ pci_uio_outw_p(*(const uint16_t *)s, reg);
#else
*(volatile uint16_t *)reg = *(const uint16_t *)s;
#endif
} else {
size = 1;
#if defined(RTE_ARCH_X86)
- outb_p(*s, reg);
+ pci_uio_outb_p(*s, reg);
#else
*(volatile uint8_t *)reg = *s;
#endif
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write}
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (2 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-30 22:25 ` Thomas Monjalon
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 05/15] bus/fslmc: fix compile error with musl libc Natanael Copa
` (15 subsequent siblings)
19 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
define the macros so we can remove various #if defined(RTE_ARCH_X86)
Ref: https://bugs.dpdk.org/show_bug.cgi?id=35#c6
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/pci/linux/pci_uio.c | 54 +++++++++++++++------------------
1 file changed, 24 insertions(+), 30 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index e1dd8c875..b0470358d 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -14,11 +14,18 @@
#if defined(RTE_ARCH_X86)
#include <sys/io.h>
+
+#define pci_uio_inl(reg) inl(reg)
+#define pci_uio_inw(reg) inw(reg)
+#define pci_uio_inb(reg) inb(reg)
+
#if defined(__GLIBC__)
+
#define pci_uio_outl_p outl_p
#define pci_uio_outw_p outw_p
#define pci_uio_outb_p outb_p
-#else
+
+#else /* defined(__GLIBC__) */
static inline void
pci_uio_outl_p(unsigned int value, unsigned short int port)
{
@@ -39,8 +46,19 @@ pci_uio_outb_p(unsigned char value, unsigned short int port)
__asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
"Nd" (port));
}
-#endif
-#endif
+#endif /* defined(__GLIBC__) */
+
+#else /* RTE_ARCH_X86 */
+
+#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg))
+#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg))
+#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg))
+
+#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value))
+#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value))
+#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value))
+
+#endif /* RTE_ARCH_X86 */
#include <rte_log.h>
#include <rte_pci.h>
@@ -518,25 +536,13 @@ pci_uio_ioport_read(struct rte_pci_ioport *p,
for (d = data; len > 0; d += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
- *(uint32_t *)d = inl(reg);
-#else
- *(uint32_t *)d = *(volatile uint32_t *)reg;
-#endif
+ *(uint32_t *)d = pci_uio_inl(reg);
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
- *(uint16_t *)d = inw(reg);
-#else
- *(uint16_t *)d = *(volatile uint16_t *)reg;
-#endif
+ *(uint16_t *)d = pci_uio_inw(reg);
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
- *d = inb(reg);
-#else
- *d = *(volatile uint8_t *)reg;
-#endif
+ *d = pci_uio_inb(reg);
}
}
}
@@ -552,25 +558,13 @@ pci_uio_ioport_write(struct rte_pci_ioport *p,
for (s = data; len > 0; s += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
pci_uio_outl_p(*(const uint32_t *)s, reg);
-#else
- *(volatile uint32_t *)reg = *(const uint32_t *)s;
-#endif
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
pci_uio_outw_p(*(const uint16_t *)s, reg);
-#else
- *(volatile uint16_t *)reg = *(const uint16_t *)s;
-#endif
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
pci_uio_outb_p(*s, reg);
-#else
- *(volatile uint8_t *)reg = *s;
-#endif
}
}
}
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 05/15] bus/fslmc: fix compile error with musl libc
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (3 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 06/15] bus/fslmc: remove unused include of error.h Natanael Copa
` (14 subsequent siblings)
19 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
This fixes the following compile error with musl libc:
../drivers/bus/fslmc/qbman/include/compat.h:41:10: error: 'stdout' undeclared (first use in this function)
fflush(stdout); \
^~~~~~
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/fslmc/qbman/include/compat.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index 655bff4b6..ae84528b9 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -11,6 +11,7 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 06/15] bus/fslmc: remove unused include of error.h
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (4 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 05/15] bus/fslmc: fix compile error with musl libc Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 07/15] net/nfp: build fix for musl libc Natanael Copa
` (13 subsequent siblings)
19 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Fixes following build error with musl libc:
In file included from ../drivers/bus/fslmc/qbman/qbman_debug.c:6:
../drivers/bus/fslmc/qbman/include/compat.h:21:10: fatal error: error.h: No such file or directory
#include <error.h>
^~~~~~~~~
Apparently it is not used anywere in qbman so simply remove the include.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/fslmc/qbman/include/compat.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index ae84528b9..1ddd69e12 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -18,7 +18,6 @@
#include <string.h>
#include <malloc.h>
#include <unistd.h>
-#include <error.h>
#include <linux/types.h>
#include <rte_atomic.h>
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 07/15] net/nfp: build fix for musl libc
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (5 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 06/15] bus/fslmc: remove unused include of error.h Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-21 9:48 ` Alejandro Lucero
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 08/15] app/test: include fcntl.h due to use of O_RDONLY Natanael Copa
` (12 subsequent siblings)
19 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Fixes following build error on systems without execinfo.h:
../drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c:19:10: fatal error: execinfo.h: No such file or directory
#include <execinfo.h>
^~~~~~~~~~~~
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index 39bd48a83..93ee310f5 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -16,7 +16,9 @@
#include <assert.h>
#include <stdio.h>
+#if defined(RTE_BACKTRACE)
#include <execinfo.h>
+#endif
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 08/15] app/test: include fcntl.h due to use of O_RDONLY
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (6 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 07/15] net/nfp: build fix for musl libc Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 09/15] app/test: fix setting of -D_GNU_SOURCE with meson Natanael Copa
` (11 subsequent siblings)
19 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Fix following build error with musl libc:
../app/test/test_eal_flags.c:152:55: error: 'O_RDONLY' undeclared (first use in this function)
fd = openat(dirfd(hugepage_dir), dirent->d_name, O_RDONLY);
^~~~~~~~
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
app/test/test_eal_flags.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 1a64b0900..d626dd712 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -17,6 +17,7 @@
#include <sys/wait.h>
#include <sys/file.h>
#include <limits.h>
+#include <fcntl.h>
#include <rte_per_lcore.h>
#include <rte_debug.h>
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 09/15] app/test: fix setting of -D_GNU_SOURCE with meson
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (7 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 08/15] app/test: include fcntl.h due to use of O_RDONLY Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability Natanael Copa
` (10 subsequent siblings)
19 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
in app/test/meson.build the default_cflag is never used so the
-D_GNU_SOURCE was never passed as intended.
Fixes the following build error with musl libc:
../lib/librte_eal/common/include/rte_lcore.h:26:9: error: unknown type name 'cpu_set_t'
typedef cpu_set_t rte_cpuset_t;
^~~~~~~~~
The problem is that cpu_set_t is only defined when _GNU_SOURCE is set.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
app/test/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test/meson.build b/app/test/meson.build
index 05e5ddeb0..2f2ec5057 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -298,7 +298,7 @@ if cc.has_argument('-Wno-format-truncation')
endif
# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
+cflags += '-D_GNU_SOURCE'
test_dep_objs = []
if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV')
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (8 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 09/15] app/test: fix setting of -D_GNU_SOURCE with meson Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-30 22:33 ` Thomas Monjalon
2020-07-10 5:13 ` Hemant Agrawal
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
` (9 subsequent siblings)
19 siblings, 2 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Fix build with musl libc by using warn(3) instead of error(3).
This also fixes error message for kzmalloc failures which previously
would have given "Unknown error -1".
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 ++--
drivers/bus/dpaa/base/qbman/bman_driver.c | 6 +++---
drivers/bus/dpaa/base/qbman/qman_driver.c | 12 ++++++------
drivers/bus/dpaa/include/compat.h | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index 6b5224203..0c3a1bfa3 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -8,7 +8,7 @@
#include <of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
@@ -89,7 +89,7 @@ netcfg_acquire(void)
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ warn("%s(): open(SOCK_RAW)", __func__);
return NULL;
}
diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c
index 750b756b9..dbe00d1c9 100644
--- a/drivers/bus/dpaa/base/qbman/bman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/bman_driver.c
@@ -40,7 +40,7 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ warn("pthread_getaffinity_np()");
return ret;
}
pcfg.cpu = -1;
@@ -60,7 +60,7 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
map.index = idx;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ warn("process_portal_map()");
return ret;
}
/* Make the portal's cache-[enabled|inhibited] regions */
@@ -105,7 +105,7 @@ static int fsl_bman_portal_finish(void)
DPAA_BUG_ON(cfg != &pcfg);
ret = process_portal_unmap(&map.addr);
if (ret)
- error(0, ret, "process_portal_unmap()");
+ warn("process_portal_unmap()");
return ret;
}
diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index ba153396d..163a66b30 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -41,7 +41,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ warn("pthread_getaffinity_np()");
return ret;
}
qpcfg.cpu = -1;
@@ -62,7 +62,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
map.index = index;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ warn("process_portal_map()");
return ret;
}
qpcfg.channel = map.channel;
@@ -109,7 +109,7 @@ static int fsl_qman_portal_finish(void)
DPAA_BUG_ON(cfg != &qpcfg);
ret = process_portal_unmap(&map.addr);
if (ret)
- error(0, ret, "process_portal_unmap()");
+ warn("process_portal_unmap()");
return ret;
}
@@ -156,7 +156,7 @@ struct qman_portal *fsl_qman_portal_create(void)
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
- error(0, -1, "q_pcfg kzalloc failed");
+ warn("q_pcfg kzalloc failed");
return NULL;
}
@@ -164,7 +164,7 @@ struct qman_portal *fsl_qman_portal_create(void)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ warn("pthread_getaffinity_np()");
kfree(q_pcfg);
return NULL;
}
@@ -190,7 +190,7 @@ struct qman_portal *fsl_qman_portal_create(void)
q_map.index = QBMAN_ANY_PORTAL_IDX;
ret = process_portal_map(&q_map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ warn("process_portal_map()");
kfree(q_pcfg);
return NULL;
}
diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
index 412265779..0c01c5514 100644
--- a/drivers/bus/dpaa/include/compat.h
+++ b/drivers/bus/dpaa/include/compat.h
@@ -33,7 +33,7 @@
#include <assert.h>
#include <dirent.h>
#include <inttypes.h>
-#include <error.h>
+#include <err.h>
#include <rte_byteorder.h>
#include <rte_atomic.h>
#include <rte_spinlock.h>
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (9 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-30 22:36 ` Thomas Monjalon
2020-07-10 5:10 ` Hemant Agrawal
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
` (8 subsequent siblings)
19 siblings, 2 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
There is no standard saying that __WORDSIZE should be be defined or in
what include it should be defined. Use a portable way to detect 64 bit
environment.
This fixes a warning when building with musl libc:
warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/include/fsl_qman.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index e43841499..7f3f40d49 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -11,11 +11,12 @@
extern "C" {
#endif
+#include <limits.h>
#include <dpaa_rbtree.h>
#include <rte_eventdev.h>
/* FQ lookups (turn this on for 64bit user-space) */
-#if (__WORDSIZE == 64)
+#if (ULONG_MAX == 0xffffffffffffffff)
#define CONFIG_FSL_QMAN_FQ_LOOKUP
/* if FQ lookups are supported, this controls the number of initialised,
* s/w-consumed FQs that can be supported at any one time.
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 12/15] crypto/dpaa2_sec: build fix for musl libc
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (10 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2020-07-10 5:11 ` Hemant Agrawal
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
` (7 subsequent siblings)
19 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
The swab16/swab32/swab64 are Linux specific and nog GNU libc specific.
Keep the check for __GLIBC__ just in case other GNU systems depends on
this (Hurd or GNU/kFreeBSD).
This fixes a build error with musl libc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/crypto/dpaa2_sec/hw/compat.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/dpaa2_sec/hw/compat.h b/drivers/crypto/dpaa2_sec/hw/compat.h
index ce946ccb5..1362045ca 100644
--- a/drivers/crypto/dpaa2_sec/hw/compat.h
+++ b/drivers/crypto/dpaa2_sec/hw/compat.h
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <errno.h>
-#ifdef __GLIBC__
+#ifdef __linux__
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -40,7 +40,7 @@
#define __maybe_unused __attribute__((unused))
#endif
-#if defined(__GLIBC__) && !defined(pr_debug)
+#if !defined(pr_debug)
#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
#define pr_debug(fmt, ...) \
RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -49,7 +49,7 @@
#endif
#endif /* pr_debug */
-#if defined(__GLIBC__) && !defined(pr_err)
+#if !defined(pr_err)
#if !defined(SUPPRESS_PRINTS)
#define pr_err(fmt, ...) \
RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -58,7 +58,7 @@
#endif
#endif /* pr_err */
-#if defined(__GLIBC__) && !defined(pr_warn)
+#if !defined(pr_warn)
#if !defined(SUPPRESS_PRINTS)
#define pr_warn(fmt, ...) \
RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -101,7 +101,7 @@
#endif
/* Use Linux naming convention */
-#ifdef __GLIBC__
+#if defined(__linux__) || defined(__GLIBC__)
#define swab16(x) rte_bswap16(x)
#define swab32(x) rte_bswap32(x)
#define swab64(x) rte_bswap64(x)
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (11 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-30 22:39 ` Thomas Monjalon
` (2 more replies)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 14/15] net/netvsc: fix compile warning for fcntl.h include Natanael Copa
` (6 subsequent siblings)
19 siblings, 3 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Simplify pr_debug, pr_err and pr_warn macros by add an intermediate
pr_msg macro. This way we only need test for SUPPRESS_PRINTS once.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/crypto/dpaa2_sec/hw/compat.h | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/crypto/dpaa2_sec/hw/compat.h b/drivers/crypto/dpaa2_sec/hw/compat.h
index 1362045ca..e36229f5f 100644
--- a/drivers/crypto/dpaa2_sec/hw/compat.h
+++ b/drivers/crypto/dpaa2_sec/hw/compat.h
@@ -40,31 +40,27 @@
#define __maybe_unused __attribute__((unused))
#endif
+#if defined(SUPPRESS_PRINTS)
+#define pr_msg(l, fmt, ...) do { } while (0)
+#else
+#define pr_msg(l, fmt, ...) \
+ RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#endif
+
#if !defined(pr_debug)
-#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
-#define pr_debug(fmt, ...) \
- RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#if defined(RTA_DEBUG)
+#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, ...) do { } while (0)
+#define pr_debug(fmt, ...) do { } while (0)
#endif
#endif /* pr_debug */
#if !defined(pr_err)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_err(fmt, ...) \
- RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_err(fmt, ...) do { } while (0)
-#endif
+#define pr_err(fmt, ...) pr_msg(ERR, fmt, ##__VA_ARGS__)
#endif /* pr_err */
#if !defined(pr_warn)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_warn(fmt, ...) \
- RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_warn(fmt, ...) do { } while (0)
-#endif
+#define pr_warn(fmt, ...) pr_msg(WARNING, fmt, ##__VA_ARGS__)
#endif /* pr_warn */
/**
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 14/15] net/netvsc: fix compile warning for fcntl.h include
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (12 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 15/15] eal/linux: simplify debug message in sigbus_handler Natanael Copa
` (5 subsequent siblings)
19 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
Fix the following warning when building with musl libc:
In file included from ../drivers/net/netvsc/hn_vf.c:14:
/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp]
#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
^~~~~~~
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/net/netvsc/hn_vf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 3f714ec99..6eeacb659 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -10,8 +10,8 @@
#include <errno.h>
#include <unistd.h>
#include <dirent.h>
+#include <fcntl.h>
#include <sys/types.h>
-#include <sys/fcntl.h>
#include <sys/uio.h>
#include <rte_ether.h>
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v3 15/15] eal/linux: simplify debug message in sigbus_handler
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (13 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 14/15] net/netvsc: fix compile warning for fcntl.h include Natanael Copa
@ 2019-03-13 17:06 ` Natanael Copa
2019-03-14 17:09 ` [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Sirvys, Andrius
` (4 subsequent siblings)
19 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-03-13 17:06 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
There is no guarantee that pthread_self() returns the thread ID or that
pthread_t is an integer. The thread ID is not that useful so simply
remove it.
This fixes the following warning when building with musl libc:
../lib/librte_eal/linuxapp/eal/eal_dev.c: In function 'sigbus_handler':
../lib/librte_eal/linuxapp/eal/eal_dev.c:70:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(int)pthread_self(), info->si_addr);
^
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
lib/librte_eal/linux/eal/eal_dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/linux/eal/eal_dev.c b/lib/librte_eal/linux/eal/eal_dev.c
index 2830c8687..c41809380 100644
--- a/lib/librte_eal/linux/eal/eal_dev.c
+++ b/lib/librte_eal/linux/eal/eal_dev.c
@@ -66,8 +66,8 @@ static void sigbus_handler(int signum, siginfo_t *info,
{
int ret;
- RTE_LOG(DEBUG, EAL, "Thread[%d] catch SIGBUS, fault address:%p\n",
- (int)pthread_self(), info->si_addr);
+ RTE_LOG(DEBUG, EAL, "Thread catch SIGBUS, fault address:%p\n",
+ info->si_addr);
rte_spinlock_lock(&failure_handle_lock);
ret = rte_bus_sigbus_handler(info->si_addr);
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (14 preceding siblings ...)
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 15/15] eal/linux: simplify debug message in sigbus_handler Natanael Copa
@ 2019-03-14 17:09 ` Sirvys, Andrius
2019-03-14 17:09 ` Sirvys, Andrius
2019-03-30 23:57 ` Thomas Monjalon
` (3 subsequent siblings)
19 siblings, 1 reply; 140+ messages in thread
From: Sirvys, Andrius @ 2019-03-14 17:09 UTC (permalink / raw)
To: Natanael Copa, dev
When I try building I'm still getting this error
/root/dpdk/app/test-pmd/bpf_cmd.c:23:11: error: initialization discards
'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
.val = &stdout,
On 13/03/2019 17:06, Natanael Copa wrote:
> A set of patches to fix build with musl libc. I also did a few cleanups wrt
> macros and fixed a few scary compiler warnings while at it.
>
> Please note that those are only compile tested on x86_64 with musl libc.
>
> v2 has some code style fixes reported by checkpatch
> v3 is a full reroll of the entire patch set to enable automatted tests
> and logic for patchwork patchset.
>
> Natanael Copa (15):
> app/testpmd: replace uint with unsigned int
> net/cxgbe: replace uint with unsigned int
> bus/pci: add fallback for out[lwb]_p for non GNU libc
> bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
> bus/fslmc: fix compile error with musl libc
> bus/fslmc: remove unused include of error.h
> net/nfp: build fix for musl libc
> app/test: include fcntl.h due to use of O_RDONLY
> app/test: fix setting of -D_GNU_SOURCE with meson
> bus/dpaa: use warn(3) instead of error(3) to improve portability
> bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
> crypto/dpaa2_sec: build fix for musl libc
> crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
> net/netvsc: fix compile warning for fcntl.h include
> eal/linux: simplify debug message in sigbus_handler
>
> app/test-pmd/testpmd.h | 2 +-
> app/test/meson.build | 2 +-
> app/test/test_eal_flags.c | 1 +
> drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +-
> drivers/bus/dpaa/base/qbman/bman_driver.c | 6 +-
> drivers/bus/dpaa/base/qbman/qman_driver.c | 12 ++--
> drivers/bus/dpaa/include/compat.h | 2 +-
> drivers/bus/dpaa/include/fsl_qman.h | 3 +-
> drivers/bus/fslmc/qbman/include/compat.h | 2 +-
> drivers/bus/pci/linux/pci_uio.c | 82 ++++++++++++++--------
> drivers/crypto/dpaa2_sec/hw/compat.h | 36 +++++-----
> drivers/net/cxgbe/base/common.h | 18 ++---
> drivers/net/netvsc/hn_vf.c | 2 +-
> drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 2 +
> lib/librte_eal/linux/eal/eal_dev.c | 4 +-
> 15 files changed, 99 insertions(+), 79 deletions(-)
>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc
2019-03-14 17:09 ` [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Sirvys, Andrius
@ 2019-03-14 17:09 ` Sirvys, Andrius
0 siblings, 0 replies; 140+ messages in thread
From: Sirvys, Andrius @ 2019-03-14 17:09 UTC (permalink / raw)
To: Natanael Copa, dev
When I try building I'm still getting this error
/root/dpdk/app/test-pmd/bpf_cmd.c:23:11: error: initialization discards
'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
.val = &stdout,
On 13/03/2019 17:06, Natanael Copa wrote:
> A set of patches to fix build with musl libc. I also did a few cleanups wrt
> macros and fixed a few scary compiler warnings while at it.
>
> Please note that those are only compile tested on x86_64 with musl libc.
>
> v2 has some code style fixes reported by checkpatch
> v3 is a full reroll of the entire patch set to enable automatted tests
> and logic for patchwork patchset.
>
> Natanael Copa (15):
> app/testpmd: replace uint with unsigned int
> net/cxgbe: replace uint with unsigned int
> bus/pci: add fallback for out[lwb]_p for non GNU libc
> bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
> bus/fslmc: fix compile error with musl libc
> bus/fslmc: remove unused include of error.h
> net/nfp: build fix for musl libc
> app/test: include fcntl.h due to use of O_RDONLY
> app/test: fix setting of -D_GNU_SOURCE with meson
> bus/dpaa: use warn(3) instead of error(3) to improve portability
> bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
> crypto/dpaa2_sec: build fix for musl libc
> crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
> net/netvsc: fix compile warning for fcntl.h include
> eal/linux: simplify debug message in sigbus_handler
>
> app/test-pmd/testpmd.h | 2 +-
> app/test/meson.build | 2 +-
> app/test/test_eal_flags.c | 1 +
> drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +-
> drivers/bus/dpaa/base/qbman/bman_driver.c | 6 +-
> drivers/bus/dpaa/base/qbman/qman_driver.c | 12 ++--
> drivers/bus/dpaa/include/compat.h | 2 +-
> drivers/bus/dpaa/include/fsl_qman.h | 3 +-
> drivers/bus/fslmc/qbman/include/compat.h | 2 +-
> drivers/bus/pci/linux/pci_uio.c | 82 ++++++++++++++--------
> drivers/crypto/dpaa2_sec/hw/compat.h | 36 +++++-----
> drivers/net/cxgbe/base/common.h | 18 ++---
> drivers/net/netvsc/hn_vf.c | 2 +-
> drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 2 +
> lib/librte_eal/linux/eal/eal_dev.c | 4 +-
> 15 files changed, 99 insertions(+), 79 deletions(-)
>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 07/15] net/nfp: build fix for musl libc
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 07/15] net/nfp: build fix for musl libc Natanael Copa
@ 2019-03-21 9:48 ` Alejandro Lucero
2019-03-21 9:48 ` Alejandro Lucero
0 siblings, 1 reply; 140+ messages in thread
From: Alejandro Lucero @ 2019-03-21 9:48 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
On Wed, Mar 13, 2019 at 5:08 PM Natanael Copa <ncopa@alpinelinux.org> wrote:
> Fixes following build error on systems without execinfo.h:
>
> ../drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c:19:10: fatal error:
> execinfo.h: No such file or directory
> #include <execinfo.h>
> ^~~~~~~~~~~~
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
> ---
> drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> index 39bd48a83..93ee310f5 100644
> --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> @@ -16,7 +16,9 @@
>
> #include <assert.h>
> #include <stdio.h>
> +#if defined(RTE_BACKTRACE)
> #include <execinfo.h>
> +#endif
> #include <stdlib.h>
> #include <unistd.h>
> #include <stdint.h>
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 07/15] net/nfp: build fix for musl libc
2019-03-21 9:48 ` Alejandro Lucero
@ 2019-03-21 9:48 ` Alejandro Lucero
0 siblings, 0 replies; 140+ messages in thread
From: Alejandro Lucero @ 2019-03-21 9:48 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
On Wed, Mar 13, 2019 at 5:08 PM Natanael Copa <ncopa@alpinelinux.org> wrote:
> Fixes following build error on systems without execinfo.h:
>
> ../drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c:19:10: fatal error:
> execinfo.h: No such file or directory
> #include <execinfo.h>
> ^~~~~~~~~~~~
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
> ---
> drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> index 39bd48a83..93ee310f5 100644
> --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
> @@ -16,7 +16,9 @@
>
> #include <assert.h>
> #include <stdio.h>
> +#if defined(RTE_BACKTRACE)
> #include <execinfo.h>
> +#endif
> #include <stdlib.h>
> #include <unistd.h>
> #include <stdint.h>
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
@ 2019-03-26 16:59 ` Iremonger, Bernard
2019-03-26 16:59 ` Iremonger, Bernard
2019-03-30 22:17 ` Thomas Monjalon
1 sibling, 1 reply; 140+ messages in thread
From: Iremonger, Bernard @ 2019-03-26 16:59 UTC (permalink / raw)
To: Natanael Copa, dev
Hi Nataneal,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Natanael Copa
> Sent: Wednesday, March 13, 2019 5:07 PM
> To: dev@dpdk.org
> Cc: Natanael Copa <ncopa@alpinelinux.org>
> Subject: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with
> unsigned int
This should have the fix keyword in the commit line and a fixes line should be added.
Suggest something like the following:
" app/testpmd: fix build error with musl libc"
> Improve portability by avoid use non-standard 'uint'.
>
> This fixes following build error when building with musl libc:
>
> In file included from ../app/test-pmd/cmdline.c:75:
> ../app/test-pmd/testpmd.h:809:29: error: unknown type name 'uint'; did you
> mean 'int'?
> uint8_t *hash_key, uint hash_key_len);
> ^~~~
> int
>
./dpdk /devtools/check-git-log.sh -1
Line too long:
../app/test-pmd/testpmd.h:809:29: error: unknown type name 'uint'; did you mean 'int'?
Wrong tag:
This fixes following build error when building with musl libc:
Need to wrap the compile error message to pass the check-git-log.sh checks.
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
> app/test-pmd/testpmd.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index
> fa4887853..84ef3fc30 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -806,7 +806,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf,
> uint16_t rate,
>
> void port_rss_hash_conf_show(portid_t port_id, int show_rss_key); void
> port_rss_hash_key_update(portid_t port_id, char rss_type[],
> - uint8_t *hash_key, uint hash_key_len);
uint should be replaced by uint8_t instead of unsigned int.
The rss_key_len is a uint8_t type.
> + uint8_t *hash_key, unsigned int hash_key_len);
> int rx_queue_id_is_invalid(queueid_t rxq_id); int
> tx_queue_id_is_invalid(queueid_t txq_id); void setup_gro(const char
> *onoff, portid_t port_id);
> --
> 2.21.0
Regards,
Bernard.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int
2019-03-26 16:59 ` Iremonger, Bernard
@ 2019-03-26 16:59 ` Iremonger, Bernard
0 siblings, 0 replies; 140+ messages in thread
From: Iremonger, Bernard @ 2019-03-26 16:59 UTC (permalink / raw)
To: Natanael Copa, dev
Hi Nataneal,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Natanael Copa
> Sent: Wednesday, March 13, 2019 5:07 PM
> To: dev@dpdk.org
> Cc: Natanael Copa <ncopa@alpinelinux.org>
> Subject: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with
> unsigned int
This should have the fix keyword in the commit line and a fixes line should be added.
Suggest something like the following:
" app/testpmd: fix build error with musl libc"
> Improve portability by avoid use non-standard 'uint'.
>
> This fixes following build error when building with musl libc:
>
> In file included from ../app/test-pmd/cmdline.c:75:
> ../app/test-pmd/testpmd.h:809:29: error: unknown type name 'uint'; did you
> mean 'int'?
> uint8_t *hash_key, uint hash_key_len);
> ^~~~
> int
>
./dpdk /devtools/check-git-log.sh -1
Line too long:
../app/test-pmd/testpmd.h:809:29: error: unknown type name 'uint'; did you mean 'int'?
Wrong tag:
This fixes following build error when building with musl libc:
Need to wrap the compile error message to pass the check-git-log.sh checks.
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
> app/test-pmd/testpmd.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index
> fa4887853..84ef3fc30 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -806,7 +806,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf,
> uint16_t rate,
>
> void port_rss_hash_conf_show(portid_t port_id, int show_rss_key); void
> port_rss_hash_key_update(portid_t port_id, char rss_type[],
> - uint8_t *hash_key, uint hash_key_len);
uint should be replaced by uint8_t instead of unsigned int.
The rss_key_len is a uint8_t type.
> + uint8_t *hash_key, unsigned int hash_key_len);
> int rx_queue_id_is_invalid(queueid_t rxq_id); int
> tx_queue_id_is_invalid(queueid_t txq_id); void setup_gro(const char
> *onoff, portid_t port_id);
> --
> 2.21.0
Regards,
Bernard.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
2019-03-26 16:59 ` Iremonger, Bernard
@ 2019-03-30 22:17 ` Thomas Monjalon
2019-03-30 22:17 ` Thomas Monjalon
2019-07-04 9:20 ` Iremonger, Bernard
1 sibling, 2 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:17 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
13/03/2019 18:06, Natanael Copa:
> Improve portability by avoid use non-standard 'uint'.
After running git grep '\<uint\>', I see there is also an occurence
in examples/tep_termination/vxlan.c
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int
2019-03-30 22:17 ` Thomas Monjalon
@ 2019-03-30 22:17 ` Thomas Monjalon
2019-07-04 9:20 ` Iremonger, Bernard
1 sibling, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:17 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
13/03/2019 18:06, Natanael Copa:
> Improve portability by avoid use non-standard 'uint'.
After running git grep '\<uint\>', I see there is also an occurence
in examples/tep_termination/vxlan.c
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
@ 2019-03-30 22:22 ` Thomas Monjalon
2019-03-30 22:22 ` Thomas Monjalon
2019-07-04 12:16 ` Natanael Copa
0 siblings, 2 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:22 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
13/03/2019 18:06, Natanael Copa:
> Add a fallback for non-GNU libc systems like musl libc for the
> non-standard functions outl_p, outw_p and outb_p.
>
> This ifixes the following buildtime errors when building with musl libc:
> pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
> pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
> pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
>
> fixes https://bugs.dpdk.org/show_bug.cgi?id=35
Please use this syntax:
Bugzilla ID: 35
[...]
> #if defined(RTE_ARCH_X86)
> #include <sys/io.h>
> +#if defined(__GLIBC__)
> +#define pci_uio_outl_p outl_p
> +#define pci_uio_outw_p outw_p
> +#define pci_uio_outb_p outb_p
> +#else
> +static inline void
> +pci_uio_outl_p(unsigned int value, unsigned short int port)
> +{
> + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
> + "Nd" (port));
> +}
> +
> +static inline void
> +pci_uio_outw_p(unsigned short int value, unsigned short int port)
> +{
> + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
> + "Nd" (port));
> +}
> +
> +static inline void
> +pci_uio_outb_p(unsigned char value, unsigned short int port)
> +{
> + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
> + "Nd" (port));
> +}
> +#endif
> #endif
[...]
> #if defined(RTE_ARCH_X86)
> - outl_p(*(const uint32_t *)s, reg);
> + pci_uio_outl_p(*(const uint32_t *)s, reg);
> #else
> *(volatile uint32_t *)reg = *(const uint32_t *)s;
> #endif
Could we manage non-x86 case in the macros pci_uio_out?
Thanks
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-30 22:22 ` Thomas Monjalon
@ 2019-03-30 22:22 ` Thomas Monjalon
2019-07-04 12:16 ` Natanael Copa
1 sibling, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:22 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
13/03/2019 18:06, Natanael Copa:
> Add a fallback for non-GNU libc systems like musl libc for the
> non-standard functions outl_p, outw_p and outb_p.
>
> This ifixes the following buildtime errors when building with musl libc:
> pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
> pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
> pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
>
> fixes https://bugs.dpdk.org/show_bug.cgi?id=35
Please use this syntax:
Bugzilla ID: 35
[...]
> #if defined(RTE_ARCH_X86)
> #include <sys/io.h>
> +#if defined(__GLIBC__)
> +#define pci_uio_outl_p outl_p
> +#define pci_uio_outw_p outw_p
> +#define pci_uio_outb_p outb_p
> +#else
> +static inline void
> +pci_uio_outl_p(unsigned int value, unsigned short int port)
> +{
> + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
> + "Nd" (port));
> +}
> +
> +static inline void
> +pci_uio_outw_p(unsigned short int value, unsigned short int port)
> +{
> + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
> + "Nd" (port));
> +}
> +
> +static inline void
> +pci_uio_outb_p(unsigned char value, unsigned short int port)
> +{
> + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
> + "Nd" (port));
> +}
> +#endif
> #endif
[...]
> #if defined(RTE_ARCH_X86)
> - outl_p(*(const uint32_t *)s, reg);
> + pci_uio_outl_p(*(const uint32_t *)s, reg);
> #else
> *(volatile uint32_t *)reg = *(const uint32_t *)s;
> #endif
Could we manage non-x86 case in the macros pci_uio_out?
Thanks
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write}
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
@ 2019-03-30 22:25 ` Thomas Monjalon
2019-03-30 22:25 ` Thomas Monjalon
0 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:25 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa, gaetan.rivet, ferruh.yigit
13/03/2019 18:06, Natanael Copa:
> define the macros so we can remove various #if defined(RTE_ARCH_X86)
>
> Ref: https://bugs.dpdk.org/show_bug.cgi?id=35#c6
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
> drivers/bus/pci/linux/pci_uio.c | 54 +++++++++++++++------------------
> 1 file changed, 24 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
> index e1dd8c875..b0470358d 100644
> --- a/drivers/bus/pci/linux/pci_uio.c
> +++ b/drivers/bus/pci/linux/pci_uio.c
> @@ -14,11 +14,18 @@
>
> #if defined(RTE_ARCH_X86)
> #include <sys/io.h>
> +
> +#define pci_uio_inl(reg) inl(reg)
> +#define pci_uio_inw(reg) inw(reg)
> +#define pci_uio_inb(reg) inb(reg)
> +
> #if defined(__GLIBC__)
> +
> #define pci_uio_outl_p outl_p
> #define pci_uio_outw_p outw_p
> #define pci_uio_outb_p outb_p
> -#else
> +
> +#else /* defined(__GLIBC__) */
> static inline void
> pci_uio_outl_p(unsigned int value, unsigned short int port)
> {
> @@ -39,8 +46,19 @@ pci_uio_outb_p(unsigned char value, unsigned short int port)
> __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
> "Nd" (port));
> }
> -#endif
> -#endif
> +#endif /* defined(__GLIBC__) */
> +
> +#else /* RTE_ARCH_X86 */
> +
> +#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg))
> +#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg))
> +#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg))
> +
> +#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value))
> +#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value))
> +#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value))
> +
> +#endif /* RTE_ARCH_X86 */
I think I would prefer having the #ifdef inside the macros,
instead of redefining the macros.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write}
2019-03-30 22:25 ` Thomas Monjalon
@ 2019-03-30 22:25 ` Thomas Monjalon
0 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:25 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa, gaetan.rivet, ferruh.yigit
13/03/2019 18:06, Natanael Copa:
> define the macros so we can remove various #if defined(RTE_ARCH_X86)
>
> Ref: https://bugs.dpdk.org/show_bug.cgi?id=35#c6
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
> drivers/bus/pci/linux/pci_uio.c | 54 +++++++++++++++------------------
> 1 file changed, 24 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
> index e1dd8c875..b0470358d 100644
> --- a/drivers/bus/pci/linux/pci_uio.c
> +++ b/drivers/bus/pci/linux/pci_uio.c
> @@ -14,11 +14,18 @@
>
> #if defined(RTE_ARCH_X86)
> #include <sys/io.h>
> +
> +#define pci_uio_inl(reg) inl(reg)
> +#define pci_uio_inw(reg) inw(reg)
> +#define pci_uio_inb(reg) inb(reg)
> +
> #if defined(__GLIBC__)
> +
> #define pci_uio_outl_p outl_p
> #define pci_uio_outw_p outw_p
> #define pci_uio_outb_p outb_p
> -#else
> +
> +#else /* defined(__GLIBC__) */
> static inline void
> pci_uio_outl_p(unsigned int value, unsigned short int port)
> {
> @@ -39,8 +46,19 @@ pci_uio_outb_p(unsigned char value, unsigned short int port)
> __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
> "Nd" (port));
> }
> -#endif
> -#endif
> +#endif /* defined(__GLIBC__) */
> +
> +#else /* RTE_ARCH_X86 */
> +
> +#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg))
> +#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg))
> +#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg))
> +
> +#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value))
> +#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value))
> +#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value))
> +
> +#endif /* RTE_ARCH_X86 */
I think I would prefer having the #ifdef inside the macros,
instead of redefining the macros.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability Natanael Copa
@ 2019-03-30 22:33 ` Thomas Monjalon
2019-03-30 22:33 ` Thomas Monjalon
2020-07-10 5:13 ` Hemant Agrawal
1 sibling, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:33 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, hemant.agrawal
13/03/2019 18:06, Natanael Copa:
> Fix build with musl libc by using warn(3) instead of error(3).
>
> This also fixes error message for kzmalloc failures which previously
> would have given "Unknown error -1".
I think this patch requires more explanations about what was the error,
why using warn, and how it is related to kzmalloc failure log.
Thanks
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
2019-03-30 22:33 ` Thomas Monjalon
@ 2019-03-30 22:33 ` Thomas Monjalon
0 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:33 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, hemant.agrawal
13/03/2019 18:06, Natanael Copa:
> Fix build with musl libc by using warn(3) instead of error(3).
>
> This also fixes error message for kzmalloc failures which previously
> would have given "Unknown error -1".
I think this patch requires more explanations about what was the error,
why using warn, and how it is related to kzmalloc failure log.
Thanks
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
@ 2019-03-30 22:36 ` Thomas Monjalon
2019-03-30 22:36 ` Thomas Monjalon
2020-07-10 5:10 ` Hemant Agrawal
1 sibling, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:36 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, hemant.agrawal
13/03/2019 18:06, Natanael Copa:
> There is no standard saying that __WORDSIZE should be be defined or in
> what include it should be defined. Use a portable way to detect 64 bit
> environment.
>
> This fixes a warning when building with musl libc:
>
> warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
[...]
> -#if (__WORDSIZE == 64)
> +#if (ULONG_MAX == 0xffffffffffffffff)
There is a more explicit config in DPDK: RTE_ARCH_64
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
2019-03-30 22:36 ` Thomas Monjalon
@ 2019-03-30 22:36 ` Thomas Monjalon
0 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:36 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, hemant.agrawal
13/03/2019 18:06, Natanael Copa:
> There is no standard saying that __WORDSIZE should be be defined or in
> what include it should be defined. Use a portable way to detect 64 bit
> environment.
>
> This fixes a warning when building with musl libc:
>
> warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
[...]
> -#if (__WORDSIZE == 64)
> +#if (ULONG_MAX == 0xffffffffffffffff)
There is a more explicit config in DPDK: RTE_ARCH_64
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
@ 2019-03-30 22:39 ` Thomas Monjalon
2019-03-30 22:39 ` Thomas Monjalon
2020-07-10 5:09 ` Hemant Agrawal
2020-07-10 5:11 ` Hemant Agrawal
2 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:39 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, akhil.goyal, hemant.agrawal, shreyansh.jain
13/03/2019 18:06, Natanael Copa:
> Simplify pr_debug, pr_err and pr_warn macros by add an intermediate
> pr_msg macro. This way we only need test for SUPPRESS_PRINTS once.
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Adding more Cc for review.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros
2019-03-30 22:39 ` Thomas Monjalon
@ 2019-03-30 22:39 ` Thomas Monjalon
0 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 22:39 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, akhil.goyal, hemant.agrawal, shreyansh.jain
13/03/2019 18:06, Natanael Copa:
> Simplify pr_debug, pr_err and pr_warn macros by add an intermediate
> pr_msg macro. This way we only need test for SUPPRESS_PRINTS once.
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Adding more Cc for review.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (15 preceding siblings ...)
2019-03-14 17:09 ` [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Sirvys, Andrius
@ 2019-03-30 23:57 ` Thomas Monjalon
2019-03-30 23:57 ` Thomas Monjalon
` (2 more replies)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (2 subsequent siblings)
19 siblings, 3 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 23:57 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
13/03/2019 18:06, Natanael Copa:
> A set of patches to fix build with musl libc. I also did a few cleanups wrt
> macros and fixed a few scary compiler warnings while at it.
>
> Please note that those are only compile tested on x86_64 with musl libc.
>
> v2 has some code style fixes reported by checkpatch
> v3 is a full reroll of the entire patch set to enable automatted tests
> and logic for patchwork patchset.
>
> Natanael Copa (15):
> app/testpmd: replace uint with unsigned int
> net/cxgbe: replace uint with unsigned int
> bus/pci: add fallback for out[lwb]_p for non GNU libc
> bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
> bus/fslmc: fix compile error with musl libc
> bus/fslmc: remove unused include of error.h
> net/nfp: build fix for musl libc
> app/test: include fcntl.h due to use of O_RDONLY
> app/test: fix setting of -D_GNU_SOURCE with meson
> bus/dpaa: use warn(3) instead of error(3) to improve portability
> bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
> crypto/dpaa2_sec: build fix for musl libc
> crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
> net/netvsc: fix compile warning for fcntl.h include
> eal/linux: simplify debug message in sigbus_handler
Thanks for the cleanup.
Some patches may deserve more reviews.
If you send a new version, please use --to-cmd devtools/get-maintainer.sh
so the maintainers will be Cc'ed.
All these patches are fixes and may be interesting to backport them
in the latest LTS or other stable releases.
In order to help with backporting, please fill "Fixes:" tag
and add Cc: stable when relevant.
The exact recommendation is described in this doc chapter:
http://doc.dpdk.org/guides/contributing/patches.html#commit-messages-body
In order to help, I already fixed 7 commit messages and merged them.
The remaining patches, requiring a v4, are:
app/testpmd: replace uint with unsigned int
net/cxgbe: replace uint with unsigned int
bus/pci: add fallback for out[lwb]_p for non GNU libc
bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
bus/dpaa: use warn(3) instead of error(3) to improve portability
bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
crypto/dpaa2_sec: build fix for musl libc
crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc
2019-03-30 23:57 ` Thomas Monjalon
@ 2019-03-30 23:57 ` Thomas Monjalon
2019-07-05 8:03 ` David Marchand
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
2 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2019-03-30 23:57 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
13/03/2019 18:06, Natanael Copa:
> A set of patches to fix build with musl libc. I also did a few cleanups wrt
> macros and fixed a few scary compiler warnings while at it.
>
> Please note that those are only compile tested on x86_64 with musl libc.
>
> v2 has some code style fixes reported by checkpatch
> v3 is a full reroll of the entire patch set to enable automatted tests
> and logic for patchwork patchset.
>
> Natanael Copa (15):
> app/testpmd: replace uint with unsigned int
> net/cxgbe: replace uint with unsigned int
> bus/pci: add fallback for out[lwb]_p for non GNU libc
> bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
> bus/fslmc: fix compile error with musl libc
> bus/fslmc: remove unused include of error.h
> net/nfp: build fix for musl libc
> app/test: include fcntl.h due to use of O_RDONLY
> app/test: fix setting of -D_GNU_SOURCE with meson
> bus/dpaa: use warn(3) instead of error(3) to improve portability
> bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
> crypto/dpaa2_sec: build fix for musl libc
> crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
> net/netvsc: fix compile warning for fcntl.h include
> eal/linux: simplify debug message in sigbus_handler
Thanks for the cleanup.
Some patches may deserve more reviews.
If you send a new version, please use --to-cmd devtools/get-maintainer.sh
so the maintainers will be Cc'ed.
All these patches are fixes and may be interesting to backport them
in the latest LTS or other stable releases.
In order to help with backporting, please fill "Fixes:" tag
and add Cc: stable when relevant.
The exact recommendation is described in this doc chapter:
http://doc.dpdk.org/guides/contributing/patches.html#commit-messages-body
In order to help, I already fixed 7 commit messages and merged them.
The remaining patches, requiring a v4, are:
app/testpmd: replace uint with unsigned int
net/cxgbe: replace uint with unsigned int
bus/pci: add fallback for out[lwb]_p for non GNU libc
bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
bus/dpaa: use warn(3) instead of error(3) to improve portability
bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
crypto/dpaa2_sec: build fix for musl libc
crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int
2019-03-30 22:17 ` Thomas Monjalon
2019-03-30 22:17 ` Thomas Monjalon
@ 2019-07-04 9:20 ` Iremonger, Bernard
1 sibling, 0 replies; 140+ messages in thread
From: Iremonger, Bernard @ 2019-07-04 9:20 UTC (permalink / raw)
To: Thomas Monjalon, Natanael Copa; +Cc: dev
Hi Natanael
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Saturday, March 30, 2019 10:17 PM
> To: Natanael Copa <ncopa@alpinelinux.org>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with
> unsigned int
>
> 13/03/2019 18:06, Natanael Copa:
> > Improve portability by avoid use non-standard 'uint'.
>
> After running git grep '\<uint\>', I see there is also an occurence in
> examples/tep_termination/vxlan.c
>
>
An update to this patchset is needed if you want to get it applied in 19.08
Regards,
Bernard.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-30 22:22 ` Thomas Monjalon
2019-03-30 22:22 ` Thomas Monjalon
@ 2019-07-04 12:16 ` Natanael Copa
2019-07-04 13:20 ` Thomas Monjalon
1 sibling, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2019-07-04 12:16 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Sat, 30 Mar 2019 23:22:27 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:
> 13/03/2019 18:06, Natanael Copa:
> > Add a fallback for non-GNU libc systems like musl libc for the
> > non-standard functions outl_p, outw_p and outb_p.
> >
> > This ifixes the following buildtime errors when building with musl libc:
> > pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
> > pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
> > pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
> >
> > fixes https://bugs.dpdk.org/show_bug.cgi?id=35
>
> Please use this syntax:
> Bugzilla ID: 35
Ok.
>
> [...]
> > #if defined(RTE_ARCH_X86)
> > #include <sys/io.h>
> > +#if defined(__GLIBC__)
> > +#define pci_uio_outl_p outl_p
> > +#define pci_uio_outw_p outw_p
> > +#define pci_uio_outb_p outb_p
> > +#else
> > +static inline void
> > +pci_uio_outl_p(unsigned int value, unsigned short int port)
> > +{
> > + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
> > + "Nd" (port));
> > +}
> > +
> > +static inline void
> > +pci_uio_outw_p(unsigned short int value, unsigned short int port)
> > +{
> > + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
> > + "Nd" (port));
> > +}
> > +
> > +static inline void
> > +pci_uio_outb_p(unsigned char value, unsigned short int port)
> > +{
> > + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
> > + "Nd" (port));
> > +}
> > +#endif
> > #endif
> [...]
> > #if defined(RTE_ARCH_X86)
> > - outl_p(*(const uint32_t *)s, reg);
> > + pci_uio_outl_p(*(const uint32_t *)s, reg);
> > #else
> > *(volatile uint32_t *)reg = *(const uint32_t *)s;
> > #endif
>
> Could we manage non-x86 case in the macros pci_uio_out?
I did that in separate commit. Do you want do both in same commit?
>
> Thanks
>
>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-07-04 12:16 ` Natanael Copa
@ 2019-07-04 13:20 ` Thomas Monjalon
2019-07-04 15:30 ` Natanael Copa
0 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2019-07-04 13:20 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
04/07/2019 14:16, Natanael Copa:
> On Sat, 30 Mar 2019 23:22:27 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
>
> > 13/03/2019 18:06, Natanael Copa:
> > > Add a fallback for non-GNU libc systems like musl libc for the
> > > non-standard functions outl_p, outw_p and outb_p.
> > >
> > > This ifixes the following buildtime errors when building with musl libc:
> > > pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
> > > pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
> > > pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
> > >
> > > fixes https://bugs.dpdk.org/show_bug.cgi?id=35
> >
> > Please use this syntax:
> > Bugzilla ID: 35
>
> Ok.
>
> >
> > [...]
> > > #if defined(RTE_ARCH_X86)
> > > #include <sys/io.h>
> > > +#if defined(__GLIBC__)
> > > +#define pci_uio_outl_p outl_p
> > > +#define pci_uio_outw_p outw_p
> > > +#define pci_uio_outb_p outb_p
> > > +#else
> > > +static inline void
> > > +pci_uio_outl_p(unsigned int value, unsigned short int port)
> > > +{
> > > + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
> > > + "Nd" (port));
> > > +}
> > > +
> > > +static inline void
> > > +pci_uio_outw_p(unsigned short int value, unsigned short int port)
> > > +{
> > > + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
> > > + "Nd" (port));
> > > +}
> > > +
> > > +static inline void
> > > +pci_uio_outb_p(unsigned char value, unsigned short int port)
> > > +{
> > > + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
> > > + "Nd" (port));
> > > +}
> > > +#endif
> > > #endif
> > [...]
> > > #if defined(RTE_ARCH_X86)
> > > - outl_p(*(const uint32_t *)s, reg);
> > > + pci_uio_outl_p(*(const uint32_t *)s, reg);
> > > #else
> > > *(volatile uint32_t *)reg = *(const uint32_t *)s;
> > > #endif
> >
> > Could we manage non-x86 case in the macros pci_uio_out?
>
> I did that in separate commit. Do you want do both in same commit?
Maybe change the order of commits?
Anyway I think you need to rebase and resend this series :)
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-07-04 13:20 ` Thomas Monjalon
@ 2019-07-04 15:30 ` Natanael Copa
0 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2019-07-04 15:30 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Thu, 04 Jul 2019 15:20:55 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:
> 04/07/2019 14:16, Natanael Copa:
> > On Sat, 30 Mar 2019 23:22:27 +0100
> > Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > > 13/03/2019 18:06, Natanael Copa:
> > > > Add a fallback for non-GNU libc systems like musl libc for the
> > > > non-standard functions outl_p, outw_p and outb_p.
> > > >
> > > > This ifixes the following buildtime errors when building with musl libc:
> > > > pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
> > > > pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
> > > > pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
> > > >
> > > > fixes https://bugs.dpdk.org/show_bug.cgi?id=35
> > >
> > > Please use this syntax:
> > > Bugzilla ID: 35
> >
> > Ok.
> >
> > >
> > > [...]
> > > > #if defined(RTE_ARCH_X86)
> > > > #include <sys/io.h>
> > > > +#if defined(__GLIBC__)
> > > > +#define pci_uio_outl_p outl_p
> > > > +#define pci_uio_outw_p outw_p
> > > > +#define pci_uio_outb_p outb_p
> > > > +#else
> > > > +static inline void
> > > > +pci_uio_outl_p(unsigned int value, unsigned short int port)
> > > > +{
> > > > + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
> > > > + "Nd" (port));
> > > > +}
> > > > +
> > > > +static inline void
> > > > +pci_uio_outw_p(unsigned short int value, unsigned short int port)
> > > > +{
> > > > + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
> > > > + "Nd" (port));
> > > > +}
> > > > +
> > > > +static inline void
> > > > +pci_uio_outb_p(unsigned char value, unsigned short int port)
> > > > +{
> > > > + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
> > > > + "Nd" (port));
> > > > +}
> > > > +#endif
> > > > #endif
> > > [...]
> > > > #if defined(RTE_ARCH_X86)
> > > > - outl_p(*(const uint32_t *)s, reg);
> > > > + pci_uio_outl_p(*(const uint32_t *)s, reg);
> > > > #else
> > > > *(volatile uint32_t *)reg = *(const uint32_t *)s;
> > > > #endif
> > >
> > > Could we manage non-x86 case in the macros pci_uio_out?
> >
> > I did that in separate commit. Do you want do both in same commit?
>
> Maybe change the order of commits?
That would mean that first commit would use a define or inline that is
not yet introduced :)
> Anyway I think you need to rebase and resend this series :)
I'm on it. Thanks for your feedback.
-nc
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc
2019-03-30 23:57 ` Thomas Monjalon
2019-03-30 23:57 ` Thomas Monjalon
@ 2019-07-05 8:03 ` David Marchand
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
2 siblings, 0 replies; 140+ messages in thread
From: David Marchand @ 2019-07-05 8:03 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, Thomas Monjalon
On Sun, Mar 31, 2019 at 12:57 AM Thomas Monjalon <thomas@monjalon.net>
wrote:
> 13/03/2019 18:06, Natanael Copa:
> > A set of patches to fix build with musl libc. I also did a few cleanups
> wrt
> > macros and fixed a few scary compiler warnings while at it.
> >
> > Please note that those are only compile tested on x86_64 with musl libc.
> >
> > v2 has some code style fixes reported by checkpatch
> > v3 is a full reroll of the entire patch set to enable automatted tests
> > and logic for patchwork patchset.
> >
> > Natanael Copa (15):
> > app/testpmd: replace uint with unsigned int
> > net/cxgbe: replace uint with unsigned int
> > bus/pci: add fallback for out[lwb]_p for non GNU libc
> > bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
> > bus/fslmc: fix compile error with musl libc
> > bus/fslmc: remove unused include of error.h
> > net/nfp: build fix for musl libc
> > app/test: include fcntl.h due to use of O_RDONLY
> > app/test: fix setting of -D_GNU_SOURCE with meson
> > bus/dpaa: use warn(3) instead of error(3) to improve portability
> > bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
> > crypto/dpaa2_sec: build fix for musl libc
> > crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
> > net/netvsc: fix compile warning for fcntl.h include
> > eal/linux: simplify debug message in sigbus_handler
>
> Thanks for the cleanup.
>
> Some patches may deserve more reviews.
> If you send a new version, please use --to-cmd devtools/get-maintainer.sh
> so the maintainers will be Cc'ed.
>
> All these patches are fixes and may be interesting to backport them
> in the latest LTS or other stable releases.
> In order to help with backporting, please fill "Fixes:" tag
> and add Cc: stable when relevant.
> The exact recommendation is described in this doc chapter:
> http://doc.dpdk.org/guides/contributing/patches.html#commit-messages-body
>
> In order to help, I already fixed 7 commit messages and merged them.
> The remaining patches, requiring a v4, are:
> app/testpmd: replace uint with unsigned int
> net/cxgbe: replace uint with unsigned int
> bus/pci: add fallback for out[lwb]_p for non GNU libc
> bus/pci: factor out various ifdefs in pci_uio_ioport_{read,write}
> bus/dpaa: use warn(3) instead of error(3) to improve portability
> bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
> crypto/dpaa2_sec: build fix for musl libc
> crypto/dpaa2_sec: simplify pr_{debug,err,warn} macros
>
If you intend to send a v4, I noticed a few more "uint" in the tree, I
suppose this is worth fixing them:
$ git grep -w uint
app/test-pmd/config.c: uint hash_key_len)
examples/tep_termination/vxlan.c: uint vport_id;
--
David Marchand
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
2019-03-30 22:39 ` Thomas Monjalon
@ 2020-07-10 5:09 ` Hemant Agrawal
2020-07-10 5:11 ` Hemant Agrawal
2 siblings, 0 replies; 140+ messages in thread
From: Hemant Agrawal @ 2020-07-10 5:09 UTC (permalink / raw)
To: Natanael Copa, dev
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
2019-03-30 22:36 ` Thomas Monjalon
@ 2020-07-10 5:10 ` Hemant Agrawal
1 sibling, 0 replies; 140+ messages in thread
From: Hemant Agrawal @ 2020-07-10 5:10 UTC (permalink / raw)
To: Natanael Copa, dev
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 12/15] crypto/dpaa2_sec: build fix for musl libc
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
@ 2020-07-10 5:11 ` Hemant Agrawal
0 siblings, 0 replies; 140+ messages in thread
From: Hemant Agrawal @ 2020-07-10 5:11 UTC (permalink / raw)
To: Natanael Copa, dev
The location of the file has been changed from
drivers/crypto/dpaa2_sec/hw/compat.h
to:
drivers/common/dpaax/caamflib/compat.h
In next version you can add
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Natanael Copa
Sent: Wednesday, March 13, 2019 10:37 PM
To: dev@dpdk.org
Cc: Natanael Copa <ncopa@alpinelinux.org>
Subject: [dpdk-dev] [PATCH v3 12/15] crypto/dpaa2_sec: build fix for musl libc
The swab16/swab32/swab64 are Linux specific and nog GNU libc specific.
Keep the check for __GLIBC__ just in case other GNU systems depends on this (Hurd or GNU/kFreeBSD).
This fixes a build error with musl libc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/crypto/dpaa2_sec/hw/compat.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/dpaa2_sec/hw/compat.h b/drivers/crypto/dpaa2_sec/hw/compat.h
index ce946ccb5..1362045ca 100644
--- a/drivers/crypto/dpaa2_sec/hw/compat.h
+++ b/drivers/crypto/dpaa2_sec/hw/compat.h
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <errno.h>
-#ifdef __GLIBC__
+#ifdef __linux__
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -40,7 +40,7 @@
#define __maybe_unused __attribute__((unused)) #endif
-#if defined(__GLIBC__) && !defined(pr_debug)
+#if !defined(pr_debug)
#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG) #define pr_debug(fmt, ...) \
RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) @@ -49,7 +49,7 @@ #endif #endif /* pr_debug */
-#if defined(__GLIBC__) && !defined(pr_err)
+#if !defined(pr_err)
#if !defined(SUPPRESS_PRINTS)
#define pr_err(fmt, ...) \
RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) @@ -58,7 +58,7 @@ #endif #endif /* pr_err */
-#if defined(__GLIBC__) && !defined(pr_warn)
+#if !defined(pr_warn)
#if !defined(SUPPRESS_PRINTS)
#define pr_warn(fmt, ...) \
RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) @@ -101,7 +101,7 @@ #endif
/* Use Linux naming convention */
-#ifdef __GLIBC__
+#if defined(__linux__) || defined(__GLIBC__)
#define swab16(x) rte_bswap16(x)
#define swab32(x) rte_bswap32(x)
#define swab64(x) rte_bswap64(x)
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
2019-03-30 22:39 ` Thomas Monjalon
2020-07-10 5:09 ` Hemant Agrawal
@ 2020-07-10 5:11 ` Hemant Agrawal
2 siblings, 0 replies; 140+ messages in thread
From: Hemant Agrawal @ 2020-07-10 5:11 UTC (permalink / raw)
To: Natanael Copa, dev
Change it to new location drivers/common/dpaax/caamflib/compat.h
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Natanael Copa
Sent: Wednesday, March 13, 2019 10:37 PM
To: dev@dpdk.org
Cc: Natanael Copa <ncopa@alpinelinux.org>
Subject: [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros
Simplify pr_debug, pr_err and pr_warn macros by add an intermediate pr_msg macro. This way we only need test for SUPPRESS_PRINTS once.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/crypto/dpaa2_sec/hw/compat.h | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/crypto/dpaa2_sec/hw/compat.h b/drivers/crypto/dpaa2_sec/hw/compat.h
index 1362045ca..e36229f5f 100644
--- a/drivers/crypto/dpaa2_sec/hw/compat.h
+++ b/drivers/crypto/dpaa2_sec/hw/compat.h
@@ -40,31 +40,27 @@
#define __maybe_unused __attribute__((unused)) #endif
+#if defined(SUPPRESS_PRINTS)
+#define pr_msg(l, fmt, ...) do { } while (0) #else #define pr_msg(l,
+fmt, ...) \
+ RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) #endif
+
#if !defined(pr_debug)
-#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG) -#define pr_debug(fmt, ...) \
- RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#if defined(RTA_DEBUG)
+#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, ...) do { } while (0)
+#define pr_debug(fmt, ...) do { } while (0)
#endif
#endif /* pr_debug */
#if !defined(pr_err)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_err(fmt, ...) \
- RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_err(fmt, ...) do { } while (0)
-#endif
+#define pr_err(fmt, ...) pr_msg(ERR, fmt, ##__VA_ARGS__)
#endif /* pr_err */
#if !defined(pr_warn)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_warn(fmt, ...) \
- RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_warn(fmt, ...) do { } while (0)
-#endif
+#define pr_warn(fmt, ...) pr_msg(WARNING, fmt, ##__VA_ARGS__)
#endif /* pr_warn */
/**
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability Natanael Copa
2019-03-30 22:33 ` Thomas Monjalon
@ 2020-07-10 5:13 ` Hemant Agrawal
2021-03-19 9:56 ` Thomas Monjalon
1 sibling, 1 reply; 140+ messages in thread
From: Hemant Agrawal @ 2020-07-10 5:13 UTC (permalink / raw)
To: Natanael Copa, dev
NAK
error is different from warning - the return value is also not carried.
-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Natanael Copa
Sent: Wednesday, March 13, 2019 10:37 PM
To: dev@dpdk.org
Cc: Natanael Copa <ncopa@alpinelinux.org>
Subject: [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
Fix build with musl libc by using warn(3) instead of error(3).
This also fixes error message for kzmalloc failures which previously would have given "Unknown error -1".
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 ++-- drivers/bus/dpaa/base/qbman/bman_driver.c | 6 +++--- drivers/bus/dpaa/base/qbman/qman_driver.c | 12 ++++++------
drivers/bus/dpaa/include/compat.h | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index 6b5224203..0c3a1bfa3 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -8,7 +8,7 @@
#include <of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
@@ -89,7 +89,7 @@ netcfg_acquire(void)
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ warn("%s(): open(SOCK_RAW)", __func__);
return NULL;
}
diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c
index 750b756b9..dbe00d1c9 100644
--- a/drivers/bus/dpaa/base/qbman/bman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/bman_driver.c
@@ -40,7 +40,7 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ warn("pthread_getaffinity_np()");
return ret;
}
pcfg.cpu = -1;
@@ -60,7 +60,7 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
map.index = idx;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ warn("process_portal_map()");
return ret;
}
/* Make the portal's cache-[enabled|inhibited] regions */ @@ -105,7 +105,7 @@ static int fsl_bman_portal_finish(void)
DPAA_BUG_ON(cfg != &pcfg);
ret = process_portal_unmap(&map.addr);
if (ret)
- error(0, ret, "process_portal_unmap()");
+ warn("process_portal_unmap()");
return ret;
}
diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index ba153396d..163a66b30 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -41,7 +41,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ warn("pthread_getaffinity_np()");
return ret;
}
qpcfg.cpu = -1;
@@ -62,7 +62,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
map.index = index;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ warn("process_portal_map()");
return ret;
}
qpcfg.channel = map.channel;
@@ -109,7 +109,7 @@ static int fsl_qman_portal_finish(void)
DPAA_BUG_ON(cfg != &qpcfg);
ret = process_portal_unmap(&map.addr);
if (ret)
- error(0, ret, "process_portal_unmap()");
+ warn("process_portal_unmap()");
return ret;
}
@@ -156,7 +156,7 @@ struct qman_portal *fsl_qman_portal_create(void)
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
- error(0, -1, "q_pcfg kzalloc failed");
+ warn("q_pcfg kzalloc failed");
return NULL;
}
@@ -164,7 +164,7 @@ struct qman_portal *fsl_qman_portal_create(void)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ warn("pthread_getaffinity_np()");
kfree(q_pcfg);
return NULL;
}
@@ -190,7 +190,7 @@ struct qman_portal *fsl_qman_portal_create(void)
q_map.index = QBMAN_ANY_PORTAL_IDX;
ret = process_portal_map(&q_map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ warn("process_portal_map()");
kfree(q_pcfg);
return NULL;
}
diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
index 412265779..0c01c5514 100644
--- a/drivers/bus/dpaa/include/compat.h
+++ b/drivers/bus/dpaa/include/compat.h
@@ -33,7 +33,7 @@
#include <assert.h>
#include <dirent.h>
#include <inttypes.h>
-#include <error.h>
+#include <err.h>
#include <rte_byteorder.h>
#include <rte_atomic.h>
#include <rte_spinlock.h>
--
2.21.0
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] Build fixes for musl libc
2019-03-30 23:57 ` Thomas Monjalon
2019-03-30 23:57 ` Thomas Monjalon
2019-07-05 8:03 ` David Marchand
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error with " Natanael Copa
` (9 more replies)
2 siblings, 10 replies; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa
A set of patches to fix build with musl libc. I also did a few cleanups wrt
macros and fixed a few scary compiler warnings while at it.
Please note that those are only compile tested on x86_64 with musl libc.
v2 has some code style fixes reported by checkpatch
v3 is a full reroll of the entire patch set to enable automatted tests
and logic for patchwork patchset.
v4 rebase against main and deal with renames/moves.
fix commit messages to make check-git-log.sh happy.
improve error(3) -> warn(3) patch and clarify commit message.
update __WORDSIZE patch to use RTE_ARCH_64
add "Fixes:" tags
add a couple of patches fro eal
Sorry that it took so long time to follow up.
Natanael Copa (8):
app/testpmd: fix uint build error with musl libc
net/cxgbe: fix uint build error with musl libc
bus/pci: add fallback for out* for non GNU libc
bus/dpaa: use warn instead of error to improve portability
bus/dpaa: fix detection of 64 bit arch
common/dpaax: build fix for musl libc
common/dpaax: simplify pr debug/err/warn macros
eal: add missing include to fix build with musl libc
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +-
drivers/bus/dpaa/base/qbman/bman_driver.c | 12 ++-
drivers/bus/dpaa/base/qbman/qman_driver.c | 15 ++--
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
drivers/bus/pci/linux/pci_uio.c | 95 +++++++++++++++--------
drivers/common/dpaax/caamflib/compat.h | 36 ++++-----
drivers/net/cxgbe/base/common.h | 18 ++---
lib/librte_eal/unix/eal_file.c | 1 +
10 files changed, 113 insertions(+), 74 deletions(-)
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error with musl libc
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-06 9:22 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error withmusl libc Morten Brørup
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc Natanael Copa
` (8 subsequent siblings)
9 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev, Wenzhuo Lu, Beilei Xing, Bernard Iremonger; +Cc: Natanael Copa, stable
Improve portability by avoid use non-standard 'uint'.
Use uint8_t for hash_key_len as rss_key_len is a uint8_t type.
This solves following build error when building with musl libc:
In file included from ../app/test-pmd/cmdline.c:74:
../app/test-pmd/testpmd.h:813:29: error: unknown type name 'uint'; did
you mean 'int'?
813 | uint8_t *hash_key, uint hash_key_len);
| ^~~~
| int
Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash commands")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 755d1dfc9..8ec091077 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3015,7 +3015,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
void
port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
- uint hash_key_len)
+ uint8_t hash_key_len)
{
struct rte_eth_rss_conf rss_conf;
int diag;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 519d5517e..1cb6a6d04 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -945,7 +945,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
void port_rss_hash_key_update(portid_t port_id, char rss_type[],
- uint8_t *hash_key, uint hash_key_len);
+ uint8_t *hash_key, uint8_t hash_key_len);
int rx_queue_id_is_invalid(queueid_t rxq_id);
int tx_queue_id_is_invalid(queueid_t txq_id);
void setup_gro(const char *onoff, portid_t port_id);
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error with " Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-06 9:24 ` [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musllibc Morten Brørup
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc Natanael Copa
` (7 subsequent siblings)
9 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev, Rahul Lakkireddy; +Cc: Natanael Copa, stable
Improve portability by replacing non-standard 'uint' with 'unsigned int'
This solves the build error with musl libc:
In file included from ../drivers/net/cxgbe/cxgbe.h:9,
from ../drivers/net/cxgbe/cxgbe_ethdev.c:37:
../drivers/net/cxgbe/base/common.h:201:4: error: unknown type name 'uint'
201 | uint synmapen:1; /* SYN Map Enable */
| ^~~~
Fixes: bfcb257d3014 ("net/cxgbe: enable RSS for VF")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/net/cxgbe/base/common.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 8fe8e2a36..c1d09dfad 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -201,15 +201,15 @@ struct rss_params {
unsigned int mode; /* RSS mode */
union {
struct {
- uint synmapen:1; /* SYN Map Enable */
- uint syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
- uint syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
- uint syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
- uint syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
- uint ofdmapen:1; /* Offload Map Enable */
- uint tnlmapen:1; /* Tunnel Map Enable */
- uint tnlalllookup:1; /* Tunnel All Lookup */
- uint hashtoeplitz:1; /* use Toeplitz hash */
+ unsigned int synmapen:1; /* SYN Map Enable */
+ unsigned int syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
+ unsigned int syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
+ unsigned int syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
+ unsigned int syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
+ unsigned int ofdmapen:1; /* Offload Map Enable */
+ unsigned int tnlmapen:1; /* Tunnel Map Enable */
+ unsigned int tnlalllookup:1; /* Tunnel All Lookup */
+ unsigned int hashtoeplitz:1; /* use Toeplitz hash */
} basicvirtual;
} u;
};
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error with " Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability Natanael Copa
` (6 subsequent siblings)
9 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev, Ferruh Yigit; +Cc: Natanael Copa, stable
Add a fallback for non-GNU libc systems like musl libc for the
non-standard functions outl_p, outw_p and outb_p.
This solves the following buildtime errors when building with musl libc:
pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
We also handle the non-x86 with macros to factor out various ifdefs in
the code.
Bugzilla ID: 35
Fixes: c752998b5e2e ("pci: introduce library and driver")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/pci/linux/pci_uio.c | 95 ++++++++++++++++++++++-----------
1 file changed, 64 insertions(+), 31 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index f3305a2f2..626c8a2cc 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -14,7 +14,64 @@
#if defined(RTE_ARCH_X86)
#include <sys/io.h>
-#endif
+
+#define pci_uio_inl(reg) inl(reg)
+#define pci_uio_inw(reg) inw(reg)
+#define pci_uio_inb(reg) inb(reg)
+
+#else /* RTE_ARCH_X86 */
+
+#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg))
+#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg))
+#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg))
+
+#endif /* RTE_ARCH_X86 */
+
+
+#if defined(RTE_ARCH_X86)
+static inline void
+pci_uio_outl_p(unsigned int value, unsigned short int port)
+{
+#if defined(__GLIBC__)
+ outl_p(value, port);
+#else /* __GLIBC__ */
+ __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif /* __GLIBC__ */
+}
+#else /* RTE_ARCH_X86 */
+#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value))
+#endif /* RTE_ARCH_X86 */
+
+#if defined(RTE_ARCH_X86)
+static inline void
+pci_uio_outw_p(unsigned short int value, unsigned short int port)
+{
+#if defined(__GLIBC__)
+ outw_p(value, port);
+#else /* __GLIBC__ */
+ __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif /* __GLIBC__ */
+}
+#else /* RTE_ARCH_X86 */
+#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value))
+#endif /* RTE_ARCH_X86 */
+
+#if defined(RTE_ARCH_X86)
+static inline void
+pci_uio_outb_p(unsigned char value, unsigned short int port)
+{
+#if defined(__GLIBC__)
+ outb_p(value, port);
+#else /* __GLIBC__ */
+ __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif /* __GLIBC__ */
+}
+#else /* RTE_ARCH_X86 */
+#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value))
+#endif /* RTE_ARCH_X86 */
#include <rte_string_fns.h>
#include <rte_log.h>
@@ -500,25 +557,13 @@ pci_uio_ioport_read(struct rte_pci_ioport *p,
for (d = data; len > 0; d += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
- *(uint32_t *)d = inl(reg);
-#else
- *(uint32_t *)d = *(volatile uint32_t *)reg;
-#endif
+ *(uint32_t *)d = pci_uio_inl(reg);
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
- *(uint16_t *)d = inw(reg);
-#else
- *(uint16_t *)d = *(volatile uint16_t *)reg;
-#endif
+ *(uint16_t *)d = pci_uio_inw(reg);
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
- *d = inb(reg);
-#else
- *d = *(volatile uint8_t *)reg;
-#endif
+ *d = pci_uio_inb(reg);
}
}
}
@@ -534,25 +579,13 @@ pci_uio_ioport_write(struct rte_pci_ioport *p,
for (s = data; len > 0; s += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
- outl_p(*(const uint32_t *)s, reg);
-#else
- *(volatile uint32_t *)reg = *(const uint32_t *)s;
-#endif
+ pci_uio_outl_p(*(const uint32_t *)s, reg);
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
- outw_p(*(const uint16_t *)s, reg);
-#else
- *(volatile uint16_t *)reg = *(const uint16_t *)s;
-#endif
+ pci_uio_outw_p(*(const uint16_t *)s, reg);
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
- outb_p(*s, reg);
-#else
- *(volatile uint8_t *)reg = *s;
-#endif
+ pci_uio_outb_p(*s, reg);
}
}
}
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
` (2 preceding siblings ...)
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-10 14:41 ` Fabrizio D'Angelo
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch Natanael Copa
` (5 subsequent siblings)
9 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Natanael Copa, stable
Fix build with musl libc by using warn(3) instead of using the GNU
specific error(3).
`error(0, errno, ...)` is identical to `warn(...)` so replace:
error(0, ret, ...);
with the identical:
errno = ret;
warn(...);
We could have used the identical `warnx("...: %s", strerror(ret))` but
strerror(3) is not thread-safe and the strerror_r variant has two
incompatible versions, one GNU specific and one XSI-compliant. Avoid the
mess by letting `warn` use the thread-local errno.
This also fixes error message for kzmalloc failures which previously
would always have given "Unknown error -1", since that is what
strerror(-1) returns. Let 'warn' use the proper error message from errno
which is set by kzalloc.
Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal")
Fixes: f09ede6c8fd1 ("bus/dpaa: add BMAN driver core")
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 ++--
drivers/bus/dpaa/base/qbman/bman_driver.c | 12 ++++++++----
drivers/bus/dpaa/base/qbman/qman_driver.c | 15 ++++++++++-----
3 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index b7009f229..bcedbaf68 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -8,7 +8,7 @@
#include <dpaa_of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
@@ -90,7 +90,7 @@ netcfg_acquire(void)
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ warn("%s(): open(SOCK_RAW)", __func__);
return NULL;
}
diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c
index 750b756b9..8c9a98c48 100644
--- a/drivers/bus/dpaa/base/qbman/bman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/bman_driver.c
@@ -40,7 +40,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ errno = ret;
+ warn("pthread_getaffinity_np()");
return ret;
}
pcfg.cpu = -1;
@@ -60,7 +61,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
map.index = idx;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
return ret;
}
/* Make the portal's cache-[enabled|inhibited] regions */
@@ -104,8 +106,10 @@ static int fsl_bman_portal_finish(void)
cfg = bman_destroy_affine_portal();
DPAA_BUG_ON(cfg != &pcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ warn("process_portal_unmap()");
+ }
return ret;
}
diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index 6d9aaff16..4cff2c161 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -50,7 +50,8 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
map.index = index;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
return ret;
}
qpcfg.channel = map.channel;
@@ -96,8 +97,10 @@ static int fsl_qman_portal_finish(void)
cfg = qman_destroy_affine_portal(NULL);
DPAA_BUG_ON(cfg != &qpcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ warn("process_portal_unmap()");
+ }
return ret;
}
@@ -146,7 +149,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
- error(0, -1, "q_pcfg kzalloc failed");
+ /* kzalloc sets errno */
+ warn("q_pcfg kzalloc failed");
return NULL;
}
@@ -155,7 +159,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_map.index = QBMAN_ANY_PORTAL_IDX;
ret = process_portal_map(&q_map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
kfree(q_pcfg);
return NULL;
}
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
` (3 preceding siblings ...)
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 6/8] common/dpaax: build fix for musl libc Natanael Copa
` (4 subsequent siblings)
9 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Natanael Copa, stable
There is no standard saying that __WORDSIZE should be be defined or in
what include it should be defined. Use RTE_ARCH_64 instead.
This solves a warning when building with musl libc:
warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]
Fixes: 847ee3bd0d1f ("bus/dpaa: support FMAN frame queue lookup")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 10212f0fd..7ef2f3b2e 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -16,7 +16,7 @@ extern "C" {
#include <rte_eventdev.h>
/* FQ lookups (turn this on for 64bit user-space) */
-#if (__WORDSIZE == 64)
+#ifdef RTE_ARCH_64
#define CONFIG_FSL_QMAN_FQ_LOOKUP
/* if FQ lookups are supported, this controls the number of initialised,
* s/w-consumed FQs that can be supported at any one time.
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 6/8] common/dpaax: build fix for musl libc
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
` (4 preceding siblings ...)
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 7/8] common/dpaax: simplify pr debug/err/warn macros Natanael Copa
` (3 subsequent siblings)
9 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Natanael Copa, stable
The swab16/swab32/swab64 are Linux specific and not GNU libc specific.
Keep the check for __GLIBC__ just in case other GNU systems depends on
this (Hurd or GNU/kFreeBSD).
This fixes a build error with musl libc.
Fixes: 04711d41a872 ("crypto/dpaa2_sec: add run-time assembler for descriptor")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/common/dpaax/caamflib/compat.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index 36ee4b533..e755c77af 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <errno.h>
-#ifdef __GLIBC__
+#ifdef __linux__
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -40,7 +40,7 @@
#define __maybe_unused __rte_unused
#endif
-#if defined(__GLIBC__) && !defined(pr_debug)
+#if !defined(pr_debug)
#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
#define pr_debug(fmt, ...) \
RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -49,7 +49,7 @@
#endif
#endif /* pr_debug */
-#if defined(__GLIBC__) && !defined(pr_err)
+#if !defined(pr_err)
#if !defined(SUPPRESS_PRINTS)
#define pr_err(fmt, ...) \
RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -58,7 +58,7 @@
#endif
#endif /* pr_err */
-#if defined(__GLIBC__) && !defined(pr_warn)
+#if !defined(pr_warn)
#if !defined(SUPPRESS_PRINTS)
#define pr_warn(fmt, ...) \
RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -101,7 +101,7 @@
#endif
/* Use Linux naming convention */
-#ifdef __GLIBC__
+#if defined(__linux__) || defined(__GLIBC__)
#define swab16(x) rte_bswap16(x)
#define swab32(x) rte_bswap32(x)
#define swab64(x) rte_bswap64(x)
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 7/8] common/dpaax: simplify pr debug/err/warn macros
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
` (5 preceding siblings ...)
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 6/8] common/dpaax: build fix for musl libc Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 8/8] eal: add missing include to fix build with musl libc Natanael Copa
` (2 subsequent siblings)
9 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Natanael Copa
Simplify pr_debug, pr_err and pr_warn macros by add an intermediate
pr_msg macro. This way we only need test for SUPPRESS_PRINTS once.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/common/dpaax/caamflib/compat.h | 28 +++++++++++---------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index e755c77af..11c916412 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -40,31 +40,27 @@
#define __maybe_unused __rte_unused
#endif
+#if defined(SUPPRESS_PRINTS)
+#define pr_msg(l, fmt, ...) do { } while (0)
+#else
+#define pr_msg(l, fmt, ...) \
+ RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#endif
+
#if !defined(pr_debug)
-#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
-#define pr_debug(fmt, ...) \
- RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#if defined(RTA_DEBUG)
+#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, ...) do { } while (0)
+#define pr_debug(fmt, ...) do { } while (0)
#endif
#endif /* pr_debug */
#if !defined(pr_err)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_err(fmt, ...) \
- RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_err(fmt, ...) do { } while (0)
-#endif
+#define pr_err(fmt, ...) pr_msg(ERR, fmt, ##__VA_ARGS__)
#endif /* pr_err */
#if !defined(pr_warn)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_warn(fmt, ...) \
- RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_warn(fmt, ...) do { } while (0)
-#endif
+#define pr_warn(fmt, ...) pr_msg(WARNING, fmt, ##__VA_ARGS__)
#endif /* pr_warn */
/**
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v4 8/8] eal: add missing include to fix build with musl libc
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
` (6 preceding siblings ...)
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 7/8] common/dpaax: simplify pr debug/err/warn macros Natanael Copa
@ 2020-11-05 21:17 ` Natanael Copa
2020-11-06 10:11 ` [dpdk-dev] Build fixes for " Thomas Monjalon
2020-11-06 10:44 ` David Marchand
9 siblings, 0 replies; 140+ messages in thread
From: Natanael Copa @ 2020-11-05 21:17 UTC (permalink / raw)
To: dev; +Cc: Natanael Copa, stable
Solve the build error with musl libc:
../lib/librte_eal/unix/eal_file.c: In function 'eal_file_open':
../lib/librte_eal/unix/eal_file.c:22:15: error: 'O_RDONLY' undeclared
(first use in this function)
22 | sys_flags = O_RDONLY;
| ^~~~~~~~
Fixes: 176bb37ca6f3 ("eal: introduce internal wrappers for file operations")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
lib/librte_eal/unix/eal_file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/unix/eal_file.c b/lib/librte_eal/unix/eal_file.c
index 1b26475ba..ec554e009 100644
--- a/lib/librte_eal/unix/eal_file.c
+++ b/lib/librte_eal/unix/eal_file.c
@@ -4,6 +4,7 @@
#include <sys/file.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <unistd.h>
#include <rte_errno.h>
--
2.29.2
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error withmusl libc
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error with " Natanael Copa
@ 2020-11-06 9:22 ` Morten Brørup
0 siblings, 0 replies; 140+ messages in thread
From: Morten Brørup @ 2020-11-06 9:22 UTC (permalink / raw)
To: Natanael Copa; +Cc: stable, dev, Wenzhuo Lu, Beilei Xing, Bernard Iremonger
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Natanael Copa
> Sent: Thursday, November 5, 2020 10:17 PM
>
> Improve portability by avoid use non-standard 'uint'.
>
> Use uint8_t for hash_key_len as rss_key_len is a uint8_t type.
>
> This solves following build error when building with musl libc:
>
> In file included from ../app/test-pmd/cmdline.c:74:
> ../app/test-pmd/testpmd.h:813:29: error: unknown type name 'uint'; did
> you mean 'int'?
> 813 | uint8_t *hash_key, uint hash_key_len);
> | ^~~~
> | int
>
> Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash
> commands")
> Cc: stable@dpdk.org
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
> app/test-pmd/config.c | 2 +-
> app/test-pmd/testpmd.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 755d1dfc9..8ec091077 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -3015,7 +3015,7 @@ port_rss_hash_conf_show(portid_t port_id, int
> show_rss_key)
>
> void
> port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t
> *hash_key,
> - uint hash_key_len)
> + uint8_t hash_key_len)
> {
> struct rte_eth_rss_conf rss_conf;
> int diag;
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 519d5517e..1cb6a6d04 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -945,7 +945,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t
> vf, uint16_t rate,
>
> void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
> void port_rss_hash_key_update(portid_t port_id, char rss_type[],
> - uint8_t *hash_key, uint hash_key_len);
> + uint8_t *hash_key, uint8_t hash_key_len);
> int rx_queue_id_is_invalid(queueid_t rxq_id);
> int tx_queue_id_is_invalid(queueid_t txq_id);
> void setup_gro(const char *onoff, portid_t port_id);
> --
> 2.29.2
>
Ethdev RSS hash key length is uint8_t, so this patch is correct not using unsigned int as replacement.
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musllibc
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc Natanael Copa
@ 2020-11-06 9:24 ` Morten Brørup
0 siblings, 0 replies; 140+ messages in thread
From: Morten Brørup @ 2020-11-06 9:24 UTC (permalink / raw)
To: Natanael Copa; +Cc: stable, dev, Rahul Lakkireddy
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Natanael Copa
> Sent: Thursday, November 5, 2020 10:17 PM
>
> Improve portability by replacing non-standard 'uint' with 'unsigned
> int'
>
> This solves the build error with musl libc:
>
> In file included from ../drivers/net/cxgbe/cxgbe.h:9,
> from ../drivers/net/cxgbe/cxgbe_ethdev.c:37:
> ../drivers/net/cxgbe/base/common.h:201:4: error: unknown type name
> 'uint'
> 201 | uint synmapen:1; /* SYN Map Enable */
> | ^~~~
>
> Fixes: bfcb257d3014 ("net/cxgbe: enable RSS for VF")
> Cc: stable@dpdk.org
>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
> drivers/net/cxgbe/base/common.h | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/cxgbe/base/common.h
> b/drivers/net/cxgbe/base/common.h
> index 8fe8e2a36..c1d09dfad 100644
> --- a/drivers/net/cxgbe/base/common.h
> +++ b/drivers/net/cxgbe/base/common.h
> @@ -201,15 +201,15 @@ struct rss_params {
> unsigned int mode; /* RSS mode */
> union {
> struct {
> - uint synmapen:1; /* SYN Map Enable */
> - uint syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash
> */
> - uint syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash
> */
> - uint syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash
> */
> - uint syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash
> */
> - uint ofdmapen:1; /* Offload Map Enable */
> - uint tnlmapen:1; /* Tunnel Map Enable */
> - uint tnlalllookup:1; /* Tunnel All Lookup */
> - uint hashtoeplitz:1; /* use Toeplitz hash */
> + unsigned int synmapen:1; /* SYN Map Enable */
> + unsigned int syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs
> hash */
> + unsigned int syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs
> hash */
> + unsigned int syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs
> hash */
> + unsigned int syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs
> hash */
> + unsigned int ofdmapen:1; /* Offload Map Enable
> */
> + unsigned int tnlmapen:1; /* Tunnel Map Enable */
> + unsigned int tnlalllookup:1; /* Tunnel All Lookup */
> + unsigned int hashtoeplitz:1; /* use Toeplitz hash */
> } basicvirtual;
> } u;
> };
> --
> 2.29.2
>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] Build fixes for musl libc
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
` (7 preceding siblings ...)
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 8/8] eal: add missing include to fix build with musl libc Natanael Copa
@ 2020-11-06 10:11 ` Thomas Monjalon
2020-11-06 10:44 ` David Marchand
9 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2020-11-06 10:11 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, david.marchand
05/11/2020 22:17, Natanael Copa:
> v4 rebase against main and deal with renames/moves.
> fix commit messages to make check-git-log.sh happy.
> improve error(3) -> warn(3) patch and clarify commit message.
> update __WORDSIZE patch to use RTE_ARCH_64
> add "Fixes:" tags
> add a couple of patches fro eal
>
> Sorry that it took so long time to follow up.
No problem, that's very good to receive these fixes. Thanks
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] Build fixes for musl libc
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
` (8 preceding siblings ...)
2020-11-06 10:11 ` [dpdk-dev] Build fixes for " Thomas Monjalon
@ 2020-11-06 10:44 ` David Marchand
2021-02-18 16:13 ` Thomas Monjalon
9 siblings, 1 reply; 140+ messages in thread
From: David Marchand @ 2020-11-06 10:44 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
Hello Natanael,
On Thu, Nov 5, 2020 at 10:17 PM Natanael Copa <ncopa@alpinelinux.org> wrote:
>
> A set of patches to fix build with musl libc. I also did a few cleanups wrt
> macros and fixed a few scary compiler warnings while at it.
>
> Please note that those are only compile tested on x86_64 with musl libc.
>
> v2 has some code style fixes reported by checkpatch
>
> v3 is a full reroll of the entire patch set to enable automatted tests
> and logic for patchwork patchset.
>
> v4 rebase against main and deal with renames/moves.
> fix commit messages to make check-git-log.sh happy.
> improve error(3) -> warn(3) patch and clarify commit message.
> update __WORDSIZE patch to use RTE_ARCH_64
> add "Fixes:" tags
> add a couple of patches fro eal
>
> Sorry that it took so long time to follow up.
>
> Natanael Copa (8):
> app/testpmd: fix uint build error with musl libc
> net/cxgbe: fix uint build error with musl libc
> bus/pci: add fallback for out* for non GNU libc
> bus/dpaa: use warn instead of error to improve portability
> bus/dpaa: fix detection of 64 bit arch
> common/dpaax: build fix for musl libc
> common/dpaax: simplify pr debug/err/warn macros
> eal: add missing include to fix build with musl libc
- I suppose you got the mails with the build errors from the robot.
Build is broken in dpaa (missing a few <err.h> includes).
https://travis-ci.com/github/ovsrobot/dpdk/jobs/429242867#L1005
- I still see a uint use in drivers/net/igc.
How about:
diff --git a/drivers/net/igc/igc_flow.c b/drivers/net/igc/igc_flow.c
index 1bb64d323c..66053060af 100644
--- a/drivers/net/igc/igc_flow.c
+++ b/drivers/net/igc/igc_flow.c
@@ -656,7 +656,7 @@ igc_parse_action_rss(struct rte_eth_dev *dev,
* Return the pointer of the flow, or NULL for failed
**/
static inline struct rte_flow *
-igc_alloc_flow(const void *filter, enum igc_filter_type type, uint inbytes)
+igc_alloc_flow(const void *filter, enum igc_filter_type type, size_t inbytes)
{
/* allocate memory, 8 bytes boundary aligned */
struct rte_flow *flow = rte_malloc("igc flow filter",
--
David Marchand
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability Natanael Copa
@ 2020-11-10 14:41 ` Fabrizio D'Angelo
0 siblings, 0 replies; 140+ messages in thread
From: Fabrizio D'Angelo @ 2020-11-10 14:41 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
I ran into this error and fixed it by removing the include directive
for error.h:
/drivers/common/dpaax/compat.h:37:10: fatal error: error.h: No such
file or directory
Not sure if this change was missing or if there is some other way the
build should be configured.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] Build fixes for musl libc
2020-11-06 10:44 ` David Marchand
@ 2021-02-18 16:13 ` Thomas Monjalon
2021-02-20 8:51 ` Natanael Copa
0 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-18 16:13 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, David Marchand
Hi Natanael,
06/11/2020 11:44, David Marchand:
> Hello Natanael,
>
> - I suppose you got the mails with the build errors from the robot.
> Build is broken in dpaa (missing a few <err.h> includes).
> https://travis-ci.com/github/ovsrobot/dpdk/jobs/429242867#L1005
Please could send a new version fixing the build issues?
If you don't have time, just ask for someone to follow-up,
we probably can find a volunteer.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] Build fixes for musl libc
2021-02-18 16:13 ` Thomas Monjalon
@ 2021-02-20 8:51 ` Natanael Copa
2021-02-25 9:41 ` Thomas Monjalon
0 siblings, 1 reply; 140+ messages in thread
From: Natanael Copa @ 2021-02-20 8:51 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, David Marchand
Hi,
Sorry, I thought I would be able to allocate time yesterday but got distracted.
I would appreciate if someone else could follow up, since I don’t know when I´ll find time for it.
Thanks!
-nc
> 18. feb. 2021 kl. 17:13 skrev Thomas Monjalon <thomas@monjalon.net>:
>
> Hi Natanael,
>
> 06/11/2020 11:44, David Marchand:
>> Hello Natanael,
>>
>> - I suppose you got the mails with the build errors from the robot.
>> Build is broken in dpaa (missing a few <err.h> includes).
>> https://travis-ci.com/github/ovsrobot/dpdk/jobs/429242867#L1005
>
> Please could send a new version fixing the build issues?
> If you don't have time, just ask for someone to follow-up,
> we probably can find a volunteer.
>
>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] Build fixes for musl libc
2021-02-20 8:51 ` Natanael Copa
@ 2021-02-25 9:41 ` Thomas Monjalon
0 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 9:41 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev, David Marchand
20/02/2021 09:51, Natanael Copa:
> 18. feb. 2021 kl. 17:13 skrev Thomas Monjalon <thomas@monjalon.net>:
> > 06/11/2020 11:44, David Marchand:
> >> Hello Natanael,
> >>
> >> - I suppose you got the mails with the build errors from the robot.
> >> Build is broken in dpaa (missing a few <err.h> includes).
> >> https://travis-ci.com/github/ovsrobot/dpdk/jobs/429242867#L1005
> >
> > Please could send a new version fixing the build issues?
> > If you don't have time, just ask for someone to follow-up,
> > we probably can find a volunteer.
>
> Sorry, I thought I would be able to allocate time yesterday but got distracted.
>
> I would appreciate if someone else could follow up, since I don’t know when I´ll find time for it.
I am taking over the series, adding multiple fixes
to make Alpine fully supported.
I will send a v5 soon.
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (16 preceding siblings ...)
2019-03-30 23:57 ` Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
` (16 more replies)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
19 siblings, 17 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev; +Cc: ncopa
These patches fix some build errors/warning for Alpine Linux,
using musl and busybox.
Few improvements are added on the way.
The goal is to run a container with the following Dockerfile:
8< ------------
FROM alpine
# DPDK prerequisites
RUN apk --no-cache add \
gcc libc-dev bsd-compat-headers linux-headers \
python3 py3-elftools meson ninja \
libexecinfo-dev numactl-dev zlib-dev libpcap-dev libbpf-dev openssl-dev
# mlx prerequisites
RUN apk --no-cache add \
git cmake libnl3-dev
RUN git clone https://github.com/linux-rdma/rdma-core.git
WORKDIR /rdma-core/build
RUN cmake -DNO_MAN_PAGES=1 -DNO_PYVERBS=1 -GNinja ..
RUN ninja install
WORKDIR /
# download
ARG version
RUN if [ "$version" = git ] ; then \
git clone http://dpdk.org/git/dpdk dpdk-$version ;\
else \
wget http://fast.dpdk.org/rel/dpdk-$version.tar.xz && \
tar xf dpdk-$version.tar.xz ;\
fi
# build
WORKDIR dpdk-$version/build
RUN meson ..
RUN ninja install
8< ------------
Natanael Copa (7):
bus/pci: support I/O port operations with musl
bus/dpaa: fix 64-bit arch detection
bus/dpaa: fix build with musl
common/dpaax/caamflib: fix build with musl
common/dpaax/caamflib: simplify log macros
net/cxgbe: remove use of uint type
app/testpmd: fix build with musl
Thomas Monjalon (10):
eal: fix comment of OS-specific header files
buildtools: fix build with busybox
build: detect execinfo library on Linux
build: define _GNU_SOURCE globally
eal/linux: fix build with musl
drivers: fix header includes for musl
drivers: replace page size definitions with function
net/igc: remove use of uint type
vdpa/mlx5: replace pthread functions unavailable in musl
examples/bbdev: fix header include for musl
app/meson.build | 4 -
app/test-pmd/bpf_cmd.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
app/test/meson.build | 3 -
buildtools/binutils-avx512-check.sh | 2 +-
buildtools/check-symbols.sh | 2 +-
buildtools/map-list-symbol.sh | 2 +-
buildtools/pkg-config/meson.build | 1 +
config/meson.build | 9 +-
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +-
drivers/bus/dpaa/base/qbman/bman_driver.c | 13 ++-
drivers/bus/dpaa/base/qbman/qman_driver.c | 17 +++-
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
drivers/bus/dpaa/include/netcfg.h | 1 -
drivers/bus/fslmc/qbman/include/compat.h | 3 -
drivers/bus/pci/linux/pci_uio.c | 91 +++++++++++++------
drivers/bus/pci/linux/pci_vfio.c | 9 +-
drivers/bus/vmbus/linux/vmbus_uio.c | 4 +-
drivers/bus/vmbus/private.h | 5 +-
drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
drivers/bus/vmbus/vmbus_common_uio.c | 4 +-
drivers/common/dpaax/caamflib/compat.h | 40 ++++----
drivers/common/dpaax/compat.h | 5 -
drivers/common/dpaax/meson.build | 1 -
drivers/crypto/virtio/virtio_pci.h | 3 +-
drivers/event/dlb/dlb.c | 9 +-
drivers/event/dlb/dlb_priv.h | 2 -
drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
drivers/event/dlb/pf/dlb_main.h | 5 +-
drivers/event/dlb/pf/dlb_pf.c | 13 ++-
drivers/event/dlb2/dlb2.c | 2 +-
drivers/event/dlb2/dlb2_priv.h | 2 -
drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
drivers/event/dlb2/pf/dlb2_main.h | 5 +-
drivers/event/dlb2/pf/dlb2_pf.c | 11 ++-
drivers/net/bnx2x/ecore_fw_defs.h | 18 ++--
drivers/net/cxgbe/base/common.h | 18 ++--
drivers/net/igc/igc_flow.c | 2 +-
drivers/net/ionic/ionic_lif.c | 25 ++---
drivers/net/ionic/ionic_main.c | 3 +-
drivers/net/ionic/ionic_osdep.h | 2 +-
drivers/net/memif/rte_eth_memif.h | 4 -
drivers/net/mlx5/linux/mlx5_socket.c | 4 -
drivers/net/netvsc/hn_rndis.c | 12 +--
drivers/net/netvsc/hn_rxtx.c | 10 +-
drivers/net/netvsc/hn_var.h | 9 +-
drivers/net/virtio/virtio.h | 2 +-
drivers/net/virtio/virtio_ethdev.c | 6 +-
drivers/net/virtio/virtio_ethdev.h | 4 -
drivers/vdpa/ifc/ifcvf_vdpa.c | 17 ++--
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 ++---
examples/bbdev_app/main.c | 2 +-
examples/ip_pipeline/Makefile | 2 +-
examples/meson.build | 4 +-
.../performance-thread/l3fwd-thread/main.c | 4 -
.../performance-thread/pthread_shim/Makefile | 1 -
examples/pipeline/Makefile | 2 +-
examples/vhost_blk/vhost_blk.c | 4 -
lib/librte_eal/freebsd/include/rte_os.h | 5 +-
lib/librte_eal/linux/include/rte_os.h | 7 +-
lib/librte_eal/unix/eal_file.c | 1 +
lib/librte_eal/windows/include/rte_os.h | 5 +-
63 files changed, 242 insertions(+), 242 deletions(-)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 01/17] eal: fix comment of OS-specific header files
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 02/17] buildtools: fix build with busybox Thomas Monjalon
` (15 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Bruce Richardson, Dmitry Kozlyuk,
Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
Harini Ramakrishnan, Anand Rawat
The same comment is on top of each rte_os.h file.
It is reworded to remove the mention of "future releases".
Fixes: 428eb983f5f7 ("eal: add OS specific header file")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_eal/freebsd/include/rte_os.h | 5 ++---
lib/librte_eal/linux/include/rte_os.h | 5 ++---
lib/librte_eal/windows/include/rte_os.h | 5 ++---
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/lib/librte_eal/freebsd/include/rte_os.h b/lib/librte_eal/freebsd/include/rte_os.h
index eeb750cd81..c16f2a30e9 100644
--- a/lib/librte_eal/freebsd/include/rte_os.h
+++ b/lib/librte_eal/freebsd/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * freebsd OS. Functions will be added in future releases.
+ * This header should contain any definition
+ * which is not supported natively or named differently in FreeBSD.
*/
#include <pthread_np.h>
diff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h
index 218d4fa86e..390b87b3a1 100644
--- a/lib/librte_eal/linux/include/rte_os.h
+++ b/lib/librte_eal/linux/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * linux OS. Functions will be added in future releases.
+ * This header should contain any definition
+ * which is not supported natively or named differently in Linux.
*/
#include <sched.h>
diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 7ef38ff06c..f0512f20a6 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * Windows OS. It must not include Windows-specific headers.
+ * This header should contain any definition
+ * which is not supported natively or named differently in Windows.
*/
#include <stdarg.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 02/17] buildtools: fix build with busybox
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-26 9:11 ` Bruce Richardson
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 03/17] build: detect execinfo library on Linux Thomas Monjalon
` (14 subsequent siblings)
16 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Bruce Richardson, Konstantin Ananyev,
Ray Kinsella, Neil Horman, Haiyue Wang, David Marchand,
Adrien Mazarguil
If using busybox for mktemp and awk (as in Alpine),
some bugs prevent the script from running:
1/ It seems busybox mktemp requires the pattern to have at least
6 X and no other suffix.
The same has been fixed for other scripts in the past:
commit 3771edc35438 ("buildtools: fix build for some mktemp")
2/ It seems busybox awk does not accept the regex ^.*{
except if the opening curly brace is escaped.
Fixes: 4c82473412e8 ("build: add internal tag check")
Fixes: 68b1f1cda5b4 ("build: check AVX512 rather than binutils version")
Fixes: 3290ac14eb94 ("buildtools: detect discrepancies for experimental symbols")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
buildtools/binutils-avx512-check.sh | 2 +-
buildtools/check-symbols.sh | 2 +-
buildtools/map-list-symbol.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
index a7e068140f..2a833b64b7 100755
--- a/buildtools/binutils-avx512-check.sh
+++ b/buildtools/binutils-avx512-check.sh
@@ -3,7 +3,7 @@
# Copyright(c) 2020 Intel Corporation
AS=${AS:-as}
-OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
+OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX)
trap 'rm -f "$OBJFILE"' EXIT
# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
diff --git a/buildtools/check-symbols.sh b/buildtools/check-symbols.sh
index e407553a34..6723e38450 100755
--- a/buildtools/check-symbols.sh
+++ b/buildtools/check-symbols.sh
@@ -18,7 +18,7 @@ then
exit 0
fi
-DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
+DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
trap 'rm -f "$DUMPFILE"' EXIT
objdump -t $OBJFILE >$DUMPFILE
diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh
index 5509b4a7fa..3bf9bd66f8 100755
--- a/buildtools/map-list-symbol.sh
+++ b/buildtools/map-list-symbol.sh
@@ -44,7 +44,7 @@ for file in $@; do
ret = 1;
}
}
- /^.*{/ {
+ /^.*\{/ {
if ("'$section'" == "all" || $1 == "'$section'") {
current_section = $1;
}
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 03/17] build: detect execinfo library on Linux
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 02/17] buildtools: fix build with busybox Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-26 9:08 ` Bruce Richardson
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally Thomas Monjalon
` (13 subsequent siblings)
16 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Bruce Richardson
The library execinfo and its header file can be installed on Alpine Linux
where the backtrace feature is not part of musl libc:
apk add libexecinfo-dev
As a consequence, this library should not be restricted to BSD only.
At the same time, the library and header are detected once and added
globally to be linked with any application, internal or external.
Fixes: 9065b1fac65f ("build: fix dependency on execinfo for BSD meson builds")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/meson.build | 4 ----
app/test/meson.build | 1 -
config/meson.build | 9 ++++++---
examples/meson.build | 4 +---
4 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/app/meson.build b/app/meson.build
index 87fc195dbf..50a53dbde8 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -21,9 +21,6 @@ apps = [
'test-regex',
'test-sad']
-# for BSD only
-lib_execinfo = cc.find_library('execinfo', required: false)
-
default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
default_ldflags = []
if get_option('default_library') == 'static' and not is_windows
@@ -53,7 +50,6 @@ foreach app:apps
dep_objs += get_variable(get_option('default_library')
+ '_rte_' + d)
endforeach
- dep_objs += lib_execinfo
link_libs = []
if get_option('default_library') == 'static'
diff --git a/app/test/meson.build b/app/test/meson.build
index 561e493a29..099895fc87 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -426,7 +426,6 @@ foreach d:test_deps
def_lib = get_option('default_library')
test_dep_objs += get_variable(def_lib + '_rte_' + d)
endforeach
-test_dep_objs += cc.find_library('execinfo', required: false)
link_libs = []
if get_option('default_library') == 'static'
diff --git a/config/meson.build b/config/meson.build
index 3cf560b8a3..66a2edcc47 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -125,11 +125,8 @@ if cc.find_library('m', required : false).found()
dpdk_extra_ldflags += '-lm'
endif
-# for linux link against dl, for bsd execinfo
if is_linux
link_lib = 'dl'
-elif is_freebsd
- link_lib = 'execinfo'
else
link_lib = ''
endif
@@ -166,6 +163,12 @@ if fdt_dep.found() and cc.has_header('fdt.h')
dpdk_extra_ldflags += '-lfdt'
endif
+libexecinfo = cc.find_library('libexecinfo', required: false)
+if libexecinfo.found() and cc.has_header('execinfo.h')
+ add_project_link_arguments('-lexecinfo', language: 'c')
+ dpdk_extra_ldflags += '-lexecinfo'
+endif
+
# check for libbsd
libbsd = dependency('libbsd', required: false, method: 'pkg-config')
if libbsd.found()
diff --git a/examples/meson.build b/examples/meson.build
index b9ab24223f..ab06e2da33 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -6,8 +6,6 @@ if get_option('default_library') == 'static'
link_whole_libs = dpdk_static_libraries + dpdk_drivers
endif
-execinfo = cc.find_library('execinfo', required: false)
-
# list of all example apps. Keep 1-3 per line, in alphabetical order.
all_examples = [
'bbdev_app', 'bond',
@@ -76,7 +74,7 @@ foreach example: examples
cflags = default_cflags
ldflags = default_ldflags
- ext_deps = [execinfo]
+ ext_deps = []
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
subdir(example)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (2 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 03/17] build: detect execinfo library on Linux Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-26 9:08 ` Bruce Richardson
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 05/17] eal/linux: fix build with musl Thomas Monjalon
` (12 subsequent siblings)
16 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Bruce Richardson, Hemant Agrawal, Sachin Saxena,
Jakub Grajciar, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko,
Cristian Dumitrescu, John McNamara, Maxime Coquelin, Chenbo Xia,
Anatoly Burakov, Konstantin Ananyev, Marcin Smoczynski
There was an intent to define _GNU_SOURCE globally,
but it was not set in pkg-config for external applications.
The internal definition in config/meson.build is kept,
and one is added in buildtools/pkg-config/meson.build for external apps.
All other specific definitions of _GNU_SOURCE are removed.
Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")
Fixes: 28188cee2aa0 ("build: enable BSD features visibility for FreeBSD")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/meson.build | 2 --
buildtools/pkg-config/meson.build | 1 +
drivers/bus/fslmc/qbman/include/compat.h | 3 ---
drivers/common/dpaax/compat.h | 4 ----
drivers/common/dpaax/meson.build | 1 -
drivers/net/memif/rte_eth_memif.h | 4 ----
drivers/net/mlx5/linux/mlx5_socket.c | 4 ----
examples/ip_pipeline/Makefile | 2 +-
examples/performance-thread/l3fwd-thread/main.c | 4 ----
examples/performance-thread/pthread_shim/Makefile | 1 -
examples/pipeline/Makefile | 2 +-
examples/vhost_blk/vhost_blk.c | 4 ----
12 files changed, 3 insertions(+), 29 deletions(-)
diff --git a/app/test/meson.build b/app/test/meson.build
index 099895fc87..76eaaea457 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -398,8 +398,6 @@ if cc.has_argument('-Wno-format-truncation')
cflags += '-Wno-format-truncation'
endif
-# specify -D_GNU_SOURCE unconditionally
-cflags += '-D_GNU_SOURCE'
# Strict-aliasing rules are violated by uint8_t[] to context size casts.
cflags += '-fno-strict-aliasing'
diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build
index 39a8fd1c8e..d3f3edaa2f 100644
--- a/buildtools/pkg-config/meson.build
+++ b/buildtools/pkg-config/meson.build
@@ -3,6 +3,7 @@
pkg = import('pkgconfig')
pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
+pkg_extra_cflags += '-D_GNU_SOURCE'
if is_freebsd
pkg_extra_cflags += ['-D__BSD_VISIBLE']
endif
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index 1ddd69e127..a4471a80af 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -8,9 +8,6 @@
#ifndef HEADER_COMPAT_H
#define HEADER_COMPAT_H
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index 1a5f36e99e..c69e76ab96 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -10,10 +10,6 @@
#define __COMPAT_H
#include <sched.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/drivers/common/dpaax/meson.build b/drivers/common/dpaax/meson.build
index 4535482701..b7f177a62e 100644
--- a/drivers/common/dpaax/meson.build
+++ b/drivers/common/dpaax/meson.build
@@ -10,7 +10,6 @@ sources = files('dpaax_iova_table.c', 'dpaa_of.c', 'caamflib.c')
includes += include_directories('caamflib')
-cflags += ['-D_GNU_SOURCE']
if cc.has_argument('-Wno-cast-qual')
cflags += '-Wno-cast-qual'
endif
diff --git a/drivers/net/memif/rte_eth_memif.h b/drivers/net/memif/rte_eth_memif.h
index 24321d3a39..2038bda742 100644
--- a/drivers/net/memif/rte_eth_memif.h
+++ b/drivers/net/memif/rte_eth_memif.h
@@ -5,10 +5,6 @@
#ifndef _RTE_ETH_MEMIF_H_
#define _RTE_ETH_MEMIF_H_
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif /* GNU_SOURCE */
-
#include <sys/queue.h>
#include <ethdev_driver.h>
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 1938453980..b1f41bc102 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -2,10 +2,6 @@
* Copyright 2019 Mellanox Technologies, Ltd
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
index 96f492a5ea..7933ad7519 100644
--- a/examples/ip_pipeline/Makefile
+++ b/examples/ip_pipeline/Makefile
@@ -47,7 +47,7 @@ $(error "Cannot generate statically-linked binaries with this version of pkg-con
endif
endif
-CFLAGS += -I. -DALLOW_EXPERIMENTAL_API -D_GNU_SOURCE
+CFLAGS += -I. -DALLOW_EXPERIMENTAL_API
OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 4d82fb82ef..10bd33d767 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -2,10 +2,6 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
diff --git a/examples/performance-thread/pthread_shim/Makefile b/examples/performance-thread/pthread_shim/Makefile
index 5aa401dc49..a1f4557cd4 100644
--- a/examples/performance-thread/pthread_shim/Makefile
+++ b/examples/performance-thread/pthread_shim/Makefile
@@ -18,7 +18,6 @@ endif
endif
CFLAGS += -DALLOW_EXPERIMENTAL_API
-CFLAGS += -D_GNU_SOURCE
LDFLAGS += "-Wl,--copy-dt-needed-entries"
# Build using pkg-config variables if possible
diff --git a/examples/pipeline/Makefile b/examples/pipeline/Makefile
index fcba51fd4d..92caf4aeb2 100644
--- a/examples/pipeline/Makefile
+++ b/examples/pipeline/Makefile
@@ -38,7 +38,7 @@ $(error "Cannot generate statically-linked binaries with this version of pkg-con
endif
endif
-CFLAGS += -I. -DALLOW_EXPERIMENTAL_API -D_GNU_SOURCE
+CFLAGS += -I. -DALLOW_EXPERIMENTAL_API
OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c
index 7ea60863da..e9361267a6 100644
--- a/examples/vhost_blk/vhost_blk.c
+++ b/examples/vhost_blk/vhost_blk.c
@@ -2,12 +2,8 @@
* Copyright(c) 2010-2019 Intel Corporation
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <pthread.h>
#include <sched.h>
-
#include <stdint.h>
#include <unistd.h>
#include <stdbool.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 05/17] eal/linux: fix build with musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (3 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 06/17] drivers: fix header includes for musl Thomas Monjalon
` (11 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Ferruh Yigit, Jerin Jacob, Dmitry Kozlyuk
In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
In case _GNU_SOURCE is undefined, as in eal_common_errno.c,
it was not possible to include rte_os.h which uses cpu_set_t.
This limitation is removed: if _GNU_SOURCE is not defined,
cpu_set_t related definitions are skipped.
Note: such definitions are unneeded in eal_common_errno.c.
A missing include of fcntl.h is also added.
Bugzilla ID: 35
Fixes: 11b57c698005 ("eal: fix error string function")
Fixes: 176bb37ca6f3 ("eal: introduce internal wrappers for file operations")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
lib/librte_eal/linux/include/rte_os.h | 2 ++
lib/librte_eal/unix/eal_file.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h
index 390b87b3a1..f3f9982f40 100644
--- a/lib/librte_eal/linux/include/rte_os.h
+++ b/lib/librte_eal/linux/include/rte_os.h
@@ -12,6 +12,7 @@
#include <sched.h>
+#ifdef _GNU_SOURCE
typedef cpu_set_t rte_cpuset_t;
#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
@@ -28,5 +29,6 @@ typedef cpu_set_t rte_cpuset_t;
RTE_CPU_FILL(&tmp); \
CPU_XOR(dst, &tmp, src); \
} while (0)
+#endif
#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/unix/eal_file.c b/lib/librte_eal/unix/eal_file.c
index 1b26475ba4..ec554e0096 100644
--- a/lib/librte_eal/unix/eal_file.c
+++ b/lib/librte_eal/unix/eal_file.c
@@ -4,6 +4,7 @@
#include <sys/file.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <unistd.h>
#include <rte_errno.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 06/17] drivers: fix header includes for musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (4 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 05/17] eal/linux: fix build with musl Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 07/17] drivers: replace page size definitions with function Thomas Monjalon
` (10 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Timothy McDaniel,
Geoff Thorpe, Shreyansh Jain, Gage Eads
The header files argp.h and error.h do not exist in musl libc
and are not needed in dpaa code.
The header file fcntl.h should not be included from sys/ directory
as done in dlb drivers, it is an error with musl libc.
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros")
Fixes: 19980083fd57 ("event/dlb: add eventdev probe")
Fixes: 5433956d5185 ("event/dlb2: add eventdev probe")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/bus/dpaa/include/netcfg.h | 1 -
drivers/common/dpaax/compat.h | 1 -
drivers/event/dlb/dlb.c | 2 +-
drivers/event/dlb/pf/dlb_pf.c | 3 ++-
drivers/event/dlb2/dlb2.c | 2 +-
drivers/event/dlb2/pf/dlb2_pf.c | 3 ++-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h
index d7d1befd24..bb18a34e3d 100644
--- a/drivers/bus/dpaa/include/netcfg.h
+++ b/drivers/bus/dpaa/include/netcfg.h
@@ -9,7 +9,6 @@
#define __NETCFG_H
#include <fman.h>
-#include <argp.h>
/* Configuration information related to a specific ethernet port */
struct fm_eth_port_cfg {
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index c69e76ab96..7166f8cceb 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -30,7 +30,6 @@
#include <assert.h>
#include <dirent.h>
#include <inttypes.h>
-#include <error.h>
#include <rte_byteorder.h>
#include <rte_atomic.h>
#include <rte_spinlock.h>
diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
index 8b26d1d2d2..2fbfc6aed4 100644
--- a/drivers/event/dlb/dlb.c
+++ b/drivers/event/dlb/dlb.c
@@ -10,7 +10,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
index 3aeef6f91d..876c68e51d 100644
--- a/drivers/event/dlb/pf/dlb_pf.c
+++ b/drivers/event/dlb/pf/dlb_pf.c
@@ -6,12 +6,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
+
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_dev.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index b28ec58bfb..fb5ff012a4 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <rte_common.h>
#include <rte_config.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 1a7d8fc294..b85fd3ec56 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -6,12 +6,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
+
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_dev.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 07/17] drivers: replace page size definitions with function
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (5 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 06/17] drivers: fix header includes for musl Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 08/17] bus/pci: support I/O port operations with musl Thomas Monjalon
` (9 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, Anatoly Burakov, Stephen Hemminger, Long Li, Jay Zhou,
Timothy McDaniel, Rasesh Mody, Shahed Shaikh, Andrew Boyer,
Maxime Coquelin, Chenbo Xia, Xiao Wang
The page size is often retrieved from the macro PAGE_SIZE.
If PAGE_SIZE is not defined, it is either using hard coded default,
or getting the system value from the UNIX-only function sysconf().
Such definitions are replaced with the generic function
rte_mem_page_size() defined for each supported OS.
Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
because #ifdef checks were missing, causing redefinition errors.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/bus/pci/linux/pci_vfio.c | 9 ++-------
drivers/bus/vmbus/linux/vmbus_uio.c | 4 ++--
drivers/bus/vmbus/private.h | 5 +----
drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
drivers/bus/vmbus/vmbus_common_uio.c | 4 ++--
drivers/crypto/virtio/virtio_pci.h | 3 ++-
drivers/event/dlb/dlb.c | 7 +++++--
drivers/event/dlb/dlb_priv.h | 2 --
drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
drivers/event/dlb/pf/dlb_main.h | 5 +----
drivers/event/dlb/pf/dlb_pf.c | 10 ++++++----
drivers/event/dlb2/dlb2_priv.h | 2 --
drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
drivers/event/dlb2/pf/dlb2_main.h | 5 +----
drivers/event/dlb2/pf/dlb2_pf.c | 8 ++++----
drivers/net/bnx2x/ecore_fw_defs.h | 18 ++++++++++++------
drivers/net/ionic/ionic_lif.c | 25 ++++++++++++++-----------
drivers/net/ionic/ionic_main.c | 3 ++-
drivers/net/ionic/ionic_osdep.h | 2 +-
drivers/net/netvsc/hn_rndis.c | 12 ++++++------
drivers/net/netvsc/hn_rxtx.c | 10 ++++++----
drivers/net/netvsc/hn_var.h | 9 +++------
drivers/net/virtio/virtio.h | 2 +-
drivers/net/virtio/virtio_ethdev.c | 6 +++---
drivers/net/virtio/virtio_ethdev.h | 4 ----
drivers/vdpa/ifc/ifcvf_vdpa.c | 17 +++++++----------
26 files changed, 84 insertions(+), 94 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index e3f7b6abeb..9d689d6fd9 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -38,11 +38,6 @@
#ifdef VFIO_PRESENT
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
-#define PAGE_MASK (~(PAGE_SIZE - 1))
-
static struct rte_tailq_elem rte_vfio_tailq = {
.name = "VFIO_RESOURCE_LIST",
};
@@ -507,8 +502,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
*/
uint32_t table_start = msix_table->offset;
uint32_t table_end = table_start + msix_table->size;
- table_end = RTE_ALIGN(table_end, PAGE_SIZE);
- table_start = RTE_ALIGN_FLOOR(table_start, PAGE_SIZE);
+ table_end = RTE_ALIGN(table_end, rte_mem_page_size());
+ table_start = RTE_ALIGN_FLOOR(table_start, rte_mem_page_size());
/* If page-aligned start of MSI-X table is less than the
* actual MSI-X table start address, reassign to the actual
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5dc0c47de6..b52ca5bf1d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -154,7 +154,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
vmbus_map_addr = vmbus_find_max_end_va();
/* offset is special in uio it indicates which resource */
- offset = idx * PAGE_SIZE;
+ offset = idx * rte_mem_page_size();
mapaddr = vmbus_map_resource(vmbus_map_addr, fd, offset, size, flags);
close(fd);
@@ -224,7 +224,7 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
}
file_size = sb.st_size;
- if (file_size == 0 || (file_size & (PAGE_SIZE - 1))) {
+ if (file_size == 0 || (file_size & (rte_mem_page_size() - 1))) {
VMBUS_LOG(ERR, "incorrect size %s: %zu",
ring_path, file_size);
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index f19b14e4a6..528d60a42f 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,13 +9,10 @@
#include <stdbool.h>
#include <sys/uio.h>
#include <rte_log.h>
+#include <rte_eal_paging.h>
#include <rte_vmbus_reg.h>
#include <rte_bus_vmbus.h>
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
extern struct rte_vmbus_bus rte_vmbus_bus;
extern int vmbus_logtype_bus;
diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h b/drivers/bus/vmbus/rte_vmbus_reg.h
index f5a0693dcb..8562672979 100644
--- a/drivers/bus/vmbus/rte_vmbus_reg.h
+++ b/drivers/bus/vmbus/rte_vmbus_reg.h
@@ -100,7 +100,7 @@ struct vmbus_bufring {
uint32_t value;
} feature_bits;
- /* Pad it to PAGE_SIZE so that data starts on page boundary */
+ /* Pad it to rte_mem_page_size() so that data starts on page boundary */
uint8_t reserved2[4028];
/*
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index a689bf11b3..8582e32c1d 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -63,7 +63,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
for (i = 0; i != uio_res->nb_maps; i++) {
void *mapaddr;
- off_t offset = i * PAGE_SIZE;
+ off_t offset = i * rte_mem_page_size();
mapaddr = vmbus_map_resource(uio_res->maps[i].addr,
fd, offset,
@@ -175,7 +175,7 @@ vmbus_uio_map_resource(struct rte_vmbus_device *dev)
}
dev->int_page = (uint32_t *)((char *)uio_res->maps[HV_INT_PAGE_MAP].addr
- + (PAGE_SIZE >> 1));
+ + (rte_mem_page_size() >> 1));
dev->monitor_page = uio_res->maps[HV_MON_PAGE_MAP].addr;
return 0;
}
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index d9a214dfd0..0a7ea1bb64 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <rte_eal_paging.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_cryptodev.h>
@@ -67,7 +68,7 @@ struct virtqueue;
*
* Note the sizeof(struct vring_desc) is 16 bytes.
*/
-#define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16))
+#define VIRTIO_MAX_INDIRECT ((int) (rte_mem_page_size() / 16))
/* Do we get callbacks when the ring is completely used, even if we've
* suppressed them?
diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
index 2fbfc6aed4..60084ced3b 100644
--- a/drivers/event/dlb/dlb.c
+++ b/drivers/event/dlb/dlb.c
@@ -23,6 +23,7 @@
#include <rte_io.h>
#include <rte_kvargs.h>
#include <rte_log.h>
+#include <rte_eal_paging.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_power_intrinsics.h>
@@ -991,7 +992,8 @@ dlb_hw_create_ldb_port(struct dlb_eventdev *dlb,
goto error_exit;
}
- qm_port->pp_mmio_base = DLB_LDB_PP_BASE + PAGE_SIZE * qm_port_id;
+ qm_port->pp_mmio_base = DLB_LDB_PP_BASE +
+ rte_mem_page_size() * qm_port_id;
qm_port->id = qm_port_id;
/* The credit window is one high water mark of QEs */
@@ -1181,7 +1183,8 @@ dlb_hw_create_dir_port(struct dlb_eventdev *dlb,
goto error_exit;
}
- qm_port->pp_mmio_base = DLB_DIR_PP_BASE + PAGE_SIZE * qm_port_id;
+ qm_port->pp_mmio_base = DLB_DIR_PP_BASE +
+ rte_mem_page_size() * qm_port_id;
qm_port->id = qm_port_id;
/* The credit window is one high water mark of QEs */
diff --git a/drivers/event/dlb/dlb_priv.h b/drivers/event/dlb/dlb_priv.h
index 272e17482f..ca4d6a84cf 100644
--- a/drivers/event/dlb/dlb_priv.h
+++ b/drivers/event/dlb/dlb_priv.h
@@ -76,8 +76,6 @@
#define PP_BASE(is_dir) ((is_dir) ? DLB_DIR_PP_BASE : DLB_LDB_PP_BASE)
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-
#define DLB_NUM_QES_PER_CACHE_LINE 4
#define DLB_MAX_ENQUEUE_DEPTH 64
diff --git a/drivers/event/dlb/pf/base/dlb_osdep.h b/drivers/event/dlb/pf/base/dlb_osdep.h
index 0c119b759a..dee20660ed 100644
--- a/drivers/event/dlb/pf/base/dlb_osdep.h
+++ b/drivers/event/dlb/pf/base/dlb_osdep.h
@@ -92,7 +92,7 @@ static inline void *os_map_producer_port(struct dlb_hw *hw,
pp_dma_base = (uintptr_t)hw->func_kva + DLB_PP_BASE(is_ldb);
- addr = (pp_dma_base + (PAGE_SIZE * port_id));
+ addr = (pp_dma_base + (rte_mem_page_size() * port_id));
return (void *)(uintptr_t)addr;
diff --git a/drivers/event/dlb/pf/dlb_main.h b/drivers/event/dlb/pf/dlb_main.h
index 22e215223d..e66ba228d1 100644
--- a/drivers/event/dlb/pf/dlb_main.h
+++ b/drivers/event/dlb/pf/dlb_main.h
@@ -10,10 +10,7 @@
#include <rte_spinlock.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
+#include <rte_eal_paging.h>
#include "base/dlb_hw_types.h"
#include "../dlb_user.h"
diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
index 876c68e51d..5445c2d57d 100644
--- a/drivers/event/dlb/pf/dlb_pf.c
+++ b/drivers/event/dlb/pf/dlb_pf.c
@@ -304,7 +304,7 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
- alloc_sz, PAGE_SIZE);
+ alloc_sz, rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -329,7 +329,8 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
dlb_port[response.id][DLB_LDB].pp_addr =
- (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
+ (void *)(uintptr_t)(pp_dma_base +
+ (rte_mem_page_size() * response.id));
dlb_port[response.id][DLB_LDB].cq_base =
(void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
@@ -382,7 +383,7 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
- alloc_sz, PAGE_SIZE);
+ alloc_sz, rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -407,7 +408,8 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
dlb_port[response.id][DLB_DIR].pp_addr =
- (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
+ (void *)(uintptr_t)(pp_dma_base +
+ (rte_mem_page_size() * response.id));
dlb_port[response.id][DLB_DIR].cq_base =
(void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
index b73cf3ff14..eb1a932399 100644
--- a/drivers/event/dlb2/dlb2_priv.h
+++ b/drivers/event/dlb2/dlb2_priv.h
@@ -78,8 +78,6 @@
DLB2_LDB_CQ_MAX_SIZE)
#define PP_BASE(is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE)
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-
#define DLB2_NUM_QES_PER_CACHE_LINE 4
#define DLB2_MAX_ENQUEUE_DEPTH 64
diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h
index c4c34eba5f..aa101a49a3 100644
--- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
+++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
@@ -89,7 +89,7 @@ static inline void *os_map_producer_port(struct dlb2_hw *hw,
uint64_t pp_dma_base;
pp_dma_base = (uintptr_t)hw->func_kva + DLB2_PP_BASE(is_ldb);
- addr = (pp_dma_base + (PAGE_SIZE * port_id));
+ addr = (pp_dma_base + (rte_mem_page_size() * port_id));
return (void *)(uintptr_t)addr;
}
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index f3bee71fb6..9eeda482a3 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -10,10 +10,7 @@
#include <rte_spinlock.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
+#include <rte_eal_paging.h>
#include "base/dlb2_hw_types.h"
#include "../dlb2_user.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index b85fd3ec56..cfb22efe8a 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -285,7 +285,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
- PAGE_SIZE);
+ rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -308,7 +308,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
dlb2_port[response.id][DLB2_LDB_PORT].pp_addr =
- (void *)(pp_base + (PAGE_SIZE * response.id));
+ (void *)(pp_base + (rte_mem_page_size() * response.id));
dlb2_port[response.id][DLB2_LDB_PORT].cq_base = (void *)(port_base);
memset(&port_memory, 0, sizeof(port_memory));
@@ -360,7 +360,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
- PAGE_SIZE);
+ rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -383,7 +383,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
dlb2_port[response.id][DLB2_DIR_PORT].pp_addr =
- (void *)(pp_base + (PAGE_SIZE * response.id));
+ (void *)(pp_base + (rte_mem_page_size() * response.id));
dlb2_port[response.id][DLB2_DIR_PORT].cq_base =
(void *)(port_base);
diff --git a/drivers/net/bnx2x/ecore_fw_defs.h b/drivers/net/bnx2x/ecore_fw_defs.h
index 5397a701aa..93bca8ad33 100644
--- a/drivers/net/bnx2x/ecore_fw_defs.h
+++ b/drivers/net/bnx2x/ecore_fw_defs.h
@@ -13,6 +13,8 @@
#ifndef ECORE_FW_DEFS_H
#define ECORE_FW_DEFS_H
+#include <rte_eal_paging.h>
+
#define CSTORM_ASSERT_LIST_INDEX_OFFSET (IRO[152].base)
#define CSTORM_ASSERT_LIST_OFFSET(assertListEntry) \
(IRO[151].base + ((assertListEntry) * IRO[151].m1))
@@ -252,7 +254,8 @@
#define X_ETH_LOCAL_RING_SIZE 13
#define FIRST_BD_IN_PKT 0
#define PARSE_BD_INDEX 1
-#define NUM_OF_ETH_BDS_IN_PAGE ((PAGE_SIZE)/(STRUCT_SIZE(eth_tx_bd)/8))
+#define NUM_OF_ETH_BDS_IN_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_tx_bd) / 8))
#define U_ETH_NUM_OF_SGES_TO_FETCH 8
#define U_ETH_MAX_SGES_FOR_PACKET 3
@@ -265,11 +268,14 @@
#define IP_HEADER_ALIGNMENT_PADDING 2
#define U_ETH_SGES_PER_PAGE_INVERSE_MASK \
- (0xFFFF - ((PAGE_SIZE/((STRUCT_SIZE(eth_rx_sge))/8))-1))
+ (0xFFFF - ((rte_mem_page_size() / ((STRUCT_SIZE(eth_rx_sge)) / 8)) - 1))
-#define TU_ETH_CQES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_cqe)/8))
-#define U_ETH_BDS_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_bd)/8))
-#define U_ETH_SGES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_sge)/8))
+#define TU_ETH_CQES_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_cqe) / 8))
+#define U_ETH_BDS_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_bd) / 8))
+#define U_ETH_SGES_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_sge) / 8))
#define U_ETH_BDS_PER_PAGE_MASK (U_ETH_BDS_PER_PAGE-1)
#define U_ETH_CQE_PER_PAGE_MASK (TU_ETH_CQES_PER_PAGE-1)
@@ -396,7 +402,7 @@
/* Event Ring definitions */
#define C_ERES_PER_PAGE \
- (PAGE_SIZE / BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
+ (rte_mem_page_size() / BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
#define C_ERE_PER_PAGE_MASK (C_ERES_PER_PAGE - 1)
/* number of statistic command */
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index e083f92417..395e5acc8b 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -617,18 +617,18 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type,
cq_size = num_descs * cq_desc_size;
sg_size = num_descs * sg_desc_size;
- total_size = RTE_ALIGN(q_size, PAGE_SIZE) +
- RTE_ALIGN(cq_size, PAGE_SIZE);
+ total_size = RTE_ALIGN(q_size, rte_mem_page_size()) +
+ RTE_ALIGN(cq_size, rte_mem_page_size());
/*
* Note: aligning q_size/cq_size is not enough due to cq_base address
* aligning as q_base could be not aligned to the page.
- * Adding PAGE_SIZE.
+ * Adding rte_mem_page_size().
*/
- total_size += PAGE_SIZE;
+ total_size += rte_mem_page_size();
if (flags & IONIC_QCQ_F_SG) {
- total_size += RTE_ALIGN(sg_size, PAGE_SIZE);
- total_size += PAGE_SIZE;
+ total_size += RTE_ALIGN(sg_size, rte_mem_page_size());
+ total_size += rte_mem_page_size();
}
new = rte_zmalloc("ionic", sizeof(*new), 0);
@@ -679,13 +679,16 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type,
q_base = new->base;
q_base_pa = new->base_pa;
- cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, PAGE_SIZE);
- cq_base_pa = RTE_ALIGN(q_base_pa + q_size, PAGE_SIZE);
+ cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size,
+ rte_mem_page_size());
+ cq_base_pa = RTE_ALIGN(q_base_pa + q_size,
+ rte_mem_page_size());
if (flags & IONIC_QCQ_F_SG) {
sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size,
- PAGE_SIZE);
- sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, PAGE_SIZE);
+ rte_mem_page_size());
+ sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size,
+ rte_mem_page_size());
ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
}
@@ -975,7 +978,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
IONIC_PRINT(DEBUG, "Allocating Lif Info");
- lif->info_sz = RTE_ALIGN(sizeof(*lif->info), PAGE_SIZE);
+ lif->info_sz = RTE_ALIGN(sizeof(*lif->info), rte_mem_page_size());
lif->info_z = rte_eth_dma_zone_reserve(lif->eth_dev,
"lif_info", 0 /* queue_idx*/,
diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
index 3f1a764888..3ee4999fa5 100644
--- a/drivers/net/ionic/ionic_main.c
+++ b/drivers/net/ionic/ionic_main.c
@@ -375,7 +375,8 @@ ionic_port_init(struct ionic_adapter *adapter)
if (idev->port_info)
return 0;
- idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
+ idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info),
+ rte_mem_page_size());
snprintf(z_name, sizeof(z_name), "%s_port_%s_info",
IONIC_DRV_NAME, adapter->name);
diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
index a6575c36b5..89ed106d11 100644
--- a/drivers/net/ionic/ionic_osdep.h
+++ b/drivers/net/ionic/ionic_osdep.h
@@ -17,6 +17,7 @@
#include <rte_byteorder.h>
#include <rte_io.h>
#include <rte_memory.h>
+#include <rte_eal_paging.h>
#include "ionic_logs.h"
@@ -25,7 +26,6 @@
#ifndef PAGE_SHIFT
#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
#endif
#define __iomem
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index e317539de7..e3f7e636d7 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -67,7 +67,7 @@ hn_rndis_rid(struct hn_data *hv)
static void *hn_rndis_alloc(size_t size)
{
- return rte_zmalloc("RNDIS", size, PAGE_SIZE);
+ return rte_zmalloc("RNDIS", size, rte_mem_page_size());
}
#ifdef RTE_LIBRTE_NETVSC_DEBUG_DUMP
@@ -265,17 +265,17 @@ static int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan,
return -EINVAL;
}
- if (unlikely(reqlen > PAGE_SIZE)) {
+ if (unlikely(reqlen > rte_mem_page_size())) {
PMD_DRV_LOG(ERR, "RNDIS request %u greater than page size",
reqlen);
return -EINVAL;
}
- sg.page = addr / PAGE_SIZE;
+ sg.page = addr / rte_mem_page_size();
sg.ofs = addr & PAGE_MASK;
sg.len = reqlen;
- if (sg.ofs + reqlen > PAGE_SIZE) {
+ if (sg.ofs + reqlen > rte_mem_page_size()) {
PMD_DRV_LOG(ERR, "RNDIS request crosses page boundary");
return -EINVAL;
}
@@ -479,7 +479,7 @@ hn_rndis_query(struct hn_data *hv, uint32_t oid,
return -ENOMEM;
comp_len = sizeof(*comp) + odlen;
- comp = rte_zmalloc("QUERY", comp_len, PAGE_SIZE);
+ comp = rte_zmalloc("QUERY", comp_len, rte_mem_page_size());
if (!comp) {
error = -ENOMEM;
goto done;
@@ -736,7 +736,7 @@ hn_rndis_set(struct hn_data *hv, uint32_t oid, const void *data, uint32_t dlen)
int error;
reqlen = sizeof(*req) + dlen;
- req = rte_zmalloc("RNDIS_SET", reqlen, PAGE_SIZE);
+ req = rte_zmalloc("RNDIS_SET", reqlen, rte_mem_page_size());
if (!req)
return -ENOMEM;
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 0f4ef0100b..c6bf7cc132 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1387,7 +1387,8 @@ static unsigned int hn_get_slots(const struct rte_mbuf *m)
unsigned int size = rte_pktmbuf_data_len(m);
unsigned int offs = rte_mbuf_data_iova(m) & PAGE_MASK;
- slots += (offs + size + PAGE_SIZE - 1) / PAGE_SIZE;
+ slots += (offs + size + rte_mem_page_size() - 1) /
+ rte_mem_page_size();
m = m->next;
}
@@ -1402,12 +1403,13 @@ static unsigned int hn_fill_sg(struct vmbus_gpa *sg,
while (m) {
rte_iova_t addr = rte_mbuf_data_iova(m);
- unsigned int page = addr / PAGE_SIZE;
+ unsigned int page = addr / rte_mem_page_size();
unsigned int offset = addr & PAGE_MASK;
unsigned int len = rte_pktmbuf_data_len(m);
while (len > 0) {
- unsigned int bytes = RTE_MIN(len, PAGE_SIZE - offset);
+ unsigned int bytes = RTE_MIN(len,
+ rte_mem_page_size() - offset);
sg[segs].page = page;
sg[segs].ofs = offset;
@@ -1450,7 +1452,7 @@ static int hn_xmit_sg(struct hn_tx_queue *txq,
addr = txq->tx_rndis_iova +
((char *)txd->rndis_pkt - (char *)txq->tx_rndis);
- sg[0].page = addr / PAGE_SIZE;
+ sg[0].page = addr / rte_mem_page_size();
sg[0].ofs = addr & PAGE_MASK;
sg[0].len = RNDIS_PACKET_MSG_OFFSET_ABS(hn_rndis_pktlen(txd->rndis_pkt));
segs = 1;
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index b7405ca726..43642408bc 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -6,6 +6,8 @@
* All rights reserved.
*/
+#include <rte_eal_paging.h>
+
/*
* Tunable ethdev params
*/
@@ -28,13 +30,8 @@
#define HN_RX_EXTMBUF_ENABLE 0
-/* Buffers need to be aligned */
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#ifndef PAGE_MASK
-#define PAGE_MASK (PAGE_SIZE - 1)
+#define PAGE_MASK (rte_mem_page_size() - 1)
#endif
struct hn_data;
diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h
index 21d54904e7..2c987d19ab 100644
--- a/drivers/net/virtio/virtio.h
+++ b/drivers/net/virtio/virtio.h
@@ -98,7 +98,7 @@
*
* Note the sizeof(struct vring_desc) is 16 bytes.
*/
-#define VIRTIO_MAX_INDIRECT ((int)(PAGE_SIZE / 16))
+#define VIRTIO_MAX_INDIRECT ((int)(rte_mem_page_size() / 16))
/*
* Maximum number of virtqueues per device.
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 333a5243a9..289b240c4e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -21,8 +21,8 @@
#include <rte_errno.h>
#include <rte_cpuflags.h>
#include <rte_vect.h>
-
#include <rte_memory.h>
+#include <rte_eal_paging.h>
#include <rte_eal.h>
#include <rte_dev.h>
#include <rte_cycles.h>
@@ -469,7 +469,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
sz_hdr_mz = vq_size * sizeof(struct virtio_tx_region);
} else if (queue_type == VTNET_CQ) {
/* Allocate a page for control vq command, data and status */
- sz_hdr_mz = PAGE_SIZE;
+ sz_hdr_mz = rte_mem_page_size();
}
vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE,
@@ -568,7 +568,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
cvq->mz = mz;
cvq->virtio_net_hdr_mz = hdr_mz;
cvq->virtio_net_hdr_mem = hdr_mz->iova;
- memset(cvq->virtio_net_hdr_mz->addr, 0, PAGE_SIZE);
+ memset(cvq->virtio_net_hdr_mz->addr, 0, rte_mem_page_size());
hw->cvq = cvq;
}
diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h
index 873327d989..5a501e7890 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -11,10 +11,6 @@
#include "virtio.h"
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#define VIRTIO_MAX_RX_QUEUES 128U
#define VIRTIO_MAX_TX_QUEUES 128U
#define VIRTIO_MAX_MAC_ADDRS 64
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 6a1b44bc77..39237aecf7 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -11,6 +11,7 @@
#include <linux/virtio_net.h>
#include <stdbool.h>
+#include <rte_eal_paging.h>
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_bus_pci.h>
@@ -30,10 +31,6 @@ RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
"IFCVF %s(): " fmt "\n", __func__, ##args)
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#define IFCVF_USED_RING_LEN(size) \
((size) * sizeof(struct vring_used_elem) + sizeof(uint16_t) * 3)
@@ -600,11 +597,11 @@ m_ifcvf_start(struct ifcvf_internal *internal)
for (i = 0; i < nr_vring; i++) {
rte_vhost_get_vhost_vring(vid, i, &vq);
- size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
- PAGE_SIZE);
- vring_buf = rte_zmalloc("ifcvf", size, PAGE_SIZE);
+ size = RTE_ALIGN_CEIL(vring_size(vq.size, rte_mem_page_size()),
+ rte_mem_page_size());
+ vring_buf = rte_zmalloc("ifcvf", size, rte_mem_page_size());
vring_init(&internal->m_vring[i], vq.size, vring_buf,
- PAGE_SIZE);
+ rte_mem_page_size());
ret = rte_vfio_container_dma_map(internal->vfio_container_fd,
(uint64_t)(uintptr_t)vring_buf, m_vring_iova, size);
@@ -686,8 +683,8 @@ m_ifcvf_stop(struct ifcvf_internal *internal)
len = IFCVF_USED_RING_LEN(vq.size);
rte_vhost_log_used_vring(vid, i, 0, len);
- size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
- PAGE_SIZE);
+ size = RTE_ALIGN_CEIL(vring_size(vq.size, rte_mem_page_size()),
+ rte_mem_page_size());
rte_vfio_container_dma_unmap(internal->vfio_container_fd,
(uint64_t)(uintptr_t)internal->m_vring[i].desc,
m_vring_iova, size);
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 08/17] bus/pci: support I/O port operations with musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (6 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 07/17] drivers: replace page size definitions with function Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
` (8 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Ferruh Yigit, David Marchand, Yuanhan Liu
From: Natanael Copa <ncopa@alpinelinux.org>
Add a fallback for non-GNU libc systems like musl libc for the
non-standard functions outl_p, outw_p and outb_p.
This solves the following buildtime errors when building with musl libc:
pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
The non-x86 case are handled with macros to factor out various ifdefs.
Bugzilla ID: 35
Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/bus/pci/linux/pci_uio.c | 91 ++++++++++++++++++++++-----------
1 file changed, 61 insertions(+), 30 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index f3305a2f28..1294f505be 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -489,6 +489,16 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
}
#endif
+#ifdef RTE_ARCH_X86
+#define pci_uio_inl(reg) inl(reg)
+#define pci_uio_inw(reg) inw(reg)
+#define pci_uio_inb(reg) inb(reg)
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg))
+#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg))
+#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg))
+#endif
+
void
pci_uio_ioport_read(struct rte_pci_ioport *p,
void *data, size_t len, off_t offset)
@@ -500,29 +510,62 @@ pci_uio_ioport_read(struct rte_pci_ioport *p,
for (d = data; len > 0; d += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
- *(uint32_t *)d = inl(reg);
-#else
- *(uint32_t *)d = *(volatile uint32_t *)reg;
-#endif
+ *(uint32_t *)d = pci_uio_inl(reg);
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
- *(uint16_t *)d = inw(reg);
-#else
- *(uint16_t *)d = *(volatile uint16_t *)reg;
-#endif
+ *(uint16_t *)d = pci_uio_inw(reg);
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
- *d = inb(reg);
-#else
- *d = *(volatile uint8_t *)reg;
-#endif
+ *d = pci_uio_inb(reg);
}
}
}
+#ifdef RTE_ARCH_X86
+static inline void
+pci_uio_outl_p(unsigned int value, unsigned short int port)
+{
+#ifdef __GLIBC__
+ outl_p(value, port);
+#else
+ __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif
+}
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value))
+#endif
+
+#ifdef RTE_ARCH_X86
+static inline void
+pci_uio_outw_p(unsigned short int value, unsigned short int port)
+{
+#ifdef __GLIBC__
+ outw_p(value, port);
+#else
+ __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif
+}
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value))
+#endif
+
+#ifdef RTE_ARCH_X86
+static inline void
+pci_uio_outb_p(unsigned char value, unsigned short int port)
+{
+#ifdef __GLIBC__
+ outb_p(value, port);
+#else
+ __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif
+}
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value))
+#endif
+
void
pci_uio_ioport_write(struct rte_pci_ioport *p,
const void *data, size_t len, off_t offset)
@@ -534,25 +577,13 @@ pci_uio_ioport_write(struct rte_pci_ioport *p,
for (s = data; len > 0; s += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
- outl_p(*(const uint32_t *)s, reg);
-#else
- *(volatile uint32_t *)reg = *(const uint32_t *)s;
-#endif
+ pci_uio_outl_p(*(const uint32_t *)s, reg);
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
- outw_p(*(const uint16_t *)s, reg);
-#else
- *(volatile uint16_t *)reg = *(const uint16_t *)s;
-#endif
+ pci_uio_outw_p(*(const uint16_t *)s, reg);
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
- outb_p(*s, reg);
-#else
- *(volatile uint8_t *)reg = *s;
-#endif
+ pci_uio_outb_p(*s, reg);
}
}
}
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 09/17] bus/dpaa: fix 64-bit arch detection
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (7 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 08/17] bus/pci: support I/O port operations with musl Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 10/17] bus/dpaa: fix build with musl Thomas Monjalon
` (7 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Shreyansh Jain,
Roy Pledge, Geoff Thorpe
From: Natanael Copa <ncopa@alpinelinux.org>
There is no standard saying that __WORDSIZE should be be defined or in
what include it should be defined. Use RTE_ARCH_64 instead.
This solves a warning when building with musl libc:
warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]
Fixes: 847ee3bd0d1f ("bus/dpaa: support FMAN frame queue lookup")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 10212f0fd5..7ef2f3b2e3 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -16,7 +16,7 @@ extern "C" {
#include <rte_eventdev.h>
/* FQ lookups (turn this on for 64bit user-space) */
-#if (__WORDSIZE == 64)
+#ifdef RTE_ARCH_64
#define CONFIG_FSL_QMAN_FQ_LOOKUP
/* if FQ lookups are supported, this controls the number of initialised,
* s/w-consumed FQs that can be supported at any one time.
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 10/17] bus/dpaa: fix build with musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (8 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 11/17] common/dpaax/caamflib: " Thomas Monjalon
` (6 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Shreyansh Jain,
Roy Pledge, Geoff Thorpe
From: Natanael Copa <ncopa@alpinelinux.org>
Fix build with musl libc by using warn(3) instead of using the GNU
specific error(3).
`error(0, errno, ...)` is identical to `warn(...)` so replace:
error(0, ret, ...);
with the identical:
errno = ret;
warn(...);
We could have used the identical `warnx("...: %s", strerror(ret))` but
strerror(3) is not thread-safe and the strerror_r variant has two
incompatible versions, one GNU specific and one XSI-compliant. Avoid the
mess by letting `warn` use the thread-local errno.
This also fixes error message for kzmalloc failures which previously
would always have given "Unknown error -1", since that is what
strerror(-1) returns. Let 'warn' use the proper error message from errno
which is set by kzalloc.
Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal")
Fixes: f09ede6c8fd1 ("bus/dpaa: add BMAN driver core")
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 ++--
drivers/bus/dpaa/base/qbman/bman_driver.c | 13 +++++++++----
drivers/bus/dpaa/base/qbman/qman_driver.c | 17 ++++++++++++-----
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index b7009f2299..bcedbaf68f 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -8,7 +8,7 @@
#include <dpaa_of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
@@ -90,7 +90,7 @@ netcfg_acquire(void)
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ warn("%s(): open(SOCK_RAW)", __func__);
return NULL;
}
diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c
index 750b756b93..c0b9e3da77 100644
--- a/drivers/bus/dpaa/base/qbman/bman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/bman_driver.c
@@ -11,6 +11,7 @@
#include <process.h>
#include "bman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
/*
* Global variables of the max portal/pool number this bman version supported
@@ -40,7 +41,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ errno = ret;
+ warn("pthread_getaffinity_np()");
return ret;
}
pcfg.cpu = -1;
@@ -60,7 +62,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
map.index = idx;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
return ret;
}
/* Make the portal's cache-[enabled|inhibited] regions */
@@ -104,8 +107,10 @@ static int fsl_bman_portal_finish(void)
cfg = bman_destroy_affine_portal();
DPAA_BUG_ON(cfg != &pcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ warn("process_portal_unmap()");
+ }
return ret;
}
diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index 6d9aaff164..93375d1ea8 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -9,6 +9,8 @@
#include <process.h>
#include "qman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
+
#include <rte_branch_prediction.h>
/* Global variable containing revision id (even on non-control plane systems
@@ -50,7 +52,8 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
map.index = index;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
return ret;
}
qpcfg.channel = map.channel;
@@ -96,8 +99,10 @@ static int fsl_qman_portal_finish(void)
cfg = qman_destroy_affine_portal(NULL);
DPAA_BUG_ON(cfg != &qpcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ warn("process_portal_unmap()");
+ }
return ret;
}
@@ -146,7 +151,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
- error(0, -1, "q_pcfg kzalloc failed");
+ /* kzalloc sets errno */
+ warn("q_pcfg kzalloc failed");
return NULL;
}
@@ -155,7 +161,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_map.index = QBMAN_ANY_PORTAL_IDX;
ret = process_portal_map(&q_map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
kfree(q_pcfg);
return NULL;
}
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 11/17] common/dpaax/caamflib: fix build with musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (9 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 10/17] bus/dpaa: fix build with musl Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 12/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
` (5 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Akhil Goyal,
Horia Geanta Neag
From: Natanael Copa <ncopa@alpinelinux.org>
The swab16/swab32/swab64 are Linux specific and not GNU libc specific.
Keep the check for __GLIBC__ just in case other GNU systems depends on
this (Hurd or GNU/kFreeBSD).
This fixes a build error with musl libc.
Fixes: 04711d41a872 ("crypto/dpaa2_sec: add run-time assembler for descriptor")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/common/dpaax/caamflib/compat.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index 36ee4b5335..c1a693498d 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <errno.h>
-#ifdef __GLIBC__
+#ifdef RTE_EXEC_ENV_LINUX
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -24,7 +24,7 @@
#error "Undefined endianness"
#endif
-#else
+#else /* !RTE_EXEC_ENV_LINUX */
#error Environment not supported!
#endif
@@ -40,7 +40,7 @@
#define __maybe_unused __rte_unused
#endif
-#if defined(__GLIBC__) && !defined(pr_debug)
+#if !defined(pr_debug)
#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
#define pr_debug(fmt, ...) \
RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -49,7 +49,7 @@
#endif
#endif /* pr_debug */
-#if defined(__GLIBC__) && !defined(pr_err)
+#if !defined(pr_err)
#if !defined(SUPPRESS_PRINTS)
#define pr_err(fmt, ...) \
RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -58,7 +58,7 @@
#endif
#endif /* pr_err */
-#if defined(__GLIBC__) && !defined(pr_warn)
+#if !defined(pr_warn)
#if !defined(SUPPRESS_PRINTS)
#define pr_warn(fmt, ...) \
RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -101,7 +101,7 @@
#endif
/* Use Linux naming convention */
-#ifdef __GLIBC__
+#if defined(RTE_EXEC_ENV_LINUX) || defined(__GLIBC__)
#define swab16(x) rte_bswap16(x)
#define swab32(x) rte_bswap32(x)
#define swab64(x) rte_bswap64(x)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 12/17] common/dpaax/caamflib: simplify log macros
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (10 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 11/17] common/dpaax/caamflib: " Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 13/17] net/cxgbe: remove use of uint type Thomas Monjalon
` (4 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev; +Cc: ncopa, Hemant Agrawal, Sachin Saxena
From: Natanael Copa <ncopa@alpinelinux.org>
Simplify pr_debug, pr_err and pr_warn macros by adding an intermediate
pr_msg macro. This way we only need to test for SUPPRESS_PRINTS once.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/common/dpaax/caamflib/compat.h | 28 +++++++++++---------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index c1a693498d..9776eed437 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -40,31 +40,27 @@
#define __maybe_unused __rte_unused
#endif
+#if defined(SUPPRESS_PRINTS)
+#define pr_msg(l, fmt, ...) do { } while (0)
+#else
+#define pr_msg(l, fmt, ...) \
+ RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#endif
+
#if !defined(pr_debug)
-#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
-#define pr_debug(fmt, ...) \
- RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#if defined(RTA_DEBUG)
+#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, ...) do { } while (0)
+#define pr_debug(fmt, ...) do { } while (0)
#endif
#endif /* pr_debug */
#if !defined(pr_err)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_err(fmt, ...) \
- RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_err(fmt, ...) do { } while (0)
-#endif
+#define pr_err(fmt, ...) pr_msg(ERR, fmt, ##__VA_ARGS__)
#endif /* pr_err */
#if !defined(pr_warn)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_warn(fmt, ...) \
- RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_warn(fmt, ...) do { } while (0)
-#endif
+#define pr_warn(fmt, ...) pr_msg(WARNING, fmt, ##__VA_ARGS__)
#endif /* pr_warn */
/**
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 13/17] net/cxgbe: remove use of uint type
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (11 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 12/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 14/17] net/igc: " Thomas Monjalon
` (3 subsequent siblings)
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Morten Brørup, Rahul Lakkireddy, Kumar Sanghvi
From: Natanael Copa <ncopa@alpinelinux.org>
Improve portability by replacing non-standard 'uint' with 'unsigned int'.
This solves the build error with musl libc:
In file included from ../drivers/net/cxgbe/cxgbe.h:9,
from ../drivers/net/cxgbe/cxgbe_ethdev.c:37:
../drivers/net/cxgbe/base/common.h:201:4: error: unknown type name 'uint'
201 | uint synmapen:1; /* SYN Map Enable */
| ^~~~
Fixes: bfcb257d3014 ("net/cxgbe: enable RSS for VF")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
drivers/net/cxgbe/base/common.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 202a2f4baf..ab100d784c 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -189,15 +189,15 @@ struct rss_params {
unsigned int mode; /* RSS mode */
union {
struct {
- uint synmapen:1; /* SYN Map Enable */
- uint syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
- uint syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
- uint syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
- uint syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
- uint ofdmapen:1; /* Offload Map Enable */
- uint tnlmapen:1; /* Tunnel Map Enable */
- uint tnlalllookup:1; /* Tunnel All Lookup */
- uint hashtoeplitz:1; /* use Toeplitz hash */
+ unsigned int synmapen:1; /* SYN Map Enable */
+ unsigned int syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
+ unsigned int syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
+ unsigned int syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
+ unsigned int syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
+ unsigned int ofdmapen:1; /* Offload Map Enable */
+ unsigned int tnlmapen:1; /* Tunnel Map Enable */
+ unsigned int tnlalllookup:1; /* Tunnel All Lookup */
+ unsigned int hashtoeplitz:1; /* use Toeplitz hash */
} basicvirtual;
} u;
};
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 14/17] net/igc: remove use of uint type
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (12 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 13/17] net/cxgbe: remove use of uint type Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-26 0:49 ` Wang, Haiyue
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 15/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
` (2 subsequent siblings)
16 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, David Marchand, Jeff Guo, Haiyue Wang,
Ferruh Yigit, Alvin Zhang
Improve portability (especially with musl libc)
by replacing the non-standard type 'uint' with 'size_t'.
Fixes: 746664d546fb ("net/igc: support flow API")
Cc: stable@dpdk.org
Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/igc/igc_flow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/igc/igc_flow.c b/drivers/net/igc/igc_flow.c
index 1bb64d323c..66053060af 100644
--- a/drivers/net/igc/igc_flow.c
+++ b/drivers/net/igc/igc_flow.c
@@ -656,7 +656,7 @@ igc_parse_action_rss(struct rte_eth_dev *dev,
* Return the pointer of the flow, or NULL for failed
**/
static inline struct rte_flow *
-igc_alloc_flow(const void *filter, enum igc_filter_type type, uint inbytes)
+igc_alloc_flow(const void *filter, enum igc_filter_type type, size_t inbytes)
{
/* allocate memory, 8 bytes boundary aligned */
struct rte_flow *flow = rte_malloc("igc flow filter",
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 15/17] vdpa/mlx5: replace pthread functions unavailable in musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (13 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 14/17] net/igc: " Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-03-01 7:30 ` Matan Azrad
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 16/17] app/testpmd: fix build with musl Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
16 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Matan Azrad, Viacheslav Ovsiienko, Xueming Li,
Maxime Coquelin
1/ The function pthread_yield() does not exist in musl libc,
and can be replaced with sched_yield() after including sched.h.
2/ The function pthread_attr_setaffinity_np() does not exist in musl libc,
and can be replaced with pthread_setaffinity_np() after pthread_create().
Fixes: b7fa0bf4d5c6 ("vdpa/mlx5: fix polling threads scheduling")
Fixes: 5cf3fd3af4df ("vdpa/mlx5: add CPU core parameter to bind polling thread")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 86adc864f5..49632dfaa7 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -3,6 +3,7 @@
*/
#include <unistd.h>
#include <stdint.h>
+#include <sched.h>
#include <fcntl.h>
#include <sys/eventfd.h>
@@ -234,7 +235,7 @@ mlx5_vdpa_timer_sleep(struct mlx5_vdpa_priv *priv, uint32_t max)
usleep(priv->timer_delay_us);
else
/* Give-up CPU to improve polling threads scheduling. */
- pthread_yield();
+ sched_yield();
}
static void *
@@ -515,17 +516,6 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
pthread_cond_init(&priv->timer_cond, NULL);
priv->timer_on = 0;
pthread_attr_init(&attr);
- CPU_ZERO(&cpuset);
- if (priv->event_core != -1)
- CPU_SET(priv->event_core, &cpuset);
- else
- cpuset = rte_lcore_cpuset(rte_get_main_lcore());
- ret = pthread_attr_setaffinity_np(&attr, sizeof(cpuset),
- &cpuset);
- if (ret) {
- DRV_LOG(ERR, "Failed to set thread affinity.");
- return -1;
- }
ret = pthread_attr_setschedpolicy(&attr, SCHED_RR);
if (ret) {
DRV_LOG(ERR, "Failed to set thread sched policy = RR.");
@@ -542,6 +532,17 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
DRV_LOG(ERR, "Failed to create timer thread.");
return -1;
}
+ CPU_ZERO(&cpuset);
+ if (priv->event_core != -1)
+ CPU_SET(priv->event_core, &cpuset);
+ else
+ cpuset = rte_lcore_cpuset(rte_get_main_lcore());
+ ret = pthread_setaffinity_np(priv->timer_tid,
+ sizeof(cpuset), &cpuset);
+ if (ret) {
+ DRV_LOG(ERR, "Failed to set thread affinity.");
+ goto error;
+ }
snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid);
ret = pthread_setname_np(priv->timer_tid, name);
if (ret) {
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 16/17] app/testpmd: fix build with musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (14 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 15/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Morten Brørup, Xiaoyun Li,
Nélio Laranjeiro, Konstantin Ananyev, Ferruh Yigit
From: Natanael Copa <ncopa@alpinelinux.org>
1/ Improve portability by avoiding use of non-standard 'uint'.
Use uint8_t for hash_key_len as rss_key_len is a uint8_t type.
This solves following build error when building with musl libc:
app/test-pmd/testpmd.h:813:29: error: unknown type name 'uint'
2/ In musl libc, stdout is of type (FILE * const).
Because of the const qualifier, a dark magic cast
must be achieved through uintptr_t.
Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash commands")
Fixes: e977e4199a8d ("app/testpmd: add commands to load/unload BPF filters")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-pmd/bpf_cmd.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/test-pmd/bpf_cmd.c b/app/test-pmd/bpf_cmd.c
index 066619e115..6980291f07 100644
--- a/app/test-pmd/bpf_cmd.c
+++ b/app/test-pmd/bpf_cmd.c
@@ -20,7 +20,7 @@ static const struct rte_bpf_xsym bpf_xsym[] = {
.name = RTE_STR(stdout),
.type = RTE_BPF_XTYPE_VAR,
.var = {
- .val = &stdout,
+ .val = (void *)(uintptr_t)&stdout,
.desc = {
.type = RTE_BPF_ARG_PTR,
.size = sizeof(stdout),
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index dab8afe5dd..9ca03c236e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2963,7 +2963,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
void
port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
- uint hash_key_len)
+ uint8_t hash_key_len)
{
struct rte_eth_rss_conf rss_conf;
int diag;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 4aca522859..5437b6229e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -935,7 +935,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
void port_rss_hash_key_update(portid_t port_id, char rss_type[],
- uint8_t *hash_key, uint hash_key_len);
+ uint8_t *hash_key, uint8_t hash_key_len);
int rx_queue_id_is_invalid(queueid_t rxq_id);
int tx_queue_id_is_invalid(queueid_t txq_id);
void setup_gro(const char *onoff, portid_t port_id);
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v5 17/17] examples/bbdev: fix header include for musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
` (15 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 16/17] app/testpmd: fix build with musl Thomas Monjalon
@ 2021-02-25 18:22 ` Thomas Monjalon
16 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-25 18:22 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Nicolas Chautru, Amr Mokhtar
The header file unistd.h should not be included from sys/ directory,
it is an error with musl libc.
Fixes: 1ffee690eaa1 ("examples/bbdev: add sample app")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/bbdev_app/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 2e170caf84..20cfd327fb 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/unistd.h>
+#include <unistd.h>
#include <sys/queue.h>
#include <stdarg.h>
#include <ctype.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 14/17] net/igc: remove use of uint type
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 14/17] net/igc: " Thomas Monjalon
@ 2021-02-26 0:49 ` Wang, Haiyue
0 siblings, 0 replies; 140+ messages in thread
From: Wang, Haiyue @ 2021-02-26 0:49 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ncopa, stable, David Marchand, Guo, Jia, Yigit, Ferruh, Zhang, AlvinX
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, February 26, 2021 02:23
> To: dev@dpdk.org
> Cc: ncopa@alpinelinux.org; stable@dpdk.org; David Marchand <david.marchand@redhat.com>; Guo, Jia
> <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> Zhang, AlvinX <alvinx.zhang@intel.com>
> Subject: [PATCH v5 14/17] net/igc: remove use of uint type
>
> Improve portability (especially with musl libc)
> by replacing the non-standard type 'uint' with 'size_t'.
>
> Fixes: 746664d546fb ("net/igc: support flow API")
> Cc: stable@dpdk.org
>
> Suggested-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> drivers/net/igc/igc_flow.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
> 2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally Thomas Monjalon
@ 2021-02-26 9:08 ` Bruce Richardson
2021-02-26 9:40 ` Thomas Monjalon
0 siblings, 1 reply; 140+ messages in thread
From: Bruce Richardson @ 2021-02-26 9:08 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ncopa, stable, Hemant Agrawal, Sachin Saxena,
Jakub Grajciar, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko,
Cristian Dumitrescu, John McNamara, Maxime Coquelin, Chenbo Xia,
Anatoly Burakov, Konstantin Ananyev, Marcin Smoczynski
On Thu, Feb 25, 2021 at 07:22:37PM +0100, Thomas Monjalon wrote:
> There was an intent to define _GNU_SOURCE globally,
> but it was not set in pkg-config for external applications.
>
Is this something that we really want to do, to force all external apps to
use _GNU_SOURCE when compiling? Do some of our header files rely on
definitions only available with _GNU_SOURCE? If so, we should probably look
to remove that dependency rather than mandating the define.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 03/17] build: detect execinfo library on Linux
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 03/17] build: detect execinfo library on Linux Thomas Monjalon
@ 2021-02-26 9:08 ` Bruce Richardson
0 siblings, 0 replies; 140+ messages in thread
From: Bruce Richardson @ 2021-02-26 9:08 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, ncopa, stable
On Thu, Feb 25, 2021 at 07:22:36PM +0100, Thomas Monjalon wrote:
> The library execinfo and its header file can be installed on Alpine Linux
> where the backtrace feature is not part of musl libc:
> apk add libexecinfo-dev
>
> As a consequence, this library should not be restricted to BSD only.
>
> At the same time, the library and header are detected once and added
> globally to be linked with any application, internal or external.
>
> Fixes: 9065b1fac65f ("build: fix dependency on execinfo for BSD meson builds")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 02/17] buildtools: fix build with busybox
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 02/17] buildtools: fix build with busybox Thomas Monjalon
@ 2021-02-26 9:11 ` Bruce Richardson
0 siblings, 0 replies; 140+ messages in thread
From: Bruce Richardson @ 2021-02-26 9:11 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ncopa, stable, Konstantin Ananyev, Ray Kinsella,
Neil Horman, Haiyue Wang, David Marchand, Adrien Mazarguil
On Thu, Feb 25, 2021 at 07:22:35PM +0100, Thomas Monjalon wrote:
> If using busybox for mktemp and awk (as in Alpine),
> some bugs prevent the script from running:
>
> 1/ It seems busybox mktemp requires the pattern to have at least
> 6 X and no other suffix.
> The same has been fixed for other scripts in the past:
> commit 3771edc35438 ("buildtools: fix build for some mktemp")
>
> 2/ It seems busybox awk does not accept the regex ^.*{
> except if the opening curly brace is escaped.
>
> Fixes: 4c82473412e8 ("build: add internal tag check")
> Fixes: 68b1f1cda5b4 ("build: check AVX512 rather than binutils version")
> Fixes: 3290ac14eb94 ("buildtools: detect discrepancies for experimental symbols")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally
2021-02-26 9:08 ` Bruce Richardson
@ 2021-02-26 9:40 ` Thomas Monjalon
2021-02-26 9:46 ` Bruce Richardson
0 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-26 9:40 UTC (permalink / raw)
To: Bruce Richardson
Cc: dev, ncopa, stable, Hemant Agrawal, Sachin Saxena,
Jakub Grajciar, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko,
Cristian Dumitrescu, John McNamara, Maxime Coquelin, Chenbo Xia,
Anatoly Burakov, Konstantin Ananyev, Marcin Smoczynski
26/02/2021 10:08, Bruce Richardson:
> On Thu, Feb 25, 2021 at 07:22:37PM +0100, Thomas Monjalon wrote:
> > There was an intent to define _GNU_SOURCE globally,
> > but it was not set in pkg-config for external applications.
> >
> Is this something that we really want to do, to force all external apps to
> use _GNU_SOURCE when compiling? Do some of our header files rely on
> definitions only available with _GNU_SOURCE? If so, we should probably look
> to remove that dependency rather than mandating the define.
From patch 5:
In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
If we avoid mandating _GNU_SOURCE,
we must #ifdef functions relying on rte_cpuset_t in the headers:
- rte_lcore_cpuset
- rte_thread_set_affinity
- rte_thread_get_affinity
- rte_telemetry_init (internal)
Or a different trick in linux/include/rte_os.h could be:
typedef void rte_cpuset_t;
so it allows including files, but not using above functions of course.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally
2021-02-26 9:40 ` Thomas Monjalon
@ 2021-02-26 9:46 ` Bruce Richardson
2021-02-26 10:04 ` Thomas Monjalon
0 siblings, 1 reply; 140+ messages in thread
From: Bruce Richardson @ 2021-02-26 9:46 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ncopa, stable, Hemant Agrawal, Sachin Saxena,
Jakub Grajciar, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko,
Cristian Dumitrescu, John McNamara, Maxime Coquelin, Chenbo Xia,
Anatoly Burakov, Konstantin Ananyev, Marcin Smoczynski
On Fri, Feb 26, 2021 at 10:40:32AM +0100, Thomas Monjalon wrote:
> 26/02/2021 10:08, Bruce Richardson:
> > On Thu, Feb 25, 2021 at 07:22:37PM +0100, Thomas Monjalon wrote:
> > > There was an intent to define _GNU_SOURCE globally,
> > > but it was not set in pkg-config for external applications.
> > >
> > Is this something that we really want to do, to force all external apps to
> > use _GNU_SOURCE when compiling? Do some of our header files rely on
> > definitions only available with _GNU_SOURCE? If so, we should probably look
> > to remove that dependency rather than mandating the define.
>
> From patch 5:
> In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
>
> If we avoid mandating _GNU_SOURCE,
> we must #ifdef functions relying on rte_cpuset_t in the headers:
> - rte_lcore_cpuset
> - rte_thread_set_affinity
> - rte_thread_get_affinity
> - rte_telemetry_init (internal)
> Or a different trick in linux/include/rte_os.h could be:
> typedef void rte_cpuset_t;
> so it allows including files, but not using above functions of course.
>
Can we just define _GNU_SOURCE in the header file with rte_cpuset_t?
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally
2021-02-26 9:46 ` Bruce Richardson
@ 2021-02-26 10:04 ` Thomas Monjalon
2021-02-28 12:53 ` Thomas Monjalon
0 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-26 10:04 UTC (permalink / raw)
To: Bruce Richardson
Cc: dev, ncopa, stable, Hemant Agrawal, Sachin Saxena,
Jakub Grajciar, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko,
Cristian Dumitrescu, John McNamara, Maxime Coquelin, Chenbo Xia,
Anatoly Burakov, Konstantin Ananyev, Marcin Smoczynski
26/02/2021 10:46, Bruce Richardson:
> On Fri, Feb 26, 2021 at 10:40:32AM +0100, Thomas Monjalon wrote:
> > 26/02/2021 10:08, Bruce Richardson:
> > > On Thu, Feb 25, 2021 at 07:22:37PM +0100, Thomas Monjalon wrote:
> > > > There was an intent to define _GNU_SOURCE globally,
> > > > but it was not set in pkg-config for external applications.
> > > >
> > > Is this something that we really want to do, to force all external apps to
> > > use _GNU_SOURCE when compiling? Do some of our header files rely on
> > > definitions only available with _GNU_SOURCE? If so, we should probably look
> > > to remove that dependency rather than mandating the define.
> >
> > From patch 5:
> > In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
> >
> > If we avoid mandating _GNU_SOURCE,
> > we must #ifdef functions relying on rte_cpuset_t in the headers:
> > - rte_lcore_cpuset
> > - rte_thread_set_affinity
> > - rte_thread_get_affinity
> > - rte_telemetry_init (internal)
> > Or a different trick in linux/include/rte_os.h could be:
> > typedef void rte_cpuset_t;
> > so it allows including files, but not using above functions of course.
> >
> Can we just define _GNU_SOURCE in the header file with rte_cpuset_t?
That would be the simplest solution yes :)
I don't really like defining such flag in a header file because
it impacts all code coming after the include.
It would mean all includes done after DPDK ones behave differently.
I vote for the trick:
#ifdef _GNU_SOURCE
typedef cpu_set_t rte_cpuset_t;
#else
typedef void rte_cpuset_t;
#endif
Opinions?
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (17 preceding siblings ...)
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
` (17 more replies)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
19 siblings, 18 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev; +Cc: ncopa
These patches fix some build errors/warning for Alpine Linux,
using musl and busybox.
Few improvements are added on the way.
The goal is to run a container with the following Dockerfile:
8< ------------
FROM alpine
# DPDK prerequisites
RUN apk --no-cache add \
gcc libc-dev bsd-compat-headers linux-headers \
python3 py3-elftools meson ninja \
libexecinfo-dev numactl-dev zlib-dev libpcap-dev libbpf-dev openssl-dev
# mlx prerequisites
RUN apk --no-cache add \
git cmake libnl3-dev
RUN git clone https://github.com/linux-rdma/rdma-core.git
WORKDIR /rdma-core/build
RUN cmake -DNO_MAN_PAGES=1 -DNO_PYVERBS=1 -GNinja ..
RUN ninja install
WORKDIR /
# download
ARG version
RUN if [ "$version" = git ] ; then \
git clone http://dpdk.org/git/dpdk dpdk-$version ;\
else \
wget http://fast.dpdk.org/rel/dpdk-$version.tar.xz && \
tar xf dpdk-$version.tar.xz ;\
fi
# build
WORKDIR dpdk-$version/build
RUN meson ..
RUN ninja install
8< ------------
v6: do not set _GNU_SOURCE in pkg-config
Natanael Copa (7):
bus/pci: support I/O port operations with musl
bus/dpaa: fix 64-bit arch detection
bus/dpaa: fix build with musl
common/dpaax/caamflib: fix build with musl
common/dpaax/caamflib: simplify log macros
net/cxgbe: remove use of uint type
app/testpmd: fix build with musl
Thomas Monjalon (10):
eal: fix comment of OS-specific header files
buildtools: fix build with busybox
build: detect execinfo library on Linux
build: remove redundant _GNU_SOURCE definitions
eal: fix build with musl
drivers: fix header includes for musl
drivers: replace page size definitions with function
net/igc: remove use of uint type
vdpa/mlx5: replace pthread functions unavailable in musl
examples/bbdev: fix header include for musl
app/meson.build | 4 -
app/test-pmd/bpf_cmd.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
app/test/meson.build | 3 -
buildtools/binutils-avx512-check.sh | 2 +-
buildtools/check-symbols.sh | 2 +-
buildtools/map-list-symbol.sh | 2 +-
config/meson.build | 9 ++-
doc/api/doxy-api.conf.in | 3 +-
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +-
drivers/bus/dpaa/base/qbman/bman_driver.c | 13 +++-
drivers/bus/dpaa/base/qbman/qman_driver.c | 17 +++--
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
drivers/bus/dpaa/include/netcfg.h | 1 -
drivers/bus/fslmc/qbman/include/compat.h | 3 -
drivers/bus/pci/linux/pci_uio.c | 91 +++++++++++++++--------
drivers/bus/pci/linux/pci_vfio.c | 9 +--
drivers/bus/vmbus/linux/vmbus_uio.c | 4 +-
drivers/bus/vmbus/private.h | 5 +-
drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
drivers/bus/vmbus/vmbus_common_uio.c | 4 +-
drivers/common/dpaax/caamflib/compat.h | 40 +++++-----
drivers/common/dpaax/compat.h | 5 --
drivers/common/dpaax/meson.build | 1 -
drivers/crypto/virtio/virtio_pci.h | 3 +-
drivers/event/dlb/dlb.c | 9 ++-
drivers/event/dlb/dlb_priv.h | 2 -
drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
drivers/event/dlb/pf/dlb_main.h | 5 +-
drivers/event/dlb/pf/dlb_pf.c | 13 ++--
drivers/event/dlb2/dlb2.c | 2 +-
drivers/event/dlb2/dlb2_priv.h | 2 -
drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
drivers/event/dlb2/pf/dlb2_main.h | 5 +-
drivers/event/dlb2/pf/dlb2_pf.c | 11 +--
drivers/net/bnx2x/ecore_fw_defs.h | 18 +++--
drivers/net/cxgbe/base/common.h | 18 ++---
drivers/net/igc/igc_flow.c | 2 +-
drivers/net/ionic/ionic_lif.c | 25 ++++---
drivers/net/ionic/ionic_main.c | 3 +-
drivers/net/ionic/ionic_osdep.h | 2 +-
drivers/net/memif/rte_eth_memif.h | 4 -
drivers/net/mlx5/linux/mlx5_socket.c | 4 -
drivers/net/netvsc/hn_rndis.c | 12 +--
drivers/net/netvsc/hn_rxtx.c | 10 ++-
drivers/net/netvsc/hn_var.h | 9 +--
drivers/net/virtio/virtio.h | 2 +-
drivers/net/virtio/virtio_ethdev.c | 6 +-
drivers/net/virtio/virtio_ethdev.h | 4 -
drivers/vdpa/ifc/ifcvf_vdpa.c | 17 ++---
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 ++++---
examples/bbdev_app/main.c | 2 +-
examples/meson.build | 4 +-
lib/librte_eal/freebsd/include/rte_os.h | 6 +-
lib/librte_eal/include/rte_lcore.h | 4 +
lib/librte_eal/include/rte_thread.h | 4 +
lib/librte_eal/linux/include/rte_os.h | 8 +-
lib/librte_eal/unix/eal_file.c | 1 +
lib/librte_eal/windows/include/rte_os.h | 5 +-
lib/librte_eal/windows/include/sched.h | 1 +
lib/librte_telemetry/rte_telemetry.h | 4 +
62 files changed, 256 insertions(+), 232 deletions(-)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 01/17] eal: fix comment of OS-specific header files
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 02/17] buildtools: fix build with busybox Thomas Monjalon
` (16 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Bruce Richardson, Dmitry Kozlyuk,
Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
Anand Rawat, Harini Ramakrishnan
The same comment is on top of each rte_os.h file.
It is reworded to remove the mention of "future releases".
Fixes: 428eb983f5f7 ("eal: add OS specific header file")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_eal/freebsd/include/rte_os.h | 5 ++---
lib/librte_eal/linux/include/rte_os.h | 5 ++---
lib/librte_eal/windows/include/rte_os.h | 5 ++---
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/lib/librte_eal/freebsd/include/rte_os.h b/lib/librte_eal/freebsd/include/rte_os.h
index eeb750cd81..c16f2a30e9 100644
--- a/lib/librte_eal/freebsd/include/rte_os.h
+++ b/lib/librte_eal/freebsd/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * freebsd OS. Functions will be added in future releases.
+ * This header should contain any definition
+ * which is not supported natively or named differently in FreeBSD.
*/
#include <pthread_np.h>
diff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h
index 218d4fa86e..390b87b3a1 100644
--- a/lib/librte_eal/linux/include/rte_os.h
+++ b/lib/librte_eal/linux/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * linux OS. Functions will be added in future releases.
+ * This header should contain any definition
+ * which is not supported natively or named differently in Linux.
*/
#include <sched.h>
diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 7ef38ff06c..f0512f20a6 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * Windows OS. It must not include Windows-specific headers.
+ * This header should contain any definition
+ * which is not supported natively or named differently in Windows.
*/
#include <stdarg.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 02/17] buildtools: fix build with busybox
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 03/17] build: detect execinfo library on Linux Thomas Monjalon
` (15 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Bruce Richardson, Konstantin Ananyev,
Ray Kinsella, Neil Horman, David Marchand, Haiyue Wang,
Adrien Mazarguil
If using busybox for mktemp and awk (as in Alpine),
some bugs prevent the script from running:
1/ It seems busybox mktemp requires the pattern to have at least
6 X and no other suffix.
The same has been fixed for other scripts in the past:
commit 3771edc35438 ("buildtools: fix build for some mktemp")
2/ It seems busybox awk does not accept the regex ^.*{
except if the opening curly brace is escaped.
Fixes: 4c82473412e8 ("build: add internal tag check")
Fixes: 68b1f1cda5b4 ("build: check AVX512 rather than binutils version")
Fixes: 3290ac14eb94 ("buildtools: detect discrepancies for experimental symbols")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
buildtools/binutils-avx512-check.sh | 2 +-
buildtools/check-symbols.sh | 2 +-
buildtools/map-list-symbol.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
index a7e068140f..2a833b64b7 100755
--- a/buildtools/binutils-avx512-check.sh
+++ b/buildtools/binutils-avx512-check.sh
@@ -3,7 +3,7 @@
# Copyright(c) 2020 Intel Corporation
AS=${AS:-as}
-OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
+OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX)
trap 'rm -f "$OBJFILE"' EXIT
# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
diff --git a/buildtools/check-symbols.sh b/buildtools/check-symbols.sh
index e407553a34..6723e38450 100755
--- a/buildtools/check-symbols.sh
+++ b/buildtools/check-symbols.sh
@@ -18,7 +18,7 @@ then
exit 0
fi
-DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
+DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
trap 'rm -f "$DUMPFILE"' EXIT
objdump -t $OBJFILE >$DUMPFILE
diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh
index 5509b4a7fa..3bf9bd66f8 100755
--- a/buildtools/map-list-symbol.sh
+++ b/buildtools/map-list-symbol.sh
@@ -44,7 +44,7 @@ for file in $@; do
ret = 1;
}
}
- /^.*{/ {
+ /^.*\{/ {
if ("'$section'" == "all" || $1 == "'$section'") {
current_section = $1;
}
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 03/17] build: detect execinfo library on Linux
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 02/17] buildtools: fix build with busybox Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 04/17] build: remove redundant _GNU_SOURCE definitions Thomas Monjalon
` (14 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Bruce Richardson
The library execinfo and its header file can be installed on Alpine Linux
where the backtrace feature is not part of musl libc:
apk add libexecinfo-dev
As a consequence, this library should not be restricted to BSD only.
At the same time, the library and header are detected once and added
globally to be linked with any application, internal or external.
Fixes: 9065b1fac65f ("build: fix dependency on execinfo for BSD meson builds")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
app/meson.build | 4 ----
app/test/meson.build | 1 -
config/meson.build | 9 ++++++---
examples/meson.build | 4 +---
4 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/app/meson.build b/app/meson.build
index 87fc195dbf..50a53dbde8 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -21,9 +21,6 @@ apps = [
'test-regex',
'test-sad']
-# for BSD only
-lib_execinfo = cc.find_library('execinfo', required: false)
-
default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
default_ldflags = []
if get_option('default_library') == 'static' and not is_windows
@@ -53,7 +50,6 @@ foreach app:apps
dep_objs += get_variable(get_option('default_library')
+ '_rte_' + d)
endforeach
- dep_objs += lib_execinfo
link_libs = []
if get_option('default_library') == 'static'
diff --git a/app/test/meson.build b/app/test/meson.build
index 561e493a29..099895fc87 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -426,7 +426,6 @@ foreach d:test_deps
def_lib = get_option('default_library')
test_dep_objs += get_variable(def_lib + '_rte_' + d)
endforeach
-test_dep_objs += cc.find_library('execinfo', required: false)
link_libs = []
if get_option('default_library') == 'static'
diff --git a/config/meson.build b/config/meson.build
index 3cf560b8a3..66a2edcc47 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -125,11 +125,8 @@ if cc.find_library('m', required : false).found()
dpdk_extra_ldflags += '-lm'
endif
-# for linux link against dl, for bsd execinfo
if is_linux
link_lib = 'dl'
-elif is_freebsd
- link_lib = 'execinfo'
else
link_lib = ''
endif
@@ -166,6 +163,12 @@ if fdt_dep.found() and cc.has_header('fdt.h')
dpdk_extra_ldflags += '-lfdt'
endif
+libexecinfo = cc.find_library('libexecinfo', required: false)
+if libexecinfo.found() and cc.has_header('execinfo.h')
+ add_project_link_arguments('-lexecinfo', language: 'c')
+ dpdk_extra_ldflags += '-lexecinfo'
+endif
+
# check for libbsd
libbsd = dependency('libbsd', required: false, method: 'pkg-config')
if libbsd.found()
diff --git a/examples/meson.build b/examples/meson.build
index b9ab24223f..ab06e2da33 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -6,8 +6,6 @@ if get_option('default_library') == 'static'
link_whole_libs = dpdk_static_libraries + dpdk_drivers
endif
-execinfo = cc.find_library('execinfo', required: false)
-
# list of all example apps. Keep 1-3 per line, in alphabetical order.
all_examples = [
'bbdev_app', 'bond',
@@ -76,7 +74,7 @@ foreach example: examples
cflags = default_cflags
ldflags = default_ldflags
- ext_deps = [execinfo]
+ ext_deps = []
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
subdir(example)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 04/17] build: remove redundant _GNU_SOURCE definitions
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (2 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 03/17] build: detect execinfo library on Linux Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 05/17] eal: fix build with musl Thomas Monjalon
` (13 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Jakub Grajciar,
Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko,
Anatoly Burakov, Marcin Smoczynski, Konstantin Ananyev,
Xueming Li, Xiaoyu Min
The feature macro _GNU_SOURCE is defined globally,
but there was some remaining useless settings.
The internal definition in config/meson.build is kept,
all other internal definitions of _GNU_SOURCE are removed,
except in examples, which can be built as external applications.
Note: external applications do not inherit of _GNU_SOURCE.
Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")
Fixes: 28188cee2aa0 ("build: enable BSD features visibility for FreeBSD")
Fixes: e6cdc54cc0ef ("net/mlx5: add socket server for external tools")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/meson.build | 2 --
drivers/bus/fslmc/qbman/include/compat.h | 3 ---
drivers/common/dpaax/compat.h | 4 ----
drivers/common/dpaax/meson.build | 1 -
drivers/net/memif/rte_eth_memif.h | 4 ----
drivers/net/mlx5/linux/mlx5_socket.c | 4 ----
6 files changed, 18 deletions(-)
diff --git a/app/test/meson.build b/app/test/meson.build
index 099895fc87..76eaaea457 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -398,8 +398,6 @@ if cc.has_argument('-Wno-format-truncation')
cflags += '-Wno-format-truncation'
endif
-# specify -D_GNU_SOURCE unconditionally
-cflags += '-D_GNU_SOURCE'
# Strict-aliasing rules are violated by uint8_t[] to context size casts.
cflags += '-fno-strict-aliasing'
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index 1ddd69e127..a4471a80af 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -8,9 +8,6 @@
#ifndef HEADER_COMPAT_H
#define HEADER_COMPAT_H
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index 1a5f36e99e..c69e76ab96 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -10,10 +10,6 @@
#define __COMPAT_H
#include <sched.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/drivers/common/dpaax/meson.build b/drivers/common/dpaax/meson.build
index 4535482701..b7f177a62e 100644
--- a/drivers/common/dpaax/meson.build
+++ b/drivers/common/dpaax/meson.build
@@ -10,7 +10,6 @@ sources = files('dpaax_iova_table.c', 'dpaa_of.c', 'caamflib.c')
includes += include_directories('caamflib')
-cflags += ['-D_GNU_SOURCE']
if cc.has_argument('-Wno-cast-qual')
cflags += '-Wno-cast-qual'
endif
diff --git a/drivers/net/memif/rte_eth_memif.h b/drivers/net/memif/rte_eth_memif.h
index 24321d3a39..2038bda742 100644
--- a/drivers/net/memif/rte_eth_memif.h
+++ b/drivers/net/memif/rte_eth_memif.h
@@ -5,10 +5,6 @@
#ifndef _RTE_ETH_MEMIF_H_
#define _RTE_ETH_MEMIF_H_
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif /* GNU_SOURCE */
-
#include <sys/queue.h>
#include <ethdev_driver.h>
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 1938453980..b1f41bc102 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -2,10 +2,6 @@
* Copyright 2019 Mellanox Technologies, Ltd
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 05/17] eal: fix build with musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (3 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 04/17] build: remove redundant _GNU_SOURCE definitions Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 06/17] drivers: fix header includes for musl Thomas Monjalon
` (12 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Bruce Richardson, Dmitry Kozlyuk,
Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
Kevin Laatz, Ferruh Yigit, Jerin Jacob
In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
In case _GNU_SOURCE is undefined, as in eal_common_errno.c,
it was not possible to include rte_os.h which uses cpu_set_t.
This limitation is removed: if CPU_SETSIZE is not defined,
cpu_set_t related definitions and functions are skipped.
Note: such definitions are unneeded in eal_common_errno.c.
Applications which do not define _GNU_SOURCE may miss cpu_set_t related
features on musl. Such case is detected by RTE_HAS_CPUSET being undefined,
so functions which depend on rte_cpuset_t will be unavailable.
A missing include of fcntl.h is also added.
Bugzilla ID: 35
Fixes: 11b57c698005 ("eal: fix error string function")
Fixes: 176bb37ca6f3 ("eal: introduce internal wrappers for file operations")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
doc/api/doxy-api.conf.in | 3 ++-
lib/librte_eal/freebsd/include/rte_os.h | 1 +
lib/librte_eal/include/rte_lcore.h | 4 ++++
lib/librte_eal/include/rte_thread.h | 4 ++++
lib/librte_eal/linux/include/rte_os.h | 3 +++
lib/librte_eal/unix/eal_file.c | 1 +
lib/librte_eal/windows/include/sched.h | 1 +
lib/librte_telemetry/rte_telemetry.h | 4 ++++
8 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index 5c883b613b..a536bcb493 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -80,7 +80,8 @@ INPUT += @API_EXAMPLES@
FILE_PATTERNS = rte_*.h \
cmdline.h
PREDEFINED = __DOXYGEN__ \
- VFIO_PRESENT \
+ RTE_HAS_CPUSET \
+ VFIO_PRESENT \
__attribute__(x)=
OPTIMIZE_OUTPUT_FOR_C = YES
diff --git a/lib/librte_eal/freebsd/include/rte_os.h b/lib/librte_eal/freebsd/include/rte_os.h
index c16f2a30e9..627f0483ab 100644
--- a/lib/librte_eal/freebsd/include/rte_os.h
+++ b/lib/librte_eal/freebsd/include/rte_os.h
@@ -13,6 +13,7 @@
#include <pthread_np.h>
typedef cpuset_t rte_cpuset_t;
+#define RTE_HAS_CPUSET
#define RTE_CPU_AND(dst, src1, src2) do \
{ \
cpuset_t tmp; \
diff --git a/lib/librte_eal/include/rte_lcore.h b/lib/librte_eal/include/rte_lcore.h
index 0fe0bd839c..1550b75da0 100644
--- a/lib/librte_eal/include/rte_lcore.h
+++ b/lib/librte_eal/include/rte_lcore.h
@@ -186,6 +186,8 @@ __rte_experimental
int
rte_lcore_to_cpu_id(int lcore_id);
+#ifdef RTE_HAS_CPUSET
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
@@ -200,6 +202,8 @@ __rte_experimental
rte_cpuset_t
rte_lcore_cpuset(unsigned int lcore_id);
+#endif /* RTE_HAS_CPUSET */
+
/**
* Test if an lcore is enabled.
*
diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h
index e640ea1857..ac5a89b1ad 100644
--- a/lib/librte_eal/include/rte_thread.h
+++ b/lib/librte_eal/include/rte_thread.h
@@ -25,6 +25,8 @@ extern "C" {
*/
typedef struct eal_tls_key *rte_tls_key;
+#ifdef RTE_HAS_CPUSET
+
/**
* Set core affinity of the current thread.
* Support both EAL and non-EAL thread and update TLS.
@@ -46,6 +48,8 @@ int rte_thread_set_affinity(rte_cpuset_t *cpusetp);
*/
void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
+#endif /* RTE_HAS_CPUSET */
+
/**
* Create a TLS data key visible to all threads in the process.
* the created key is later used to get/set a value.
diff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h
index 390b87b3a1..1618b4df22 100644
--- a/lib/librte_eal/linux/include/rte_os.h
+++ b/lib/librte_eal/linux/include/rte_os.h
@@ -12,7 +12,9 @@
#include <sched.h>
+#ifdef CPU_SETSIZE /* may require _GNU_SOURCE */
typedef cpu_set_t rte_cpuset_t;
+#define RTE_HAS_CPUSET
#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
#define RTE_CPU_FILL(set) do \
@@ -28,5 +30,6 @@ typedef cpu_set_t rte_cpuset_t;
RTE_CPU_FILL(&tmp); \
CPU_XOR(dst, &tmp, src); \
} while (0)
+#endif
#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/unix/eal_file.c b/lib/librte_eal/unix/eal_file.c
index 1b26475ba4..ec554e0096 100644
--- a/lib/librte_eal/unix/eal_file.c
+++ b/lib/librte_eal/unix/eal_file.c
@@ -4,6 +4,7 @@
#include <sys/file.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <unistd.h>
#include <rte_errno.h>
diff --git a/lib/librte_eal/windows/include/sched.h b/lib/librte_eal/windows/include/sched.h
index fbe07f742c..ff572b5dcb 100644
--- a/lib/librte_eal/windows/include/sched.h
+++ b/lib/librte_eal/windows/include/sched.h
@@ -28,6 +28,7 @@ extern "C" {
typedef struct _rte_cpuset_s {
long long _bits[_NUM_SETS(CPU_SETSIZE)];
} rte_cpuset_t;
+#define RTE_HAS_CPUSET
#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h
index f8e54dc68e..3ff3a42d78 100644
--- a/lib/librte_telemetry/rte_telemetry.h
+++ b/lib/librte_telemetry/rte_telemetry.h
@@ -292,6 +292,8 @@ __rte_experimental
int
rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);
+#ifdef RTE_HAS_CPUSET
+
/**
* @internal
* Initialize Telemetry.
@@ -314,6 +316,8 @@ int
rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
const char **err_str);
+#endif /* RTE_HAS_CPUSET */
+
/**
* Get a pointer to a container with memory allocated. The container is to be
* used embedded within an existing telemetry dict/array.
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 06/17] drivers: fix header includes for musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (4 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 05/17] eal: fix build with musl Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function Thomas Monjalon
` (11 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Timothy McDaniel,
Shreyansh Jain, Geoff Thorpe, Gage Eads
The header files argp.h and error.h do not exist in musl libc
and are not needed in dpaa code.
The header file fcntl.h should not be included from sys/ directory
as done in dlb drivers, it is an error with musl libc.
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros")
Fixes: 19980083fd57 ("event/dlb: add eventdev probe")
Fixes: 5433956d5185 ("event/dlb2: add eventdev probe")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/bus/dpaa/include/netcfg.h | 1 -
drivers/common/dpaax/compat.h | 1 -
drivers/event/dlb/dlb.c | 2 +-
drivers/event/dlb/pf/dlb_pf.c | 3 ++-
drivers/event/dlb2/dlb2.c | 2 +-
drivers/event/dlb2/pf/dlb2_pf.c | 3 ++-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h
index d7d1befd24..bb18a34e3d 100644
--- a/drivers/bus/dpaa/include/netcfg.h
+++ b/drivers/bus/dpaa/include/netcfg.h
@@ -9,7 +9,6 @@
#define __NETCFG_H
#include <fman.h>
-#include <argp.h>
/* Configuration information related to a specific ethernet port */
struct fm_eth_port_cfg {
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index c69e76ab96..7166f8cceb 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -30,7 +30,6 @@
#include <assert.h>
#include <dirent.h>
#include <inttypes.h>
-#include <error.h>
#include <rte_byteorder.h>
#include <rte_atomic.h>
#include <rte_spinlock.h>
diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
index 8b26d1d2d2..2fbfc6aed4 100644
--- a/drivers/event/dlb/dlb.c
+++ b/drivers/event/dlb/dlb.c
@@ -10,7 +10,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
index 3aeef6f91d..876c68e51d 100644
--- a/drivers/event/dlb/pf/dlb_pf.c
+++ b/drivers/event/dlb/pf/dlb_pf.c
@@ -6,12 +6,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
+
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_dev.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index b28ec58bfb..fb5ff012a4 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <rte_common.h>
#include <rte_config.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 1a7d8fc294..b85fd3ec56 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -6,12 +6,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
+
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_dev.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (5 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 06/17] drivers: fix header includes for musl Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-03-01 9:41 ` Bruce Richardson
2021-03-01 14:22 ` Andrew Boyer
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 08/17] bus/pci: support I/O port operations with musl Thomas Monjalon
` (10 subsequent siblings)
17 siblings, 2 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, Anatoly Burakov, Stephen Hemminger, Long Li, Jay Zhou,
Timothy McDaniel, Rasesh Mody, Shahed Shaikh, Andrew Boyer,
Maxime Coquelin, Chenbo Xia, Xiao Wang
The page size is often retrieved from the macro PAGE_SIZE.
If PAGE_SIZE is not defined, it is either using hard coded default,
or getting the system value from the UNIX-only function sysconf().
Such definitions are replaced with the generic function
rte_mem_page_size() defined for each supported OS.
Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
because #ifdef checks were missing, causing redefinition errors.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/bus/pci/linux/pci_vfio.c | 9 ++-------
drivers/bus/vmbus/linux/vmbus_uio.c | 4 ++--
drivers/bus/vmbus/private.h | 5 +----
drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
drivers/bus/vmbus/vmbus_common_uio.c | 4 ++--
drivers/crypto/virtio/virtio_pci.h | 3 ++-
drivers/event/dlb/dlb.c | 7 +++++--
drivers/event/dlb/dlb_priv.h | 2 --
drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
drivers/event/dlb/pf/dlb_main.h | 5 +----
drivers/event/dlb/pf/dlb_pf.c | 10 ++++++----
drivers/event/dlb2/dlb2_priv.h | 2 --
drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
drivers/event/dlb2/pf/dlb2_main.h | 5 +----
drivers/event/dlb2/pf/dlb2_pf.c | 8 ++++----
drivers/net/bnx2x/ecore_fw_defs.h | 18 ++++++++++++------
drivers/net/ionic/ionic_lif.c | 25 ++++++++++++++-----------
drivers/net/ionic/ionic_main.c | 3 ++-
drivers/net/ionic/ionic_osdep.h | 2 +-
drivers/net/netvsc/hn_rndis.c | 12 ++++++------
drivers/net/netvsc/hn_rxtx.c | 10 ++++++----
drivers/net/netvsc/hn_var.h | 9 +++------
drivers/net/virtio/virtio.h | 2 +-
drivers/net/virtio/virtio_ethdev.c | 6 +++---
drivers/net/virtio/virtio_ethdev.h | 4 ----
drivers/vdpa/ifc/ifcvf_vdpa.c | 17 +++++++----------
26 files changed, 84 insertions(+), 94 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index e3f7b6abeb..9d689d6fd9 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -38,11 +38,6 @@
#ifdef VFIO_PRESENT
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
-#define PAGE_MASK (~(PAGE_SIZE - 1))
-
static struct rte_tailq_elem rte_vfio_tailq = {
.name = "VFIO_RESOURCE_LIST",
};
@@ -507,8 +502,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
*/
uint32_t table_start = msix_table->offset;
uint32_t table_end = table_start + msix_table->size;
- table_end = RTE_ALIGN(table_end, PAGE_SIZE);
- table_start = RTE_ALIGN_FLOOR(table_start, PAGE_SIZE);
+ table_end = RTE_ALIGN(table_end, rte_mem_page_size());
+ table_start = RTE_ALIGN_FLOOR(table_start, rte_mem_page_size());
/* If page-aligned start of MSI-X table is less than the
* actual MSI-X table start address, reassign to the actual
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5dc0c47de6..b52ca5bf1d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -154,7 +154,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
vmbus_map_addr = vmbus_find_max_end_va();
/* offset is special in uio it indicates which resource */
- offset = idx * PAGE_SIZE;
+ offset = idx * rte_mem_page_size();
mapaddr = vmbus_map_resource(vmbus_map_addr, fd, offset, size, flags);
close(fd);
@@ -224,7 +224,7 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
}
file_size = sb.st_size;
- if (file_size == 0 || (file_size & (PAGE_SIZE - 1))) {
+ if (file_size == 0 || (file_size & (rte_mem_page_size() - 1))) {
VMBUS_LOG(ERR, "incorrect size %s: %zu",
ring_path, file_size);
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index f19b14e4a6..528d60a42f 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,13 +9,10 @@
#include <stdbool.h>
#include <sys/uio.h>
#include <rte_log.h>
+#include <rte_eal_paging.h>
#include <rte_vmbus_reg.h>
#include <rte_bus_vmbus.h>
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
extern struct rte_vmbus_bus rte_vmbus_bus;
extern int vmbus_logtype_bus;
diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h b/drivers/bus/vmbus/rte_vmbus_reg.h
index f5a0693dcb..8562672979 100644
--- a/drivers/bus/vmbus/rte_vmbus_reg.h
+++ b/drivers/bus/vmbus/rte_vmbus_reg.h
@@ -100,7 +100,7 @@ struct vmbus_bufring {
uint32_t value;
} feature_bits;
- /* Pad it to PAGE_SIZE so that data starts on page boundary */
+ /* Pad it to rte_mem_page_size() so that data starts on page boundary */
uint8_t reserved2[4028];
/*
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index a689bf11b3..8582e32c1d 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -63,7 +63,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
for (i = 0; i != uio_res->nb_maps; i++) {
void *mapaddr;
- off_t offset = i * PAGE_SIZE;
+ off_t offset = i * rte_mem_page_size();
mapaddr = vmbus_map_resource(uio_res->maps[i].addr,
fd, offset,
@@ -175,7 +175,7 @@ vmbus_uio_map_resource(struct rte_vmbus_device *dev)
}
dev->int_page = (uint32_t *)((char *)uio_res->maps[HV_INT_PAGE_MAP].addr
- + (PAGE_SIZE >> 1));
+ + (rte_mem_page_size() >> 1));
dev->monitor_page = uio_res->maps[HV_MON_PAGE_MAP].addr;
return 0;
}
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index d9a214dfd0..0a7ea1bb64 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <rte_eal_paging.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_cryptodev.h>
@@ -67,7 +68,7 @@ struct virtqueue;
*
* Note the sizeof(struct vring_desc) is 16 bytes.
*/
-#define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16))
+#define VIRTIO_MAX_INDIRECT ((int) (rte_mem_page_size() / 16))
/* Do we get callbacks when the ring is completely used, even if we've
* suppressed them?
diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
index 2fbfc6aed4..60084ced3b 100644
--- a/drivers/event/dlb/dlb.c
+++ b/drivers/event/dlb/dlb.c
@@ -23,6 +23,7 @@
#include <rte_io.h>
#include <rte_kvargs.h>
#include <rte_log.h>
+#include <rte_eal_paging.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_power_intrinsics.h>
@@ -991,7 +992,8 @@ dlb_hw_create_ldb_port(struct dlb_eventdev *dlb,
goto error_exit;
}
- qm_port->pp_mmio_base = DLB_LDB_PP_BASE + PAGE_SIZE * qm_port_id;
+ qm_port->pp_mmio_base = DLB_LDB_PP_BASE +
+ rte_mem_page_size() * qm_port_id;
qm_port->id = qm_port_id;
/* The credit window is one high water mark of QEs */
@@ -1181,7 +1183,8 @@ dlb_hw_create_dir_port(struct dlb_eventdev *dlb,
goto error_exit;
}
- qm_port->pp_mmio_base = DLB_DIR_PP_BASE + PAGE_SIZE * qm_port_id;
+ qm_port->pp_mmio_base = DLB_DIR_PP_BASE +
+ rte_mem_page_size() * qm_port_id;
qm_port->id = qm_port_id;
/* The credit window is one high water mark of QEs */
diff --git a/drivers/event/dlb/dlb_priv.h b/drivers/event/dlb/dlb_priv.h
index 272e17482f..ca4d6a84cf 100644
--- a/drivers/event/dlb/dlb_priv.h
+++ b/drivers/event/dlb/dlb_priv.h
@@ -76,8 +76,6 @@
#define PP_BASE(is_dir) ((is_dir) ? DLB_DIR_PP_BASE : DLB_LDB_PP_BASE)
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-
#define DLB_NUM_QES_PER_CACHE_LINE 4
#define DLB_MAX_ENQUEUE_DEPTH 64
diff --git a/drivers/event/dlb/pf/base/dlb_osdep.h b/drivers/event/dlb/pf/base/dlb_osdep.h
index 0c119b759a..dee20660ed 100644
--- a/drivers/event/dlb/pf/base/dlb_osdep.h
+++ b/drivers/event/dlb/pf/base/dlb_osdep.h
@@ -92,7 +92,7 @@ static inline void *os_map_producer_port(struct dlb_hw *hw,
pp_dma_base = (uintptr_t)hw->func_kva + DLB_PP_BASE(is_ldb);
- addr = (pp_dma_base + (PAGE_SIZE * port_id));
+ addr = (pp_dma_base + (rte_mem_page_size() * port_id));
return (void *)(uintptr_t)addr;
diff --git a/drivers/event/dlb/pf/dlb_main.h b/drivers/event/dlb/pf/dlb_main.h
index 22e215223d..e66ba228d1 100644
--- a/drivers/event/dlb/pf/dlb_main.h
+++ b/drivers/event/dlb/pf/dlb_main.h
@@ -10,10 +10,7 @@
#include <rte_spinlock.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
+#include <rte_eal_paging.h>
#include "base/dlb_hw_types.h"
#include "../dlb_user.h"
diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
index 876c68e51d..5445c2d57d 100644
--- a/drivers/event/dlb/pf/dlb_pf.c
+++ b/drivers/event/dlb/pf/dlb_pf.c
@@ -304,7 +304,7 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
- alloc_sz, PAGE_SIZE);
+ alloc_sz, rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -329,7 +329,8 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
dlb_port[response.id][DLB_LDB].pp_addr =
- (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
+ (void *)(uintptr_t)(pp_dma_base +
+ (rte_mem_page_size() * response.id));
dlb_port[response.id][DLB_LDB].cq_base =
(void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
@@ -382,7 +383,7 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
- alloc_sz, PAGE_SIZE);
+ alloc_sz, rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -407,7 +408,8 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
dlb_port[response.id][DLB_DIR].pp_addr =
- (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
+ (void *)(uintptr_t)(pp_dma_base +
+ (rte_mem_page_size() * response.id));
dlb_port[response.id][DLB_DIR].cq_base =
(void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
index b73cf3ff14..eb1a932399 100644
--- a/drivers/event/dlb2/dlb2_priv.h
+++ b/drivers/event/dlb2/dlb2_priv.h
@@ -78,8 +78,6 @@
DLB2_LDB_CQ_MAX_SIZE)
#define PP_BASE(is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE)
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-
#define DLB2_NUM_QES_PER_CACHE_LINE 4
#define DLB2_MAX_ENQUEUE_DEPTH 64
diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h
index c4c34eba5f..aa101a49a3 100644
--- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
+++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
@@ -89,7 +89,7 @@ static inline void *os_map_producer_port(struct dlb2_hw *hw,
uint64_t pp_dma_base;
pp_dma_base = (uintptr_t)hw->func_kva + DLB2_PP_BASE(is_ldb);
- addr = (pp_dma_base + (PAGE_SIZE * port_id));
+ addr = (pp_dma_base + (rte_mem_page_size() * port_id));
return (void *)(uintptr_t)addr;
}
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index f3bee71fb6..9eeda482a3 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -10,10 +10,7 @@
#include <rte_spinlock.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
+#include <rte_eal_paging.h>
#include "base/dlb2_hw_types.h"
#include "../dlb2_user.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index b85fd3ec56..cfb22efe8a 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -285,7 +285,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
- PAGE_SIZE);
+ rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -308,7 +308,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
dlb2_port[response.id][DLB2_LDB_PORT].pp_addr =
- (void *)(pp_base + (PAGE_SIZE * response.id));
+ (void *)(pp_base + (rte_mem_page_size() * response.id));
dlb2_port[response.id][DLB2_LDB_PORT].cq_base = (void *)(port_base);
memset(&port_memory, 0, sizeof(port_memory));
@@ -360,7 +360,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
- PAGE_SIZE);
+ rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -383,7 +383,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
dlb2_port[response.id][DLB2_DIR_PORT].pp_addr =
- (void *)(pp_base + (PAGE_SIZE * response.id));
+ (void *)(pp_base + (rte_mem_page_size() * response.id));
dlb2_port[response.id][DLB2_DIR_PORT].cq_base =
(void *)(port_base);
diff --git a/drivers/net/bnx2x/ecore_fw_defs.h b/drivers/net/bnx2x/ecore_fw_defs.h
index 5397a701aa..93bca8ad33 100644
--- a/drivers/net/bnx2x/ecore_fw_defs.h
+++ b/drivers/net/bnx2x/ecore_fw_defs.h
@@ -13,6 +13,8 @@
#ifndef ECORE_FW_DEFS_H
#define ECORE_FW_DEFS_H
+#include <rte_eal_paging.h>
+
#define CSTORM_ASSERT_LIST_INDEX_OFFSET (IRO[152].base)
#define CSTORM_ASSERT_LIST_OFFSET(assertListEntry) \
(IRO[151].base + ((assertListEntry) * IRO[151].m1))
@@ -252,7 +254,8 @@
#define X_ETH_LOCAL_RING_SIZE 13
#define FIRST_BD_IN_PKT 0
#define PARSE_BD_INDEX 1
-#define NUM_OF_ETH_BDS_IN_PAGE ((PAGE_SIZE)/(STRUCT_SIZE(eth_tx_bd)/8))
+#define NUM_OF_ETH_BDS_IN_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_tx_bd) / 8))
#define U_ETH_NUM_OF_SGES_TO_FETCH 8
#define U_ETH_MAX_SGES_FOR_PACKET 3
@@ -265,11 +268,14 @@
#define IP_HEADER_ALIGNMENT_PADDING 2
#define U_ETH_SGES_PER_PAGE_INVERSE_MASK \
- (0xFFFF - ((PAGE_SIZE/((STRUCT_SIZE(eth_rx_sge))/8))-1))
+ (0xFFFF - ((rte_mem_page_size() / ((STRUCT_SIZE(eth_rx_sge)) / 8)) - 1))
-#define TU_ETH_CQES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_cqe)/8))
-#define U_ETH_BDS_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_bd)/8))
-#define U_ETH_SGES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_sge)/8))
+#define TU_ETH_CQES_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_cqe) / 8))
+#define U_ETH_BDS_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_bd) / 8))
+#define U_ETH_SGES_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_sge) / 8))
#define U_ETH_BDS_PER_PAGE_MASK (U_ETH_BDS_PER_PAGE-1)
#define U_ETH_CQE_PER_PAGE_MASK (TU_ETH_CQES_PER_PAGE-1)
@@ -396,7 +402,7 @@
/* Event Ring definitions */
#define C_ERES_PER_PAGE \
- (PAGE_SIZE / BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
+ (rte_mem_page_size() / BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
#define C_ERE_PER_PAGE_MASK (C_ERES_PER_PAGE - 1)
/* number of statistic command */
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index e083f92417..395e5acc8b 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -617,18 +617,18 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type,
cq_size = num_descs * cq_desc_size;
sg_size = num_descs * sg_desc_size;
- total_size = RTE_ALIGN(q_size, PAGE_SIZE) +
- RTE_ALIGN(cq_size, PAGE_SIZE);
+ total_size = RTE_ALIGN(q_size, rte_mem_page_size()) +
+ RTE_ALIGN(cq_size, rte_mem_page_size());
/*
* Note: aligning q_size/cq_size is not enough due to cq_base address
* aligning as q_base could be not aligned to the page.
- * Adding PAGE_SIZE.
+ * Adding rte_mem_page_size().
*/
- total_size += PAGE_SIZE;
+ total_size += rte_mem_page_size();
if (flags & IONIC_QCQ_F_SG) {
- total_size += RTE_ALIGN(sg_size, PAGE_SIZE);
- total_size += PAGE_SIZE;
+ total_size += RTE_ALIGN(sg_size, rte_mem_page_size());
+ total_size += rte_mem_page_size();
}
new = rte_zmalloc("ionic", sizeof(*new), 0);
@@ -679,13 +679,16 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type,
q_base = new->base;
q_base_pa = new->base_pa;
- cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, PAGE_SIZE);
- cq_base_pa = RTE_ALIGN(q_base_pa + q_size, PAGE_SIZE);
+ cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size,
+ rte_mem_page_size());
+ cq_base_pa = RTE_ALIGN(q_base_pa + q_size,
+ rte_mem_page_size());
if (flags & IONIC_QCQ_F_SG) {
sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size,
- PAGE_SIZE);
- sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, PAGE_SIZE);
+ rte_mem_page_size());
+ sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size,
+ rte_mem_page_size());
ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
}
@@ -975,7 +978,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
IONIC_PRINT(DEBUG, "Allocating Lif Info");
- lif->info_sz = RTE_ALIGN(sizeof(*lif->info), PAGE_SIZE);
+ lif->info_sz = RTE_ALIGN(sizeof(*lif->info), rte_mem_page_size());
lif->info_z = rte_eth_dma_zone_reserve(lif->eth_dev,
"lif_info", 0 /* queue_idx*/,
diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
index 3f1a764888..3ee4999fa5 100644
--- a/drivers/net/ionic/ionic_main.c
+++ b/drivers/net/ionic/ionic_main.c
@@ -375,7 +375,8 @@ ionic_port_init(struct ionic_adapter *adapter)
if (idev->port_info)
return 0;
- idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
+ idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info),
+ rte_mem_page_size());
snprintf(z_name, sizeof(z_name), "%s_port_%s_info",
IONIC_DRV_NAME, adapter->name);
diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
index a6575c36b5..89ed106d11 100644
--- a/drivers/net/ionic/ionic_osdep.h
+++ b/drivers/net/ionic/ionic_osdep.h
@@ -17,6 +17,7 @@
#include <rte_byteorder.h>
#include <rte_io.h>
#include <rte_memory.h>
+#include <rte_eal_paging.h>
#include "ionic_logs.h"
@@ -25,7 +26,6 @@
#ifndef PAGE_SHIFT
#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
#endif
#define __iomem
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index e317539de7..e3f7e636d7 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -67,7 +67,7 @@ hn_rndis_rid(struct hn_data *hv)
static void *hn_rndis_alloc(size_t size)
{
- return rte_zmalloc("RNDIS", size, PAGE_SIZE);
+ return rte_zmalloc("RNDIS", size, rte_mem_page_size());
}
#ifdef RTE_LIBRTE_NETVSC_DEBUG_DUMP
@@ -265,17 +265,17 @@ static int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan,
return -EINVAL;
}
- if (unlikely(reqlen > PAGE_SIZE)) {
+ if (unlikely(reqlen > rte_mem_page_size())) {
PMD_DRV_LOG(ERR, "RNDIS request %u greater than page size",
reqlen);
return -EINVAL;
}
- sg.page = addr / PAGE_SIZE;
+ sg.page = addr / rte_mem_page_size();
sg.ofs = addr & PAGE_MASK;
sg.len = reqlen;
- if (sg.ofs + reqlen > PAGE_SIZE) {
+ if (sg.ofs + reqlen > rte_mem_page_size()) {
PMD_DRV_LOG(ERR, "RNDIS request crosses page boundary");
return -EINVAL;
}
@@ -479,7 +479,7 @@ hn_rndis_query(struct hn_data *hv, uint32_t oid,
return -ENOMEM;
comp_len = sizeof(*comp) + odlen;
- comp = rte_zmalloc("QUERY", comp_len, PAGE_SIZE);
+ comp = rte_zmalloc("QUERY", comp_len, rte_mem_page_size());
if (!comp) {
error = -ENOMEM;
goto done;
@@ -736,7 +736,7 @@ hn_rndis_set(struct hn_data *hv, uint32_t oid, const void *data, uint32_t dlen)
int error;
reqlen = sizeof(*req) + dlen;
- req = rte_zmalloc("RNDIS_SET", reqlen, PAGE_SIZE);
+ req = rte_zmalloc("RNDIS_SET", reqlen, rte_mem_page_size());
if (!req)
return -ENOMEM;
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 0f4ef0100b..c6bf7cc132 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1387,7 +1387,8 @@ static unsigned int hn_get_slots(const struct rte_mbuf *m)
unsigned int size = rte_pktmbuf_data_len(m);
unsigned int offs = rte_mbuf_data_iova(m) & PAGE_MASK;
- slots += (offs + size + PAGE_SIZE - 1) / PAGE_SIZE;
+ slots += (offs + size + rte_mem_page_size() - 1) /
+ rte_mem_page_size();
m = m->next;
}
@@ -1402,12 +1403,13 @@ static unsigned int hn_fill_sg(struct vmbus_gpa *sg,
while (m) {
rte_iova_t addr = rte_mbuf_data_iova(m);
- unsigned int page = addr / PAGE_SIZE;
+ unsigned int page = addr / rte_mem_page_size();
unsigned int offset = addr & PAGE_MASK;
unsigned int len = rte_pktmbuf_data_len(m);
while (len > 0) {
- unsigned int bytes = RTE_MIN(len, PAGE_SIZE - offset);
+ unsigned int bytes = RTE_MIN(len,
+ rte_mem_page_size() - offset);
sg[segs].page = page;
sg[segs].ofs = offset;
@@ -1450,7 +1452,7 @@ static int hn_xmit_sg(struct hn_tx_queue *txq,
addr = txq->tx_rndis_iova +
((char *)txd->rndis_pkt - (char *)txq->tx_rndis);
- sg[0].page = addr / PAGE_SIZE;
+ sg[0].page = addr / rte_mem_page_size();
sg[0].ofs = addr & PAGE_MASK;
sg[0].len = RNDIS_PACKET_MSG_OFFSET_ABS(hn_rndis_pktlen(txd->rndis_pkt));
segs = 1;
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index b7405ca726..43642408bc 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -6,6 +6,8 @@
* All rights reserved.
*/
+#include <rte_eal_paging.h>
+
/*
* Tunable ethdev params
*/
@@ -28,13 +30,8 @@
#define HN_RX_EXTMBUF_ENABLE 0
-/* Buffers need to be aligned */
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#ifndef PAGE_MASK
-#define PAGE_MASK (PAGE_SIZE - 1)
+#define PAGE_MASK (rte_mem_page_size() - 1)
#endif
struct hn_data;
diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h
index 21d54904e7..2c987d19ab 100644
--- a/drivers/net/virtio/virtio.h
+++ b/drivers/net/virtio/virtio.h
@@ -98,7 +98,7 @@
*
* Note the sizeof(struct vring_desc) is 16 bytes.
*/
-#define VIRTIO_MAX_INDIRECT ((int)(PAGE_SIZE / 16))
+#define VIRTIO_MAX_INDIRECT ((int)(rte_mem_page_size() / 16))
/*
* Maximum number of virtqueues per device.
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 333a5243a9..289b240c4e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -21,8 +21,8 @@
#include <rte_errno.h>
#include <rte_cpuflags.h>
#include <rte_vect.h>
-
#include <rte_memory.h>
+#include <rte_eal_paging.h>
#include <rte_eal.h>
#include <rte_dev.h>
#include <rte_cycles.h>
@@ -469,7 +469,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
sz_hdr_mz = vq_size * sizeof(struct virtio_tx_region);
} else if (queue_type == VTNET_CQ) {
/* Allocate a page for control vq command, data and status */
- sz_hdr_mz = PAGE_SIZE;
+ sz_hdr_mz = rte_mem_page_size();
}
vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE,
@@ -568,7 +568,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
cvq->mz = mz;
cvq->virtio_net_hdr_mz = hdr_mz;
cvq->virtio_net_hdr_mem = hdr_mz->iova;
- memset(cvq->virtio_net_hdr_mz->addr, 0, PAGE_SIZE);
+ memset(cvq->virtio_net_hdr_mz->addr, 0, rte_mem_page_size());
hw->cvq = cvq;
}
diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h
index 873327d989..5a501e7890 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -11,10 +11,6 @@
#include "virtio.h"
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#define VIRTIO_MAX_RX_QUEUES 128U
#define VIRTIO_MAX_TX_QUEUES 128U
#define VIRTIO_MAX_MAC_ADDRS 64
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 6a1b44bc77..39237aecf7 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -11,6 +11,7 @@
#include <linux/virtio_net.h>
#include <stdbool.h>
+#include <rte_eal_paging.h>
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_bus_pci.h>
@@ -30,10 +31,6 @@ RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
"IFCVF %s(): " fmt "\n", __func__, ##args)
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#define IFCVF_USED_RING_LEN(size) \
((size) * sizeof(struct vring_used_elem) + sizeof(uint16_t) * 3)
@@ -600,11 +597,11 @@ m_ifcvf_start(struct ifcvf_internal *internal)
for (i = 0; i < nr_vring; i++) {
rte_vhost_get_vhost_vring(vid, i, &vq);
- size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
- PAGE_SIZE);
- vring_buf = rte_zmalloc("ifcvf", size, PAGE_SIZE);
+ size = RTE_ALIGN_CEIL(vring_size(vq.size, rte_mem_page_size()),
+ rte_mem_page_size());
+ vring_buf = rte_zmalloc("ifcvf", size, rte_mem_page_size());
vring_init(&internal->m_vring[i], vq.size, vring_buf,
- PAGE_SIZE);
+ rte_mem_page_size());
ret = rte_vfio_container_dma_map(internal->vfio_container_fd,
(uint64_t)(uintptr_t)vring_buf, m_vring_iova, size);
@@ -686,8 +683,8 @@ m_ifcvf_stop(struct ifcvf_internal *internal)
len = IFCVF_USED_RING_LEN(vq.size);
rte_vhost_log_used_vring(vid, i, 0, len);
- size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
- PAGE_SIZE);
+ size = RTE_ALIGN_CEIL(vring_size(vq.size, rte_mem_page_size()),
+ rte_mem_page_size());
rte_vfio_container_dma_unmap(internal->vfio_container_fd,
(uint64_t)(uintptr_t)internal->m_vring[i].desc,
m_vring_iova, size);
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally
2021-02-26 10:04 ` Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
0 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: Bruce Richardson
Cc: dev, ncopa, stable, Hemant Agrawal, Sachin Saxena,
Jakub Grajciar, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko,
Cristian Dumitrescu, John McNamara, Maxime Coquelin, Chenbo Xia,
Anatoly Burakov, Konstantin Ananyev, Marcin Smoczynski
26/02/2021 11:04, Thomas Monjalon:
> 26/02/2021 10:46, Bruce Richardson:
> > On Fri, Feb 26, 2021 at 10:40:32AM +0100, Thomas Monjalon wrote:
> > > 26/02/2021 10:08, Bruce Richardson:
> > > > On Thu, Feb 25, 2021 at 07:22:37PM +0100, Thomas Monjalon wrote:
> > > > > There was an intent to define _GNU_SOURCE globally,
> > > > > but it was not set in pkg-config for external applications.
> > > > >
> > > > Is this something that we really want to do, to force all external apps to
> > > > use _GNU_SOURCE when compiling? Do some of our header files rely on
> > > > definitions only available with _GNU_SOURCE? If so, we should probably look
> > > > to remove that dependency rather than mandating the define.
> > >
> > > From patch 5:
> > > In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
> > >
> > > If we avoid mandating _GNU_SOURCE,
> > > we must #ifdef functions relying on rte_cpuset_t in the headers:
> > > - rte_lcore_cpuset
> > > - rte_thread_set_affinity
> > > - rte_thread_get_affinity
> > > - rte_telemetry_init (internal)
> > > Or a different trick in linux/include/rte_os.h could be:
> > > typedef void rte_cpuset_t;
> > > so it allows including files, but not using above functions of course.
> > >
> > Can we just define _GNU_SOURCE in the header file with rte_cpuset_t?
>
> That would be the simplest solution yes :)
> I don't really like defining such flag in a header file because
> it impacts all code coming after the include.
> It would mean all includes done after DPDK ones behave differently.
>
> I vote for the trick:
> #ifdef _GNU_SOURCE
> typedef cpu_set_t rte_cpuset_t;
> #else
> typedef void rte_cpuset_t;
> #endif
>
> Opinions?
I changed my mind, I think it is saner to not export functions
which use rte_cpuset_t, if the type is not defined.
The type definition is detected thanks to CPU_SETSIZE
and a new definition is used inside DPDK: RTE_HAS_CPUSET.
I think it is more elegant and easier to debug.
I am sending a v6.
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 08/17] bus/pci: support I/O port operations with musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (6 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
` (9 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Ferruh Yigit, Yuanhan Liu, David Marchand
From: Natanael Copa <ncopa@alpinelinux.org>
Add a fallback for non-GNU libc systems like musl libc for the
non-standard functions outl_p, outw_p and outb_p.
This solves the following buildtime errors when building with musl libc:
pci_uio.c:(.text+0xaa1): undefined reference to `outw_p'
pci_uio.c:(.text+0xac5): undefined reference to `outl_p'
pci_uio.c:(.text+0xadf): undefined reference to `outb_p'
The non-x86 case are handled with macros to factor out various ifdefs.
Bugzilla ID: 35
Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/bus/pci/linux/pci_uio.c | 91 ++++++++++++++++++++++-----------
1 file changed, 61 insertions(+), 30 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index f3305a2f28..1294f505be 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -489,6 +489,16 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
}
#endif
+#ifdef RTE_ARCH_X86
+#define pci_uio_inl(reg) inl(reg)
+#define pci_uio_inw(reg) inw(reg)
+#define pci_uio_inb(reg) inb(reg)
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg))
+#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg))
+#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg))
+#endif
+
void
pci_uio_ioport_read(struct rte_pci_ioport *p,
void *data, size_t len, off_t offset)
@@ -500,29 +510,62 @@ pci_uio_ioport_read(struct rte_pci_ioport *p,
for (d = data; len > 0; d += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
- *(uint32_t *)d = inl(reg);
-#else
- *(uint32_t *)d = *(volatile uint32_t *)reg;
-#endif
+ *(uint32_t *)d = pci_uio_inl(reg);
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
- *(uint16_t *)d = inw(reg);
-#else
- *(uint16_t *)d = *(volatile uint16_t *)reg;
-#endif
+ *(uint16_t *)d = pci_uio_inw(reg);
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
- *d = inb(reg);
-#else
- *d = *(volatile uint8_t *)reg;
-#endif
+ *d = pci_uio_inb(reg);
}
}
}
+#ifdef RTE_ARCH_X86
+static inline void
+pci_uio_outl_p(unsigned int value, unsigned short int port)
+{
+#ifdef __GLIBC__
+ outl_p(value, port);
+#else
+ __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif
+}
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value))
+#endif
+
+#ifdef RTE_ARCH_X86
+static inline void
+pci_uio_outw_p(unsigned short int value, unsigned short int port)
+{
+#ifdef __GLIBC__
+ outw_p(value, port);
+#else
+ __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif
+}
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value))
+#endif
+
+#ifdef RTE_ARCH_X86
+static inline void
+pci_uio_outb_p(unsigned char value, unsigned short int port)
+{
+#ifdef __GLIBC__
+ outb_p(value, port);
+#else
+ __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value),
+ "Nd" (port));
+#endif
+}
+#else /* !RTE_ARCH_X86 */
+#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value))
+#endif
+
void
pci_uio_ioport_write(struct rte_pci_ioport *p,
const void *data, size_t len, off_t offset)
@@ -534,25 +577,13 @@ pci_uio_ioport_write(struct rte_pci_ioport *p,
for (s = data; len > 0; s += size, reg += size, len -= size) {
if (len >= 4) {
size = 4;
-#if defined(RTE_ARCH_X86)
- outl_p(*(const uint32_t *)s, reg);
-#else
- *(volatile uint32_t *)reg = *(const uint32_t *)s;
-#endif
+ pci_uio_outl_p(*(const uint32_t *)s, reg);
} else if (len >= 2) {
size = 2;
-#if defined(RTE_ARCH_X86)
- outw_p(*(const uint16_t *)s, reg);
-#else
- *(volatile uint16_t *)reg = *(const uint16_t *)s;
-#endif
+ pci_uio_outw_p(*(const uint16_t *)s, reg);
} else {
size = 1;
-#if defined(RTE_ARCH_X86)
- outb_p(*s, reg);
-#else
- *(volatile uint8_t *)reg = *s;
-#endif
+ pci_uio_outb_p(*s, reg);
}
}
}
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 09/17] bus/dpaa: fix 64-bit arch detection
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (7 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 08/17] bus/pci: support I/O port operations with musl Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 10/17] bus/dpaa: fix build with musl Thomas Monjalon
` (8 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Shreyansh Jain,
Geoff Thorpe, Roy Pledge
From: Natanael Copa <ncopa@alpinelinux.org>
There is no standard saying that __WORDSIZE should be be defined or in
what include it should be defined. Use RTE_ARCH_64 instead.
This solves a warning when building with musl libc:
warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]
Fixes: 847ee3bd0d1f ("bus/dpaa: support FMAN frame queue lookup")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 10212f0fd5..7ef2f3b2e3 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -16,7 +16,7 @@ extern "C" {
#include <rte_eventdev.h>
/* FQ lookups (turn this on for 64bit user-space) */
-#if (__WORDSIZE == 64)
+#ifdef RTE_ARCH_64
#define CONFIG_FSL_QMAN_FQ_LOOKUP
/* if FQ lookups are supported, this controls the number of initialised,
* s/w-consumed FQs that can be supported at any one time.
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 10/17] bus/dpaa: fix build with musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (8 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 11/17] common/dpaax/caamflib: " Thomas Monjalon
` (7 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Geoff Thorpe,
Shreyansh Jain, Roy Pledge
From: Natanael Copa <ncopa@alpinelinux.org>
Fix build with musl libc by using warn(3) instead of using the GNU
specific error(3).
`error(0, errno, ...)` is identical to `warn(...)` so replace:
error(0, ret, ...);
with the identical:
errno = ret;
warn(...);
We could have used the identical `warnx("...: %s", strerror(ret))` but
strerror(3) is not thread-safe and the strerror_r variant has two
incompatible versions, one GNU specific and one XSI-compliant. Avoid the
mess by letting `warn` use the thread-local errno.
This also fixes error message for kzmalloc failures which previously
would always have given "Unknown error -1", since that is what
strerror(-1) returns. Let 'warn' use the proper error message from errno
which is set by kzalloc.
Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal")
Fixes: f09ede6c8fd1 ("bus/dpaa: add BMAN driver core")
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 ++--
drivers/bus/dpaa/base/qbman/bman_driver.c | 13 +++++++++----
drivers/bus/dpaa/base/qbman/qman_driver.c | 17 ++++++++++++-----
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index b7009f2299..bcedbaf68f 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -8,7 +8,7 @@
#include <dpaa_of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
@@ -90,7 +90,7 @@ netcfg_acquire(void)
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ warn("%s(): open(SOCK_RAW)", __func__);
return NULL;
}
diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c
index 750b756b93..c0b9e3da77 100644
--- a/drivers/bus/dpaa/base/qbman/bman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/bman_driver.c
@@ -11,6 +11,7 @@
#include <process.h>
#include "bman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
/*
* Global variables of the max portal/pool number this bman version supported
@@ -40,7 +41,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ errno = ret;
+ warn("pthread_getaffinity_np()");
return ret;
}
pcfg.cpu = -1;
@@ -60,7 +62,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
map.index = idx;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
return ret;
}
/* Make the portal's cache-[enabled|inhibited] regions */
@@ -104,8 +107,10 @@ static int fsl_bman_portal_finish(void)
cfg = bman_destroy_affine_portal();
DPAA_BUG_ON(cfg != &pcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ warn("process_portal_unmap()");
+ }
return ret;
}
diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index 6d9aaff164..93375d1ea8 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -9,6 +9,8 @@
#include <process.h>
#include "qman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
+
#include <rte_branch_prediction.h>
/* Global variable containing revision id (even on non-control plane systems
@@ -50,7 +52,8 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
map.index = index;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
return ret;
}
qpcfg.channel = map.channel;
@@ -96,8 +99,10 @@ static int fsl_qman_portal_finish(void)
cfg = qman_destroy_affine_portal(NULL);
DPAA_BUG_ON(cfg != &qpcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ warn("process_portal_unmap()");
+ }
return ret;
}
@@ -146,7 +151,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
- error(0, -1, "q_pcfg kzalloc failed");
+ /* kzalloc sets errno */
+ warn("q_pcfg kzalloc failed");
return NULL;
}
@@ -155,7 +161,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_map.index = QBMAN_ANY_PORTAL_IDX;
ret = process_portal_map(&q_map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ warn("process_portal_map()");
kfree(q_pcfg);
return NULL;
}
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 11/17] common/dpaax/caamflib: fix build with musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (9 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 10/17] bus/dpaa: fix build with musl Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 12/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
` (6 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Sachin Saxena, Akhil Goyal,
Horia Geanta Neag
From: Natanael Copa <ncopa@alpinelinux.org>
The swab16/swab32/swab64 are Linux specific and not GNU libc specific.
Keep the check for __GLIBC__ just in case other GNU systems depends on
this (Hurd or GNU/kFreeBSD).
This fixes a build error with musl libc.
Fixes: 04711d41a872 ("crypto/dpaa2_sec: add run-time assembler for descriptor")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/common/dpaax/caamflib/compat.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index 36ee4b5335..c1a693498d 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <errno.h>
-#ifdef __GLIBC__
+#ifdef RTE_EXEC_ENV_LINUX
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -24,7 +24,7 @@
#error "Undefined endianness"
#endif
-#else
+#else /* !RTE_EXEC_ENV_LINUX */
#error Environment not supported!
#endif
@@ -40,7 +40,7 @@
#define __maybe_unused __rte_unused
#endif
-#if defined(__GLIBC__) && !defined(pr_debug)
+#if !defined(pr_debug)
#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
#define pr_debug(fmt, ...) \
RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -49,7 +49,7 @@
#endif
#endif /* pr_debug */
-#if defined(__GLIBC__) && !defined(pr_err)
+#if !defined(pr_err)
#if !defined(SUPPRESS_PRINTS)
#define pr_err(fmt, ...) \
RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -58,7 +58,7 @@
#endif
#endif /* pr_err */
-#if defined(__GLIBC__) && !defined(pr_warn)
+#if !defined(pr_warn)
#if !defined(SUPPRESS_PRINTS)
#define pr_warn(fmt, ...) \
RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -101,7 +101,7 @@
#endif
/* Use Linux naming convention */
-#ifdef __GLIBC__
+#if defined(RTE_EXEC_ENV_LINUX) || defined(__GLIBC__)
#define swab16(x) rte_bswap16(x)
#define swab32(x) rte_bswap32(x)
#define swab64(x) rte_bswap64(x)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 12/17] common/dpaax/caamflib: simplify log macros
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (10 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 11/17] common/dpaax/caamflib: " Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 13/17] net/cxgbe: remove use of uint type Thomas Monjalon
` (5 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev; +Cc: ncopa, Hemant Agrawal, Sachin Saxena
From: Natanael Copa <ncopa@alpinelinux.org>
Simplify pr_debug, pr_err and pr_warn macros by adding an intermediate
pr_msg macro. This way we only need to test for SUPPRESS_PRINTS once.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/common/dpaax/caamflib/compat.h | 28 +++++++++++---------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index c1a693498d..9776eed437 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -40,31 +40,27 @@
#define __maybe_unused __rte_unused
#endif
+#if defined(SUPPRESS_PRINTS)
+#define pr_msg(l, fmt, ...) do { } while (0)
+#else
+#define pr_msg(l, fmt, ...) \
+ RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#endif
+
#if !defined(pr_debug)
-#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
-#define pr_debug(fmt, ...) \
- RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#if defined(RTA_DEBUG)
+#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, ...) do { } while (0)
+#define pr_debug(fmt, ...) do { } while (0)
#endif
#endif /* pr_debug */
#if !defined(pr_err)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_err(fmt, ...) \
- RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_err(fmt, ...) do { } while (0)
-#endif
+#define pr_err(fmt, ...) pr_msg(ERR, fmt, ##__VA_ARGS__)
#endif /* pr_err */
#if !defined(pr_warn)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_warn(fmt, ...) \
- RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_warn(fmt, ...) do { } while (0)
-#endif
+#define pr_warn(fmt, ...) pr_msg(WARNING, fmt, ##__VA_ARGS__)
#endif /* pr_warn */
/**
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 13/17] net/cxgbe: remove use of uint type
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (11 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 12/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 14/17] net/igc: " Thomas Monjalon
` (4 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Morten Brørup, Rahul Lakkireddy, Kumar Sanghvi
From: Natanael Copa <ncopa@alpinelinux.org>
Improve portability by replacing non-standard 'uint' with 'unsigned int'.
This solves the build error with musl libc:
In file included from ../drivers/net/cxgbe/cxgbe.h:9,
from ../drivers/net/cxgbe/cxgbe_ethdev.c:37:
../drivers/net/cxgbe/base/common.h:201:4: error: unknown type name 'uint'
201 | uint synmapen:1; /* SYN Map Enable */
| ^~~~
Fixes: bfcb257d3014 ("net/cxgbe: enable RSS for VF")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
drivers/net/cxgbe/base/common.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 202a2f4baf..ab100d784c 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -189,15 +189,15 @@ struct rss_params {
unsigned int mode; /* RSS mode */
union {
struct {
- uint synmapen:1; /* SYN Map Enable */
- uint syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
- uint syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
- uint syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
- uint syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
- uint ofdmapen:1; /* Offload Map Enable */
- uint tnlmapen:1; /* Tunnel Map Enable */
- uint tnlalllookup:1; /* Tunnel All Lookup */
- uint hashtoeplitz:1; /* use Toeplitz hash */
+ unsigned int synmapen:1; /* SYN Map Enable */
+ unsigned int syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
+ unsigned int syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
+ unsigned int syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
+ unsigned int syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
+ unsigned int ofdmapen:1; /* Offload Map Enable */
+ unsigned int tnlmapen:1; /* Tunnel Map Enable */
+ unsigned int tnlalllookup:1; /* Tunnel All Lookup */
+ unsigned int hashtoeplitz:1; /* use Toeplitz hash */
} basicvirtual;
} u;
};
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 14/17] net/igc: remove use of uint type
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (12 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 13/17] net/cxgbe: remove use of uint type Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 15/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
` (3 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, David Marchand, Haiyue Wang, Jeff Guo,
Alvin Zhang, Ferruh Yigit
Improve portability (especially with musl libc)
by replacing the non-standard type 'uint' with 'size_t'.
Fixes: 746664d546fb ("net/igc: support flow API")
Cc: stable@dpdk.org
Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
---
drivers/net/igc/igc_flow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/igc/igc_flow.c b/drivers/net/igc/igc_flow.c
index 1bb64d323c..66053060af 100644
--- a/drivers/net/igc/igc_flow.c
+++ b/drivers/net/igc/igc_flow.c
@@ -656,7 +656,7 @@ igc_parse_action_rss(struct rte_eth_dev *dev,
* Return the pointer of the flow, or NULL for failed
**/
static inline struct rte_flow *
-igc_alloc_flow(const void *filter, enum igc_filter_type type, uint inbytes)
+igc_alloc_flow(const void *filter, enum igc_filter_type type, size_t inbytes)
{
/* allocate memory, 8 bytes boundary aligned */
struct rte_flow *flow = rte_malloc("igc flow filter",
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 15/17] vdpa/mlx5: replace pthread functions unavailable in musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (13 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 14/17] net/igc: " Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 16/17] app/testpmd: fix build with musl Thomas Monjalon
` (2 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Matan Azrad, Viacheslav Ovsiienko, Xueming Li,
Maxime Coquelin
1/ The function pthread_yield() does not exist in musl libc,
and can be replaced with sched_yield() after including sched.h.
2/ The function pthread_attr_setaffinity_np() does not exist in musl libc,
and can be replaced with pthread_setaffinity_np() after pthread_create().
Fixes: b7fa0bf4d5c6 ("vdpa/mlx5: fix polling threads scheduling")
Fixes: 5cf3fd3af4df ("vdpa/mlx5: add CPU core parameter to bind polling thread")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 86adc864f5..49632dfaa7 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -3,6 +3,7 @@
*/
#include <unistd.h>
#include <stdint.h>
+#include <sched.h>
#include <fcntl.h>
#include <sys/eventfd.h>
@@ -234,7 +235,7 @@ mlx5_vdpa_timer_sleep(struct mlx5_vdpa_priv *priv, uint32_t max)
usleep(priv->timer_delay_us);
else
/* Give-up CPU to improve polling threads scheduling. */
- pthread_yield();
+ sched_yield();
}
static void *
@@ -515,17 +516,6 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
pthread_cond_init(&priv->timer_cond, NULL);
priv->timer_on = 0;
pthread_attr_init(&attr);
- CPU_ZERO(&cpuset);
- if (priv->event_core != -1)
- CPU_SET(priv->event_core, &cpuset);
- else
- cpuset = rte_lcore_cpuset(rte_get_main_lcore());
- ret = pthread_attr_setaffinity_np(&attr, sizeof(cpuset),
- &cpuset);
- if (ret) {
- DRV_LOG(ERR, "Failed to set thread affinity.");
- return -1;
- }
ret = pthread_attr_setschedpolicy(&attr, SCHED_RR);
if (ret) {
DRV_LOG(ERR, "Failed to set thread sched policy = RR.");
@@ -542,6 +532,17 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
DRV_LOG(ERR, "Failed to create timer thread.");
return -1;
}
+ CPU_ZERO(&cpuset);
+ if (priv->event_core != -1)
+ CPU_SET(priv->event_core, &cpuset);
+ else
+ cpuset = rte_lcore_cpuset(rte_get_main_lcore());
+ ret = pthread_setaffinity_np(priv->timer_tid,
+ sizeof(cpuset), &cpuset);
+ if (ret) {
+ DRV_LOG(ERR, "Failed to set thread affinity.");
+ goto error;
+ }
snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid);
ret = pthread_setname_np(priv->timer_tid, name);
if (ret) {
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 16/17] app/testpmd: fix build with musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (14 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 15/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
2021-03-17 22:42 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Morten Brørup, Xiaoyun Li,
Nélio Laranjeiro, Konstantin Ananyev, Ferruh Yigit
From: Natanael Copa <ncopa@alpinelinux.org>
1/ Improve portability by avoiding use of non-standard 'uint'.
Use uint8_t for hash_key_len as rss_key_len is a uint8_t type.
This solves following build error when building with musl libc:
app/test-pmd/testpmd.h:813:29: error: unknown type name 'uint'
2/ In musl libc, stdout is of type (FILE * const).
Because of the const qualifier, a dark magic cast
must be achieved through uintptr_t.
Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash commands")
Fixes: e977e4199a8d ("app/testpmd: add commands to load/unload BPF filters")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-pmd/bpf_cmd.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/test-pmd/bpf_cmd.c b/app/test-pmd/bpf_cmd.c
index 066619e115..6980291f07 100644
--- a/app/test-pmd/bpf_cmd.c
+++ b/app/test-pmd/bpf_cmd.c
@@ -20,7 +20,7 @@ static const struct rte_bpf_xsym bpf_xsym[] = {
.name = RTE_STR(stdout),
.type = RTE_BPF_XTYPE_VAR,
.var = {
- .val = &stdout,
+ .val = (void *)(uintptr_t)&stdout,
.desc = {
.type = RTE_BPF_ARG_PTR,
.size = sizeof(stdout),
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index dab8afe5dd..9ca03c236e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2963,7 +2963,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
void
port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
- uint hash_key_len)
+ uint8_t hash_key_len)
{
struct rte_eth_rss_conf rss_conf;
int diag;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 4aca522859..5437b6229e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -935,7 +935,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
void port_rss_hash_key_update(portid_t port_id, char rss_type[],
- uint8_t *hash_key, uint hash_key_len);
+ uint8_t *hash_key, uint8_t hash_key_len);
int rx_queue_id_is_invalid(queueid_t rxq_id);
int tx_queue_id_is_invalid(queueid_t txq_id);
void setup_gro(const char *onoff, portid_t port_id);
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v6 17/17] examples/bbdev: fix header include for musl
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (15 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 16/17] app/testpmd: fix build with musl Thomas Monjalon
@ 2021-02-28 12:53 ` Thomas Monjalon
2021-03-17 22:42 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-02-28 12:53 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Nicolas Chautru, Amr Mokhtar
The header file unistd.h should not be included from sys/ directory,
it is an error with musl libc.
Fixes: 1ffee690eaa1 ("examples/bbdev: add sample app")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/bbdev_app/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 2e170caf84..20cfd327fb 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/unistd.h>
+#include <unistd.h>
#include <sys/queue.h>
#include <stdarg.h>
#include <ctype.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v5 15/17] vdpa/mlx5: replace pthread functions unavailable in musl
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 15/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
@ 2021-03-01 7:30 ` Matan Azrad
0 siblings, 0 replies; 140+ messages in thread
From: Matan Azrad @ 2021-03-01 7:30 UTC (permalink / raw)
To: NBU-Contact-Thomas Monjalon, dev
Cc: ncopa, stable, Slava Ovsiienko, Xueming(Steven) Li, Maxime Coquelin
From: Thomas Monjalon
> 1/ The function pthread_yield() does not exist in musl libc, and can be replaced
> with sched_yield() after including sched.h.
>
> 2/ The function pthread_attr_setaffinity_np() does not exist in musl libc, and
> can be replaced with pthread_setaffinity_np() after pthread_create().
>
> Fixes: b7fa0bf4d5c6 ("vdpa/mlx5: fix polling threads scheduling")
> Fixes: 5cf3fd3af4df ("vdpa/mlx5: add CPU core parameter to bind polling
> thread")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@nvidia.com>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function Thomas Monjalon
@ 2021-03-01 9:41 ` Bruce Richardson
2021-03-01 9:53 ` Thomas Monjalon
2021-03-01 14:22 ` Andrew Boyer
1 sibling, 1 reply; 140+ messages in thread
From: Bruce Richardson @ 2021-03-01 9:41 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ncopa, Anatoly Burakov, Stephen Hemminger, Long Li,
Jay Zhou, Timothy McDaniel, Rasesh Mody, Shahed Shaikh,
Andrew Boyer, Maxime Coquelin, Chenbo Xia, Xiao Wang
On Sun, Feb 28, 2021 at 01:53:42PM +0100, Thomas Monjalon wrote:
> The page size is often retrieved from the macro PAGE_SIZE.
> If PAGE_SIZE is not defined, it is either using hard coded default,
> or getting the system value from the UNIX-only function sysconf().
>
> Such definitions are replaced with the generic function
> rte_mem_page_size() defined for each supported OS.
>
> Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
> because #ifdef checks were missing, causing redefinition errors.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Is the header file with the rte_mem_page_size() function missing from this
patch?
Also, rather than a function for this, would it not be better to keep it as
a macro as RTE_PAGE_SIZE, to keep it more in line with the macro people
expect to have available?
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function
2021-03-01 9:41 ` Bruce Richardson
@ 2021-03-01 9:53 ` Thomas Monjalon
2021-03-01 10:09 ` Bruce Richardson
0 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-01 9:53 UTC (permalink / raw)
To: Bruce Richardson
Cc: dev, ncopa, Anatoly Burakov, Stephen Hemminger, Long Li,
Jay Zhou, Timothy McDaniel, Rasesh Mody, Shahed Shaikh,
Andrew Boyer, Maxime Coquelin, Chenbo Xia, Xiao Wang
01/03/2021 10:41, Bruce Richardson:
> On Sun, Feb 28, 2021 at 01:53:42PM +0100, Thomas Monjalon wrote:
> > The page size is often retrieved from the macro PAGE_SIZE.
> > If PAGE_SIZE is not defined, it is either using hard coded default,
> > or getting the system value from the UNIX-only function sysconf().
> >
> > Such definitions are replaced with the generic function
> > rte_mem_page_size() defined for each supported OS.
> >
> > Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
> > because #ifdef checks were missing, causing redefinition errors.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> Is the header file with the rte_mem_page_size() function missing from this
> patch?
No, the function exists since DPDK 20.08.
> Also, rather than a function for this, would it not be better to keep it as
> a macro as RTE_PAGE_SIZE, to keep it more in line with the macro people
> expect to have available?
No because the size is not always known at compilation time.
See the implementation:
https://git.dpdk.org/dpdk/commit/?id=c4b89ecb64eae
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function
2021-03-01 9:53 ` Thomas Monjalon
@ 2021-03-01 10:09 ` Bruce Richardson
0 siblings, 0 replies; 140+ messages in thread
From: Bruce Richardson @ 2021-03-01 10:09 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ncopa, Anatoly Burakov, Stephen Hemminger, Long Li,
Jay Zhou, Timothy McDaniel, Rasesh Mody, Shahed Shaikh,
Andrew Boyer, Maxime Coquelin, Chenbo Xia, Xiao Wang
On Mon, Mar 01, 2021 at 10:53:46AM +0100, Thomas Monjalon wrote:
> 01/03/2021 10:41, Bruce Richardson:
> > On Sun, Feb 28, 2021 at 01:53:42PM +0100, Thomas Monjalon wrote:
> > > The page size is often retrieved from the macro PAGE_SIZE.
> > > If PAGE_SIZE is not defined, it is either using hard coded default,
> > > or getting the system value from the UNIX-only function sysconf().
> > >
> > > Such definitions are replaced with the generic function
> > > rte_mem_page_size() defined for each supported OS.
> > >
> > > Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
> > > because #ifdef checks were missing, causing redefinition errors.
> > >
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > ---
> > Is the header file with the rte_mem_page_size() function missing from this
> > patch?
>
> No, the function exists since DPDK 20.08.
>
> > Also, rather than a function for this, would it not be better to keep it as
> > a macro as RTE_PAGE_SIZE, to keep it more in line with the macro people
> > expect to have available?
>
> No because the size is not always known at compilation time.
> See the implementation:
> https://git.dpdk.org/dpdk/commit/?id=c4b89ecb64eae
>
Ok, thanks for the explanation.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function Thomas Monjalon
2021-03-01 9:41 ` Bruce Richardson
@ 2021-03-01 14:22 ` Andrew Boyer
1 sibling, 0 replies; 140+ messages in thread
From: Andrew Boyer @ 2021-03-01 14:22 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ncopa, Anatoly Burakov, Stephen Hemminger, Long Li,
Jay Zhou, Timothy McDaniel, Rasesh Mody, Shahed Shaikh,
Maxime Coquelin, Chenbo Xia, Xiao Wang
> On Feb 28, 2021, at 7:53 AM, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The page size is often retrieved from the macro PAGE_SIZE.
> If PAGE_SIZE is not defined, it is either using hard coded default,
> or getting the system value from the UNIX-only function sysconf().
>
> Such definitions are replaced with the generic function
> rte_mem_page_size() defined for each supported OS.
>
> Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
> because #ifdef checks were missing, causing redefinition errors.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> drivers/bus/pci/linux/pci_vfio.c | 9 ++-------
> drivers/bus/vmbus/linux/vmbus_uio.c | 4 ++--
> drivers/bus/vmbus/private.h | 5 +----
> drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
> drivers/bus/vmbus/vmbus_common_uio.c | 4 ++--
> drivers/crypto/virtio/virtio_pci.h | 3 ++-
> drivers/event/dlb/dlb.c | 7 +++++--
> drivers/event/dlb/dlb_priv.h | 2 --
> drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
> drivers/event/dlb/pf/dlb_main.h | 5 +----
> drivers/event/dlb/pf/dlb_pf.c | 10 ++++++----
> drivers/event/dlb2/dlb2_priv.h | 2 --
> drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
> drivers/event/dlb2/pf/dlb2_main.h | 5 +----
> drivers/event/dlb2/pf/dlb2_pf.c | 8 ++++----
> drivers/net/bnx2x/ecore_fw_defs.h | 18 ++++++++++++------
> drivers/net/ionic/ionic_lif.c | 25 ++++++++++++++-----------
> drivers/net/ionic/ionic_main.c | 3 ++-
> drivers/net/ionic/ionic_osdep.h | 2 +-
> drivers/net/netvsc/hn_rndis.c | 12 ++++++------
> drivers/net/netvsc/hn_rxtx.c | 10 ++++++----
> drivers/net/netvsc/hn_var.h | 9 +++------
> drivers/net/virtio/virtio.h | 2 +-
> drivers/net/virtio/virtio_ethdev.c | 6 +++---
> drivers/net/virtio/virtio_ethdev.h | 4 ----
> drivers/vdpa/ifc/ifcvf_vdpa.c | 17 +++++++----------
> 26 files changed, 84 insertions(+), 94 deletions(-)
>
OK for net/ionic
Acked-by: Andrew Boyer <aboyer@pensando.io>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
` (16 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
@ 2021-03-17 22:42 ` Thomas Monjalon
2021-03-18 8:12 ` Andrew Rybchenko
2021-03-18 8:56 ` David Marchand
17 siblings, 2 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-17 22:42 UTC (permalink / raw)
To: dev
Cc: ncopa, bruce.richardson, david.marchand, ferruh.yigit, andrew.rybchenko
28/02/2021 13:53, Thomas Monjalon:
> These patches fix some build errors/warning for Alpine Linux,
> using musl and busybox.
> Few improvements are added on the way.
No more comment on this series? Ready to merge?
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support
2021-03-17 22:42 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
@ 2021-03-18 8:12 ` Andrew Rybchenko
2021-03-18 8:56 ` David Marchand
1 sibling, 0 replies; 140+ messages in thread
From: Andrew Rybchenko @ 2021-03-18 8:12 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ncopa, bruce.richardson, david.marchand, ferruh.yigit
On 3/18/21 1:42 AM, Thomas Monjalon wrote:
> 28/02/2021 13:53, Thomas Monjalon:
>> These patches fix some build errors/warning for Alpine Linux,
>> using musl and busybox.
>> Few improvements are added on the way.
>
> No more comment on this series? Ready to merge?
Series-acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support
2021-03-17 22:42 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
2021-03-18 8:12 ` Andrew Rybchenko
@ 2021-03-18 8:56 ` David Marchand
1 sibling, 0 replies; 140+ messages in thread
From: David Marchand @ 2021-03-18 8:56 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Natanael Copa, Bruce Richardson, Yigit, Ferruh, Andrew Rybchenko
On Wed, Mar 17, 2021 at 11:42 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 28/02/2021 13:53, Thomas Monjalon:
> > These patches fix some build errors/warning for Alpine Linux,
> > using musl and busybox.
> > Few improvements are added on the way.
>
> No more comment on this series? Ready to merge?
This will probably need some rebase on the ioport changes.
I did not find the time to look at busybox, but I still think there is
something funny about awk :-).
For the rest, it looks good to me.
Acked-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
2020-07-10 5:13 ` Hemant Agrawal
@ 2021-03-19 9:56 ` Thomas Monjalon
0 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 9:56 UTC (permalink / raw)
To: Hemant Agrawal; +Cc: Natanael Copa, dev
10/07/2020 07:13, Hemant Agrawal:
> NAK
> error is different from warning - the return value is also not carried.
It seems this comment has been ignored so far.
I will address it in a v7.
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 00/17] Alpine/musl build support
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
` (18 preceding siblings ...)
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
` (17 more replies)
19 siblings, 18 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev; +Cc: ncopa
These patches fix some build errors/warning for Alpine Linux,
using musl and busybox.
Few improvements are added on the way.
The goal is to run a container with the following Dockerfile:
8< ------------
FROM alpine
# DPDK prerequisites
RUN apk --no-cache add \
gcc libc-dev bsd-compat-headers linux-headers \
python3 py3-elftools meson ninja \
libexecinfo-dev numactl-dev zlib-dev libpcap-dev libbpf-dev openssl-dev
# mlx prerequisites
RUN apk --no-cache add \
git cmake libnl3-dev
RUN git clone https://github.com/linux-rdma/rdma-core.git
WORKDIR /rdma-core/build
RUN cmake -DNO_MAN_PAGES=1 -DNO_PYVERBS=1 -GNinja ..
RUN ninja install
WORKDIR /
# download
ARG version
RUN if [ "$version" = git ] ; then \
git clone http://dpdk.org/git/dpdk dpdk-$version ;\
else \
wget http://fast.dpdk.org/rel/dpdk-$version.tar.xz && \
tar xf dpdk-$version.tar.xz ;\
fi
# build
WORKDIR dpdk-$version/build
RUN meson ..
RUN ninja install
8< ------------
v7:
- rework port I/O fix after rebase and without asm
- fix patch order for compilation
- fix DPAA error with err instead of warn
v6: do not set _GNU_SOURCE in pkg-config
Natanael Copa (6):
common/dpaax/caamflib: fix build with musl
common/dpaax/caamflib: simplify log macros
bus/dpaa: fix 64-bit arch detection
bus/dpaa: fix build with musl
net/cxgbe: remove use of uint type
app/testpmd: fix build with musl
Thomas Monjalon (11):
eal: fix comment of OS-specific header files
buildtools: fix build with busybox
build: detect execinfo library on Linux
build: remove redundant _GNU_SOURCE definitions
eal: fix build with musl
drivers: replace page size definitions with function
bus/pci: support I/O port operations with musl
net/igc: remove use of uint type
vdpa/mlx5: replace pthread functions unavailable in musl
event/dlb: fix header includes for musl
examples/bbdev: fix header include for musl
app/meson.build | 4 ---
app/test-pmd/bpf_cmd.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
app/test/meson.build | 3 --
buildtools/binutils-avx512-check.sh | 2 +-
buildtools/check-symbols.sh | 2 +-
buildtools/map-list-symbol.sh | 2 +-
config/meson.build | 9 +++--
doc/api/doxy-api.conf.in | 3 +-
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +--
drivers/bus/dpaa/base/qbman/bman_driver.c | 13 +++++---
drivers/bus/dpaa/base/qbman/qman_driver.c | 17 +++++++---
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
drivers/bus/dpaa/include/netcfg.h | 1 -
drivers/bus/fslmc/qbman/include/compat.h | 3 --
drivers/bus/pci/linux/pci_uio.c | 32 ++++++++++++++++--
drivers/bus/pci/linux/pci_vfio.c | 9 ++---
drivers/bus/vmbus/linux/vmbus_uio.c | 4 +--
drivers/bus/vmbus/private.h | 5 +--
drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
drivers/bus/vmbus/vmbus_common_uio.c | 4 +--
drivers/common/dpaax/caamflib/compat.h | 40 ++++++++++-------------
drivers/common/dpaax/compat.h | 5 ---
drivers/common/dpaax/meson.build | 1 -
drivers/crypto/virtio/virtio_pci.h | 3 +-
drivers/event/dlb/dlb.c | 9 +++--
drivers/event/dlb/dlb_priv.h | 2 --
drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
drivers/event/dlb/pf/dlb_main.h | 5 +--
drivers/event/dlb/pf/dlb_pf.c | 13 +++++---
drivers/event/dlb2/dlb2.c | 2 +-
drivers/event/dlb2/dlb2_priv.h | 2 --
drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
drivers/event/dlb2/pf/dlb2_main.h | 5 +--
drivers/event/dlb2/pf/dlb2_pf.c | 11 ++++---
drivers/net/bnx2x/ecore_fw_defs.h | 18 ++++++----
drivers/net/cxgbe/base/common.h | 18 +++++-----
drivers/net/igc/igc_flow.c | 2 +-
drivers/net/ionic/ionic_lif.c | 27 ++++++++-------
drivers/net/ionic/ionic_main.c | 3 +-
drivers/net/ionic/ionic_osdep.h | 2 +-
drivers/net/memif/rte_eth_memif.h | 4 ---
drivers/net/mlx5/linux/mlx5_socket.c | 4 ---
drivers/net/netvsc/hn_rndis.c | 12 +++----
drivers/net/netvsc/hn_rxtx.c | 10 +++---
drivers/net/netvsc/hn_var.h | 9 ++---
drivers/net/virtio/virtio.h | 2 +-
drivers/net/virtio/virtio_ethdev.c | 6 ++--
drivers/net/virtio/virtio_ethdev.h | 4 ---
drivers/vdpa/ifc/ifcvf_vdpa.c | 17 ++++------
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 +++++++-------
examples/bbdev_app/main.c | 2 +-
examples/meson.build | 4 +--
lib/librte_eal/freebsd/include/rte_os.h | 6 ++--
lib/librte_eal/include/rte_lcore.h | 4 +++
lib/librte_eal/include/rte_thread.h | 4 +++
lib/librte_eal/linux/include/rte_os.h | 8 +++--
lib/librte_eal/unix/eal_file.c | 1 +
lib/librte_eal/windows/include/rte_os.h | 5 ++-
lib/librte_eal/windows/include/sched.h | 1 +
lib/librte_telemetry/rte_telemetry.h | 4 +++
62 files changed, 226 insertions(+), 205 deletions(-)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 01/17] eal: fix comment of OS-specific header files
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox Thomas Monjalon
` (16 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand,
Bruce Richardson, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
Dmitry Malloy, Pallavi Kadam, Anand Rawat, Harini Ramakrishnan
The same comment is on top of each rte_os.h file.
It is reworded to remove the mention of "future releases".
Fixes: 428eb983f5f7 ("eal: add OS specific header file")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
lib/librte_eal/freebsd/include/rte_os.h | 5 ++---
lib/librte_eal/linux/include/rte_os.h | 5 ++---
lib/librte_eal/windows/include/rte_os.h | 5 ++---
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/lib/librte_eal/freebsd/include/rte_os.h b/lib/librte_eal/freebsd/include/rte_os.h
index eeb750cd81..c16f2a30e9 100644
--- a/lib/librte_eal/freebsd/include/rte_os.h
+++ b/lib/librte_eal/freebsd/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * freebsd OS. Functions will be added in future releases.
+ * This header should contain any definition
+ * which is not supported natively or named differently in FreeBSD.
*/
#include <pthread_np.h>
diff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h
index 218d4fa86e..390b87b3a1 100644
--- a/lib/librte_eal/linux/include/rte_os.h
+++ b/lib/librte_eal/linux/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * linux OS. Functions will be added in future releases.
+ * This header should contain any definition
+ * which is not supported natively or named differently in Linux.
*/
#include <sched.h>
diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 7ef38ff06c..f0512f20a6 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -6,9 +6,8 @@
#define _RTE_OS_H_
/**
- * This is header should contain any function/macro definition
- * which are not supported natively or named differently in the
- * Windows OS. It must not include Windows-specific headers.
+ * This header should contain any definition
+ * which is not supported natively or named differently in Windows.
*/
#include <stdarg.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-22 8:52 ` Kinsella, Ray
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 03/17] build: detect execinfo library on Linux Thomas Monjalon
` (15 subsequent siblings)
17 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Bruce Richardson, Andrew Rybchenko,
David Marchand, Konstantin Ananyev, Ray Kinsella, Neil Horman,
Haiyue Wang, Adrien Mazarguil
If using busybox for mktemp and awk (as in Alpine),
some bugs prevent the script from running:
1/ It seems busybox mktemp requires the pattern to have at least
6 X and no other suffix.
The same has been fixed for other scripts in the past:
commit 3771edc35438 ("buildtools: fix build for some mktemp")
2/ It seems busybox awk does not accept the regex ^.*{
except if the opening curly brace is escaped.
Fixes: 4c82473412e8 ("build: add internal tag check")
Fixes: 68b1f1cda5b4 ("build: check AVX512 rather than binutils version")
Fixes: 3290ac14eb94 ("buildtools: detect discrepancies for experimental symbols")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
buildtools/binutils-avx512-check.sh | 2 +-
buildtools/check-symbols.sh | 2 +-
buildtools/map-list-symbol.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
index a7e068140f..2a833b64b7 100755
--- a/buildtools/binutils-avx512-check.sh
+++ b/buildtools/binutils-avx512-check.sh
@@ -3,7 +3,7 @@
# Copyright(c) 2020 Intel Corporation
AS=${AS:-as}
-OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
+OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX)
trap 'rm -f "$OBJFILE"' EXIT
# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
diff --git a/buildtools/check-symbols.sh b/buildtools/check-symbols.sh
index e407553a34..6723e38450 100755
--- a/buildtools/check-symbols.sh
+++ b/buildtools/check-symbols.sh
@@ -18,7 +18,7 @@ then
exit 0
fi
-DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
+DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
trap 'rm -f "$DUMPFILE"' EXIT
objdump -t $OBJFILE >$DUMPFILE
diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh
index 5509b4a7fa..3bf9bd66f8 100755
--- a/buildtools/map-list-symbol.sh
+++ b/buildtools/map-list-symbol.sh
@@ -44,7 +44,7 @@ for file in $@; do
ret = 1;
}
}
- /^.*{/ {
+ /^.*\{/ {
if ("'$section'" == "all" || $1 == "'$section'") {
current_section = $1;
}
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 03/17] build: detect execinfo library on Linux
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 04/17] build: remove redundant _GNU_SOURCE definitions Thomas Monjalon
` (14 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev; +Cc: ncopa, stable, Bruce Richardson, Andrew Rybchenko, David Marchand
The library execinfo and its header file can be installed on Alpine Linux
where the backtrace feature is not part of musl libc:
apk add libexecinfo-dev
As a consequence, this library should not be restricted to BSD only.
At the same time, the library and header are detected once and added
globally to be linked with any application, internal or external.
Fixes: 9065b1fac65f ("build: fix dependency on execinfo for BSD meson builds")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
app/meson.build | 4 ----
app/test/meson.build | 1 -
config/meson.build | 9 ++++++---
examples/meson.build | 4 +---
4 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/app/meson.build b/app/meson.build
index 87fc195dbf..50a53dbde8 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -21,9 +21,6 @@ apps = [
'test-regex',
'test-sad']
-# for BSD only
-lib_execinfo = cc.find_library('execinfo', required: false)
-
default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
default_ldflags = []
if get_option('default_library') == 'static' and not is_windows
@@ -53,7 +50,6 @@ foreach app:apps
dep_objs += get_variable(get_option('default_library')
+ '_rte_' + d)
endforeach
- dep_objs += lib_execinfo
link_libs = []
if get_option('default_library') == 'static'
diff --git a/app/test/meson.build b/app/test/meson.build
index 561e493a29..099895fc87 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -426,7 +426,6 @@ foreach d:test_deps
def_lib = get_option('default_library')
test_dep_objs += get_variable(def_lib + '_rte_' + d)
endforeach
-test_dep_objs += cc.find_library('execinfo', required: false)
link_libs = []
if get_option('default_library') == 'static'
diff --git a/config/meson.build b/config/meson.build
index 3cf560b8a3..66a2edcc47 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -125,11 +125,8 @@ if cc.find_library('m', required : false).found()
dpdk_extra_ldflags += '-lm'
endif
-# for linux link against dl, for bsd execinfo
if is_linux
link_lib = 'dl'
-elif is_freebsd
- link_lib = 'execinfo'
else
link_lib = ''
endif
@@ -166,6 +163,12 @@ if fdt_dep.found() and cc.has_header('fdt.h')
dpdk_extra_ldflags += '-lfdt'
endif
+libexecinfo = cc.find_library('libexecinfo', required: false)
+if libexecinfo.found() and cc.has_header('execinfo.h')
+ add_project_link_arguments('-lexecinfo', language: 'c')
+ dpdk_extra_ldflags += '-lexecinfo'
+endif
+
# check for libbsd
libbsd = dependency('libbsd', required: false, method: 'pkg-config')
if libbsd.found()
diff --git a/examples/meson.build b/examples/meson.build
index 3fe08d4ca5..d065a6a08b 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -6,8 +6,6 @@ if get_option('default_library') == 'static'
link_whole_libs = dpdk_static_libraries + dpdk_drivers
endif
-execinfo = cc.find_library('execinfo', required: false)
-
# list of all example apps. Keep 1-3 per line, in alphabetical order.
all_examples = [
'bbdev_app', 'bond',
@@ -82,7 +80,7 @@ foreach example: examples
cflags = default_cflags
ldflags = default_ldflags
- ext_deps = [execinfo]
+ ext_deps = []
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
subdir(example)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 04/17] build: remove redundant _GNU_SOURCE definitions
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (2 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 03/17] build: detect execinfo library on Linux Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 05/17] eal: fix build with musl Thomas Monjalon
` (13 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand, Hemant Agrawal,
Sachin Saxena, Jakub Grajciar, Matan Azrad, Shahaf Shuler,
Viacheslav Ovsiienko, Anatoly Burakov, Konstantin Ananyev,
Marcin Smoczynski, Xiaoyu Min, Xueming Li
The feature macro _GNU_SOURCE is defined globally,
but there was some remaining useless settings.
The internal definition in config/meson.build is kept,
all other internal definitions of _GNU_SOURCE are removed,
except in examples, which can be built as external applications.
Note: external applications do not inherit of _GNU_SOURCE.
Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")
Fixes: 28188cee2aa0 ("build: enable BSD features visibility for FreeBSD")
Fixes: e6cdc54cc0ef ("net/mlx5: add socket server for external tools")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
app/test/meson.build | 2 --
drivers/bus/fslmc/qbman/include/compat.h | 3 ---
drivers/common/dpaax/compat.h | 4 ----
drivers/common/dpaax/meson.build | 1 -
drivers/net/memif/rte_eth_memif.h | 4 ----
drivers/net/mlx5/linux/mlx5_socket.c | 4 ----
6 files changed, 18 deletions(-)
diff --git a/app/test/meson.build b/app/test/meson.build
index 099895fc87..76eaaea457 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -398,8 +398,6 @@ if cc.has_argument('-Wno-format-truncation')
cflags += '-Wno-format-truncation'
endif
-# specify -D_GNU_SOURCE unconditionally
-cflags += '-D_GNU_SOURCE'
# Strict-aliasing rules are violated by uint8_t[] to context size casts.
cflags += '-fno-strict-aliasing'
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index 1ddd69e127..a4471a80af 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -8,9 +8,6 @@
#ifndef HEADER_COMPAT_H
#define HEADER_COMPAT_H
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index 1a5f36e99e..c69e76ab96 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -10,10 +10,6 @@
#define __COMPAT_H
#include <sched.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/drivers/common/dpaax/meson.build b/drivers/common/dpaax/meson.build
index 4535482701..b7f177a62e 100644
--- a/drivers/common/dpaax/meson.build
+++ b/drivers/common/dpaax/meson.build
@@ -10,7 +10,6 @@ sources = files('dpaax_iova_table.c', 'dpaa_of.c', 'caamflib.c')
includes += include_directories('caamflib')
-cflags += ['-D_GNU_SOURCE']
if cc.has_argument('-Wno-cast-qual')
cflags += '-Wno-cast-qual'
endif
diff --git a/drivers/net/memif/rte_eth_memif.h b/drivers/net/memif/rte_eth_memif.h
index 24321d3a39..2038bda742 100644
--- a/drivers/net/memif/rte_eth_memif.h
+++ b/drivers/net/memif/rte_eth_memif.h
@@ -5,10 +5,6 @@
#ifndef _RTE_ETH_MEMIF_H_
#define _RTE_ETH_MEMIF_H_
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif /* GNU_SOURCE */
-
#include <sys/queue.h>
#include <ethdev_driver.h>
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 1938453980..b1f41bc102 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -2,10 +2,6 @@
* Copyright 2019 Mellanox Technologies, Ltd
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 05/17] eal: fix build with musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (3 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 04/17] build: remove redundant _GNU_SOURCE definitions Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 06/17] drivers: replace page size definitions with function Thomas Monjalon
` (12 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand,
Bruce Richardson, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
Dmitry Malloy, Pallavi Kadam, Kevin Laatz, Jerin Jacob,
Ferruh Yigit
In musl libc, cpu_set_t is defined only if _GNU_SOURCE is defined.
In case _GNU_SOURCE is undefined, as in eal_common_errno.c,
it was not possible to include rte_os.h which uses cpu_set_t.
This limitation is removed: if CPU_SETSIZE is not defined,
cpu_set_t related definitions and functions are skipped.
Note: such definitions are unneeded in eal_common_errno.c.
Applications which do not define _GNU_SOURCE may miss cpu_set_t related
features on musl. Such case is detected by RTE_HAS_CPUSET being undefined,
so functions which depend on rte_cpuset_t will be unavailable.
A missing include of fcntl.h is also added.
Bugzilla ID: 35
Fixes: 11b57c698005 ("eal: fix error string function")
Fixes: 176bb37ca6f3 ("eal: introduce internal wrappers for file operations")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
doc/api/doxy-api.conf.in | 3 ++-
lib/librte_eal/freebsd/include/rte_os.h | 1 +
lib/librte_eal/include/rte_lcore.h | 4 ++++
lib/librte_eal/include/rte_thread.h | 4 ++++
lib/librte_eal/linux/include/rte_os.h | 3 +++
lib/librte_eal/unix/eal_file.c | 1 +
lib/librte_eal/windows/include/sched.h | 1 +
lib/librte_telemetry/rte_telemetry.h | 4 ++++
8 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index 5eb31508fd..b3c5cdfeca 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -81,7 +81,8 @@ INPUT += @API_EXAMPLES@
FILE_PATTERNS = rte_*.h \
cmdline.h
PREDEFINED = __DOXYGEN__ \
- VFIO_PRESENT \
+ RTE_HAS_CPUSET \
+ VFIO_PRESENT \
__attribute__(x)=
OPTIMIZE_OUTPUT_FOR_C = YES
diff --git a/lib/librte_eal/freebsd/include/rte_os.h b/lib/librte_eal/freebsd/include/rte_os.h
index c16f2a30e9..627f0483ab 100644
--- a/lib/librte_eal/freebsd/include/rte_os.h
+++ b/lib/librte_eal/freebsd/include/rte_os.h
@@ -13,6 +13,7 @@
#include <pthread_np.h>
typedef cpuset_t rte_cpuset_t;
+#define RTE_HAS_CPUSET
#define RTE_CPU_AND(dst, src1, src2) do \
{ \
cpuset_t tmp; \
diff --git a/lib/librte_eal/include/rte_lcore.h b/lib/librte_eal/include/rte_lcore.h
index 0fe0bd839c..1550b75da0 100644
--- a/lib/librte_eal/include/rte_lcore.h
+++ b/lib/librte_eal/include/rte_lcore.h
@@ -186,6 +186,8 @@ __rte_experimental
int
rte_lcore_to_cpu_id(int lcore_id);
+#ifdef RTE_HAS_CPUSET
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
@@ -200,6 +202,8 @@ __rte_experimental
rte_cpuset_t
rte_lcore_cpuset(unsigned int lcore_id);
+#endif /* RTE_HAS_CPUSET */
+
/**
* Test if an lcore is enabled.
*
diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h
index e640ea1857..ac5a89b1ad 100644
--- a/lib/librte_eal/include/rte_thread.h
+++ b/lib/librte_eal/include/rte_thread.h
@@ -25,6 +25,8 @@ extern "C" {
*/
typedef struct eal_tls_key *rte_tls_key;
+#ifdef RTE_HAS_CPUSET
+
/**
* Set core affinity of the current thread.
* Support both EAL and non-EAL thread and update TLS.
@@ -46,6 +48,8 @@ int rte_thread_set_affinity(rte_cpuset_t *cpusetp);
*/
void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
+#endif /* RTE_HAS_CPUSET */
+
/**
* Create a TLS data key visible to all threads in the process.
* the created key is later used to get/set a value.
diff --git a/lib/librte_eal/linux/include/rte_os.h b/lib/librte_eal/linux/include/rte_os.h
index 390b87b3a1..1618b4df22 100644
--- a/lib/librte_eal/linux/include/rte_os.h
+++ b/lib/librte_eal/linux/include/rte_os.h
@@ -12,7 +12,9 @@
#include <sched.h>
+#ifdef CPU_SETSIZE /* may require _GNU_SOURCE */
typedef cpu_set_t rte_cpuset_t;
+#define RTE_HAS_CPUSET
#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
#define RTE_CPU_FILL(set) do \
@@ -28,5 +30,6 @@ typedef cpu_set_t rte_cpuset_t;
RTE_CPU_FILL(&tmp); \
CPU_XOR(dst, &tmp, src); \
} while (0)
+#endif
#endif /* _RTE_OS_H_ */
diff --git a/lib/librte_eal/unix/eal_file.c b/lib/librte_eal/unix/eal_file.c
index 1b26475ba4..ec554e0096 100644
--- a/lib/librte_eal/unix/eal_file.c
+++ b/lib/librte_eal/unix/eal_file.c
@@ -4,6 +4,7 @@
#include <sys/file.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <unistd.h>
#include <rte_errno.h>
diff --git a/lib/librte_eal/windows/include/sched.h b/lib/librte_eal/windows/include/sched.h
index fbe07f742c..ff572b5dcb 100644
--- a/lib/librte_eal/windows/include/sched.h
+++ b/lib/librte_eal/windows/include/sched.h
@@ -28,6 +28,7 @@ extern "C" {
typedef struct _rte_cpuset_s {
long long _bits[_NUM_SETS(CPU_SETSIZE)];
} rte_cpuset_t;
+#define RTE_HAS_CPUSET
#define CPU_SET(b, s) ((s)->_bits[_WHICH_SET(b)] |= (1LL << _WHICH_BIT(b)))
diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h
index f7c8534b82..027b048d78 100644
--- a/lib/librte_telemetry/rte_telemetry.h
+++ b/lib/librte_telemetry/rte_telemetry.h
@@ -292,6 +292,8 @@ __rte_experimental
int
rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);
+#ifdef RTE_HAS_CPUSET
+
/**
* @internal
* Initialize Telemetry.
@@ -314,6 +316,8 @@ int
rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
const char **err_str);
+#endif /* RTE_HAS_CPUSET */
+
/**
* Get a pointer to a container with memory allocated. The container is to be
* used embedded within an existing telemetry dict/array.
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 06/17] drivers: replace page size definitions with function
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (4 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 05/17] eal: fix build with musl Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 15:47 ` McDaniel, Timothy
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 07/17] common/dpaax/caamflib: fix build with musl Thomas Monjalon
` (11 subsequent siblings)
17 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, Andrew Boyer, Andrew Rybchenko, David Marchand,
Anatoly Burakov, Stephen Hemminger, Long Li, Jay Zhou,
Timothy McDaniel, Rasesh Mody, Shahed Shaikh, Maxime Coquelin,
Chenbo Xia, Xiao Wang
The page size is often retrieved from the macro PAGE_SIZE.
If PAGE_SIZE is not defined, it is either using hard coded default,
or getting the system value from the UNIX-only function sysconf().
Such definitions are replaced with the generic function
rte_mem_page_size() defined for each supported OS.
Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
because #ifdef checks were missing, causing redefinition errors.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Boyer <aboyer@pensando.io>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/pci/linux/pci_vfio.c | 9 ++-------
drivers/bus/vmbus/linux/vmbus_uio.c | 4 ++--
drivers/bus/vmbus/private.h | 5 +----
drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
drivers/bus/vmbus/vmbus_common_uio.c | 4 ++--
drivers/crypto/virtio/virtio_pci.h | 3 ++-
drivers/event/dlb/dlb.c | 7 +++++--
drivers/event/dlb/dlb_priv.h | 2 --
drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
drivers/event/dlb/pf/dlb_main.h | 5 +----
drivers/event/dlb/pf/dlb_pf.c | 10 +++++----
drivers/event/dlb2/dlb2_priv.h | 2 --
drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
drivers/event/dlb2/pf/dlb2_main.h | 5 +----
drivers/event/dlb2/pf/dlb2_pf.c | 8 ++++----
drivers/net/bnx2x/ecore_fw_defs.h | 18 +++++++++++------
drivers/net/ionic/ionic_lif.c | 27 ++++++++++++++-----------
drivers/net/ionic/ionic_main.c | 3 ++-
drivers/net/ionic/ionic_osdep.h | 2 +-
drivers/net/netvsc/hn_rndis.c | 12 +++++------
drivers/net/netvsc/hn_rxtx.c | 10 +++++----
drivers/net/netvsc/hn_var.h | 9 +++------
drivers/net/virtio/virtio.h | 2 +-
drivers/net/virtio/virtio_ethdev.c | 6 +++---
drivers/net/virtio/virtio_ethdev.h | 4 ----
drivers/vdpa/ifc/ifcvf_vdpa.c | 17 +++++++---------
26 files changed, 85 insertions(+), 95 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index e3f7b6abeb..9d689d6fd9 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -38,11 +38,6 @@
#ifdef VFIO_PRESENT
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
-#define PAGE_MASK (~(PAGE_SIZE - 1))
-
static struct rte_tailq_elem rte_vfio_tailq = {
.name = "VFIO_RESOURCE_LIST",
};
@@ -507,8 +502,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
*/
uint32_t table_start = msix_table->offset;
uint32_t table_end = table_start + msix_table->size;
- table_end = RTE_ALIGN(table_end, PAGE_SIZE);
- table_start = RTE_ALIGN_FLOOR(table_start, PAGE_SIZE);
+ table_end = RTE_ALIGN(table_end, rte_mem_page_size());
+ table_start = RTE_ALIGN_FLOOR(table_start, rte_mem_page_size());
/* If page-aligned start of MSI-X table is less than the
* actual MSI-X table start address, reassign to the actual
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 5dc0c47de6..b52ca5bf1d 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -154,7 +154,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
vmbus_map_addr = vmbus_find_max_end_va();
/* offset is special in uio it indicates which resource */
- offset = idx * PAGE_SIZE;
+ offset = idx * rte_mem_page_size();
mapaddr = vmbus_map_resource(vmbus_map_addr, fd, offset, size, flags);
close(fd);
@@ -224,7 +224,7 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
}
file_size = sb.st_size;
- if (file_size == 0 || (file_size & (PAGE_SIZE - 1))) {
+ if (file_size == 0 || (file_size & (rte_mem_page_size() - 1))) {
VMBUS_LOG(ERR, "incorrect size %s: %zu",
ring_path, file_size);
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index f19b14e4a6..528d60a42f 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -9,13 +9,10 @@
#include <stdbool.h>
#include <sys/uio.h>
#include <rte_log.h>
+#include <rte_eal_paging.h>
#include <rte_vmbus_reg.h>
#include <rte_bus_vmbus.h>
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
extern struct rte_vmbus_bus rte_vmbus_bus;
extern int vmbus_logtype_bus;
diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h b/drivers/bus/vmbus/rte_vmbus_reg.h
index f5a0693dcb..8562672979 100644
--- a/drivers/bus/vmbus/rte_vmbus_reg.h
+++ b/drivers/bus/vmbus/rte_vmbus_reg.h
@@ -100,7 +100,7 @@ struct vmbus_bufring {
uint32_t value;
} feature_bits;
- /* Pad it to PAGE_SIZE so that data starts on page boundary */
+ /* Pad it to rte_mem_page_size() so that data starts on page boundary */
uint8_t reserved2[4028];
/*
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index a689bf11b3..8582e32c1d 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -63,7 +63,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
for (i = 0; i != uio_res->nb_maps; i++) {
void *mapaddr;
- off_t offset = i * PAGE_SIZE;
+ off_t offset = i * rte_mem_page_size();
mapaddr = vmbus_map_resource(uio_res->maps[i].addr,
fd, offset,
@@ -175,7 +175,7 @@ vmbus_uio_map_resource(struct rte_vmbus_device *dev)
}
dev->int_page = (uint32_t *)((char *)uio_res->maps[HV_INT_PAGE_MAP].addr
- + (PAGE_SIZE >> 1));
+ + (rte_mem_page_size() >> 1));
dev->monitor_page = uio_res->maps[HV_MON_PAGE_MAP].addr;
return 0;
}
diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
index d9a214dfd0..0a7ea1bb64 100644
--- a/drivers/crypto/virtio/virtio_pci.h
+++ b/drivers/crypto/virtio/virtio_pci.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <rte_eal_paging.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_cryptodev.h>
@@ -67,7 +68,7 @@ struct virtqueue;
*
* Note the sizeof(struct vring_desc) is 16 bytes.
*/
-#define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16))
+#define VIRTIO_MAX_INDIRECT ((int) (rte_mem_page_size() / 16))
/* Do we get callbacks when the ring is completely used, even if we've
* suppressed them?
diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
index 8b26d1d2d2..1174ab3d2b 100644
--- a/drivers/event/dlb/dlb.c
+++ b/drivers/event/dlb/dlb.c
@@ -23,6 +23,7 @@
#include <rte_io.h>
#include <rte_kvargs.h>
#include <rte_log.h>
+#include <rte_eal_paging.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_power_intrinsics.h>
@@ -991,7 +992,8 @@ dlb_hw_create_ldb_port(struct dlb_eventdev *dlb,
goto error_exit;
}
- qm_port->pp_mmio_base = DLB_LDB_PP_BASE + PAGE_SIZE * qm_port_id;
+ qm_port->pp_mmio_base = DLB_LDB_PP_BASE +
+ rte_mem_page_size() * qm_port_id;
qm_port->id = qm_port_id;
/* The credit window is one high water mark of QEs */
@@ -1181,7 +1183,8 @@ dlb_hw_create_dir_port(struct dlb_eventdev *dlb,
goto error_exit;
}
- qm_port->pp_mmio_base = DLB_DIR_PP_BASE + PAGE_SIZE * qm_port_id;
+ qm_port->pp_mmio_base = DLB_DIR_PP_BASE +
+ rte_mem_page_size() * qm_port_id;
qm_port->id = qm_port_id;
/* The credit window is one high water mark of QEs */
diff --git a/drivers/event/dlb/dlb_priv.h b/drivers/event/dlb/dlb_priv.h
index 272e17482f..ca4d6a84cf 100644
--- a/drivers/event/dlb/dlb_priv.h
+++ b/drivers/event/dlb/dlb_priv.h
@@ -76,8 +76,6 @@
#define PP_BASE(is_dir) ((is_dir) ? DLB_DIR_PP_BASE : DLB_LDB_PP_BASE)
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-
#define DLB_NUM_QES_PER_CACHE_LINE 4
#define DLB_MAX_ENQUEUE_DEPTH 64
diff --git a/drivers/event/dlb/pf/base/dlb_osdep.h b/drivers/event/dlb/pf/base/dlb_osdep.h
index 0c119b759a..dee20660ed 100644
--- a/drivers/event/dlb/pf/base/dlb_osdep.h
+++ b/drivers/event/dlb/pf/base/dlb_osdep.h
@@ -92,7 +92,7 @@ static inline void *os_map_producer_port(struct dlb_hw *hw,
pp_dma_base = (uintptr_t)hw->func_kva + DLB_PP_BASE(is_ldb);
- addr = (pp_dma_base + (PAGE_SIZE * port_id));
+ addr = (pp_dma_base + (rte_mem_page_size() * port_id));
return (void *)(uintptr_t)addr;
diff --git a/drivers/event/dlb/pf/dlb_main.h b/drivers/event/dlb/pf/dlb_main.h
index 22e215223d..e66ba228d1 100644
--- a/drivers/event/dlb/pf/dlb_main.h
+++ b/drivers/event/dlb/pf/dlb_main.h
@@ -10,10 +10,7 @@
#include <rte_spinlock.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
+#include <rte_eal_paging.h>
#include "base/dlb_hw_types.h"
#include "../dlb_user.h"
diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
index 3aeef6f91d..2f7e30abbd 100644
--- a/drivers/event/dlb/pf/dlb_pf.c
+++ b/drivers/event/dlb/pf/dlb_pf.c
@@ -303,7 +303,7 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
- alloc_sz, PAGE_SIZE);
+ alloc_sz, rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -328,7 +328,8 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
dlb_port[response.id][DLB_LDB].pp_addr =
- (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
+ (void *)(uintptr_t)(pp_dma_base +
+ (rte_mem_page_size() * response.id));
dlb_port[response.id][DLB_LDB].cq_base =
(void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
@@ -381,7 +382,7 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
- alloc_sz, PAGE_SIZE);
+ alloc_sz, rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -406,7 +407,8 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
dlb_port[response.id][DLB_DIR].pp_addr =
- (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
+ (void *)(uintptr_t)(pp_dma_base +
+ (rte_mem_page_size() * response.id));
dlb_port[response.id][DLB_DIR].cq_base =
(void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
index b73cf3ff14..eb1a932399 100644
--- a/drivers/event/dlb2/dlb2_priv.h
+++ b/drivers/event/dlb2/dlb2_priv.h
@@ -78,8 +78,6 @@
DLB2_LDB_CQ_MAX_SIZE)
#define PP_BASE(is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE)
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-
#define DLB2_NUM_QES_PER_CACHE_LINE 4
#define DLB2_MAX_ENQUEUE_DEPTH 64
diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h
index c4c34eba5f..aa101a49a3 100644
--- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
+++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
@@ -89,7 +89,7 @@ static inline void *os_map_producer_port(struct dlb2_hw *hw,
uint64_t pp_dma_base;
pp_dma_base = (uintptr_t)hw->func_kva + DLB2_PP_BASE(is_ldb);
- addr = (pp_dma_base + (PAGE_SIZE * port_id));
+ addr = (pp_dma_base + (rte_mem_page_size() * port_id));
return (void *)(uintptr_t)addr;
}
diff --git a/drivers/event/dlb2/pf/dlb2_main.h b/drivers/event/dlb2/pf/dlb2_main.h
index f3bee71fb6..9eeda482a3 100644
--- a/drivers/event/dlb2/pf/dlb2_main.h
+++ b/drivers/event/dlb2/pf/dlb2_main.h
@@ -10,10 +10,7 @@
#include <rte_spinlock.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#endif
+#include <rte_eal_paging.h>
#include "base/dlb2_hw_types.h"
#include "../dlb2_user.h"
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 1a7d8fc294..1142da5b25 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -284,7 +284,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
- PAGE_SIZE);
+ rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -307,7 +307,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
dlb2_port[response.id][DLB2_LDB_PORT].pp_addr =
- (void *)(pp_base + (PAGE_SIZE * response.id));
+ (void *)(pp_base + (rte_mem_page_size() * response.id));
dlb2_port[response.id][DLB2_LDB_PORT].cq_base = (void *)(port_base);
memset(&port_memory, 0, sizeof(port_memory));
@@ -359,7 +359,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
- PAGE_SIZE);
+ rte_mem_page_size());
if (port_base == NULL)
return -ENOMEM;
@@ -382,7 +382,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
dlb2_port[response.id][DLB2_DIR_PORT].pp_addr =
- (void *)(pp_base + (PAGE_SIZE * response.id));
+ (void *)(pp_base + (rte_mem_page_size() * response.id));
dlb2_port[response.id][DLB2_DIR_PORT].cq_base =
(void *)(port_base);
diff --git a/drivers/net/bnx2x/ecore_fw_defs.h b/drivers/net/bnx2x/ecore_fw_defs.h
index 5397a701aa..93bca8ad33 100644
--- a/drivers/net/bnx2x/ecore_fw_defs.h
+++ b/drivers/net/bnx2x/ecore_fw_defs.h
@@ -13,6 +13,8 @@
#ifndef ECORE_FW_DEFS_H
#define ECORE_FW_DEFS_H
+#include <rte_eal_paging.h>
+
#define CSTORM_ASSERT_LIST_INDEX_OFFSET (IRO[152].base)
#define CSTORM_ASSERT_LIST_OFFSET(assertListEntry) \
(IRO[151].base + ((assertListEntry) * IRO[151].m1))
@@ -252,7 +254,8 @@
#define X_ETH_LOCAL_RING_SIZE 13
#define FIRST_BD_IN_PKT 0
#define PARSE_BD_INDEX 1
-#define NUM_OF_ETH_BDS_IN_PAGE ((PAGE_SIZE)/(STRUCT_SIZE(eth_tx_bd)/8))
+#define NUM_OF_ETH_BDS_IN_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_tx_bd) / 8))
#define U_ETH_NUM_OF_SGES_TO_FETCH 8
#define U_ETH_MAX_SGES_FOR_PACKET 3
@@ -265,11 +268,14 @@
#define IP_HEADER_ALIGNMENT_PADDING 2
#define U_ETH_SGES_PER_PAGE_INVERSE_MASK \
- (0xFFFF - ((PAGE_SIZE/((STRUCT_SIZE(eth_rx_sge))/8))-1))
+ (0xFFFF - ((rte_mem_page_size() / ((STRUCT_SIZE(eth_rx_sge)) / 8)) - 1))
-#define TU_ETH_CQES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_cqe)/8))
-#define U_ETH_BDS_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_bd)/8))
-#define U_ETH_SGES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_sge)/8))
+#define TU_ETH_CQES_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_cqe) / 8))
+#define U_ETH_BDS_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_bd) / 8))
+#define U_ETH_SGES_PER_PAGE \
+ (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_sge) / 8))
#define U_ETH_BDS_PER_PAGE_MASK (U_ETH_BDS_PER_PAGE-1)
#define U_ETH_CQE_PER_PAGE_MASK (TU_ETH_CQES_PER_PAGE-1)
@@ -396,7 +402,7 @@
/* Event Ring definitions */
#define C_ERES_PER_PAGE \
- (PAGE_SIZE / BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
+ (rte_mem_page_size() / BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
#define C_ERE_PER_PAGE_MASK (C_ERES_PER_PAGE - 1)
/* number of statistic command */
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index cd220abee2..431eda777b 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -612,18 +612,18 @@ ionic_qcq_alloc(struct ionic_lif *lif,
cq_size = num_descs * cq_desc_size;
sg_size = num_descs * sg_desc_size;
- total_size = RTE_ALIGN(q_size, PAGE_SIZE) +
- RTE_ALIGN(cq_size, PAGE_SIZE);
+ total_size = RTE_ALIGN(q_size, rte_mem_page_size()) +
+ RTE_ALIGN(cq_size, rte_mem_page_size());
/*
* Note: aligning q_size/cq_size is not enough due to cq_base address
* aligning as q_base could be not aligned to the page.
- * Adding PAGE_SIZE.
+ * Adding rte_mem_page_size().
*/
- total_size += PAGE_SIZE;
+ total_size += rte_mem_page_size();
if (flags & IONIC_QCQ_F_SG) {
- total_size += RTE_ALIGN(sg_size, PAGE_SIZE);
- total_size += PAGE_SIZE;
+ total_size += RTE_ALIGN(sg_size, rte_mem_page_size());
+ total_size += rte_mem_page_size();
}
new = rte_zmalloc("ionic", struct_size, 0);
@@ -636,7 +636,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
new->q.info = rte_calloc_socket("ionic",
num_descs, sizeof(void *),
- PAGE_SIZE, socket_id);
+ rte_mem_page_size(), socket_id);
if (!new->q.info) {
IONIC_PRINT(ERR, "Cannot allocate queue info");
err = -ENOMEM;
@@ -673,13 +673,16 @@ ionic_qcq_alloc(struct ionic_lif *lif,
q_base = new->base;
q_base_pa = new->base_pa;
- cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, PAGE_SIZE);
- cq_base_pa = RTE_ALIGN(q_base_pa + q_size, PAGE_SIZE);
+ cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size,
+ rte_mem_page_size());
+ cq_base_pa = RTE_ALIGN(q_base_pa + q_size,
+ rte_mem_page_size());
if (flags & IONIC_QCQ_F_SG) {
sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size,
- PAGE_SIZE);
- sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, PAGE_SIZE);
+ rte_mem_page_size());
+ sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size,
+ rte_mem_page_size());
ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
}
@@ -1002,7 +1005,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
IONIC_PRINT(DEBUG, "Allocating Lif Info");
- lif->info_sz = RTE_ALIGN(sizeof(*lif->info), PAGE_SIZE);
+ lif->info_sz = RTE_ALIGN(sizeof(*lif->info), rte_mem_page_size());
lif->info_z = rte_eth_dma_zone_reserve(lif->eth_dev,
"lif_info", 0 /* queue_idx*/,
diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
index 9aa7b2e96c..7301f53342 100644
--- a/drivers/net/ionic/ionic_main.c
+++ b/drivers/net/ionic/ionic_main.c
@@ -456,7 +456,8 @@ ionic_port_init(struct ionic_adapter *adapter)
if (idev->port_info)
return 0;
- idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
+ idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info),
+ rte_mem_page_size());
snprintf(z_name, sizeof(z_name), "%s_port_%s_info",
IONIC_DRV_NAME, adapter->name);
diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
index a6575c36b5..89ed106d11 100644
--- a/drivers/net/ionic/ionic_osdep.h
+++ b/drivers/net/ionic/ionic_osdep.h
@@ -17,6 +17,7 @@
#include <rte_byteorder.h>
#include <rte_io.h>
#include <rte_memory.h>
+#include <rte_eal_paging.h>
#include "ionic_logs.h"
@@ -25,7 +26,6 @@
#ifndef PAGE_SHIFT
#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
#endif
#define __iomem
diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
index e317539de7..e3f7e636d7 100644
--- a/drivers/net/netvsc/hn_rndis.c
+++ b/drivers/net/netvsc/hn_rndis.c
@@ -67,7 +67,7 @@ hn_rndis_rid(struct hn_data *hv)
static void *hn_rndis_alloc(size_t size)
{
- return rte_zmalloc("RNDIS", size, PAGE_SIZE);
+ return rte_zmalloc("RNDIS", size, rte_mem_page_size());
}
#ifdef RTE_LIBRTE_NETVSC_DEBUG_DUMP
@@ -265,17 +265,17 @@ static int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan,
return -EINVAL;
}
- if (unlikely(reqlen > PAGE_SIZE)) {
+ if (unlikely(reqlen > rte_mem_page_size())) {
PMD_DRV_LOG(ERR, "RNDIS request %u greater than page size",
reqlen);
return -EINVAL;
}
- sg.page = addr / PAGE_SIZE;
+ sg.page = addr / rte_mem_page_size();
sg.ofs = addr & PAGE_MASK;
sg.len = reqlen;
- if (sg.ofs + reqlen > PAGE_SIZE) {
+ if (sg.ofs + reqlen > rte_mem_page_size()) {
PMD_DRV_LOG(ERR, "RNDIS request crosses page boundary");
return -EINVAL;
}
@@ -479,7 +479,7 @@ hn_rndis_query(struct hn_data *hv, uint32_t oid,
return -ENOMEM;
comp_len = sizeof(*comp) + odlen;
- comp = rte_zmalloc("QUERY", comp_len, PAGE_SIZE);
+ comp = rte_zmalloc("QUERY", comp_len, rte_mem_page_size());
if (!comp) {
error = -ENOMEM;
goto done;
@@ -736,7 +736,7 @@ hn_rndis_set(struct hn_data *hv, uint32_t oid, const void *data, uint32_t dlen)
int error;
reqlen = sizeof(*req) + dlen;
- req = rte_zmalloc("RNDIS_SET", reqlen, PAGE_SIZE);
+ req = rte_zmalloc("RNDIS_SET", reqlen, rte_mem_page_size());
if (!req)
return -ENOMEM;
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 0f4ef0100b..c6bf7cc132 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1387,7 +1387,8 @@ static unsigned int hn_get_slots(const struct rte_mbuf *m)
unsigned int size = rte_pktmbuf_data_len(m);
unsigned int offs = rte_mbuf_data_iova(m) & PAGE_MASK;
- slots += (offs + size + PAGE_SIZE - 1) / PAGE_SIZE;
+ slots += (offs + size + rte_mem_page_size() - 1) /
+ rte_mem_page_size();
m = m->next;
}
@@ -1402,12 +1403,13 @@ static unsigned int hn_fill_sg(struct vmbus_gpa *sg,
while (m) {
rte_iova_t addr = rte_mbuf_data_iova(m);
- unsigned int page = addr / PAGE_SIZE;
+ unsigned int page = addr / rte_mem_page_size();
unsigned int offset = addr & PAGE_MASK;
unsigned int len = rte_pktmbuf_data_len(m);
while (len > 0) {
- unsigned int bytes = RTE_MIN(len, PAGE_SIZE - offset);
+ unsigned int bytes = RTE_MIN(len,
+ rte_mem_page_size() - offset);
sg[segs].page = page;
sg[segs].ofs = offset;
@@ -1450,7 +1452,7 @@ static int hn_xmit_sg(struct hn_tx_queue *txq,
addr = txq->tx_rndis_iova +
((char *)txd->rndis_pkt - (char *)txq->tx_rndis);
- sg[0].page = addr / PAGE_SIZE;
+ sg[0].page = addr / rte_mem_page_size();
sg[0].ofs = addr & PAGE_MASK;
sg[0].len = RNDIS_PACKET_MSG_OFFSET_ABS(hn_rndis_pktlen(txd->rndis_pkt));
segs = 1;
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index b7405ca726..43642408bc 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -6,6 +6,8 @@
* All rights reserved.
*/
+#include <rte_eal_paging.h>
+
/*
* Tunable ethdev params
*/
@@ -28,13 +30,8 @@
#define HN_RX_EXTMBUF_ENABLE 0
-/* Buffers need to be aligned */
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#ifndef PAGE_MASK
-#define PAGE_MASK (PAGE_SIZE - 1)
+#define PAGE_MASK (rte_mem_page_size() - 1)
#endif
struct hn_data;
diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h
index 21d54904e7..2c987d19ab 100644
--- a/drivers/net/virtio/virtio.h
+++ b/drivers/net/virtio/virtio.h
@@ -98,7 +98,7 @@
*
* Note the sizeof(struct vring_desc) is 16 bytes.
*/
-#define VIRTIO_MAX_INDIRECT ((int)(PAGE_SIZE / 16))
+#define VIRTIO_MAX_INDIRECT ((int)(rte_mem_page_size() / 16))
/*
* Maximum number of virtqueues per device.
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 333a5243a9..289b240c4e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -21,8 +21,8 @@
#include <rte_errno.h>
#include <rte_cpuflags.h>
#include <rte_vect.h>
-
#include <rte_memory.h>
+#include <rte_eal_paging.h>
#include <rte_eal.h>
#include <rte_dev.h>
#include <rte_cycles.h>
@@ -469,7 +469,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
sz_hdr_mz = vq_size * sizeof(struct virtio_tx_region);
} else if (queue_type == VTNET_CQ) {
/* Allocate a page for control vq command, data and status */
- sz_hdr_mz = PAGE_SIZE;
+ sz_hdr_mz = rte_mem_page_size();
}
vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE,
@@ -568,7 +568,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
cvq->mz = mz;
cvq->virtio_net_hdr_mz = hdr_mz;
cvq->virtio_net_hdr_mem = hdr_mz->iova;
- memset(cvq->virtio_net_hdr_mz->addr, 0, PAGE_SIZE);
+ memset(cvq->virtio_net_hdr_mz->addr, 0, rte_mem_page_size());
hw->cvq = cvq;
}
diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h
index 873327d989..5a501e7890 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -11,10 +11,6 @@
#include "virtio.h"
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#define VIRTIO_MAX_RX_QUEUES 128U
#define VIRTIO_MAX_TX_QUEUES 128U
#define VIRTIO_MAX_MAC_ADDRS 64
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 6a1b44bc77..39237aecf7 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -11,6 +11,7 @@
#include <linux/virtio_net.h>
#include <stdbool.h>
+#include <rte_eal_paging.h>
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_bus_pci.h>
@@ -30,10 +31,6 @@ RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
"IFCVF %s(): " fmt "\n", __func__, ##args)
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
#define IFCVF_USED_RING_LEN(size) \
((size) * sizeof(struct vring_used_elem) + sizeof(uint16_t) * 3)
@@ -600,11 +597,11 @@ m_ifcvf_start(struct ifcvf_internal *internal)
for (i = 0; i < nr_vring; i++) {
rte_vhost_get_vhost_vring(vid, i, &vq);
- size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
- PAGE_SIZE);
- vring_buf = rte_zmalloc("ifcvf", size, PAGE_SIZE);
+ size = RTE_ALIGN_CEIL(vring_size(vq.size, rte_mem_page_size()),
+ rte_mem_page_size());
+ vring_buf = rte_zmalloc("ifcvf", size, rte_mem_page_size());
vring_init(&internal->m_vring[i], vq.size, vring_buf,
- PAGE_SIZE);
+ rte_mem_page_size());
ret = rte_vfio_container_dma_map(internal->vfio_container_fd,
(uint64_t)(uintptr_t)vring_buf, m_vring_iova, size);
@@ -686,8 +683,8 @@ m_ifcvf_stop(struct ifcvf_internal *internal)
len = IFCVF_USED_RING_LEN(vq.size);
rte_vhost_log_used_vring(vid, i, 0, len);
- size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
- PAGE_SIZE);
+ size = RTE_ALIGN_CEIL(vring_size(vq.size, rte_mem_page_size()),
+ rte_mem_page_size());
rte_vfio_container_dma_unmap(internal->vfio_container_fd,
(uint64_t)(uintptr_t)internal->m_vring[i].desc,
m_vring_iova, size);
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 07/17] common/dpaax/caamflib: fix build with musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (5 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 06/17] drivers: replace page size definitions with function Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 08/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
` (10 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Andrew Rybchenko, David Marchand,
Sachin Saxena, Akhil Goyal, Horia Geanta Neag
From: Natanael Copa <ncopa@alpinelinux.org>
The swab16/swab32/swab64 are Linux specific and not GNU libc specific.
Keep the check for __GLIBC__ just in case other GNU systems depends on
this (Hurd or GNU/kFreeBSD).
This fixes a build error with musl libc.
Fixes: 04711d41a872 ("crypto/dpaa2_sec: add run-time assembler for descriptor")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/common/dpaax/caamflib/compat.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index 36ee4b5335..c1a693498d 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <errno.h>
-#ifdef __GLIBC__
+#ifdef RTE_EXEC_ENV_LINUX
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -24,7 +24,7 @@
#error "Undefined endianness"
#endif
-#else
+#else /* !RTE_EXEC_ENV_LINUX */
#error Environment not supported!
#endif
@@ -40,7 +40,7 @@
#define __maybe_unused __rte_unused
#endif
-#if defined(__GLIBC__) && !defined(pr_debug)
+#if !defined(pr_debug)
#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
#define pr_debug(fmt, ...) \
RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -49,7 +49,7 @@
#endif
#endif /* pr_debug */
-#if defined(__GLIBC__) && !defined(pr_err)
+#if !defined(pr_err)
#if !defined(SUPPRESS_PRINTS)
#define pr_err(fmt, ...) \
RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -58,7 +58,7 @@
#endif
#endif /* pr_err */
-#if defined(__GLIBC__) && !defined(pr_warn)
+#if !defined(pr_warn)
#if !defined(SUPPRESS_PRINTS)
#define pr_warn(fmt, ...) \
RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
@@ -101,7 +101,7 @@
#endif
/* Use Linux naming convention */
-#ifdef __GLIBC__
+#if defined(RTE_EXEC_ENV_LINUX) || defined(__GLIBC__)
#define swab16(x) rte_bswap16(x)
#define swab32(x) rte_bswap32(x)
#define swab64(x) rte_bswap64(x)
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 08/17] common/dpaax/caamflib: simplify log macros
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (6 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 07/17] common/dpaax/caamflib: fix build with musl Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
` (9 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, Hemant Agrawal, Andrew Rybchenko, David Marchand, Sachin Saxena
From: Natanael Copa <ncopa@alpinelinux.org>
Simplify pr_debug, pr_err and pr_warn macros by adding an intermediate
pr_msg macro. This way we only need to test for SUPPRESS_PRINTS once.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/common/dpaax/caamflib/compat.h | 28 +++++++++++---------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/common/dpaax/caamflib/compat.h b/drivers/common/dpaax/caamflib/compat.h
index c1a693498d..9776eed437 100644
--- a/drivers/common/dpaax/caamflib/compat.h
+++ b/drivers/common/dpaax/caamflib/compat.h
@@ -40,31 +40,27 @@
#define __maybe_unused __rte_unused
#endif
+#if defined(SUPPRESS_PRINTS)
+#define pr_msg(l, fmt, ...) do { } while (0)
+#else
+#define pr_msg(l, fmt, ...) \
+ RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#endif
+
#if !defined(pr_debug)
-#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG)
-#define pr_debug(fmt, ...) \
- RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#if defined(RTA_DEBUG)
+#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, ...) do { } while (0)
+#define pr_debug(fmt, ...) do { } while (0)
#endif
#endif /* pr_debug */
#if !defined(pr_err)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_err(fmt, ...) \
- RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_err(fmt, ...) do { } while (0)
-#endif
+#define pr_err(fmt, ...) pr_msg(ERR, fmt, ##__VA_ARGS__)
#endif /* pr_err */
#if !defined(pr_warn)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_warn(fmt, ...) \
- RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_warn(fmt, ...) do { } while (0)
-#endif
+#define pr_warn(fmt, ...) pr_msg(WARNING, fmt, ##__VA_ARGS__)
#endif /* pr_warn */
/**
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 09/17] bus/dpaa: fix 64-bit arch detection
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (7 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 08/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 10/17] bus/dpaa: fix build with musl Thomas Monjalon
` (8 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Hemant Agrawal, Andrew Rybchenko, David Marchand,
Sachin Saxena, Roy Pledge, Geoff Thorpe, Shreyansh Jain
From: Natanael Copa <ncopa@alpinelinux.org>
There is no standard saying that __WORDSIZE should be be defined or in
what include it should be defined. Use RTE_ARCH_64 instead.
This solves a warning when building with musl libc:
warning: "__WORDSIZE" is not defined, evaluates to 0 [-Wundef]
Fixes: 847ee3bd0d1f ("bus/dpaa: support FMAN frame queue lookup")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/dpaa/include/fsl_qman.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 10212f0fd5..7ef2f3b2e3 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -16,7 +16,7 @@ extern "C" {
#include <rte_eventdev.h>
/* FQ lookups (turn this on for 64bit user-space) */
-#if (__WORDSIZE == 64)
+#ifdef RTE_ARCH_64
#define CONFIG_FSL_QMAN_FQ_LOOKUP
/* if FQ lookups are supported, this controls the number of initialised,
* s/w-consumed FQs that can be supported at any one time.
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 10/17] bus/dpaa: fix build with musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (8 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 11/17] bus/pci: support I/O port operations " Thomas Monjalon
` (7 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand, Hemant Agrawal,
Sachin Saxena, Roy Pledge, Shreyansh Jain, Geoff Thorpe
From: Natanael Copa <ncopa@alpinelinux.org>
The header files argp.h and error.h do not exist in musl libc.
Fix build with musl libc by using err(3) instead of
the GNU-specific error(3).
We could have used the identical errx("...: %s", strerror(ret))` but
strerror(3) is not thread-safe and the strerror_r variant has two
incompatible versions, one GNU specific and one XSI-compliant.
Avoid the mess by letting "err" use the thread-local errno.
This also fixes error message for kzmalloc failures which previously
would always have given "Unknown error -1", since that is what
strerror(-1) returns. Let "err" use the proper error message from errno
which is set by kzalloc.
Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal")
Fixes: f09ede6c8fd1 ("bus/dpaa: add BMAN driver core")
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 ++--
drivers/bus/dpaa/base/qbman/bman_driver.c | 13 +++++++++----
drivers/bus/dpaa/base/qbman/qman_driver.c | 17 ++++++++++++-----
drivers/bus/dpaa/include/netcfg.h | 1 -
drivers/common/dpaax/compat.h | 1 -
5 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index b7009f2299..120deb0bb6 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -8,7 +8,7 @@
#include <dpaa_of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
@@ -90,7 +90,7 @@ netcfg_acquire(void)
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ err(0, "%s(): open(SOCK_RAW)", __func__);
return NULL;
}
diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c
index 750b756b93..ee35e03da1 100644
--- a/drivers/bus/dpaa/base/qbman/bman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/bman_driver.c
@@ -11,6 +11,7 @@
#include <process.h>
#include "bman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
/*
* Global variables of the max portal/pool number this bman version supported
@@ -40,7 +41,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
&cpuset);
if (ret) {
- error(0, ret, "pthread_getaffinity_np()");
+ errno = ret;
+ err(0, "pthread_getaffinity_np()");
return ret;
}
pcfg.cpu = -1;
@@ -60,7 +62,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
map.index = idx;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ err(0, "process_portal_map()");
return ret;
}
/* Make the portal's cache-[enabled|inhibited] regions */
@@ -104,8 +107,10 @@ static int fsl_bman_portal_finish(void)
cfg = bman_destroy_affine_portal();
DPAA_BUG_ON(cfg != &pcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ err(0, "process_portal_unmap()");
+ }
return ret;
}
diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index 6d9aaff164..dfbafe581a 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -9,6 +9,8 @@
#include <process.h>
#include "qman_priv.h"
#include <sys/ioctl.h>
+#include <err.h>
+
#include <rte_branch_prediction.h>
/* Global variable containing revision id (even on non-control plane systems
@@ -50,7 +52,8 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
map.index = index;
ret = process_portal_map(&map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ err(0, "process_portal_map()");
return ret;
}
qpcfg.channel = map.channel;
@@ -96,8 +99,10 @@ static int fsl_qman_portal_finish(void)
cfg = qman_destroy_affine_portal(NULL);
DPAA_BUG_ON(cfg != &qpcfg);
ret = process_portal_unmap(&map.addr);
- if (ret)
- error(0, ret, "process_portal_unmap()");
+ if (ret) {
+ errno = ret;
+ err(0, "process_portal_unmap()");
+ }
return ret;
}
@@ -146,7 +151,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
- error(0, -1, "q_pcfg kzalloc failed");
+ /* kzalloc sets errno */
+ err(0, "q_pcfg kzalloc failed");
return NULL;
}
@@ -155,7 +161,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd)
q_map.index = QBMAN_ANY_PORTAL_IDX;
ret = process_portal_map(&q_map);
if (ret) {
- error(0, ret, "process_portal_map()");
+ errno = ret;
+ err(0, "process_portal_map()");
kfree(q_pcfg);
return NULL;
}
diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h
index d7d1befd24..bb18a34e3d 100644
--- a/drivers/bus/dpaa/include/netcfg.h
+++ b/drivers/bus/dpaa/include/netcfg.h
@@ -9,7 +9,6 @@
#define __NETCFG_H
#include <fman.h>
-#include <argp.h>
/* Configuration information related to a specific ethernet port */
struct fm_eth_port_cfg {
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index c69e76ab96..7166f8cceb 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -30,7 +30,6 @@
#include <assert.h>
#include <dirent.h>
#include <inttypes.h>
-#include <error.h>
#include <rte_byteorder.h>
#include <rte_atomic.h>
#include <rte_spinlock.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 11/17] bus/pci: support I/O port operations with musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (9 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 10/17] bus/dpaa: fix build with musl Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 12/17] net/cxgbe: remove use of uint type Thomas Monjalon
` (6 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand, Ferruh Yigit,
Yuanhan Liu, David Marchand
Add a fallback for non-GNU libc systems like musl libc for the
non-standard functions outl_p, outw_p and outb_p.
It solves the following errors when building with musl libc:
pci_uio.c: undefined reference to 'outw_p'
pci_uio.c: undefined reference to 'outl_p'
pci_uio.c: undefined reference to 'outb_p'
Bugzilla ID: 35
Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API")
Cc: stable@dpdk.org
Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/bus/pci/linux/pci_uio.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 0907051e04..39ebeac2a0 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -526,13 +526,18 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
#endif
#if defined(RTE_ARCH_X86)
+
static inline uint8_t ioread8(void *addr)
{
uint8_t val;
val = (uint64_t)(uintptr_t)addr >= PIO_MAX ?
*(volatile uint8_t *)addr :
+#ifdef __GLIBC__
inb_p((unsigned long)addr);
+#else
+ inb((unsigned long)addr);
+#endif
return val;
}
@@ -543,7 +548,11 @@ static inline uint16_t ioread16(void *addr)
val = (uint64_t)(uintptr_t)addr >= PIO_MAX ?
*(volatile uint16_t *)addr :
+#ifdef __GLIBC__
inw_p((unsigned long)addr);
+#else
+ inw((unsigned long)addr);
+#endif
return val;
}
@@ -554,7 +563,11 @@ static inline uint32_t ioread32(void *addr)
val = (uint64_t)(uintptr_t)addr >= PIO_MAX ?
*(volatile uint32_t *)addr :
+#ifdef __GLIBC__
inl_p((unsigned long)addr);
+#else
+ inl((unsigned long)addr);
+#endif
return val;
}
@@ -563,23 +576,37 @@ static inline void iowrite8(uint8_t val, void *addr)
{
(uint64_t)(uintptr_t)addr >= PIO_MAX ?
*(volatile uint8_t *)addr = val :
+#ifdef __GLIBC__
outb_p(val, (unsigned long)addr);
+#else
+ outb(val, (unsigned long)addr);
+#endif
}
static inline void iowrite16(uint16_t val, void *addr)
{
(uint64_t)(uintptr_t)addr >= PIO_MAX ?
*(volatile uint16_t *)addr = val :
+#ifdef __GLIBC__
outw_p(val, (unsigned long)addr);
+#else
+ outw(val, (unsigned long)addr);
+#endif
}
static inline void iowrite32(uint32_t val, void *addr)
{
(uint64_t)(uintptr_t)addr >= PIO_MAX ?
*(volatile uint32_t *)addr = val :
+#ifdef __GLIBC__
outl_p(val, (unsigned long)addr);
-}
#else
+ outl(val, (unsigned long)addr);
+#endif
+}
+
+#else /* !RTE_ARCH_X86 */
+
static inline uint8_t ioread8(void *addr)
{
return *(volatile uint8_t *)addr;
@@ -609,7 +636,8 @@ static inline void iowrite32(uint32_t val, void *addr)
{
*(volatile uint32_t *)addr = val;
}
-#endif
+
+#endif /* !RTE_ARCH_X86 */
void
pci_uio_ioport_read(struct rte_pci_ioport *p,
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 12/17] net/cxgbe: remove use of uint type
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (10 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 11/17] bus/pci: support I/O port operations " Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 13/17] net/igc: " Thomas Monjalon
` (5 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Morten Brørup, Andrew Rybchenko,
David Marchand, Rahul Lakkireddy, Kumar Sanghvi
From: Natanael Copa <ncopa@alpinelinux.org>
Improve portability by replacing non-standard 'uint' with 'unsigned int'.
This solves the build error with musl libc:
In file included from ../drivers/net/cxgbe/cxgbe.h:9,
from ../drivers/net/cxgbe/cxgbe_ethdev.c:37:
../drivers/net/cxgbe/base/common.h:201:4: error: unknown type name 'uint'
201 | uint synmapen:1; /* SYN Map Enable */
| ^~~~
Fixes: bfcb257d3014 ("net/cxgbe: enable RSS for VF")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/net/cxgbe/base/common.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 202a2f4baf..ab100d784c 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -189,15 +189,15 @@ struct rss_params {
unsigned int mode; /* RSS mode */
union {
struct {
- uint synmapen:1; /* SYN Map Enable */
- uint syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
- uint syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
- uint syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
- uint syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
- uint ofdmapen:1; /* Offload Map Enable */
- uint tnlmapen:1; /* Tunnel Map Enable */
- uint tnlalllookup:1; /* Tunnel All Lookup */
- uint hashtoeplitz:1; /* use Toeplitz hash */
+ unsigned int synmapen:1; /* SYN Map Enable */
+ unsigned int syn4tupenipv6:1; /* en 4-tuple IPv6 SYNs hash */
+ unsigned int syn2tupenipv6:1; /* en 2-tuple IPv6 SYNs hash */
+ unsigned int syn4tupenipv4:1; /* en 4-tuple IPv4 SYNs hash */
+ unsigned int syn2tupenipv4:1; /* en 2-tuple IPv4 SYNs hash */
+ unsigned int ofdmapen:1; /* Offload Map Enable */
+ unsigned int tnlmapen:1; /* Tunnel Map Enable */
+ unsigned int tnlalllookup:1; /* Tunnel All Lookup */
+ unsigned int hashtoeplitz:1; /* use Toeplitz hash */
} basicvirtual;
} u;
};
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 13/17] net/igc: remove use of uint type
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (11 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 12/17] net/cxgbe: remove use of uint type Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 14/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
` (4 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, David Marchand, Haiyue Wang, Andrew Rybchenko,
Jeff Guo, Ferruh Yigit, Alvin Zhang
Improve portability (especially with musl libc)
by replacing the non-standard type 'uint' with 'size_t'.
Fixes: 746664d546fb ("net/igc: support flow API")
Cc: stable@dpdk.org
Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/net/igc/igc_flow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/igc/igc_flow.c b/drivers/net/igc/igc_flow.c
index 1bb64d323c..66053060af 100644
--- a/drivers/net/igc/igc_flow.c
+++ b/drivers/net/igc/igc_flow.c
@@ -656,7 +656,7 @@ igc_parse_action_rss(struct rte_eth_dev *dev,
* Return the pointer of the flow, or NULL for failed
**/
static inline struct rte_flow *
-igc_alloc_flow(const void *filter, enum igc_filter_type type, uint inbytes)
+igc_alloc_flow(const void *filter, enum igc_filter_type type, size_t inbytes)
{
/* allocate memory, 8 bytes boundary aligned */
struct rte_flow *flow = rte_malloc("igc flow filter",
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 14/17] vdpa/mlx5: replace pthread functions unavailable in musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (12 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 13/17] net/igc: " Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 15/17] event/dlb: fix header includes for musl Thomas Monjalon
` (3 subsequent siblings)
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Matan Azrad, Andrew Rybchenko, David Marchand,
Viacheslav Ovsiienko, Xueming Li, Maxime Coquelin
1/ The function pthread_yield() does not exist in musl libc,
and can be replaced with sched_yield() after including sched.h.
2/ The function pthread_attr_setaffinity_np() does not exist in musl libc,
and can be replaced with pthread_setaffinity_np() after pthread_create().
Fixes: b7fa0bf4d5c6 ("vdpa/mlx5: fix polling threads scheduling")
Fixes: 5cf3fd3af4df ("vdpa/mlx5: add CPU core parameter to bind polling thread")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/vdpa/mlx5/mlx5_vdpa_event.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 86adc864f5..49632dfaa7 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -3,6 +3,7 @@
*/
#include <unistd.h>
#include <stdint.h>
+#include <sched.h>
#include <fcntl.h>
#include <sys/eventfd.h>
@@ -234,7 +235,7 @@ mlx5_vdpa_timer_sleep(struct mlx5_vdpa_priv *priv, uint32_t max)
usleep(priv->timer_delay_us);
else
/* Give-up CPU to improve polling threads scheduling. */
- pthread_yield();
+ sched_yield();
}
static void *
@@ -515,17 +516,6 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
pthread_cond_init(&priv->timer_cond, NULL);
priv->timer_on = 0;
pthread_attr_init(&attr);
- CPU_ZERO(&cpuset);
- if (priv->event_core != -1)
- CPU_SET(priv->event_core, &cpuset);
- else
- cpuset = rte_lcore_cpuset(rte_get_main_lcore());
- ret = pthread_attr_setaffinity_np(&attr, sizeof(cpuset),
- &cpuset);
- if (ret) {
- DRV_LOG(ERR, "Failed to set thread affinity.");
- return -1;
- }
ret = pthread_attr_setschedpolicy(&attr, SCHED_RR);
if (ret) {
DRV_LOG(ERR, "Failed to set thread sched policy = RR.");
@@ -542,6 +532,17 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
DRV_LOG(ERR, "Failed to create timer thread.");
return -1;
}
+ CPU_ZERO(&cpuset);
+ if (priv->event_core != -1)
+ CPU_SET(priv->event_core, &cpuset);
+ else
+ cpuset = rte_lcore_cpuset(rte_get_main_lcore());
+ ret = pthread_setaffinity_np(priv->timer_tid,
+ sizeof(cpuset), &cpuset);
+ if (ret) {
+ DRV_LOG(ERR, "Failed to set thread affinity.");
+ goto error;
+ }
snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid);
ret = pthread_setname_np(priv->timer_tid, name);
if (ret) {
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 15/17] event/dlb: fix header includes for musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (13 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 14/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 15:47 ` McDaniel, Timothy
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 16/17] app/testpmd: fix build with musl Thomas Monjalon
` (2 subsequent siblings)
17 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand,
Timothy McDaniel, Gage Eads
The header file fcntl.h should not be included from sys/ directory
as done in dlb drivers, it is an error with musl libc.
Fixes: 19980083fd57 ("event/dlb: add eventdev probe")
Fixes: 5433956d5185 ("event/dlb2: add eventdev probe")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
drivers/event/dlb/dlb.c | 2 +-
drivers/event/dlb/pf/dlb_pf.c | 3 ++-
drivers/event/dlb2/dlb2.c | 2 +-
drivers/event/dlb2/pf/dlb2_pf.c | 3 ++-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
index 1174ab3d2b..60084ced3b 100644
--- a/drivers/event/dlb/dlb.c
+++ b/drivers/event/dlb/dlb.c
@@ -10,7 +10,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
index 2f7e30abbd..5445c2d57d 100644
--- a/drivers/event/dlb/pf/dlb_pf.c
+++ b/drivers/event/dlb/pf/dlb_pf.c
@@ -6,12 +6,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
+
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_dev.h>
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index b28ec58bfb..fb5ff012a4 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <rte_common.h>
#include <rte_config.h>
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 1142da5b25..cfb22efe8a 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -6,12 +6,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/mman.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/time.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
+
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_dev.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 16/17] app/testpmd: fix build with musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (14 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 15/17] event/dlb: fix header includes for musl Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
2021-03-23 10:02 ` [dpdk-dev] [PATCH v7 00/17] Alpine/musl build support Thomas Monjalon
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Morten Brørup, Andrew Rybchenko,
David Marchand, Xiaoyun Li, Nélio Laranjeiro,
Konstantin Ananyev, Ferruh Yigit
From: Natanael Copa <ncopa@alpinelinux.org>
1/ Improve portability by avoiding use of non-standard 'uint'.
Use uint8_t for hash_key_len as rss_key_len is a uint8_t type.
This solves following build error when building with musl libc:
app/test-pmd/testpmd.h:813:29: error: unknown type name 'uint'
2/ In musl libc, stdout is of type (FILE * const).
Because of the const qualifier, a dark magic cast
must be achieved through uintptr_t.
Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash commands")
Fixes: e977e4199a8d ("app/testpmd: add commands to load/unload BPF filters")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
app/test-pmd/bpf_cmd.c | 2 +-
app/test-pmd/config.c | 2 +-
app/test-pmd/testpmd.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/test-pmd/bpf_cmd.c b/app/test-pmd/bpf_cmd.c
index 066619e115..6980291f07 100644
--- a/app/test-pmd/bpf_cmd.c
+++ b/app/test-pmd/bpf_cmd.c
@@ -20,7 +20,7 @@ static const struct rte_bpf_xsym bpf_xsym[] = {
.name = RTE_STR(stdout),
.type = RTE_BPF_XTYPE_VAR,
.var = {
- .val = &stdout,
+ .val = (void *)(uintptr_t)&stdout,
.desc = {
.type = RTE_BPF_ARG_PTR,
.size = sizeof(stdout),
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 576d5acab5..e865de10a4 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2674,7 +2674,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
void
port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
- uint hash_key_len)
+ uint8_t hash_key_len)
{
struct rte_eth_rss_conf rss_conf;
int diag;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index af40859170..a87ccb0f0f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -936,7 +936,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
void port_rss_hash_key_update(portid_t port_id, char rss_type[],
- uint8_t *hash_key, uint hash_key_len);
+ uint8_t *hash_key, uint8_t hash_key_len);
int rx_queue_id_is_invalid(queueid_t rxq_id);
int tx_queue_id_is_invalid(queueid_t txq_id);
void setup_gro(const char *onoff, portid_t port_id);
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* [dpdk-dev] [PATCH v7 17/17] examples/bbdev: fix header include for musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (15 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 16/17] app/testpmd: fix build with musl Thomas Monjalon
@ 2021-03-19 14:57 ` Thomas Monjalon
2021-03-23 10:02 ` [dpdk-dev] [PATCH v7 00/17] Alpine/musl build support Thomas Monjalon
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-19 14:57 UTC (permalink / raw)
To: dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand, Nicolas Chautru,
Amr Mokhtar
The header file unistd.h should not be included from sys/ directory,
it is an error with musl libc.
Fixes: 1ffee690eaa1 ("examples/bbdev: add sample app")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
---
examples/bbdev_app/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 2e170caf84..20cfd327fb 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <sys/unistd.h>
+#include <unistd.h>
#include <sys/queue.h>
#include <stdarg.h>
#include <ctype.h>
--
2.30.1
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v7 15/17] event/dlb: fix header includes for musl
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 15/17] event/dlb: fix header includes for musl Thomas Monjalon
@ 2021-03-19 15:47 ` McDaniel, Timothy
0 siblings, 0 replies; 140+ messages in thread
From: McDaniel, Timothy @ 2021-03-19 15:47 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ncopa, stable, Andrew Rybchenko, David Marchand, Gage Eads
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, March 19, 2021 9:57 AM
> To: dev@dpdk.org
> Cc: ncopa@alpinelinux.org; stable@dpdk.org; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; David Marchand
> <david.marchand@redhat.com>; McDaniel, Timothy
> <timothy.mcdaniel@intel.com>; Gage Eads <gage.eads@intel.com>
> Subject: [PATCH v7 15/17] event/dlb: fix header includes for musl
>
> The header file fcntl.h should not be included from sys/ directory
> as done in dlb drivers, it is an error with musl libc.
>
> Fixes: 19980083fd57 ("event/dlb: add eventdev probe")
> Fixes: 5433956d5185 ("event/dlb2: add eventdev probe")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Acked-by: David Marchand <david.marchand@redhat.com>
> ---
> drivers/event/dlb/dlb.c | 2 +-
> drivers/event/dlb/pf/dlb_pf.c | 3 ++-
> drivers/event/dlb2/dlb2.c | 2 +-
> drivers/event/dlb2/pf/dlb2_pf.c | 3 ++-
> 4 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
> index 1174ab3d2b..60084ced3b 100644
> --- a/drivers/event/dlb/dlb.c
> +++ b/drivers/event/dlb/dlb.c
> @@ -10,7 +10,7 @@
> #include <stdint.h>
> #include <stdio.h>
> #include <string.h>
> -#include <sys/fcntl.h>
> +#include <fcntl.h>
> #include <sys/mman.h>
> #include <unistd.h>
>
> diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
> index 2f7e30abbd..5445c2d57d 100644
> --- a/drivers/event/dlb/pf/dlb_pf.c
> +++ b/drivers/event/dlb/pf/dlb_pf.c
> @@ -6,12 +6,13 @@
> #include <stdbool.h>
> #include <stdio.h>
> #include <sys/mman.h>
> -#include <sys/fcntl.h>
> +#include <fcntl.h>
> #include <sys/time.h>
> #include <errno.h>
> #include <assert.h>
> #include <unistd.h>
> #include <string.h>
> +
> #include <rte_debug.h>
> #include <rte_log.h>
> #include <rte_dev.h>
> diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
> index b28ec58bfb..fb5ff012a4 100644
> --- a/drivers/event/dlb2/dlb2.c
> +++ b/drivers/event/dlb2/dlb2.c
> @@ -11,7 +11,7 @@
> #include <stdio.h>
> #include <string.h>
> #include <sys/mman.h>
> -#include <sys/fcntl.h>
> +#include <fcntl.h>
>
> #include <rte_common.h>
> #include <rte_config.h>
> diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
> index 1142da5b25..cfb22efe8a 100644
> --- a/drivers/event/dlb2/pf/dlb2_pf.c
> +++ b/drivers/event/dlb2/pf/dlb2_pf.c
> @@ -6,12 +6,13 @@
> #include <stdbool.h>
> #include <stdio.h>
> #include <sys/mman.h>
> -#include <sys/fcntl.h>
> +#include <fcntl.h>
> #include <sys/time.h>
> #include <errno.h>
> #include <assert.h>
> #include <unistd.h>
> #include <string.h>
> +
> #include <rte_debug.h>
> #include <rte_log.h>
> #include <rte_dev.h>
> --
> 2.30.1
ack
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v7 06/17] drivers: replace page size definitions with function
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 06/17] drivers: replace page size definitions with function Thomas Monjalon
@ 2021-03-19 15:47 ` McDaniel, Timothy
0 siblings, 0 replies; 140+ messages in thread
From: McDaniel, Timothy @ 2021-03-19 15:47 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ncopa, Andrew Boyer, Andrew Rybchenko, David Marchand, Burakov,
Anatoly, Stephen Hemminger, Long Li, Jay Zhou, Rasesh Mody,
Shahed Shaikh, Maxime Coquelin, Xia, Chenbo, Wang, Xiao W
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, March 19, 2021 9:57 AM
> To: dev@dpdk.org
> Cc: ncopa@alpinelinux.org; Andrew Boyer <aboyer@pensando.io>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>; David Marchand
> <david.marchand@redhat.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; Long Li <longli@microsoft.com>; Jay Zhou
> <jianjay.zhou@huawei.com>; McDaniel, Timothy
> <timothy.mcdaniel@intel.com>; Rasesh Mody <rmody@marvell.com>; Shahed
> Shaikh <shshaikh@marvell.com>; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>; Wang,
> Xiao W <xiao.w.wang@intel.com>
> Subject: [PATCH v7 06/17] drivers: replace page size definitions with function
>
> The page size is often retrieved from the macro PAGE_SIZE.
> If PAGE_SIZE is not defined, it is either using hard coded default,
> or getting the system value from the UNIX-only function sysconf().
>
> Such definitions are replaced with the generic function
> rte_mem_page_size() defined for each supported OS.
>
> Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
> because #ifdef checks were missing, causing redefinition errors.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Andrew Boyer <aboyer@pensando.io>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Acked-by: David Marchand <david.marchand@redhat.com>
> ---
> drivers/bus/pci/linux/pci_vfio.c | 9 ++-------
> drivers/bus/vmbus/linux/vmbus_uio.c | 4 ++--
> drivers/bus/vmbus/private.h | 5 +----
> drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
> drivers/bus/vmbus/vmbus_common_uio.c | 4 ++--
> drivers/crypto/virtio/virtio_pci.h | 3 ++-
> drivers/event/dlb/dlb.c | 7 +++++--
> drivers/event/dlb/dlb_priv.h | 2 --
> drivers/event/dlb/pf/base/dlb_osdep.h | 2 +-
> drivers/event/dlb/pf/dlb_main.h | 5 +----
> drivers/event/dlb/pf/dlb_pf.c | 10 +++++----
> drivers/event/dlb2/dlb2_priv.h | 2 --
> drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +-
> drivers/event/dlb2/pf/dlb2_main.h | 5 +----
> drivers/event/dlb2/pf/dlb2_pf.c | 8 ++++----
> drivers/net/bnx2x/ecore_fw_defs.h | 18 +++++++++++------
> drivers/net/ionic/ionic_lif.c | 27 ++++++++++++++-----------
> drivers/net/ionic/ionic_main.c | 3 ++-
> drivers/net/ionic/ionic_osdep.h | 2 +-
> drivers/net/netvsc/hn_rndis.c | 12 +++++------
> drivers/net/netvsc/hn_rxtx.c | 10 +++++----
> drivers/net/netvsc/hn_var.h | 9 +++------
> drivers/net/virtio/virtio.h | 2 +-
> drivers/net/virtio/virtio_ethdev.c | 6 +++---
> drivers/net/virtio/virtio_ethdev.h | 4 ----
> drivers/vdpa/ifc/ifcvf_vdpa.c | 17 +++++++---------
> 26 files changed, 85 insertions(+), 95 deletions(-)
>
> diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
> index e3f7b6abeb..9d689d6fd9 100644
> --- a/drivers/bus/pci/linux/pci_vfio.c
> +++ b/drivers/bus/pci/linux/pci_vfio.c
> @@ -38,11 +38,6 @@
>
> #ifdef VFIO_PRESENT
>
> -#ifndef PAGE_SIZE
> -#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
> -#endif
> -#define PAGE_MASK (~(PAGE_SIZE - 1))
> -
> static struct rte_tailq_elem rte_vfio_tailq = {
> .name = "VFIO_RESOURCE_LIST",
> };
> @@ -507,8 +502,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct
> mapped_pci_resource *vfio_res,
> */
> uint32_t table_start = msix_table->offset;
> uint32_t table_end = table_start + msix_table->size;
> - table_end = RTE_ALIGN(table_end, PAGE_SIZE);
> - table_start = RTE_ALIGN_FLOOR(table_start, PAGE_SIZE);
> + table_end = RTE_ALIGN(table_end, rte_mem_page_size());
> + table_start = RTE_ALIGN_FLOOR(table_start,
> rte_mem_page_size());
>
> /* If page-aligned start of MSI-X table is less than the
> * actual MSI-X table start address, reassign to the actual
> diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c
> b/drivers/bus/vmbus/linux/vmbus_uio.c
> index 5dc0c47de6..b52ca5bf1d 100644
> --- a/drivers/bus/vmbus/linux/vmbus_uio.c
> +++ b/drivers/bus/vmbus/linux/vmbus_uio.c
> @@ -154,7 +154,7 @@ vmbus_uio_map_resource_by_index(struct
> rte_vmbus_device *dev, int idx,
> vmbus_map_addr = vmbus_find_max_end_va();
>
> /* offset is special in uio it indicates which resource */
> - offset = idx * PAGE_SIZE;
> + offset = idx * rte_mem_page_size();
>
> mapaddr = vmbus_map_resource(vmbus_map_addr, fd, offset, size,
> flags);
> close(fd);
> @@ -224,7 +224,7 @@ static int vmbus_uio_map_subchan(const struct
> rte_vmbus_device *dev,
> }
> file_size = sb.st_size;
>
> - if (file_size == 0 || (file_size & (PAGE_SIZE - 1))) {
> + if (file_size == 0 || (file_size & (rte_mem_page_size() - 1))) {
> VMBUS_LOG(ERR, "incorrect size %s: %zu",
> ring_path, file_size);
>
> diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
> index f19b14e4a6..528d60a42f 100644
> --- a/drivers/bus/vmbus/private.h
> +++ b/drivers/bus/vmbus/private.h
> @@ -9,13 +9,10 @@
> #include <stdbool.h>
> #include <sys/uio.h>
> #include <rte_log.h>
> +#include <rte_eal_paging.h>
> #include <rte_vmbus_reg.h>
> #include <rte_bus_vmbus.h>
>
> -#ifndef PAGE_SIZE
> -#define PAGE_SIZE 4096
> -#endif
> -
> extern struct rte_vmbus_bus rte_vmbus_bus;
>
> extern int vmbus_logtype_bus;
> diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h
> b/drivers/bus/vmbus/rte_vmbus_reg.h
> index f5a0693dcb..8562672979 100644
> --- a/drivers/bus/vmbus/rte_vmbus_reg.h
> +++ b/drivers/bus/vmbus/rte_vmbus_reg.h
> @@ -100,7 +100,7 @@ struct vmbus_bufring {
> uint32_t value;
> } feature_bits;
>
> - /* Pad it to PAGE_SIZE so that data starts on page boundary */
> + /* Pad it to rte_mem_page_size() so that data starts on page boundary
> */
> uint8_t reserved2[4028];
>
> /*
> diff --git a/drivers/bus/vmbus/vmbus_common_uio.c
> b/drivers/bus/vmbus/vmbus_common_uio.c
> index a689bf11b3..8582e32c1d 100644
> --- a/drivers/bus/vmbus/vmbus_common_uio.c
> +++ b/drivers/bus/vmbus/vmbus_common_uio.c
> @@ -63,7 +63,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device
> *dev)
>
> for (i = 0; i != uio_res->nb_maps; i++) {
> void *mapaddr;
> - off_t offset = i * PAGE_SIZE;
> + off_t offset = i * rte_mem_page_size();
>
> mapaddr = vmbus_map_resource(uio_res->maps[i].addr,
> fd, offset,
> @@ -175,7 +175,7 @@ vmbus_uio_map_resource(struct rte_vmbus_device
> *dev)
> }
>
> dev->int_page = (uint32_t *)((char *)uio_res-
> >maps[HV_INT_PAGE_MAP].addr
> - + (PAGE_SIZE >> 1));
> + + (rte_mem_page_size() >> 1));
> dev->monitor_page = uio_res->maps[HV_MON_PAGE_MAP].addr;
> return 0;
> }
> diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h
> index d9a214dfd0..0a7ea1bb64 100644
> --- a/drivers/crypto/virtio/virtio_pci.h
> +++ b/drivers/crypto/virtio/virtio_pci.h
> @@ -7,6 +7,7 @@
>
> #include <stdint.h>
>
> +#include <rte_eal_paging.h>
> #include <rte_pci.h>
> #include <rte_bus_pci.h>
> #include <rte_cryptodev.h>
> @@ -67,7 +68,7 @@ struct virtqueue;
> *
> * Note the sizeof(struct vring_desc) is 16 bytes.
> */
> -#define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16))
> +#define VIRTIO_MAX_INDIRECT ((int) (rte_mem_page_size() / 16))
>
> /* Do we get callbacks when the ring is completely used, even if we've
> * suppressed them?
> diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c
> index 8b26d1d2d2..1174ab3d2b 100644
> --- a/drivers/event/dlb/dlb.c
> +++ b/drivers/event/dlb/dlb.c
> @@ -23,6 +23,7 @@
> #include <rte_io.h>
> #include <rte_kvargs.h>
> #include <rte_log.h>
> +#include <rte_eal_paging.h>
> #include <rte_malloc.h>
> #include <rte_mbuf.h>
> #include <rte_power_intrinsics.h>
> @@ -991,7 +992,8 @@ dlb_hw_create_ldb_port(struct dlb_eventdev *dlb,
> goto error_exit;
> }
>
> - qm_port->pp_mmio_base = DLB_LDB_PP_BASE + PAGE_SIZE *
> qm_port_id;
> + qm_port->pp_mmio_base = DLB_LDB_PP_BASE +
> + rte_mem_page_size() * qm_port_id;
> qm_port->id = qm_port_id;
>
> /* The credit window is one high water mark of QEs */
> @@ -1181,7 +1183,8 @@ dlb_hw_create_dir_port(struct dlb_eventdev *dlb,
> goto error_exit;
> }
>
> - qm_port->pp_mmio_base = DLB_DIR_PP_BASE + PAGE_SIZE *
> qm_port_id;
> + qm_port->pp_mmio_base = DLB_DIR_PP_BASE +
> + rte_mem_page_size() * qm_port_id;
> qm_port->id = qm_port_id;
>
> /* The credit window is one high water mark of QEs */
> diff --git a/drivers/event/dlb/dlb_priv.h b/drivers/event/dlb/dlb_priv.h
> index 272e17482f..ca4d6a84cf 100644
> --- a/drivers/event/dlb/dlb_priv.h
> +++ b/drivers/event/dlb/dlb_priv.h
> @@ -76,8 +76,6 @@
>
> #define PP_BASE(is_dir) ((is_dir) ? DLB_DIR_PP_BASE : DLB_LDB_PP_BASE)
>
> -#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
> -
> #define DLB_NUM_QES_PER_CACHE_LINE 4
>
> #define DLB_MAX_ENQUEUE_DEPTH 64
> diff --git a/drivers/event/dlb/pf/base/dlb_osdep.h
> b/drivers/event/dlb/pf/base/dlb_osdep.h
> index 0c119b759a..dee20660ed 100644
> --- a/drivers/event/dlb/pf/base/dlb_osdep.h
> +++ b/drivers/event/dlb/pf/base/dlb_osdep.h
> @@ -92,7 +92,7 @@ static inline void *os_map_producer_port(struct dlb_hw
> *hw,
>
>
> pp_dma_base = (uintptr_t)hw->func_kva + DLB_PP_BASE(is_ldb);
> - addr = (pp_dma_base + (PAGE_SIZE * port_id));
> + addr = (pp_dma_base + (rte_mem_page_size() * port_id));
>
> return (void *)(uintptr_t)addr;
>
> diff --git a/drivers/event/dlb/pf/dlb_main.h b/drivers/event/dlb/pf/dlb_main.h
> index 22e215223d..e66ba228d1 100644
> --- a/drivers/event/dlb/pf/dlb_main.h
> +++ b/drivers/event/dlb/pf/dlb_main.h
> @@ -10,10 +10,7 @@
> #include <rte_spinlock.h>
> #include <rte_pci.h>
> #include <rte_bus_pci.h>
> -
> -#ifndef PAGE_SIZE
> -#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
> -#endif
> +#include <rte_eal_paging.h>
>
> #include "base/dlb_hw_types.h"
> #include "../dlb_user.h"
> diff --git a/drivers/event/dlb/pf/dlb_pf.c b/drivers/event/dlb/pf/dlb_pf.c
> index 3aeef6f91d..2f7e30abbd 100644
> --- a/drivers/event/dlb/pf/dlb_pf.c
> +++ b/drivers/event/dlb/pf/dlb_pf.c
> @@ -303,7 +303,7 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
> alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
>
> port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
> - alloc_sz, PAGE_SIZE);
> + alloc_sz, rte_mem_page_size());
> if (port_base == NULL)
> return -ENOMEM;
>
> @@ -328,7 +328,8 @@ dlb_pf_ldb_port_create(struct dlb_hw_dev *handle,
>
> pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
> dlb_port[response.id][DLB_LDB].pp_addr =
> - (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
> + (void *)(uintptr_t)(pp_dma_base +
> + (rte_mem_page_size() * response.id));
>
> dlb_port[response.id][DLB_LDB].cq_base =
> (void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
> @@ -381,7 +382,7 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
> alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
>
> port_base = dlb_alloc_coherent_aligned(&mz, &pc_dma_base,
> - alloc_sz, PAGE_SIZE);
> + alloc_sz, rte_mem_page_size());
> if (port_base == NULL)
> return -ENOMEM;
>
> @@ -406,7 +407,8 @@ dlb_pf_dir_port_create(struct dlb_hw_dev *handle,
>
> pp_dma_base = (uintptr_t)dlb_dev->hw.func_kva + PP_BASE(is_dir);
> dlb_port[response.id][DLB_DIR].pp_addr =
> - (void *)(uintptr_t)(pp_dma_base + (PAGE_SIZE * response.id));
> + (void *)(uintptr_t)(pp_dma_base +
> + (rte_mem_page_size() * response.id));
>
> dlb_port[response.id][DLB_DIR].cq_base =
> (void *)(uintptr_t)(port_base + (2 * RTE_CACHE_LINE_SIZE));
> diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
> index b73cf3ff14..eb1a932399 100644
> --- a/drivers/event/dlb2/dlb2_priv.h
> +++ b/drivers/event/dlb2/dlb2_priv.h
> @@ -78,8 +78,6 @@
> DLB2_LDB_CQ_MAX_SIZE)
> #define PP_BASE(is_dir) ((is_dir) ? DLB2_DIR_PP_BASE : DLB2_LDB_PP_BASE)
>
> -#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
> -
> #define DLB2_NUM_QES_PER_CACHE_LINE 4
>
> #define DLB2_MAX_ENQUEUE_DEPTH 64
> diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h
> b/drivers/event/dlb2/pf/base/dlb2_osdep.h
> index c4c34eba5f..aa101a49a3 100644
> --- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
> +++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
> @@ -89,7 +89,7 @@ static inline void *os_map_producer_port(struct dlb2_hw
> *hw,
> uint64_t pp_dma_base;
>
> pp_dma_base = (uintptr_t)hw->func_kva + DLB2_PP_BASE(is_ldb);
> - addr = (pp_dma_base + (PAGE_SIZE * port_id));
> + addr = (pp_dma_base + (rte_mem_page_size() * port_id));
>
> return (void *)(uintptr_t)addr;
> }
> diff --git a/drivers/event/dlb2/pf/dlb2_main.h
> b/drivers/event/dlb2/pf/dlb2_main.h
> index f3bee71fb6..9eeda482a3 100644
> --- a/drivers/event/dlb2/pf/dlb2_main.h
> +++ b/drivers/event/dlb2/pf/dlb2_main.h
> @@ -10,10 +10,7 @@
> #include <rte_spinlock.h>
> #include <rte_pci.h>
> #include <rte_bus_pci.h>
> -
> -#ifndef PAGE_SIZE
> -#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
> -#endif
> +#include <rte_eal_paging.h>
>
> #include "base/dlb2_hw_types.h"
> #include "../dlb2_user.h"
> diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
> index 1a7d8fc294..1142da5b25 100644
> --- a/drivers/event/dlb2/pf/dlb2_pf.c
> +++ b/drivers/event/dlb2/pf/dlb2_pf.c
> @@ -284,7 +284,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
> alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
>
> port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
> - PAGE_SIZE);
> + rte_mem_page_size());
> if (port_base == NULL)
> return -ENOMEM;
>
> @@ -307,7 +307,7 @@ dlb2_pf_ldb_port_create(struct dlb2_hw_dev *handle,
>
> pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
> dlb2_port[response.id][DLB2_LDB_PORT].pp_addr =
> - (void *)(pp_base + (PAGE_SIZE * response.id));
> + (void *)(pp_base + (rte_mem_page_size() * response.id));
>
> dlb2_port[response.id][DLB2_LDB_PORT].cq_base = (void
> *)(port_base);
> memset(&port_memory, 0, sizeof(port_memory));
> @@ -359,7 +359,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
> alloc_sz = RTE_CACHE_LINE_ROUNDUP(alloc_sz);
>
> port_base = dlb2_alloc_coherent_aligned(&mz, &cq_base, alloc_sz,
> - PAGE_SIZE);
> + rte_mem_page_size());
> if (port_base == NULL)
> return -ENOMEM;
>
> @@ -382,7 +382,7 @@ dlb2_pf_dir_port_create(struct dlb2_hw_dev *handle,
>
> pp_base = (uintptr_t)dlb2_dev->hw.func_kva + PP_BASE(is_dir);
> dlb2_port[response.id][DLB2_DIR_PORT].pp_addr =
> - (void *)(pp_base + (PAGE_SIZE * response.id));
> + (void *)(pp_base + (rte_mem_page_size() * response.id));
>
> dlb2_port[response.id][DLB2_DIR_PORT].cq_base =
> (void *)(port_base);
> diff --git a/drivers/net/bnx2x/ecore_fw_defs.h
> b/drivers/net/bnx2x/ecore_fw_defs.h
> index 5397a701aa..93bca8ad33 100644
> --- a/drivers/net/bnx2x/ecore_fw_defs.h
> +++ b/drivers/net/bnx2x/ecore_fw_defs.h
> @@ -13,6 +13,8 @@
> #ifndef ECORE_FW_DEFS_H
> #define ECORE_FW_DEFS_H
>
> +#include <rte_eal_paging.h>
> +
> #define CSTORM_ASSERT_LIST_INDEX_OFFSET (IRO[152].base)
> #define CSTORM_ASSERT_LIST_OFFSET(assertListEntry) \
> (IRO[151].base + ((assertListEntry) * IRO[151].m1))
> @@ -252,7 +254,8 @@
> #define X_ETH_LOCAL_RING_SIZE 13
> #define FIRST_BD_IN_PKT 0
> #define PARSE_BD_INDEX 1
> -#define NUM_OF_ETH_BDS_IN_PAGE
> ((PAGE_SIZE)/(STRUCT_SIZE(eth_tx_bd)/8))
> +#define NUM_OF_ETH_BDS_IN_PAGE \
> + (rte_mem_page_size() / (STRUCT_SIZE(eth_tx_bd) / 8))
> #define U_ETH_NUM_OF_SGES_TO_FETCH 8
> #define U_ETH_MAX_SGES_FOR_PACKET 3
>
> @@ -265,11 +268,14 @@
> #define IP_HEADER_ALIGNMENT_PADDING 2
>
> #define U_ETH_SGES_PER_PAGE_INVERSE_MASK \
> - (0xFFFF - ((PAGE_SIZE/((STRUCT_SIZE(eth_rx_sge))/8))-1))
> + (0xFFFF - ((rte_mem_page_size() / ((STRUCT_SIZE(eth_rx_sge)) / 8)) - 1))
>
> -#define TU_ETH_CQES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_cqe)/8))
> -#define U_ETH_BDS_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_bd)/8))
> -#define U_ETH_SGES_PER_PAGE (PAGE_SIZE/(STRUCT_SIZE(eth_rx_sge)/8))
> +#define TU_ETH_CQES_PER_PAGE \
> + (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_cqe) / 8))
> +#define U_ETH_BDS_PER_PAGE \
> + (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_bd) / 8))
> +#define U_ETH_SGES_PER_PAGE \
> + (rte_mem_page_size() / (STRUCT_SIZE(eth_rx_sge) / 8))
>
> #define U_ETH_BDS_PER_PAGE_MASK (U_ETH_BDS_PER_PAGE-1)
> #define U_ETH_CQE_PER_PAGE_MASK (TU_ETH_CQES_PER_PAGE-1)
> @@ -396,7 +402,7 @@
>
> /* Event Ring definitions */
> #define C_ERES_PER_PAGE \
> - (PAGE_SIZE / BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
> + (rte_mem_page_size() /
> BITS_TO_BYTES(STRUCT_SIZE(event_ring_elem)))
> #define C_ERE_PER_PAGE_MASK (C_ERES_PER_PAGE - 1)
>
> /* number of statistic command */
> diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
> index cd220abee2..431eda777b 100644
> --- a/drivers/net/ionic/ionic_lif.c
> +++ b/drivers/net/ionic/ionic_lif.c
> @@ -612,18 +612,18 @@ ionic_qcq_alloc(struct ionic_lif *lif,
> cq_size = num_descs * cq_desc_size;
> sg_size = num_descs * sg_desc_size;
>
> - total_size = RTE_ALIGN(q_size, PAGE_SIZE) +
> - RTE_ALIGN(cq_size, PAGE_SIZE);
> + total_size = RTE_ALIGN(q_size, rte_mem_page_size()) +
> + RTE_ALIGN(cq_size, rte_mem_page_size());
> /*
> * Note: aligning q_size/cq_size is not enough due to cq_base address
> * aligning as q_base could be not aligned to the page.
> - * Adding PAGE_SIZE.
> + * Adding rte_mem_page_size().
> */
> - total_size += PAGE_SIZE;
> + total_size += rte_mem_page_size();
>
> if (flags & IONIC_QCQ_F_SG) {
> - total_size += RTE_ALIGN(sg_size, PAGE_SIZE);
> - total_size += PAGE_SIZE;
> + total_size += RTE_ALIGN(sg_size, rte_mem_page_size());
> + total_size += rte_mem_page_size();
> }
>
> new = rte_zmalloc("ionic", struct_size, 0);
> @@ -636,7 +636,7 @@ ionic_qcq_alloc(struct ionic_lif *lif,
>
> new->q.info = rte_calloc_socket("ionic",
> num_descs, sizeof(void *),
> - PAGE_SIZE, socket_id);
> + rte_mem_page_size(), socket_id);
> if (!new->q.info) {
> IONIC_PRINT(ERR, "Cannot allocate queue info");
> err = -ENOMEM;
> @@ -673,13 +673,16 @@ ionic_qcq_alloc(struct ionic_lif *lif,
> q_base = new->base;
> q_base_pa = new->base_pa;
>
> - cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, PAGE_SIZE);
> - cq_base_pa = RTE_ALIGN(q_base_pa + q_size, PAGE_SIZE);
> + cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size,
> + rte_mem_page_size());
> + cq_base_pa = RTE_ALIGN(q_base_pa + q_size,
> + rte_mem_page_size());
>
> if (flags & IONIC_QCQ_F_SG) {
> sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size,
> - PAGE_SIZE);
> - sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, PAGE_SIZE);
> + rte_mem_page_size());
> + sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size,
> + rte_mem_page_size());
> ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
> }
>
> @@ -1002,7 +1005,7 @@ ionic_lif_alloc(struct ionic_lif *lif)
>
> IONIC_PRINT(DEBUG, "Allocating Lif Info");
>
> - lif->info_sz = RTE_ALIGN(sizeof(*lif->info), PAGE_SIZE);
> + lif->info_sz = RTE_ALIGN(sizeof(*lif->info), rte_mem_page_size());
>
> lif->info_z = rte_eth_dma_zone_reserve(lif->eth_dev,
> "lif_info", 0 /* queue_idx*/,
> diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
> index 9aa7b2e96c..7301f53342 100644
> --- a/drivers/net/ionic/ionic_main.c
> +++ b/drivers/net/ionic/ionic_main.c
> @@ -456,7 +456,8 @@ ionic_port_init(struct ionic_adapter *adapter)
> if (idev->port_info)
> return 0;
>
> - idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
> + idev->port_info_sz = RTE_ALIGN(sizeof(*idev->port_info),
> + rte_mem_page_size());
>
> snprintf(z_name, sizeof(z_name), "%s_port_%s_info",
> IONIC_DRV_NAME, adapter->name);
> diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
> index a6575c36b5..89ed106d11 100644
> --- a/drivers/net/ionic/ionic_osdep.h
> +++ b/drivers/net/ionic/ionic_osdep.h
> @@ -17,6 +17,7 @@
> #include <rte_byteorder.h>
> #include <rte_io.h>
> #include <rte_memory.h>
> +#include <rte_eal_paging.h>
>
> #include "ionic_logs.h"
>
> @@ -25,7 +26,6 @@
>
> #ifndef PAGE_SHIFT
> #define PAGE_SHIFT 12
> -#define PAGE_SIZE (1 << PAGE_SHIFT)
> #endif
>
> #define __iomem
> diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c
> index e317539de7..e3f7e636d7 100644
> --- a/drivers/net/netvsc/hn_rndis.c
> +++ b/drivers/net/netvsc/hn_rndis.c
> @@ -67,7 +67,7 @@ hn_rndis_rid(struct hn_data *hv)
>
> static void *hn_rndis_alloc(size_t size)
> {
> - return rte_zmalloc("RNDIS", size, PAGE_SIZE);
> + return rte_zmalloc("RNDIS", size, rte_mem_page_size());
> }
>
> #ifdef RTE_LIBRTE_NETVSC_DEBUG_DUMP
> @@ -265,17 +265,17 @@ static int hn_nvs_send_rndis_ctrl(struct
> vmbus_channel *chan,
> return -EINVAL;
> }
>
> - if (unlikely(reqlen > PAGE_SIZE)) {
> + if (unlikely(reqlen > rte_mem_page_size())) {
> PMD_DRV_LOG(ERR, "RNDIS request %u greater than page
> size",
> reqlen);
> return -EINVAL;
> }
>
> - sg.page = addr / PAGE_SIZE;
> + sg.page = addr / rte_mem_page_size();
> sg.ofs = addr & PAGE_MASK;
> sg.len = reqlen;
>
> - if (sg.ofs + reqlen > PAGE_SIZE) {
> + if (sg.ofs + reqlen > rte_mem_page_size()) {
> PMD_DRV_LOG(ERR, "RNDIS request crosses page boundary");
> return -EINVAL;
> }
> @@ -479,7 +479,7 @@ hn_rndis_query(struct hn_data *hv, uint32_t oid,
> return -ENOMEM;
>
> comp_len = sizeof(*comp) + odlen;
> - comp = rte_zmalloc("QUERY", comp_len, PAGE_SIZE);
> + comp = rte_zmalloc("QUERY", comp_len, rte_mem_page_size());
> if (!comp) {
> error = -ENOMEM;
> goto done;
> @@ -736,7 +736,7 @@ hn_rndis_set(struct hn_data *hv, uint32_t oid, const
> void *data, uint32_t dlen)
> int error;
>
> reqlen = sizeof(*req) + dlen;
> - req = rte_zmalloc("RNDIS_SET", reqlen, PAGE_SIZE);
> + req = rte_zmalloc("RNDIS_SET", reqlen, rte_mem_page_size());
> if (!req)
> return -ENOMEM;
>
> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
> index 0f4ef0100b..c6bf7cc132 100644
> --- a/drivers/net/netvsc/hn_rxtx.c
> +++ b/drivers/net/netvsc/hn_rxtx.c
> @@ -1387,7 +1387,8 @@ static unsigned int hn_get_slots(const struct rte_mbuf
> *m)
> unsigned int size = rte_pktmbuf_data_len(m);
> unsigned int offs = rte_mbuf_data_iova(m) & PAGE_MASK;
>
> - slots += (offs + size + PAGE_SIZE - 1) / PAGE_SIZE;
> + slots += (offs + size + rte_mem_page_size() - 1) /
> + rte_mem_page_size();
> m = m->next;
> }
>
> @@ -1402,12 +1403,13 @@ static unsigned int hn_fill_sg(struct vmbus_gpa *sg,
>
> while (m) {
> rte_iova_t addr = rte_mbuf_data_iova(m);
> - unsigned int page = addr / PAGE_SIZE;
> + unsigned int page = addr / rte_mem_page_size();
> unsigned int offset = addr & PAGE_MASK;
> unsigned int len = rte_pktmbuf_data_len(m);
>
> while (len > 0) {
> - unsigned int bytes = RTE_MIN(len, PAGE_SIZE - offset);
> + unsigned int bytes = RTE_MIN(len,
> + rte_mem_page_size() - offset);
>
> sg[segs].page = page;
> sg[segs].ofs = offset;
> @@ -1450,7 +1452,7 @@ static int hn_xmit_sg(struct hn_tx_queue *txq,
> addr = txq->tx_rndis_iova +
> ((char *)txd->rndis_pkt - (char *)txq->tx_rndis);
>
> - sg[0].page = addr / PAGE_SIZE;
> + sg[0].page = addr / rte_mem_page_size();
> sg[0].ofs = addr & PAGE_MASK;
> sg[0].len = RNDIS_PACKET_MSG_OFFSET_ABS(hn_rndis_pktlen(txd-
> >rndis_pkt));
> segs = 1;
> diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
> index b7405ca726..43642408bc 100644
> --- a/drivers/net/netvsc/hn_var.h
> +++ b/drivers/net/netvsc/hn_var.h
> @@ -6,6 +6,8 @@
> * All rights reserved.
> */
>
> +#include <rte_eal_paging.h>
> +
> /*
> * Tunable ethdev params
> */
> @@ -28,13 +30,8 @@
>
> #define HN_RX_EXTMBUF_ENABLE 0
>
> -/* Buffers need to be aligned */
> -#ifndef PAGE_SIZE
> -#define PAGE_SIZE 4096
> -#endif
> -
> #ifndef PAGE_MASK
> -#define PAGE_MASK (PAGE_SIZE - 1)
> +#define PAGE_MASK (rte_mem_page_size() - 1)
> #endif
>
> struct hn_data;
> diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h
> index 21d54904e7..2c987d19ab 100644
> --- a/drivers/net/virtio/virtio.h
> +++ b/drivers/net/virtio/virtio.h
> @@ -98,7 +98,7 @@
> *
> * Note the sizeof(struct vring_desc) is 16 bytes.
> */
> -#define VIRTIO_MAX_INDIRECT ((int)(PAGE_SIZE / 16))
> +#define VIRTIO_MAX_INDIRECT ((int)(rte_mem_page_size() / 16))
>
> /*
> * Maximum number of virtqueues per device.
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 333a5243a9..289b240c4e 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -21,8 +21,8 @@
> #include <rte_errno.h>
> #include <rte_cpuflags.h>
> #include <rte_vect.h>
> -
> #include <rte_memory.h>
> +#include <rte_eal_paging.h>
> #include <rte_eal.h>
> #include <rte_dev.h>
> #include <rte_cycles.h>
> @@ -469,7 +469,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t
> queue_idx)
> sz_hdr_mz = vq_size * sizeof(struct virtio_tx_region);
> } else if (queue_type == VTNET_CQ) {
> /* Allocate a page for control vq command, data and status */
> - sz_hdr_mz = PAGE_SIZE;
> + sz_hdr_mz = rte_mem_page_size();
> }
>
> vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE,
> @@ -568,7 +568,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t
> queue_idx)
> cvq->mz = mz;
> cvq->virtio_net_hdr_mz = hdr_mz;
> cvq->virtio_net_hdr_mem = hdr_mz->iova;
> - memset(cvq->virtio_net_hdr_mz->addr, 0, PAGE_SIZE);
> + memset(cvq->virtio_net_hdr_mz->addr, 0,
> rte_mem_page_size());
>
> hw->cvq = cvq;
> }
> diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h
> index 873327d989..5a501e7890 100644
> --- a/drivers/net/virtio/virtio_ethdev.h
> +++ b/drivers/net/virtio/virtio_ethdev.h
> @@ -11,10 +11,6 @@
>
> #include "virtio.h"
>
> -#ifndef PAGE_SIZE
> -#define PAGE_SIZE 4096
> -#endif
> -
> #define VIRTIO_MAX_RX_QUEUES 128U
> #define VIRTIO_MAX_TX_QUEUES 128U
> #define VIRTIO_MAX_MAC_ADDRS 64
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 6a1b44bc77..39237aecf7 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -11,6 +11,7 @@
> #include <linux/virtio_net.h>
> #include <stdbool.h>
>
> +#include <rte_eal_paging.h>
> #include <rte_malloc.h>
> #include <rte_memory.h>
> #include <rte_bus_pci.h>
> @@ -30,10 +31,6 @@ RTE_LOG_REGISTER(ifcvf_vdpa_logtype,
> pmd.net.ifcvf_vdpa, NOTICE);
> rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
> "IFCVF %s(): " fmt "\n", __func__, ##args)
>
> -#ifndef PAGE_SIZE
> -#define PAGE_SIZE 4096
> -#endif
> -
> #define IFCVF_USED_RING_LEN(size) \
> ((size) * sizeof(struct vring_used_elem) + sizeof(uint16_t) * 3)
>
> @@ -600,11 +597,11 @@ m_ifcvf_start(struct ifcvf_internal *internal)
> for (i = 0; i < nr_vring; i++) {
> rte_vhost_get_vhost_vring(vid, i, &vq);
>
> - size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
> - PAGE_SIZE);
> - vring_buf = rte_zmalloc("ifcvf", size, PAGE_SIZE);
> + size = RTE_ALIGN_CEIL(vring_size(vq.size,
> rte_mem_page_size()),
> + rte_mem_page_size());
> + vring_buf = rte_zmalloc("ifcvf", size, rte_mem_page_size());
> vring_init(&internal->m_vring[i], vq.size, vring_buf,
> - PAGE_SIZE);
> + rte_mem_page_size());
>
> ret = rte_vfio_container_dma_map(internal-
> >vfio_container_fd,
> (uint64_t)(uintptr_t)vring_buf, m_vring_iova, size);
> @@ -686,8 +683,8 @@ m_ifcvf_stop(struct ifcvf_internal *internal)
> len = IFCVF_USED_RING_LEN(vq.size);
> rte_vhost_log_used_vring(vid, i, 0, len);
>
> - size = RTE_ALIGN_CEIL(vring_size(vq.size, PAGE_SIZE),
> - PAGE_SIZE);
> + size = RTE_ALIGN_CEIL(vring_size(vq.size,
> rte_mem_page_size()),
> + rte_mem_page_size());
> rte_vfio_container_dma_unmap(internal->vfio_container_fd,
> (uint64_t)(uintptr_t)internal->m_vring[i].desc,
> m_vring_iova, size);
> --
> 2.30.1
ack
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox Thomas Monjalon
@ 2021-03-22 8:52 ` Kinsella, Ray
2021-03-22 8:55 ` Thomas Monjalon
0 siblings, 1 reply; 140+ messages in thread
From: Kinsella, Ray @ 2021-03-22 8:52 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ncopa, stable, Bruce Richardson, Andrew Rybchenko,
David Marchand, Konstantin Ananyev, Neil Horman, Haiyue Wang,
Adrien Mazarguil
On 19/03/2021 14:57, Thomas Monjalon wrote:
> If using busybox for mktemp and awk (as in Alpine),
> some bugs prevent the script from running:
>
> 1/ It seems busybox mktemp requires the pattern to have at least
> 6 X and no other suffix.
> The same has been fixed for other scripts in the past:
> commit 3771edc35438 ("buildtools: fix build for some mktemp")
>
> 2/ It seems busybox awk does not accept the regex ^.*{
> except if the opening curly brace is escaped.
>
> Fixes: 4c82473412e8 ("build: add internal tag check")
> Fixes: 68b1f1cda5b4 ("build: check AVX512 rather than binutils version")
> Fixes: 3290ac14eb94 ("buildtools: detect discrepancies for experimental symbols")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Acked-by: David Marchand <david.marchand@redhat.com>
> ---
> buildtools/binutils-avx512-check.sh | 2 +-
> buildtools/check-symbols.sh | 2 +-
> buildtools/map-list-symbol.sh | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
> index a7e068140f..2a833b64b7 100755
> --- a/buildtools/binutils-avx512-check.sh
> +++ b/buildtools/binutils-avx512-check.sh
> @@ -3,7 +3,7 @@
> # Copyright(c) 2020 Intel Corporation
>
> AS=${AS:-as}
> -OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
> +OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX)
> trap 'rm -f "$OBJFILE"' EXIT
> # from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
> GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
> diff --git a/buildtools/check-symbols.sh b/buildtools/check-symbols.sh
> index e407553a34..6723e38450 100755
> --- a/buildtools/check-symbols.sh
> +++ b/buildtools/check-symbols.sh
> @@ -18,7 +18,7 @@ then
> exit 0
> fi
>
> -DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
> +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
Does it make sense to change it to
DUMPFILE=$(mktemp -t dpdk.${0##*/}.objdump.XXXXXX)
So we can preserve what the file is in the filename?
> trap 'rm -f "$DUMPFILE"' EXIT
> objdump -t $OBJFILE >$DUMPFILE
>
> diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh
> index 5509b4a7fa..3bf9bd66f8 100755
> --- a/buildtools/map-list-symbol.sh
> +++ b/buildtools/map-list-symbol.sh
> @@ -44,7 +44,7 @@ for file in $@; do
> ret = 1;
> }
> }
> - /^.*{/ {
> + /^.*\{/ {
> if ("'$section'" == "all" || $1 == "'$section'") {
> current_section = $1;
> }
>
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox
2021-03-22 8:52 ` Kinsella, Ray
@ 2021-03-22 8:55 ` Thomas Monjalon
2021-03-22 9:01 ` Kinsella, Ray
0 siblings, 1 reply; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-22 8:55 UTC (permalink / raw)
To: Kinsella, Ray
Cc: dev, ncopa, stable, Bruce Richardson, Andrew Rybchenko,
David Marchand, Konstantin Ananyev, Haiyue Wang,
Adrien Mazarguil
22/03/2021 09:52, Kinsella, Ray:
> On 19/03/2021 14:57, Thomas Monjalon wrote:
> > --- a/buildtools/check-symbols.sh
> > +++ b/buildtools/check-symbols.sh
> > -DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
> > +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
>
> Does it make sense to change it to
>
> DUMPFILE=$(mktemp -t dpdk.${0##*/}.objdump.XXXXXX)
>
> So we can preserve what the file is in the filename?
Yes could be.
There is already the name of the script in the temp filename,
but I am OK to add more details.
If there is no other comment, I will change when applying.
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox
2021-03-22 8:55 ` Thomas Monjalon
@ 2021-03-22 9:01 ` Kinsella, Ray
0 siblings, 0 replies; 140+ messages in thread
From: Kinsella, Ray @ 2021-03-22 9:01 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ncopa, stable, Bruce Richardson, Andrew Rybchenko,
David Marchand, Konstantin Ananyev, Haiyue Wang,
Adrien Mazarguil
On 22/03/2021 08:55, Thomas Monjalon wrote:
> 22/03/2021 09:52, Kinsella, Ray:
>> On 19/03/2021 14:57, Thomas Monjalon wrote:
>>> --- a/buildtools/check-symbols.sh
>>> +++ b/buildtools/check-symbols.sh
>>> -DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
>>> +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXXXXX)
>>
>> Does it make sense to change it to
>>
>> DUMPFILE=$(mktemp -t dpdk.${0##*/}.objdump.XXXXXX)
>>
>> So we can preserve what the file is in the filename?
>
> Yes could be.
> There is already the name of the script in the temp filename,
> but I am OK to add more details.
>
> If there is no other comment, I will change when applying.
>
Nothing from me ...
^ permalink raw reply [flat|nested] 140+ messages in thread
* Re: [dpdk-dev] [PATCH v7 00/17] Alpine/musl build support
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
` (16 preceding siblings ...)
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
@ 2021-03-23 10:02 ` Thomas Monjalon
17 siblings, 0 replies; 140+ messages in thread
From: Thomas Monjalon @ 2021-03-23 10:02 UTC (permalink / raw)
To: ncopa; +Cc: dev
19/03/2021 15:57, Thomas Monjalon:
> These patches fix some build errors/warning for Alpine Linux,
> using musl and busybox.
> Few improvements are added on the way.
Applied with a small last minute change in a script as discussed.
Alpine is now supported in DPDK.
Next step: add a test in our CI.
^ permalink raw reply [flat|nested] 140+ messages in thread
end of thread, other threads:[~2021-03-23 10:02 UTC | newest]
Thread overview: 140+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 17:06 [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
2019-03-26 16:59 ` Iremonger, Bernard
2019-03-26 16:59 ` Iremonger, Bernard
2019-03-30 22:17 ` Thomas Monjalon
2019-03-30 22:17 ` Thomas Monjalon
2019-07-04 9:20 ` Iremonger, Bernard
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 02/15] net/cxgbe: " Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
2019-03-30 22:22 ` Thomas Monjalon
2019-03-30 22:22 ` Thomas Monjalon
2019-07-04 12:16 ` Natanael Copa
2019-07-04 13:20 ` Thomas Monjalon
2019-07-04 15:30 ` Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
2019-03-30 22:25 ` Thomas Monjalon
2019-03-30 22:25 ` Thomas Monjalon
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 05/15] bus/fslmc: fix compile error with musl libc Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 06/15] bus/fslmc: remove unused include of error.h Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 07/15] net/nfp: build fix for musl libc Natanael Copa
2019-03-21 9:48 ` Alejandro Lucero
2019-03-21 9:48 ` Alejandro Lucero
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 08/15] app/test: include fcntl.h due to use of O_RDONLY Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 09/15] app/test: fix setting of -D_GNU_SOURCE with meson Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability Natanael Copa
2019-03-30 22:33 ` Thomas Monjalon
2019-03-30 22:33 ` Thomas Monjalon
2020-07-10 5:13 ` Hemant Agrawal
2021-03-19 9:56 ` Thomas Monjalon
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
2019-03-30 22:36 ` Thomas Monjalon
2019-03-30 22:36 ` Thomas Monjalon
2020-07-10 5:10 ` Hemant Agrawal
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
2020-07-10 5:11 ` Hemant Agrawal
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
2019-03-30 22:39 ` Thomas Monjalon
2019-03-30 22:39 ` Thomas Monjalon
2020-07-10 5:09 ` Hemant Agrawal
2020-07-10 5:11 ` Hemant Agrawal
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 14/15] net/netvsc: fix compile warning for fcntl.h include Natanael Copa
2019-03-13 17:06 ` [dpdk-dev] [PATCH v3 15/15] eal/linux: simplify debug message in sigbus_handler Natanael Copa
2019-03-14 17:09 ` [dpdk-dev] [PATCH v3 00/15] Build fixes for musl libc Sirvys, Andrius
2019-03-14 17:09 ` Sirvys, Andrius
2019-03-30 23:57 ` Thomas Monjalon
2019-03-30 23:57 ` Thomas Monjalon
2019-07-05 8:03 ` David Marchand
2020-11-05 21:17 ` [dpdk-dev] " Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error with " Natanael Copa
2020-11-06 9:22 ` [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error withmusl libc Morten Brørup
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc Natanael Copa
2020-11-06 9:24 ` [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musllibc Morten Brørup
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability Natanael Copa
2020-11-10 14:41 ` Fabrizio D'Angelo
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 6/8] common/dpaax: build fix for musl libc Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 7/8] common/dpaax: simplify pr debug/err/warn macros Natanael Copa
2020-11-05 21:17 ` [dpdk-dev] [PATCH v4 8/8] eal: add missing include to fix build with musl libc Natanael Copa
2020-11-06 10:11 ` [dpdk-dev] Build fixes for " Thomas Monjalon
2020-11-06 10:44 ` David Marchand
2021-02-18 16:13 ` Thomas Monjalon
2021-02-20 8:51 ` Natanael Copa
2021-02-25 9:41 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 00/17] Alpine/musl build support Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 02/17] buildtools: fix build with busybox Thomas Monjalon
2021-02-26 9:11 ` Bruce Richardson
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 03/17] build: detect execinfo library on Linux Thomas Monjalon
2021-02-26 9:08 ` Bruce Richardson
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 04/17] build: define _GNU_SOURCE globally Thomas Monjalon
2021-02-26 9:08 ` Bruce Richardson
2021-02-26 9:40 ` Thomas Monjalon
2021-02-26 9:46 ` Bruce Richardson
2021-02-26 10:04 ` Thomas Monjalon
2021-02-28 12:53 ` Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 05/17] eal/linux: fix build with musl Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 06/17] drivers: fix header includes for musl Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 07/17] drivers: replace page size definitions with function Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 08/17] bus/pci: support I/O port operations with musl Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 10/17] bus/dpaa: fix build with musl Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 11/17] common/dpaax/caamflib: " Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 12/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 13/17] net/cxgbe: remove use of uint type Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 14/17] net/igc: " Thomas Monjalon
2021-02-26 0:49 ` Wang, Haiyue
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 15/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
2021-03-01 7:30 ` Matan Azrad
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 16/17] app/testpmd: fix build with musl Thomas Monjalon
2021-02-25 18:22 ` [dpdk-dev] [PATCH v5 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 02/17] buildtools: fix build with busybox Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 03/17] build: detect execinfo library on Linux Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 04/17] build: remove redundant _GNU_SOURCE definitions Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 05/17] eal: fix build with musl Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 06/17] drivers: fix header includes for musl Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 07/17] drivers: replace page size definitions with function Thomas Monjalon
2021-03-01 9:41 ` Bruce Richardson
2021-03-01 9:53 ` Thomas Monjalon
2021-03-01 10:09 ` Bruce Richardson
2021-03-01 14:22 ` Andrew Boyer
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 08/17] bus/pci: support I/O port operations with musl Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 10/17] bus/dpaa: fix build with musl Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 11/17] common/dpaax/caamflib: " Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 12/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 13/17] net/cxgbe: remove use of uint type Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 14/17] net/igc: " Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 15/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 16/17] app/testpmd: fix build with musl Thomas Monjalon
2021-02-28 12:53 ` [dpdk-dev] [PATCH v6 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
2021-03-17 22:42 ` [dpdk-dev] [PATCH v6 00/17] Alpine/musl build support Thomas Monjalon
2021-03-18 8:12 ` Andrew Rybchenko
2021-03-18 8:56 ` David Marchand
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 " Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 01/17] eal: fix comment of OS-specific header files Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 02/17] buildtools: fix build with busybox Thomas Monjalon
2021-03-22 8:52 ` Kinsella, Ray
2021-03-22 8:55 ` Thomas Monjalon
2021-03-22 9:01 ` Kinsella, Ray
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 03/17] build: detect execinfo library on Linux Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 04/17] build: remove redundant _GNU_SOURCE definitions Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 05/17] eal: fix build with musl Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 06/17] drivers: replace page size definitions with function Thomas Monjalon
2021-03-19 15:47 ` McDaniel, Timothy
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 07/17] common/dpaax/caamflib: fix build with musl Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 08/17] common/dpaax/caamflib: simplify log macros Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 09/17] bus/dpaa: fix 64-bit arch detection Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 10/17] bus/dpaa: fix build with musl Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 11/17] bus/pci: support I/O port operations " Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 12/17] net/cxgbe: remove use of uint type Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 13/17] net/igc: " Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 14/17] vdpa/mlx5: replace pthread functions unavailable in musl Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 15/17] event/dlb: fix header includes for musl Thomas Monjalon
2021-03-19 15:47 ` McDaniel, Timothy
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 16/17] app/testpmd: fix build with musl Thomas Monjalon
2021-03-19 14:57 ` [dpdk-dev] [PATCH v7 17/17] examples/bbdev: fix header include for musl Thomas Monjalon
2021-03-23 10:02 ` [dpdk-dev] [PATCH v7 00/17] Alpine/musl build support Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).