DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: dev <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>,
	 Anatoly Burakov <anatoly.burakov@intel.com>,
	Jan Blunck <jblunck@infradead.org>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Kevin Traynor <ktraynor@redhat.com>,
	 dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] eal: fix positive error codes from probe/remove
Date: Mon, 3 Jun 2019 10:50:31 +0200	[thread overview]
Message-ID: <CAJFAV8x3Y_4UcdeEVdMHnxW2BPbgkmw=TO0pMm35t00Npwq+GA@mail.gmail.com> (raw)
In-Reply-To: <20190530132526.3496-1-i.maximets@samsung.com>

On Thu, May 30, 2019 at 3:26 PM Ilya Maximets <i.maximets@samsung.com>
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 <i.maximets@samsung.com>
> ---
>  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

  reply	other threads:[~2019-06-03  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190530132538eucas1p28fcfddad5b73d3a0baf7095f25a6c1fd@eucas1p2.samsung.com>
2019-05-30 13:25 ` [dpdk-dev] " Ilya Maximets
2019-06-03  8:50   ` David Marchand [this message]
2019-06-03 15:37     ` [dpdk-dev] [dpdk-stable] " Ilya Maximets
2019-06-03 16:13       ` David Marchand
2019-06-06  8:39         ` Ilya Maximets
     [not found]   ` <CGME20190606100234eucas1p2a73029a37495cde21bce3b9a3b023ac4@eucas1p2.samsung.com>
2019-06-06 10:02     ` [dpdk-dev] [PATCH v2] " Ilya Maximets
2019-06-07  8:32       ` David Marchand
2019-06-26 21:03         ` Thomas Monjalon
2019-06-27  7:37           ` David Marchand
2019-06-26 21:03         ` Thomas Monjalon
2019-06-29 19:30         ` Thomas Monjalon
2019-06-17 10:54       ` Ilya Maximets

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJFAV8x3Y_4UcdeEVdMHnxW2BPbgkmw=TO0pMm35t00Npwq+GA@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=i.maximets@samsung.com \
    --cc=jblunck@infradead.org \
    --cc=ktraynor@redhat.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).