Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix socket API return code/errno values: errno vs. oipfp_return_code #30

Closed
semihalf-berestovskyy-andriy opened this issue Jan 24, 2017 · 0 comments

Comments

@semihalf-berestovskyy-andriy
Copy link
Contributor

semihalf-berestovskyy-andriy commented Jan 24, 2017

Note: the issue was created automatically with bugzilla2github tool

Bugzilla Bug ID: 30

Date: 2015-06-03 09:08:04 +0200
From: Bogdan Pricope <bogdan.pricope@enea.com>
To: Sorin Vultureanu <sorin.vultureanu@enea.com>
CC: jose.pekkarinen@nokia.com

Last updated: 2015-11-24 12:02:41 +0100

Bugzilla Comment ID: 35

Date: 2015-06-03 09:08:04 +0200
From: Bogdan Pricope <bogdan.pricope@enea.com>

Fix socket API return code/errno values: errno vs. oipfp_return_code

Bugzilla Comment ID: 139

Date: 2015-11-24 11:56:05 +0100
From: José Pekkarinen <jose.pekkarinen@nokia.com>

There was work in this direction recently. What is the status on this?

Bugzilla Comment ID: 141

Date: 2015-11-24 12:02:41 +0100
From: Sorin Vultureanu <sorin.vultureanu@enea.com>

Hi,

The return values should be documented with public API and later on internal headers.
There are 3 situations:

Ofp_errno is behaving for socket calls of ofp_socket.h, as errno in Linux system calls.
OFP does not have system calls, but code ported from Linux will bring the same return model, i.e. socket calls.
Calls from ofp_socket.h return 0 on success and -1 + errno set on failture.

The <ofp_errno.h> header file defines the integer variable ofp_errno, which
is set by system calls and some library functions in the event of an
error to indicate what went wrong. Its value is significant only
when the return value of the call indicated an error (i.e., -1 from
most system calls; -1 or NULL from most library functions); a
function that succeeds is allowed to change ofp_errno.
http://man7.org/linux/man-pages/man3/errno.3.html

On hierarchical packet processing routines return values can be ofp_return_code.
enum ofp_return_code {
OFP_PKT_CONTINUE = 0,
OFP_PKT_PROCESSED,
OFP_PKT_ON_HOLD,
OFP_PKT_DROP
};

For example:
enum ofp_return_code ofp_ipv4_processing(odp_packet_t pkt);

Like in ODP model:
0 on success
-1 or multiple values < -1 on failure but each case should be documented.

For example:
ofp_init_global() should return 0 on success and -1 on failure, as documented in API. Now it returns always 0, so it should be fixed.

Kind Regards,
Sorin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant