diff mbox

[PATCHv3] api: packet: odp_packet_flags: improve function names

Message ID 1422480515-3344-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit b558ce58fd992a79d17035ce0dfdf513b7e697c1
Headers show

Commit Message

Bill Fischofer Jan. 28, 2015, 9:28 p.m. UTC
Rename odp_packet_error() to odp_packet_has_error() and delete
odp_packet_errflag_frame_len() for consistency with related
packet APIs.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 example/generator/odp_generator.c                     |  2 +-
 example/ipsec/odp_ipsec.c                             |  2 +-
 example/l2fwd/odp_l2fwd.c                             |  2 +-
 example/packet/odp_pktio.c                            |  2 +-
 platform/linux-generic/include/api/odp_packet_flags.h | 13 +++----------
 platform/linux-generic/odp_packet_flags.c             |  9 +--------
 test/validation/buffer/odp_packet_test.c              |  5 +----
 test/validation/odp_pktio.c                           |  2 +-
 8 files changed, 10 insertions(+), 27 deletions(-)

Comments

Mike Holmes Jan. 30, 2015, 3:01 p.m. UTC | #1
With 3 Way merge

On 28 January 2015 at 16:28, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> Rename odp_packet_error() to odp_packet_has_error() and delete
> odp_packet_errflag_frame_len() for consistency with related
> packet APIs.
>
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>

Reviewed-by: Mike Holmes <mike.holmes@linaro.org>



