From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 97F47A0096 for ; Mon, 3 Jun 2019 17:37:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB2371B95B; Mon, 3 Jun 2019 17:37:07 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id B63111B94D for ; Mon, 3 Jun 2019 17:37:05 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190603153703euoutp02d400a940c7ea8932cce57241a6d77d4e~kuk-0GT4Q2065520655euoutp02c for ; Mon, 3 Jun 2019 15:37:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190603153703euoutp02d400a940c7ea8932cce57241a6d77d4e~kuk-0GT4Q2065520655euoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1559576223; bh=SLXmcC7JM42pTMxzM1tNwaxDQraiWwCRuMa3tahGwkM=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=MeXLNup/d1LW3alXE2Piy06KxNGzamssQTTtAB4yMZDh6Q4OtKqPDJ8/kWEt6J+VL fhIpMNckSEUn/KRAfkzXDo37mdBRoVC9fHrFBJG6/lycDcqKVpnE52CYCvhsMPt248 wXd3yEGfAIfOptywUeL8G94KMvb/OcUd26faPPmU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190603153703eucas1p22cdb7ac70709dd603160ae7c5f9d1c03~kuk-b3zl20135501355eucas1p2W; Mon, 3 Jun 2019 15:37:03 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A4.53.04298.E9E35FC5; Mon, 3 Jun 2019 16:37:02 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190603153702eucas1p2d571c225c29d04e10114354faa163cef~kuk_iSaz70591205912eucas1p2-; Mon, 3 Jun 2019 15:37:02 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190603153701eusmtrp189681b53b72eb03025dd6f15e66f4e40~kuk_SqNQt0725807258eusmtrp1g; Mon, 3 Jun 2019 15:37:01 +0000 (GMT) X-AuditID: cbfec7f2-f13ff700000010ca-a0-5cf53e9e92bd Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 02.C3.04146.D9E35FC5; Mon, 3 Jun 2019 16:37:01 +0100 (BST) Received: from [106.109.129.180] (unknown [106.109.129.180]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190603153701eusmtip142364f4a68a13d60952d3b0329638f44~kuk9tzDOP1213012130eusmtip1m; Mon, 3 Jun 2019 15:37:01 +0000 (GMT) To: David Marchand Cc: dev , Thomas Monjalon , Anatoly Burakov , Jan Blunck , Qi Zhang , Kevin Traynor , dpdk stable From: Ilya Maximets Message-ID: <4dd83792-1418-dc82-9e98-a993438faab9@samsung.com> Date: Mon, 3 Jun 2019 18:37:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJKsWRmVeSWpSXmKPExsWy7djPc7rz7L7GGFw7bmjx6N5iZovtK7rY LN592s5kcaX9J7tF68NWJou1hz6wW0zf0M9m8a/jD7vFpwcnWBw4PX4tWMrqsXmFlsfiPS+Z PI7dnMbu8X7fVTaP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p2CXoZ7681shVcEal4f+AaawPjQf4uRk4OCQETiYZ7f1m6GLk4hASWMkrc XnqRFSIhJfHj1wUoW1jiz7UuNoii94wSnXu+sYMkhAVCJCY+nQRWJCKgJzFx2yawScwCPxkl fky9zgaSEBK4yijRuIcJxGYT0JE4tfoII4jNK2An8fbkExYQm0VARWJ2032woaICERKzdzWw QNQISpycCVHDKRAosWHqPDCbWUBd4s+8S8wQtrhE05eVrBC2vETz1tnMExiFZiFpn4WkZRaS lllIWhYwsqxiFEktLc5Nzy021CtOzC0uzUvXS87P3cQIjMptx35u3sF4aWPwIUYBDkYlHt4K 8a8xQqyJZcWVuYcYJTiYlUR4E29/iRHiTUmsrEotyo8vKs1JLT7EaAr03ERmKdHkfGDCyCuJ NzQ1NLewNDQ3Njc2s1AS5+0QOBgjJJCeWJKanZpakFoE08fEwSnVwNj2XGzeIfXjk7dc3h0o In1x06HlTf+2POJfcWwXY9e/05/iF0XfYK1zEvleb/arJnrhgcyvqavunFX7JXH28fHlJ2ZK e/gd+3aIe4/GvUqR+gL1FWfurdn1JE3F8LnOlsaZQsGL3/30XzFZ+FXxzHKPEhZb6wfTLkxd YvIwpuagpuhj5v+5/HY1SizFGYmGWsxFxYkAB9dlV+ACAAA= X-CMS-MailID: 20190603153702eucas1p2d571c225c29d04e10114354faa163cef X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190530132538eucas1p28fcfddad5b73d3a0baf7095f25a6c1fd X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190530132538eucas1p28fcfddad5b73d3a0baf7095f25a6c1fd References: <20190530132526.3496-1-i.maximets@samsung.com> Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] eal: fix positive error codes from probe/remove 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" On 03.06.2019 11:50, David Marchand wrote: > > > On Thu, May 30, 2019 at 3:26 PM Ilya Maximets > wrote: > > According to API, 'rte_dev_probe()' and 'rte_dev_remove()' and their > 'hotplug' equivalents must return 0 or negative error code. Bus code > > > About this first part, existing callers in dpdk are not consistent with the api which might explain why this was not seen earlier. > How about fixing the existing callers? Do you mean replacing all the 'rte_dev_probe() != 0' with 'rte_dev_probe() < 0' around the codebase? > > > returns positive values if device wasn't recognized by any driver, so > the result of 'bus->plug/unplug()' must be converted. > > > The problem is in local_dev_probe() (resp. local_dev_remove()) itself, since this internal api announces it should return < 0 on error. > > > > Positive on remove means that device not found by driver. > Positive on probe means that there are no suitable buses/drivers, > i.e. device is not supported. > > CC: stable@dpdk.org > Fixes: a3ee360f4440 ("eal: add hotplug add/remove device") > Fixes: 244d5130719c ("eal: enable hotplug on multi-process") > > Signed-off-by: Ilya Maximets > > --- >  lib/librte_eal/common/eal_common_dev.c | 4 ++-- >  1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c > index 824b8f926..f9cae8e26 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -233,7 +233,7 @@ rte_dev_probe(const char *devargs) >                  * process. >                  */ >                 if (ret != -EEXIST) > -                       return ret; > +                       return (ret < 0) ? ret : -ENOTSUP; >         } > >         /* primary send attach sync request to secondary. */ > @@ -319,7 +319,7 @@ local_dev_remove(struct rte_device *dev) >         if (ret) { >                 RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n", >                         dev->name); > -               return ret; > +               return (ret < 0) ? ret : -ENOENT; >         } > >         return 0; > -- > 2.17.1 > > > > -- > David Marchand