patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v4 1/8] app/testpmd: fix uint build error with musl libc
       [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
@ 2020-11-05 21:17   ` Natanael Copa
  2020-11-06  9:22     ` [dpdk-stable] [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error withmusl libc Morten Brørup
  2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc Natanael Copa
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ 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] 9+ messages in thread

* [dpdk-stable] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc
       [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
  2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 1/8] app/testpmd: fix uint build error with musl libc Natanael Copa
@ 2020-11-05 21:17   ` Natanael Copa
  2020-11-06  9:24     ` [dpdk-stable] [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musllibc Morten Brørup
  2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc Natanael Copa
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 9+ 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] 9+ messages in thread

* [dpdk-stable] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc
       [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
  2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 1/8] app/testpmd: fix uint build error with musl libc Natanael Copa
  2020-11-05 21:17   ` [dpdk-stable] [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-stable] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability Natanael Copa
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ 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] 9+ messages in thread

* [dpdk-stable] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability
       [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
                     ` (2 preceding siblings ...)
  2020-11-05 21:17   ` [dpdk-stable] [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-05 21:17   ` [dpdk-stable] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch Natanael Copa
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ 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] 9+ messages in thread

* [dpdk-stable] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch
       [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
                     ` (3 preceding siblings ...)
  2020-11-05 21:17   ` [dpdk-stable] [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-stable] [PATCH v4 6/8] common/dpaax: build fix for musl libc Natanael Copa
  2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 8/8] eal: add missing include to fix build with " Natanael Copa
  6 siblings, 0 replies; 9+ 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] 9+ messages in thread

* [dpdk-stable] [PATCH v4 6/8] common/dpaax: build fix for musl libc
       [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
                     ` (4 preceding siblings ...)
  2020-11-05 21:17   ` [dpdk-stable] [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-stable] [PATCH v4 8/8] eal: add missing include to fix build with " Natanael Copa
  6 siblings, 0 replies; 9+ 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] 9+ messages in thread

* [dpdk-stable] [PATCH v4 8/8] eal: add missing include to fix build with musl libc
       [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
                     ` (5 preceding siblings ...)
  2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 6/8] common/dpaax: build fix for musl libc Natanael Copa
@ 2020-11-05 21:17   ` Natanael Copa
  6 siblings, 0 replies; 9+ 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] 9+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error withmusl libc
  2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 1/8] app/testpmd: fix uint build error with musl libc Natanael Copa
@ 2020-11-06  9:22     ` Morten Brørup
  0 siblings, 0 replies; 9+ 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] 9+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musllibc
  2020-11-05 21:17   ` [dpdk-stable] [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; 9+ 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] 9+ messages in thread

end of thread, other threads:[~2020-11-06  9:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <18966392.1bK43UoomU@xps>
     [not found] ` <20201105211716.25181-1-ncopa@alpinelinux.org>
2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 1/8] app/testpmd: fix uint build error with musl libc Natanael Copa
2020-11-06  9:22     ` [dpdk-stable] [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error withmusl libc Morten Brørup
2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc Natanael Copa
2020-11-06  9:24     ` [dpdk-stable] [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musllibc Morten Brørup
2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc Natanael Copa
2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability Natanael Copa
2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch Natanael Copa
2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 6/8] common/dpaax: build fix for musl libc Natanael Copa
2020-11-05 21:17   ` [dpdk-stable] [PATCH v4 8/8] eal: add missing include to fix build with " Natanael Copa

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).