> ---
>  example/generator/odp_generator.c                     |  2 +-
>  example/ipsec/odp_ipsec.c                             |  2 +-
>  example/l2fwd/odp_l2fwd.c                             |  2 +-
>  example/packet/odp_pktio.c                            |  2 +-
>  platform/linux-generic/include/api/odp_packet_flags.h | 13 +++----------
>  platform/linux-generic/odp_packet_flags.c             |  9 +--------
>  test/validation/buffer/odp_packet_test.c              |  5 +----
>  test/validation/odp_pktio.c                           |  2 +-
>  8 files changed, 10 insertions(+), 27 deletions(-)
>
> diff --git a/example/generator/odp_generator.c
> b/example/generator/odp_generator.c
> index 492664e..ad62e08 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg)
>
>                 pkt = odp_packet_from_event(ev);
>                 /* Drop packets with errors */
> -               if (odp_unlikely(odp_packet_error(pkt))) {
> +               if (odp_unlikely(odp_packet_has_error(pkt))) {
>                         odp_packet_free(pkt);
>                         continue;
>                 }
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index f2d2fc7..22fddb2 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -616,7 +616,7 @@ static
>  pkt_disposition_e do_input_verify(odp_packet_t pkt,
>                                   pkt_ctx_t *ctx EXAMPLE_UNUSED)
>  {
> -       if (odp_unlikely(odp_packet_error(pkt)))
> +       if (odp_unlikely(odp_packet_has_error(pkt)))
>                 return PKT_DROP;
>
>         if (!odp_packet_has_eth(pkt))
> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
> index 18403da..305d9ae 100644
> --- a/example/l2fwd/odp_l2fwd.c
> +++ b/example/l2fwd/odp_l2fwd.c
> @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[],
> unsigned len)
>         for (i = 0, j = 0; i < len; ++i) {
>                 pkt = pkt_tbl[i];
>
> -               if (odp_unlikely(odp_packet_error(pkt))) {
> +               if (odp_unlikely(odp_packet_has_error(pkt))) {
>                         odp_packet_free(pkt); /* Drop */
>                         pkt_cnt--;
>                 } else if (odp_unlikely(i != j++)) {
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index c4c720b..1972dfa 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[],
> unsigned len)
>         for (i = 0, j = 0; i < len; ++i) {
>                 pkt = pkt_tbl[i];
>
> -               if (odp_unlikely(odp_packet_error(pkt))) {
> +               if (odp_unlikely(odp_packet_has_error(pkt))) {
>                         odp_packet_free(pkt); /* Drop */
>                         pkt_cnt--;
>                 } else if (odp_unlikely(i != j++)) {
> diff --git a/platform/linux-generic/include/api/odp_packet_flags.h
> b/platform/linux-generic/include/api/odp_packet_flags.h
> index 24c4065..c239a28 100644
> --- a/platform/linux-generic/include/api/odp_packet_flags.h
> +++ b/platform/linux-generic/include/api/odp_packet_flags.h
> @@ -32,17 +32,10 @@ extern "C" {
>   * Checks all error flags at once.
>   *
>   * @param pkt Packet handle
> - * @return 1 if packet has errors, 0 otherwise
> + * @retval 1 packet has errors
> + * @retval 0 packet has no errors
>   */
> -int odp_packet_error(odp_packet_t pkt);
> -
> -/**
> - * Check if error was 'frame length' error
> - *
> - * @param pkt Packet handle
> - * @return 1 if frame length error detected, 0 otherwise
> - */
> -int odp_packet_errflag_frame_len(odp_packet_t pkt);
> +int odp_packet_has_error(odp_packet_t pkt);
>
>  /**
>   * Check for L2 header, e.g. ethernet
> diff --git a/platform/linux-generic/odp_packet_flags.c
> b/platform/linux-generic/odp_packet_flags.c
> index 3f0ea9f..e678f66 100644
> --- a/platform/linux-generic/odp_packet_flags.c
> +++ b/platform/linux-generic/odp_packet_flags.c
> @@ -8,18 +8,11 @@
>  #include <odp_packet_internal.h>
>
>
> -int odp_packet_error(odp_packet_t pkt)
> +int odp_packet_has_error(odp_packet_t pkt)
>  {
>         return (odp_packet_hdr(pkt)->error_flags.all != 0);
>  }
>
> -/* Get Error Flags */
> -
> -int odp_packet_errflag_frame_len(odp_packet_t pkt)
> -{
> -       return odp_packet_hdr(pkt)->error_flags.frame_len;
> -}
> -
>  /* Get Input Flags */
>
>  int odp_packet_has_l2(odp_packet_t pkt)
> diff --git a/test/validation/buffer/odp_packet_test.c
> b/test/validation/buffer/odp_packet_test.c
> index c1b28ab..022f9a3 100644
> --- a/test/validation/buffer/odp_packet_test.c
> +++ b/test/validation/buffer/odp_packet_test.c
> @@ -435,10 +435,7 @@ static void packet_error_flags(void)
>          * properly set. Just check that function return one of allowed
> values.
>          * @todo: check classified packet when classifier is added in
> place.
>          */
> -       err = odp_packet_error(pkt);
> -       CU_ASSERT(err == 0 || err == 1);
> -
> -       err = odp_packet_errflag_frame_len(pkt);
> +       err = odp_packet_has_error(pkt);
>         CU_ASSERT(err == 0 || err == 1);
>  }
>
> diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
> index 0985771..03b14f9 100644
> --- a/test/validation/odp_pktio.c
> +++ b/test/validation/odp_pktio.c
> @@ -342,7 +342,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a,
> pktio_info_t *pktio_b,
>                 if (rx_pkt == ODP_PACKET_INVALID)
>                         break;
>                 CU_ASSERT(odp_packet_input(rx_pkt) == pktio_b->id);
> -               CU_ASSERT(odp_packet_error(rx_pkt) == 0);
> +               CU_ASSERT(odp_packet_has_error(rx_pkt) == 0);
>                 odp_packet_free(rx_pkt);
>         }
>
> --
> 2.1.0
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov Jan. 30, 2015, 4:36 p.m. UTC | #2
Merged!

Maxim.

On 01/29/2015 12:28 AM, Bill Fischofer wrote:
> Rename odp_packet_error() to odp_packet_has_error() and delete
> odp_packet_errflag_frame_len() for consistency with related
> packet APIs.
>
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>   example/generator/odp_generator.c                     |  2 +-
>   example/ipsec/odp_ipsec.c                             |  2 +-
>   example/l2fwd/odp_l2fwd.c                             |  2 +-
>   example/packet/odp_pktio.c                            |  2 +-
>   platform/linux-generic/include/api/odp_packet_flags.h | 13 +++----------
>   platform/linux-generic/odp_packet_flags.c             |  9 +--------
>   test/validation/buffer/odp_packet_test.c              |  5 +----
>   test/validation/odp_pktio.c                           |  2 +-
>   8 files changed, 10 insertions(+), 27 deletions(-)
>
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index 492664e..ad62e08 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg)
>   
>   		pkt = odp_packet_from_event(ev);
>   		/* Drop packets with errors */
> -		if (odp_unlikely(odp_packet_error(pkt))) {
> +		if (odp_unlikely(odp_packet_has_error(pkt))) {
>   			odp_packet_free(pkt);
>   			continue;
>   		}
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index f2d2fc7..22fddb2 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -616,7 +616,7 @@ static
>   pkt_disposition_e do_input_verify(odp_packet_t pkt,
>   				  pkt_ctx_t *ctx EXAMPLE_UNUSED)
>   {
> -	if (odp_unlikely(odp_packet_error(pkt)))
> +	if (odp_unlikely(odp_packet_has_error(pkt)))
>   		return PKT_DROP;
>   
>   	if (!odp_packet_has_eth(pkt))
> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
> index 18403da..305d9ae 100644
> --- a/example/l2fwd/odp_l2fwd.c
> +++ b/example/l2fwd/odp_l2fwd.c
> @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len)
>   	for (i = 0, j = 0; i < len; ++i) {
>   		pkt = pkt_tbl[i];
>   
> -		if (odp_unlikely(odp_packet_error(pkt))) {
> +		if (odp_unlikely(odp_packet_has_error(pkt))) {
>   			odp_packet_free(pkt); /* Drop */
>   			pkt_cnt--;
>   		} else if (odp_unlikely(i != j++)) {
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index c4c720b..1972dfa 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len)
>   	for (i = 0, j = 0; i < len; ++i) {
>   		pkt = pkt_tbl[i];
>   
> -		if (odp_unlikely(odp_packet_error(pkt))) {
> +		if (odp_unlikely(odp_packet_has_error(pkt))) {
>   			odp_packet_free(pkt); /* Drop */
>   			pkt_cnt--;
>   		} else if (odp_unlikely(i != j++)) {
> diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h
> index 24c4065..c239a28 100644
> --- a/platform/linux-generic/include/api/odp_packet_flags.h
> +++ b/platform/linux-generic/include/api/odp_packet_flags.h
> @@ -32,17 +32,10 @@ extern "C" {
>    * Checks all error flags at once.
>    *
>    * @param pkt Packet handle
> - * @return 1 if packet has errors, 0 otherwise
> + * @retval 1 packet has errors
> + * @retval 0 packet has no errors
>    */
> -int odp_packet_error(odp_packet_t pkt);
> -
> -/**
> - * Check if error was 'frame length' error
> - *
> - * @param pkt Packet handle
> - * @return 1 if frame length error detected, 0 otherwise
> - */
> -int odp_packet_errflag_frame_len(odp_packet_t pkt);
> +int odp_packet_has_error(odp_packet_t pkt);
>   
>   /**
>    * Check for L2 header, e.g. ethernet
> diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
> index 3f0ea9f..e678f66 100644
> --- a/platform/linux-generic/odp_packet_flags.c
> +++ b/platform/linux-generic/odp_packet_flags.c
> @@ -8,18 +8,11 @@
>   #include <odp_packet_internal.h>
>   
>   
> -int odp_packet_error(odp_packet_t pkt)
> +int odp_packet_has_error(odp_packet_t pkt)
>   {
>   	return (odp_packet_hdr(pkt)->error_flags.all != 0);
>   }
>   
> -/* Get Error Flags */
> -
> -int odp_packet_errflag_frame_len(odp_packet_t pkt)
> -{
> -	return odp_packet_hdr(pkt)->error_flags.frame_len;
> -}
> -
>   /* Get Input Flags */
>   
>   int odp_packet_has_l2(odp_packet_t pkt)
> diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c
> index c1b28ab..022f9a3 100644
> --- a/test/validation/buffer/odp_packet_test.c
> +++ b/test/validation/buffer/odp_packet_test.c
> @@ -435,10 +435,7 @@ static void packet_error_flags(void)
>   	 * properly set. Just check that function return one of allowed values.
>   	 * @todo: check classified packet when classifier is added in place.
>   	 */
> -	err = odp_packet_error(pkt);
> -	CU_ASSERT(err == 0 || err == 1);
> -
> -	err = odp_packet_errflag_frame_len(pkt);
> +	err = odp_packet_has_error(pkt);
>   	CU_ASSERT(err == 0 || err == 1);
>   }
>   
> diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
> index 0985771..03b14f9 100644
> --- a/test/validation/odp_pktio.c
> +++ b/test/validation/odp_pktio.c
> @@ -342,7 +342,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b,
>   		if (rx_pkt == ODP_PACKET_INVALID)
>   			break;
>   		CU_ASSERT(odp_packet_input(rx_pkt) == pktio_b->id);
> -		CU_ASSERT(odp_packet_error(rx_pkt) == 0);
> +		CU_ASSERT(odp_packet_has_error(rx_pkt) == 0);
>   		odp_packet_free(rx_pkt);
>   	}
>
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 492664e..ad62e08 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -522,7 +522,7 @@  static void *gen_recv_thread(void *arg)
 
 		pkt = odp_packet_from_event(ev);
 		/* Drop packets with errors */
-		if (odp_unlikely(odp_packet_error(pkt))) {
+		if (odp_unlikely(odp_packet_has_error(pkt))) {
 			odp_packet_free(pkt);
 			continue;
 		}
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index f2d2fc7..22fddb2 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -616,7 +616,7 @@  static
 pkt_disposition_e do_input_verify(odp_packet_t pkt,
 				  pkt_ctx_t *ctx EXAMPLE_UNUSED)
 {
-	if (odp_unlikely(odp_packet_error(pkt)))
+	if (odp_unlikely(odp_packet_has_error(pkt)))
 		return PKT_DROP;
 
 	if (!odp_packet_has_eth(pkt))
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 18403da..305d9ae 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -424,7 +424,7 @@  static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len)
 	for (i = 0, j = 0; i < len; ++i) {
 		pkt = pkt_tbl[i];
 
-		if (odp_unlikely(odp_packet_error(pkt))) {
+		if (odp_unlikely(odp_packet_has_error(pkt))) {
 			odp_packet_free(pkt); /* Drop */
 			pkt_cnt--;
 		} else if (odp_unlikely(i != j++)) {
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index c4c720b..1972dfa 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -408,7 +408,7 @@  static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len)
 	for (i = 0, j = 0; i < len; ++i) {
 		pkt = pkt_tbl[i];
 
-		if (odp_unlikely(odp_packet_error(pkt))) {
+		if (odp_unlikely(odp_packet_has_error(pkt))) {
 			odp_packet_free(pkt); /* Drop */
 			pkt_cnt--;
 		} else if (odp_unlikely(i != j++)) {
diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h
index 24c4065..c239a28 100644
--- a/platform/linux-generic/include/api/odp_packet_flags.h
+++ b/platform/linux-generic/include/api/odp_packet_flags.h
@@ -32,17 +32,10 @@  extern "C" {
  * Checks all error flags at once.
  *
  * @param pkt Packet handle
- * @return 1 if packet has errors, 0 otherwise
+ * @retval 1 packet has errors
+ * @retval 0 packet has no errors
  */
-int odp_packet_error(odp_packet_t pkt);
-
-/**
- * Check if error was 'frame length' error
- *
- * @param pkt Packet handle
- * @return 1 if frame length error detected, 0 otherwise
- */
-int odp_packet_errflag_frame_len(odp_packet_t pkt);
+int odp_packet_has_error(odp_packet_t pkt);
 
 /**
  * Check for L2 header, e.g. ethernet
diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
index 3f0ea9f..e678f66 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -8,18 +8,11 @@ 
 #include <odp_packet_internal.h>
 
 
-int odp_packet_error(odp_packet_t pkt)
+int odp_packet_has_error(odp_packet_t pkt)
 {
 	return (odp_packet_hdr(pkt)->error_flags.all != 0);
 }
 
-/* Get Error Flags */
-
-int odp_packet_errflag_frame_len(odp_packet_t pkt)
-{
-	return odp_packet_hdr(pkt)->error_flags.frame_len;
-}
-
 /* Get Input Flags */
 
 int odp_packet_has_l2(odp_packet_t pkt)
diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c
index c1b28ab..022f9a3 100644
--- a/test/validation/buffer/odp_packet_test.c
+++ b/test/validation/buffer/odp_packet_test.c
@@ -435,10 +435,7 @@  static void packet_error_flags(void)
 	 * properly set. Just check that function return one of allowed values.
 	 * @todo: check classified packet when classifier is added in place.
 	 */
-	err = odp_packet_error(pkt);
-	CU_ASSERT(err == 0 || err == 1);
-
-	err = odp_packet_errflag_frame_len(pkt);
+	err = odp_packet_has_error(pkt);
 	CU_ASSERT(err == 0 || err == 1);
 }
 
diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 0985771..03b14f9 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -342,7 +342,7 @@  static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b,
 		if (rx_pkt == ODP_PACKET_INVALID)
 			break;
 		CU_ASSERT(odp_packet_input(rx_pkt) == pktio_b->id);
-		CU_ASSERT(odp_packet_error(rx_pkt) == 0);
+		CU_ASSERT(odp_packet_has_error(rx_pkt) == 0);
 		odp_packet_free(rx_pkt);
 	}