From: "Gaëtan Rivet" <grive@u256.net>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev@dpdk.org, david.marchand@redhat.com, wenzhuo.lu@intel.com,
beilei.xing@intel.com, bernard.iremonger@intel.com
Subject: Re: [dpdk-dev] [PATCH v20.11 2/2] eal: improve device probing API
Date: Wed, 10 Jun 2020 20:13:09 +0200 [thread overview]
Message-ID: <20200610181309.s7pvscontdfwcxbu@u256.net> (raw)
In-Reply-To: <8c865cd1-80fd-7db3-d447-ef05c6615d4a@redhat.com>
On 10/06/20 19:08 +0200, Maxime Coquelin wrote:
> Hi Gaëtan,
>
> On 6/10/20 2:06 PM, Gaëtan Rivet wrote:
> > Hello Maxime,
> >
> > On 08/06/20 17:53 +0200, Maxime Coquelin wrote:
> >> This patch makes rte_dev_probe() to return the
> >> rte_device pointer on success and NULL on error
> >> instead of returning 0 on success and negative
> >> value on error.
> >>
> >> The goal is to avoid that the calling application
> >> iterates the devices list afterwards to retrieve
> >> the pointer. Retrieving the pointer is required
> >> for calling rte_dev_remove() later.
> >>
> >
> > I agree with the idea. I recall starting to do it on the legacy functions
> > (rte_eal_hotplug_*), but it was scrapped for API compat.
> >
> >> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> >> ---
> >> app/test-pmd/testpmd.c | 2 +-
> >> drivers/net/failsafe/failsafe.c | 5 +++--
> >> lib/librte_eal/common/eal_common_dev.c | 18 ++++++++++--------
> >> lib/librte_eal/include/rte_dev.h | 4 ++--
> >> 4 files changed, 16 insertions(+), 13 deletions(-)
> >>
> ...
> >>
> >> int
> >> diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
> >> index c8d985fb5c..9cf7c7fd71 100644
> >> --- a/lib/librte_eal/include/rte_dev.h
> >> +++ b/lib/librte_eal/include/rte_dev.h
> >> @@ -148,9 +148,9 @@ int rte_eal_hotplug_add(const char *busname, const char *devname,
> >> * @param devargs
> >> * Device arguments including bus, class and driver properties.
> >> * @return
> >> - * 0 on success, negative on error.
> >> + * Generic device pointer on success, NULL on error.
> >
> > If rte_errno is set, mapping codes to meanings would be helpful here.
>
> Actually David made me the same comment before I post the patch.
> I am fine with setting rte_errno. If we do that, I think we should have
> fixed error code in rte_dev_probe() and not propagate error codes from
> functions it calls. Otherwise it's likely the API doc will be outdated
> quite rapidly.
>
> What do you think?
>
Well we're stuck with the classic errno limitations.
I agree with you, if we consider possible errors as part of a function
API, then we cannot recursively inherit this API from callees.
That being said, masking errors is not ok. If an error cannot be handled
by rte_dev_probe(), it should log an appropriate message and set
rte_errno to a value that is part of its API. If the error can be
handled, then errno should be reset to its original value preceding
rte_dev_probe() call.
Of course the EAL rarely does it, and even myself I probably rarely
respected this behavior, but it would be nice if we could all define a
common agreed-upon discipline in the EAL and stick to it. I think the
current state of error reporting in EAL is terrible for users downstream.
> > Acked-by: Gaetan Rivet <grive@u256.net>
> >
>
> Great, could you also ack the deprecation notice, as this is the part
> that needs to be merged into v20.08?
>
I wanted to refresh myself with the latest rules about API breakage
before doing so but got context switched away :) . I will get back to it.
> Thanks!
> Maxime
>
--
Gaëtan
prev parent reply other threads:[~2020-06-10 18:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-08 15:53 [dpdk-dev] [PATCH 0/2] rte_dev_probe() API change Maxime Coquelin
2020-06-08 15:53 ` [dpdk-dev] [PATCH 1/2] doc: announce " Maxime Coquelin
2020-06-11 8:08 ` Gaëtan Rivet
2020-06-25 7:50 ` Maxime Coquelin
2020-06-08 15:53 ` [dpdk-dev] [PATCH v20.11 2/2] eal: improve device probing API Maxime Coquelin
2020-06-10 12:06 ` Gaëtan Rivet
2020-06-10 17:08 ` Maxime Coquelin
2020-06-10 18:13 ` Gaëtan Rivet [this message]
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=20200610181309.s7pvscontdfwcxbu@u256.net \
--to=grive@u256.net \
--cc=beilei.xing@intel.com \
--cc=bernard.iremonger@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=wenzhuo.lu@intel.com \
/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).