diff mbox

api: packet_flags: allow implementations to return an error code

Message ID 1427298200-23710-1-git-send-email-zoltan.kiss@linaro.org
State New
Headers show

Commit Message

Zoltan Kiss March 25, 2015, 3:43 p.m. UTC
This is only for debugging purposes. It could be useful for an application
developer if the platform implementation doesn't emit any error messages about
its problems.

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---
 include/odp/api/packet_flags.h            | 3 ++-
 platform/linux-generic/odp_packet_flags.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Bill Fischofer March 25, 2015, 3:49 p.m. UTC | #1
The intent of odp_packet_has_error() is to simply give a yes/no as to
whether packets contain errors.  Detail was to be broken out in other APIs
that were deferred from v1.0.  Something we should bring up again.

On Wed, Mar 25, 2015 at 10:43 AM, Zoltan Kiss <zoltan.kiss@linaro.org>
wrote:

> This is only for debugging purposes. It could be useful for an application
> developer if the platform implementation doesn't emit any error messages
> about
> its problems.
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> ---
>  include/odp/api/packet_flags.h            | 3 ++-
>  platform/linux-generic/odp_packet_flags.c | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/odp/api/packet_flags.h
> b/include/odp/api/packet_flags.h
> index b1e179e..77239d2 100644
> --- a/include/odp/api/packet_flags.h
> +++ b/include/odp/api/packet_flags.h
> @@ -32,7 +32,8 @@ extern "C" {
>   * Checks all error flags at once.
>   *
>   * @param pkt Packet handle
> - * @retval 1 packet has errors
> + * @retval !0 packet has errors (implementation is allowed to return error
> + *           codes for debugging purposes)
>   * @retval 0 packet has no errors
>   */
>  int odp_packet_has_error(odp_packet_t pkt);
> diff --git a/platform/linux-generic/odp_packet_flags.c
> b/platform/linux-generic/odp_packet_flags.c
> index ab3d12f..bcd44fb 100644
> --- a/platform/linux-generic/odp_packet_flags.c
> +++ b/platform/linux-generic/odp_packet_flags.c
> @@ -10,7 +10,7 @@
>
>  int odp_packet_has_error(odp_packet_t pkt)
>  {
> -       return (odp_packet_hdr(pkt)->error_flags.all != 0);
> +       return odp_packet_hdr(pkt)->error_flags.all;
>  }
>
>  /* Get Input Flags */
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index b1e179e..77239d2 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -32,7 +32,8 @@  extern "C" {
  * Checks all error flags at once.
  *
  * @param pkt Packet handle
- * @retval 1 packet has errors
+ * @retval !0 packet has errors (implementation is allowed to return error
+ *	      codes for debugging purposes)
  * @retval 0 packet has no errors
  */
 int odp_packet_has_error(odp_packet_t pkt);
diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
index ab3d12f..bcd44fb 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -10,7 +10,7 @@ 
 
 int odp_packet_has_error(odp_packet_t pkt)
 {
-	return (odp_packet_hdr(pkt)->error_flags.all != 0);
+	return odp_packet_hdr(pkt)->error_flags.all;
 }
 
 /* Get Input Flags */