From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DFA56A0562; Fri, 19 Mar 2021 15:59:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 14B74140F6B; Fri, 19 Mar 2021 15:58:02 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id 59494140F5E; Fri, 19 Mar 2021 15:57:58 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 0D39A5C01A9; Fri, 19 Mar 2021 10:57:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 19 Mar 2021 10:57:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=usgEUiWpufd7g RDBFqgBfPNnBTq6oysvwpzR3K49zq0=; b=GnDmX76b2sfqvAyRuLcPXpfA6UHyk jByTtL4HnEHsts4//FZjSUdq/GvOrgJ3z80+WViYJeB24ZL6utxBuPbMw7xW7qP7 PaVaFzbSlda5gLKbVPXexn2om6LqmCLzSWM2SHIfNPJVpOikgQuQG1Geet49ybO8 e9Q5Vs/f6MJxbZZ7r1qSqONJKUdloh4IwarDVNBwDt8BXrFh5/deXKZZw3bS2ZgO Bka8RlwDhB1SX0J20E/TDRXiR3wLVTTS4joWlBIMf0+1qvVTR+SRtm0Tr6jDRB6z HYji029nCXQkguZ86Sd2NNhlr2v5t+D0edtR4nHkmQpwRFaCOvXn4txwg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=usgEUiWpufd7gRDBFqgBfPNnBTq6oysvwpzR3K49zq0=; b=aA/BY8mx IOXLZoBPHmK4nCOGQyOGFBSeCOT8FIL+yWwEHS0dzO7Fs5ztA/ZT1FI+eZ5daVEX +jLPKJrh2PE3277vN/a0E3F8dM2j1+gSGKGFATRDBlOrRbHiLRoCNlGG110KT5F4 J3m/8P1DndyKZSEEW/P8yUf4mSttaB2NViSTBAfFPslmWWEtPyY6/q6A6PKH0taY 52suBhQtpYxi/Fm+OoO511faNG/3pWXBnJo+18iYjgF6WpZflh5KijtWRfgesdv0 7TO6BfcS7Phecrjz5Y0v5F6wIEQfr3rlgNtVQMM+5VaVDZ08SYlxTFjTUIMAVjx0 MqpmUY+PzQUNXA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudefkedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id EE0EF240069; Fri, 19 Mar 2021 10:57:56 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ncopa@alpinelinux.org, stable@dpdk.org, Andrew Rybchenko , David Marchand , Hemant Agrawal , Sachin Saxena , Roy Pledge , Shreyansh Jain , Geoff Thorpe Date: Fri, 19 Mar 2021 15:57:23 +0100 Message-Id: <20210319145730.3555384-11-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210319145730.3555384-1-thomas@monjalon.net> References: <20190313170657.16688-1-ncopa@alpinelinux.org> <20210319145730.3555384-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v7 10/17] bus/dpaa: fix build with musl X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Natanael Copa The header files argp.h and error.h do not exist in musl libc. Fix build with musl libc by using err(3) instead of the GNU-specific error(3). We could have used the identical errx("...: %s", strerror(ret))` but strerror(3) is not thread-safe and the strerror_r variant has two incompatible versions, one GNU specific and one XSI-compliant. Avoid the mess by letting "err" use the thread-local errno. This also fixes error message for kzmalloc failures which previously would always have given "Unknown error -1", since that is what strerror(-1) returns. Let "err" use the proper error message from errno which is set by kzalloc. Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal") Fixes: f09ede6c8fd1 ("bus/dpaa: add BMAN driver core") Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations") Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros") Cc: stable@dpdk.org Signed-off-by: Natanael Copa Signed-off-by: Thomas Monjalon Acked-by: Andrew Rybchenko Acked-by: David Marchand --- drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 ++-- drivers/bus/dpaa/base/qbman/bman_driver.c | 13 +++++++++---- drivers/bus/dpaa/base/qbman/qman_driver.c | 17 ++++++++++++----- drivers/bus/dpaa/include/netcfg.h | 1 - drivers/common/dpaax/compat.h | 1 - 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index b7009f2299..120deb0bb6 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -8,7 +8,7 @@ #include #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__); + err(0, "%s(): open(SOCK_RAW)", __func__); return NULL; } diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c index 750b756b93..ee35e03da1 100644 --- a/drivers/bus/dpaa/base/qbman/bman_driver.c +++ b/drivers/bus/dpaa/base/qbman/bman_driver.c @@ -11,6 +11,7 @@ #include #include "bman_priv.h" #include +#include /* * Global variables of the max portal/pool number this bman version supported @@ -40,7 +41,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared) ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); if (ret) { - error(0, ret, "pthread_getaffinity_np()"); + errno = ret; + err(0, "pthread_getaffinity_np()"); return ret; } pcfg.cpu = -1; @@ -60,7 +62,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared) map.index = idx; ret = process_portal_map(&map); if (ret) { - error(0, ret, "process_portal_map()"); + errno = ret; + err(0, "process_portal_map()"); return ret; } /* Make the portal's cache-[enabled|inhibited] regions */ @@ -104,8 +107,10 @@ static int fsl_bman_portal_finish(void) cfg = bman_destroy_affine_portal(); DPAA_BUG_ON(cfg != &pcfg); ret = process_portal_unmap(&map.addr); - if (ret) - error(0, ret, "process_portal_unmap()"); + if (ret) { + errno = ret; + err(0, "process_portal_unmap()"); + } return ret; } diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c index 6d9aaff164..dfbafe581a 100644 --- a/drivers/bus/dpaa/base/qbman/qman_driver.c +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c @@ -9,6 +9,8 @@ #include #include "qman_priv.h" #include +#include + #include /* Global variable containing revision id (even on non-control plane systems @@ -50,7 +52,8 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared) map.index = index; ret = process_portal_map(&map); if (ret) { - error(0, ret, "process_portal_map()"); + errno = ret; + err(0, "process_portal_map()"); return ret; } qpcfg.channel = map.channel; @@ -96,8 +99,10 @@ static int fsl_qman_portal_finish(void) cfg = qman_destroy_affine_portal(NULL); DPAA_BUG_ON(cfg != &qpcfg); ret = process_portal_unmap(&map.addr); - if (ret) - error(0, ret, "process_portal_unmap()"); + if (ret) { + errno = ret; + err(0, "process_portal_unmap()"); + } return ret; } @@ -146,7 +151,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0); if (!q_pcfg) { - error(0, -1, "q_pcfg kzalloc failed"); + /* kzalloc sets errno */ + err(0, "q_pcfg kzalloc failed"); return NULL; } @@ -155,7 +161,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) q_map.index = QBMAN_ANY_PORTAL_IDX; ret = process_portal_map(&q_map); if (ret) { - error(0, ret, "process_portal_map()"); + errno = ret; + err(0, "process_portal_map()"); kfree(q_pcfg); return NULL; } diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index d7d1befd24..bb18a34e3d 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -9,7 +9,6 @@ #define __NETCFG_H #include -#include /* Configuration information related to a specific ethernet port */ struct fm_eth_port_cfg { diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h index c69e76ab96..7166f8cceb 100644 --- a/drivers/common/dpaax/compat.h +++ b/drivers/common/dpaax/compat.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include -- 2.30.1