* [dpdk-dev] [PATCH 01/15] app/testpmd: replace uint with unsigned int
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 02/15] net/cxgbe: " Natanael Copa
` (14 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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] 26+ messages in thread
* [dpdk-dev] [PATCH 02/15] net/cxgbe: replace uint with unsigned int
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
` (13 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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] 26+ messages in thread
* [dpdk-dev] [PATCH 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 02/15] net/cxgbe: " Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-12 10:16 ` [dpdk-dev] [PATCH v2 " Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
` (12 subsequent siblings)
15 siblings, 1 reply; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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>
---
Please note that this is only compile tested with musl libc.
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..6058cd9f8 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] 26+ messages in thread
* [dpdk-dev] [PATCH v2 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-11 17:36 ` [dpdk-dev] [PATCH 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
@ 2019-03-12 10:16 ` Natanael Copa
2019-03-13 11:13 ` Ferruh Yigit
0 siblings, 1 reply; 26+ messages in thread
From: Natanael Copa @ 2019-03-12 10:16 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>
---
v2 - fixed coding style issues reported by checkpatch
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] 26+ messages in thread
* Re: [dpdk-dev] [PATCH v2 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-12 10:16 ` [dpdk-dev] [PATCH v2 " Natanael Copa
@ 2019-03-13 11:13 ` Ferruh Yigit
2019-03-13 17:08 ` Natanael Copa
0 siblings, 1 reply; 26+ messages in thread
From: Ferruh Yigit @ 2019-03-13 11:13 UTC (permalink / raw)
To: Natanael Copa, dev
On 3/12/2019 10:16 AM, Natanael Copa wrote:
> 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>
Hi Natanael,
Thank you for the patches.
I can see you have sent v2 for some of the individual patches in your set, it is
too hard to maintain individual patches in a set, also it breaks automated
checks and patchwork patchset logic.
Can you please send whole patchset when you need to update patches, starting
with a v3 of latest patchset?
Thanks,
ferruh
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [dpdk-dev] [PATCH v2 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc
2019-03-13 11:13 ` Ferruh Yigit
@ 2019-03-13 17:08 ` Natanael Copa
0 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-13 17:08 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev
On Wed, 13 Mar 2019 11:13:40 +0000
Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 3/12/2019 10:16 AM, Natanael Copa wrote:
> > 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>
>
> Hi Natanael,
>
> Thank you for the patches.
> I can see you have sent v2 for some of the individual patches in your set, it is
> too hard to maintain individual patches in a set, also it breaks automated
> checks and patchwork patchset logic.
> Can you please send whole patchset when you need to update patches, starting
> with a v3 of latest patchset?
I actually thought recent version of patchwork could handle that. Sorry.
A full patchset was resent.
Thanks!
-nc
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write}
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (2 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-12 10:18 ` [dpdk-dev] [PATCH v2 " Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 05/15] bus/fslmc: fix compile error with musl libc Natanael Copa
` (11 subsequent siblings)
15 siblings, 1 reply; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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>
---
Please note that this is only compile tested with musl libc on x86_64.
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 6058cd9f8..dfa42c565 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] 26+ messages in thread
* [dpdk-dev] [PATCH v2 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write}
2019-03-11 17:36 ` [dpdk-dev] [PATCH 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
@ 2019-03-12 10:18 ` Natanael Copa
0 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-12 10:18 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>
---
v1 -> v2 fixed coding style issues reported by checkpatch
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] 26+ messages in thread
* [dpdk-dev] [PATCH 05/15] bus/fslmc: fix compile error with musl libc
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (3 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 06/15] bus/fslmc: remove unused include of error.h Natanael Copa
` (10 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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] 26+ messages in thread
* [dpdk-dev] [PATCH 06/15] bus/fslmc: remove unused include of error.h
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (4 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 05/15] bus/fslmc: fix compile error with musl libc Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 07/15] net/nfp: build fix for musl libc Natanael Copa
` (9 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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] 26+ messages in thread
* [dpdk-dev] [PATCH 07/15] net/nfp: build fix for musl libc
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (5 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 06/15] bus/fslmc: remove unused include of error.h Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 08/15] app/test: include fcntl.h due to use of O_RDONLY Natanael Copa
` (8 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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] 26+ messages in thread
* [dpdk-dev] [PATCH 08/15] app/test: include fcntl.h due to use of O_RDONLY
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (6 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 07/15] net/nfp: build fix for musl libc Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 09/15] app/test: fix setting of -D_GNU_SOURCE with meson Natanael Copa
` (7 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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 81e345b87..775ccd3dd 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] 26+ messages in thread
* [dpdk-dev] [PATCH 09/15] app/test: fix setting of -D_GNU_SOURCE with meson
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (7 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 08/15] app/test: include fcntl.h due to use of O_RDONLY Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability Natanael Copa
` (6 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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] 26+ messages in thread
* [dpdk-dev] [PATCH 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (8 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 09/15] app/test: fix setting of -D_GNU_SOURCE with meson Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
` (5 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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>
---
Note that err.h is not in POSIX standard either, but is implemented in musl
libc.
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] 26+ messages in thread
* [dpdk-dev] [PATCH 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (9 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
` (4 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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>
---
This was not really a compile error but the warning looked scary enough.
There are various alternative ways to detect 64bit user-space at compile time,
but this is the most portable way I think.
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] 26+ messages in thread
* [dpdk-dev] [PATCH 12/15] crypto/dpaa2_sec: build fix for musl libc
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (10 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
@ 2019-03-11 17:36 ` Natanael Copa
2019-03-12 10:20 ` [dpdk-dev] [PATCH v2 " Natanael Copa
2019-03-11 17:37 ` [dpdk-dev] [PATCH 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
` (3 subsequent siblings)
15 siblings, 1 reply; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:36 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>
---
I guess the check for __linux__ and __GLIBC__ could be completely removed,
but I was not sure.
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..b9564d848 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] 26+ messages in thread
* [dpdk-dev] [PATCH v2 12/15] crypto/dpaa2_sec: build fix for musl libc
2019-03-11 17:36 ` [dpdk-dev] [PATCH 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
@ 2019-03-12 10:20 ` Natanael Copa
0 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-12 10:20 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>
---
v1 -> v2 fixed coding style issues reported by checkpatch:
WARNING:SPACING: space prohibited between function name and open parenthesis '('
#76: FILE: drivers/crypto/dpaa2_sec/hw/compat.h:104:
+#if defined(__linux__) || defined (__GLIBC__)
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] 26+ messages in thread
* [dpdk-dev] [PATCH 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (11 preceding siblings ...)
2019-03-11 17:36 ` [dpdk-dev] [PATCH 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
@ 2019-03-11 17:37 ` Natanael Copa
2019-03-11 17:37 ` [dpdk-dev] [PATCH 14/15] net/netvsc: fix compile warning for fcntl.h include Natanael Copa
` (2 subsequent siblings)
15 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:37 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>
---
This does not really fix any error, but I cleaned it up while at it. Feel
free to skip this patch.
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 b9564d848..f6186a9d3 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] 26+ messages in thread
* [dpdk-dev] [PATCH 14/15] net/netvsc: fix compile warning for fcntl.h include
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (12 preceding siblings ...)
2019-03-11 17:37 ` [dpdk-dev] [PATCH 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
@ 2019-03-11 17:37 ` Natanael Copa
2019-03-11 18:17 ` Stephen Hemminger
2019-03-11 17:37 ` [dpdk-dev] [PATCH 15/15] eal/linux: use gettid(2) for debug message in sigbus_handler Natanael Copa
2019-03-13 11:45 ` [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Sirvys, Andrius
15 siblings, 1 reply; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:37 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>
---
This is a low priority patch, but it is so trivial so I fixed it while at it.
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] 26+ messages in thread
* Re: [dpdk-dev] [PATCH 14/15] net/netvsc: fix compile warning for fcntl.h include
2019-03-11 17:37 ` [dpdk-dev] [PATCH 14/15] net/netvsc: fix compile warning for fcntl.h include Natanael Copa
@ 2019-03-11 18:17 ` Stephen Hemminger
0 siblings, 0 replies; 26+ messages in thread
From: Stephen Hemminger @ 2019-03-11 18:17 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
On Mon, 11 Mar 2019 18:37:01 +0100
Natanael Copa <ncopa@alpinelinux.org> wrote:
> 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>
Acked-by: Stephen Hemminger <sthemmin@microsoft.com>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH 15/15] eal/linux: use gettid(2) for debug message in sigbus_handler
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (13 preceding siblings ...)
2019-03-11 17:37 ` [dpdk-dev] [PATCH 14/15] net/netvsc: fix compile warning for fcntl.h include Natanael Copa
@ 2019-03-11 17:37 ` Natanael Copa
2019-03-11 18:21 ` Stephen Hemminger
2019-03-13 11:45 ` [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Sirvys, Andrius
15 siblings, 1 reply; 26+ messages in thread
From: Natanael Copa @ 2019-03-11 17:37 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. Use gettid(2) to get the kernel thread id
instead.
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>
---
This is not reallly a compile error, but the warning looked a bit scary, and
code looked wrong, so I fixed it.
lib/librte_eal/linuxapp/eal/eal_dev.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c
index 2830c8687..9ad6650cf 100644
--- a/lib/librte_eal/linuxapp/eal/eal_dev.c
+++ b/lib/librte_eal/linuxapp/eal/eal_dev.c
@@ -7,6 +7,7 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <linux/netlink.h>
#include <rte_string_fns.h>
@@ -30,6 +31,11 @@ static bool hotplug_handle;
#define EAL_UEV_MSG_LEN 4096
#define EAL_UEV_MSG_ELEM_LEN 128
+#if !defined(__GLIBC__)
+#include <sys/syscall.h>
+#define gettid() syscall(SYS_gettid)
+#endif
+
/*
* spinlock for device hot-unplug failure handling. If it try to access bus or
* device, such as handle sigbus on bus or handle memory failure for device
@@ -67,7 +73,7 @@ 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);
+ (int)gettid(), 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] 26+ messages in thread
* Re: [dpdk-dev] [PATCH 15/15] eal/linux: use gettid(2) for debug message in sigbus_handler
2019-03-11 17:37 ` [dpdk-dev] [PATCH 15/15] eal/linux: use gettid(2) for debug message in sigbus_handler Natanael Copa
@ 2019-03-11 18:21 ` Stephen Hemminger
2019-03-12 10:22 ` [dpdk-dev] [PATCH v2 15/15] eal/linux: simplify " Natanael Copa
0 siblings, 1 reply; 26+ messages in thread
From: Stephen Hemminger @ 2019-03-11 18:21 UTC (permalink / raw)
To: Natanael Copa; +Cc: dev
On Mon, 11 Mar 2019 18:37:02 +0100
Natanael Copa <ncopa@alpinelinux.org> wrote:
> +#if !defined(__GLIBC__)
> +#include <sys/syscall.h>
> +#define gettid() syscall(SYS_gettid)
> +#endif
> +
I though glibc didn't want to expose thread id.
Personally, I would just drop the thread from the log message since it is
not that useful anyway.
^ permalink raw reply [flat|nested] 26+ messages in thread
* [dpdk-dev] [PATCH v2 15/15] eal/linux: simplify debug message in sigbus_handler
2019-03-11 18:21 ` Stephen Hemminger
@ 2019-03-12 10:22 ` Natanael Copa
0 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-12 10:22 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>
---
v1 -> v2: remove gettid() and remove thread id from debug message.
lib/librte_eal/linuxapp/eal/eal_dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c
index 2830c8687..c41809380 100644
--- a/lib/librte_eal/linuxapp/eal/eal_dev.c
+++ b/lib/librte_eal/linuxapp/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] 26+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] Build fixes for musl libc
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
` (14 preceding siblings ...)
2019-03-11 17:37 ` [dpdk-dev] [PATCH 15/15] eal/linux: use gettid(2) for debug message in sigbus_handler Natanael Copa
@ 2019-03-13 11:45 ` Sirvys, Andrius
2019-03-13 16:53 ` Natanael Copa
15 siblings, 1 reply; 26+ messages in thread
From: Sirvys, Andrius @ 2019-03-13 11:45 UTC (permalink / raw)
To: Natanael Copa, dev
I'm trying on Alpine Linux to build using make with the patches, and
there are quite a few errors saying argp.h doesn't exist.
In file included from
/root/dpdk/drivers/bus/dpaa/base/fman/netcfg_layer.c:19:
/root/dpdk/drivers/bus/dpaa/include/netcfg.h:12:10: fatal error: argp.h:
No such file or directory
#include <argp.h>
In file included from /root/dpdk/drivers/bus/dpaa/rte_dpaa_bus.h:17,
from /root/dpdk/drivers/bus/dpaa/dpaa_bus.c:35:
/root/dpdk/drivers/bus/dpaa/include/netcfg.h:12:10: fatal error: argp.h:
No such file or directory
#include <argp.h>
In file included from /root/dpdk/drivers/bus/dpaa/rte_dpaa_bus.h:17,
from /root/dpdk/drivers/bus/dpaa/base/qbman/qman.c:10:
/root/dpdk/drivers/bus/dpaa/include/netcfg.h:12:10: fatal error: argp.h:
No such file or directory
#include <argp.h>
On 11/03/2019 17:36, 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.
>
> 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: use gettid(2) for 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/linuxapp/eal/eal_dev.c | 8 ++-
> 15 files changed, 104 insertions(+), 78 deletions(-)
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] Build fixes for musl libc
2019-03-13 11:45 ` [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Sirvys, Andrius
@ 2019-03-13 16:53 ` Natanael Copa
0 siblings, 0 replies; 26+ messages in thread
From: Natanael Copa @ 2019-03-13 16:53 UTC (permalink / raw)
To: Sirvys, Andrius; +Cc: dev
On Wed, 13 Mar 2019 11:45:09 +0000
"Sirvys, Andrius" <andrius.sirvys@intel.com> wrote:
> I'm trying on Alpine Linux to build using make with the patches, and
> there are quite a few errors saying argp.h doesn't exist.
>
> In file included from
> /root/dpdk/drivers/bus/dpaa/base/fman/netcfg_layer.c:19:
> /root/dpdk/drivers/bus/dpaa/include/netcfg.h:12:10: fatal error: argp.h:
> No such file or directory
> #include <argp.h>
>
> In file included from /root/dpdk/drivers/bus/dpaa/rte_dpaa_bus.h:17,
> from /root/dpdk/drivers/bus/dpaa/dpaa_bus.c:35:
> /root/dpdk/drivers/bus/dpaa/include/netcfg.h:12:10: fatal error: argp.h:
> No such file or directory
> #include <argp.h>
>
> In file included from /root/dpdk/drivers/bus/dpaa/rte_dpaa_bus.h:17,
> from /root/dpdk/drivers/bus/dpaa/base/qbman/qman.c:10:
> /root/dpdk/drivers/bus/dpaa/include/netcfg.h:12:10: fatal error: argp.h:
> No such file or directory
> #include <argp.h>
argp is a GNU extension and in Alpine we have it as a separate addon
package. Try `apk add argp-standalone`.
I also had to unset the RTE_BACKTRACE when building with ninja.
> On 11/03/2019 17:36, 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.
> >
> > 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: use gettid(2) for 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/linuxapp/eal/eal_dev.c | 8 ++-
> > 15 files changed, 104 insertions(+), 78 deletions(-)
> >
^ permalink raw reply [flat|nested] 26+ messages in thread