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 4390EA0548 for ; Sun, 28 Feb 2021 13:54:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2922822A2C0; Sun, 28 Feb 2021 13:54:21 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id BBEB422A2BA; Sun, 28 Feb 2021 13:54:17 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 609315C00C9; Sun, 28 Feb 2021 07:54:17 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 28 Feb 2021 07:54:17 -0500 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=IR1dKuuMKcYmm GI8peHQqf42UQkAyb1clGQvXz1wfGk=; b=PeNKbQEC1+quxvMZB+iUCHxDQSzQk YtshoUTEVzH1HDvPr0ycD2zhrBcWC5JE9Se+xQXbLAPBNut7HkvS6ql4BwJUkUlM 1hAhmXBZikQAUPCh7hbNwxv2gIoUCcjSzwkTvOI8nO7YoaCMqjfOgqWR5UgUwcAb zDNw8qLk2NhPSLLfW6lxv6aFQRZJ06SKQzLlUYn5t5mXaqqV+jOe6mKDlDsKntxV bcJXs4H6LF0ef2vnujQQeMtnu9IGB9Ayg/yOMLVyxA0UUJMk0qPzN/W57a9q9FNv 9tfYPSd7JHslk8mILPq8atk5bdvHgO38hLN9SRjkdHuAX2qs3xPehE3jQ== 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=IR1dKuuMKcYmmGI8peHQqf42UQkAyb1clGQvXz1wfGk=; b=QnXSe8K3 UcsmM0KPN31OnGTWLr6oLIIMkiPhL4NJenW6lYrHy6TuVi5CPGvCDRWpiHVP21Ba FQAd8tMfc9m5H5rBybnKrr9qK6OLzsp4MK3Qo9vX9qHkv3k5vzZwr+qPzHRXQZoK 3+O45Elb7GRf+V8RwP8ZO72kKopJ61WM6LSTwsov6JsumQEXjTDW1gIihDnhNpeS TxgUfQKTddFZ91sNSi7eNJ+4qGjIyw8CVl5ZT+pLl38/wypu7xnruGiukRJUQNjg v1kK+5YyeaolCaYVBk8PsCxuXXGonNK7Ur2Qhbtt4pbN7uDhMMjkd8BDvZ9jxA+g 803Whs46OGrUFQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrleeigdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 5CB091080054; Sun, 28 Feb 2021 07:54:16 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: ncopa@alpinelinux.org, stable@dpdk.org, Hemant Agrawal , Sachin Saxena , Geoff Thorpe , Shreyansh Jain , Roy Pledge Date: Sun, 28 Feb 2021 13:53:45 +0100 Message-Id: <20210228125353.2436562-11-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210228125353.2436562-1-thomas@monjalon.net> References: <20190313170657.16688-1-ncopa@alpinelinux.org> <20210228125353.2436562-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v6 10/17] bus/dpaa: fix build with musl X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Natanael Copa 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 | 13 +++++++++---- drivers/bus/dpaa/base/qbman/qman_driver.c | 17 ++++++++++++----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index b7009f2299..bcedbaf68f 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -8,7 +8,7 @@ #include #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 750b756b93..c0b9e3da77 100644 --- a/drivers/bus/dpaa/base/qbman/bman_driver.c +++ b/drivers/bus/dpaa/base/qbman/bman_driver.c @@ -11,6 +11,7 @@ #include #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; + warn("pthread_getaffinity_np()"); return ret; } pcfg.cpu = -1; @@ -60,7 +62,8 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared) map.index = idx; ret = process_portal_map(&map); if (ret) { - error(0, ret, "process_portal_map()"); + errno = ret; + warn("process_portal_map()"); return ret; } /* Make the portal's cache-[enabled|inhibited] regions */ @@ -104,8 +107,10 @@ static int fsl_bman_portal_finish(void) cfg = bman_destroy_affine_portal(); DPAA_BUG_ON(cfg != &pcfg); ret = process_portal_unmap(&map.addr); - if (ret) - error(0, ret, "process_portal_unmap()"); + if (ret) { + errno = ret; + warn("process_portal_unmap()"); + } return ret; } diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c index 6d9aaff164..93375d1ea8 100644 --- a/drivers/bus/dpaa/base/qbman/qman_driver.c +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c @@ -9,6 +9,8 @@ #include #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; + warn("process_portal_map()"); return ret; } qpcfg.channel = map.channel; @@ -96,8 +99,10 @@ static int fsl_qman_portal_finish(void) cfg = qman_destroy_affine_portal(NULL); DPAA_BUG_ON(cfg != &qpcfg); ret = process_portal_unmap(&map.addr); - if (ret) - error(0, ret, "process_portal_unmap()"); + if (ret) { + errno = ret; + warn("process_portal_unmap()"); + } return ret; } @@ -146,7 +151,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0); if (!q_pcfg) { - error(0, -1, "q_pcfg kzalloc failed"); + /* kzalloc sets errno */ + warn("q_pcfg kzalloc failed"); return NULL; } @@ -155,7 +161,8 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) q_map.index = QBMAN_ANY_PORTAL_IDX; ret = process_portal_map(&q_map); if (ret) { - error(0, ret, "process_portal_map()"); + errno = ret; + warn("process_portal_map()"); kfree(q_pcfg); return NULL; } -- 2.30.1