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 73409A0096 for ; Mon, 3 Jun 2019 10:50:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A46E1B944; 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 CAE1B1B944 for ; Mon, 3 Jun 2019 10:50:42 +0200 (CEST) Received: by mail-ua1-f67.google.com with SMTP id n2so6185693uad.8 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=FwrvE6mC+yksRBgobbt+ZzUlC+zqhLiiK4iHTLbU99wlgANxvjQ2dpFwiSsZdMQjSb Ub4Z6QzsrEWWqpLAJcIT8zE6E2u2dGpoDC9ABBAWnc9mjBeCyVnBmJ9B4qKg2sWYGKLP 0loHqRVW4/RqJgXQMUS9dKP9gslaxsj219KyQFUm4HaRSw6QV5oTb7O6G7cFQ9O2E9sI tqg2Ya4kRxhoxuVpZjLhMeUvV3ZgLi1GpBD3YRQ8l5pTi8dVtw3FgiVjo8SptHPuM/Vh qu1ofJR8Num904/BhlFPx/Sh0C5GCE2OtqN0pIJcWADy5q3u1h+G0yW9vbD9k3rpr+RX +p3w== X-Gm-Message-State: APjAAAUb3+2hO4WTR1cxJekcfD3PywBErIrDTotgnxcKJ1TBCcnqGulq h0vdZfrIYKhsnVzPquXNoFw6qfRT1QZXKzi7B5v0JA== 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-stable] [PATCH] eal: fix positive error codes from probe/remove X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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" 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