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 0EB2DA0096 for ; Mon, 3 Jun 2019 10:50:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 74DB91B954; Mon, 3 Jun 2019 10:50:44 +0200 (CEST) Received: from mail-ua1-f67.google.com (mail-ua1-f67.google.com [209.85.222.67]) by dpdk.org (Postfix) with ESMTP id CEB8D1B948 for ; Mon, 3 Jun 2019 10:50:42 +0200 (CEST) Received: by mail-ua1-f67.google.com with SMTP id w44so6174736uad.6 for ; Mon, 03 Jun 2019 01:50:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=H3Om68gZzwwZJALFZ1AoZgJo6/oUY9BKpxchrsh9EuI=; b=j5KbvhS36QIc97f/YvymgLnUqiskXgVgqcN7RAP7hXhdbuy4DYqcUu9FNHs1gdBfBU 2Ao57e24DFyFuX7P80neMOi77uY/qTtPpQCePTh9Wr1d8VgAAQe9SSK+UKiwZci/hct8 atnTqXVuwyVLZB4mBGeD0yVhcqiyXfZ2VQ6OIsGZeNhUKbNysJc3gwkAmuxIiP01O24/ h1PbR3zQNyyyUU/uHnF4RBYo61NhZmpOSV2biPPFMFsIvEoSwfJBdd+yw9x30oMYsen+ A5H5eSZAclw3YDgcTKCFRLHPrCcK5U+Jy4ACzP4QzkLlyiqATcCWAY91hAGMvVWqgBL2 yCLw== X-Gm-Message-State: APjAAAXmWKq/pfajRoICcrbAmPIGXxG+IIlxZV50+XQzrqxRai6aX6b8 JYBXzh9aqVNQ2BiZ9acu8cwJ0ZhgyBeHHrP+/IL2WQ== X-Google-Smtp-Source: APXvYqzprZ4ByNMiVNg3l6ursGldYPxY5zXvZw6ac7MnhIk6EftvO+8Mc1fBJ7dP6D/ncgMW1NRiwvmfOzwAB+Oetr8= X-Received: by 2002:ab0:1388:: with SMTP id m8mr7690331uae.53.1559551842210; Mon, 03 Jun 2019 01:50:42 -0700 (PDT) MIME-Version: 1.0 References: <20190530132526.3496-1-i.maximets@samsung.com> In-Reply-To: <20190530132526.3496-1-i.maximets@samsung.com> From: David Marchand Date: Mon, 3 Jun 2019 10:50:31 +0200 Message-ID: To: Ilya Maximets Cc: dev , Thomas Monjalon , Anatoly Burakov , Jan Blunck , Qi Zhang , Kevin Traynor , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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 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? 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