From patchwork Thu Nov 5 21:17:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83758 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9B740A0521; Thu, 5 Nov 2020 22:17:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 38E0C2BD3; Thu, 5 Nov 2020 22:17:38 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id 0161323D; Thu, 5 Nov 2020 22:17:35 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 959C213C5E2; Thu, 5 Nov 2020 21:17:33 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 2A14A13C5E1; Thu, 5 Nov 2020 21:17:32 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Cc: Natanael Copa , stable@dpdk.org Date: Thu, 5 Nov 2020 22:17:09 +0100 Message-Id: <20201105211716.25181-2-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 1/8] app/testpmd: fix uint build error with musl libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Morten Brørup --- 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); From patchwork Thu Nov 5 21:17:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83759 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BC3CA0521; Thu, 5 Nov 2020 22:18:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C4F4C2BE2; Thu, 5 Nov 2020 22:17:39 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id 5C43223D; Thu, 5 Nov 2020 22:17:35 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 0B3CE13C5EA; Thu, 5 Nov 2020 21:17:35 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 0479613C5E4; Thu, 5 Nov 2020 21:17:33 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org, Rahul Lakkireddy Cc: Natanael Copa , stable@dpdk.org Date: Thu, 5 Nov 2020 22:17:10 +0100 Message-Id: <20201105211716.25181-3-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 2/8] net/cxgbe: fix uint build error with musl libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Morten Brørup --- 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; }; From patchwork Thu Nov 5 21:17:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83760 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E6A8A0521; Thu, 5 Nov 2020 22:18:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6CB6C2C16; Thu, 5 Nov 2020 22:17:41 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id AB0E51515; Thu, 5 Nov 2020 22:17:37 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 4336F13C5F1; Thu, 5 Nov 2020 21:17:36 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 6DD9213C5EF; Thu, 5 Nov 2020 21:17:35 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org, Ferruh Yigit Cc: Natanael Copa , stable@dpdk.org Date: Thu, 5 Nov 2020 22:17:11 +0100 Message-Id: <20201105211716.25181-4-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 3/8] bus/pci: add fallback for out* for non GNU libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 -#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 #include @@ -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); } } } From patchwork Thu Nov 5 21:17:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83761 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 293CDA0521; Thu, 5 Nov 2020 22:19:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85FBB2C7A; Thu, 5 Nov 2020 22:17:42 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id DCDE21DBD; Thu, 5 Nov 2020 22:17:37 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id A183913C5FA; Thu, 5 Nov 2020 21:17:37 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 87DFB13C5F7; Thu, 5 Nov 2020 21:17:36 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Natanael Copa , stable@dpdk.org Date: Thu, 5 Nov 2020 22:17:12 +0100 Message-Id: <20201105211716.25181-5-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 4/8] bus/dpaa: use warn instead of error to improve portability X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 #include #include -#include +#include #include #include #include @@ -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; } From patchwork Thu Nov 5 21:17:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83762 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 889D6A0521; Thu, 5 Nov 2020 22:19:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4EA3E34EE; Thu, 5 Nov 2020 22:17:44 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id 13C732BF4; Thu, 5 Nov 2020 22:17:39 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id B412C13C602; Thu, 5 Nov 2020 21:17:38 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id E365313C600; Thu, 5 Nov 2020 21:17:37 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Natanael Copa , stable@dpdk.org Date: Thu, 5 Nov 2020 22:17:13 +0100 Message-Id: <20201105211716.25181-6-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 5/8] bus/dpaa: fix detection of 64 bit arch X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 /* 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. From patchwork Thu Nov 5 21:17:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83763 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0501DA0521; Thu, 5 Nov 2020 22:19:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 049974CA6; Thu, 5 Nov 2020 22:17:46 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id D8EFE2C2A; Thu, 5 Nov 2020 22:17:40 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 8C72713C60D; Thu, 5 Nov 2020 21:17:40 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 215E813C604; Thu, 5 Nov 2020 21:17:38 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Natanael Copa , stable@dpdk.org Date: Thu, 5 Nov 2020 22:17:14 +0100 Message-Id: <20201105211716.25181-7-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 6/8] common/dpaax: build fix for musl libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Hemant Agrawal --- 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 #include -#ifdef __GLIBC__ +#ifdef __linux__ #include #include #include @@ -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) From patchwork Thu Nov 5 21:17:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83764 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 73633A0521; Thu, 5 Nov 2020 22:20:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E7D905958; Thu, 5 Nov 2020 22:17:47 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id E5BCA2DCC for ; Thu, 5 Nov 2020 22:17:41 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 9A8EB13C610; Thu, 5 Nov 2020 21:17:41 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id E472613C60F; Thu, 5 Nov 2020 21:17:40 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Natanael Copa Date: Thu, 5 Nov 2020 22:17:15 +0100 Message-Id: <20201105211716.25181-8-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 7/8] common/dpaax: simplify pr debug/err/warn macros X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Hemant Agrawal --- 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 */ /** From patchwork Thu Nov 5 21:17:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 83765 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97851A0521; Thu, 5 Nov 2020 22:20:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 14FE15AB2; Thu, 5 Nov 2020 22:17:49 +0100 (CET) Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by dpdk.org (Postfix) with ESMTP id C5F942E8B; Thu, 5 Nov 2020 22:17:43 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 76A5E13C616; Thu, 5 Nov 2020 21:17:42 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id DC9F013C612; Thu, 5 Nov 2020 21:17:41 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org Cc: Natanael Copa , stable@dpdk.org Date: Thu, 5 Nov 2020 22:17:16 +0100 Message-Id: <20201105211716.25181-9-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201105211716.25181-1-ncopa@alpinelinux.org> References: <18966392.1bK43UoomU@xps> <20201105211716.25181-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 8/8] eal: add missing include to fix build with musl libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 #include +#include #include #include