[dpdk-dev,v3,25/25] rte_eal_init: add info about rte_errno codes

Message ID 20170209142953.8167-26-aconole@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Aaron Conole Feb. 9, 2017, 2:29 p.m. UTC
  The rte_eal_init function will now pass failure reason hints to the
application.  To help app developers deciper this, add some brief
information about what the codes are indicating.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 lib/librte_eal/common/include/rte_eal.h | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
  

Comments

Stephen Hemminger Feb. 9, 2017, 10:37 p.m. UTC | #1
On Thu,  9 Feb 2017 09:29:53 -0500
Aaron Conole <aconole@redhat.com> wrote:

> + *   The error codes returned via rte_errno:
> + *     EACCES indicates a permissions issue.
> + *
> + *     EAGAIN indicates either a bus or system resource was not available,
> + *            try again.
> + *
> + *     EALREADY indicates that the rte_eal_init function has already been
> + *              called, and cannot be called again.
> + *
> + *     EFAULT indicates the tailq configuration name was not found in
> + *            memory configuration.
> + *
> + *     EINVAL indicates invalid parameters were passed as argv/argc.
> + *
> + *     EIO indicates failure to setup the logging handlers.  This is usually
> + *         caused by an out-of-memory condition.
> + *
> + *     ENODEV indicates memory setup issues.
> + *
> + *     ENOTSUP indicates that the EAL cannot initialize on this system.
> + *
> + *     EUNATCH indicates that the PCI bus is either not present, or is not
> + *             readable by the eal.
>   */

You might want to be less restrictive about wording in the comment.
In future more errors might be returned, and also for out of memory
ENOMEM is better.
  
Aaron Conole Feb. 14, 2017, 9:31 p.m. UTC | #2
Stephen Hemminger <stephen@networkplumber.org> writes:

> On Thu,  9 Feb 2017 09:29:53 -0500
> Aaron Conole <aconole@redhat.com> wrote:
>
>> + *   The error codes returned via rte_errno:
>> + *     EACCES indicates a permissions issue.
>> + *
>> + *     EAGAIN indicates either a bus or system resource was not available,
>> + *            try again.
>> + *
>> + *     EALREADY indicates that the rte_eal_init function has already been
>> + *              called, and cannot be called again.
>> + *
>> + *     EFAULT indicates the tailq configuration name was not found in
>> + *            memory configuration.
>> + *
>> + *     EINVAL indicates invalid parameters were passed as argv/argc.
>> + *
>> + *     EIO indicates failure to setup the logging handlers.  This is usually
>> + *         caused by an out-of-memory condition.
>> + *
>> + *     ENODEV indicates memory setup issues.
>> + *
>> + *     ENOTSUP indicates that the EAL cannot initialize on this system.
>> + *
>> + *     EUNATCH indicates that the PCI bus is either not present, or is not
>> + *             readable by the eal.
>>   */
>
> You might want to be less restrictive about wording in the comment.
> In future more errors might be returned, and also for out of memory
> ENOMEM is better.

Sure thing, I'll switch EIO and ENODEV to ENOMEM, does that make sense?

Also, which message do you refer to?  Is it "The error codes returned
via rte_errno" section?  I assume that adding new error codes will also
bring an update to the eal_init documentation, but perhaps I'm
misunderstanding.

Thanks for your review, Stephen!
  

Patch

diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 03fee50..5f184c9 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -159,7 +159,32 @@  int rte_eal_iopl_init(void);
  *     function call and should not be further interpreted by the
  *     application.  The EAL does not take any ownership of the memory used
  *     for either the argv array, or its members.
- *   - On failure, a negative error value.
+ *   - On failure, -1 and rte_errno is set to a value indicating the cause
+ *     for failure.
+ *
+ *   The error codes returned via rte_errno:
+ *     EACCES indicates a permissions issue.
+ *
+ *     EAGAIN indicates either a bus or system resource was not available,
+ *            try again.
+ *
+ *     EALREADY indicates that the rte_eal_init function has already been
+ *              called, and cannot be called again.
+ *
+ *     EFAULT indicates the tailq configuration name was not found in
+ *            memory configuration.
+ *
+ *     EINVAL indicates invalid parameters were passed as argv/argc.
+ *
+ *     EIO indicates failure to setup the logging handlers.  This is usually
+ *         caused by an out-of-memory condition.
+ *
+ *     ENODEV indicates memory setup issues.
+ *
+ *     ENOTSUP indicates that the EAL cannot initialize on this system.
+ *
+ *     EUNATCH indicates that the PCI bus is either not present, or is not
+ *             readable by the eal.
  */
 int rte_eal_init(int argc, char **argv);