diff mbox

[API-NEXT/PATCHv1,1/4] validation: classification: move destroy_inq() to common file

Message ID 1445404495-14144-1-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit 00f320bdadeab1495429bb272d7037cfdf0726d7
Headers show

Commit Message

Balasubramanian Manoharan Oct. 21, 2015, 5:14 a.m. UTC
Common in-queue destroy function destroy_inq() is moved to
odp_classification_common.c file

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 .../classification/odp_classification_common.c     | 27 ++++++++++++++++++++++
 .../classification/odp_classification_test_pmr.c   | 27 ----------------------
 .../classification/odp_classification_tests.c      | 27 ----------------------
 .../classification/odp_classification_testsuites.h |  2 +-
 4 files changed, 28 insertions(+), 55 deletions(-)

Comments

Bill Fischofer Oct. 21, 2015, 11:04 a.m. UTC | #1
For this series:

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>

Part 4 has a typo in the commit msg, however
(s/classificaiton/classification/)


On Wed, Oct 21, 2015 at 12:14 AM, Balasubramanian Manoharan <
bala.manoharan@linaro.org> wrote:

> Common in-queue destroy function destroy_inq() is moved to
> odp_classification_common.c file
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
>  .../classification/odp_classification_common.c     | 27
> ++++++++++++++++++++++
>  .../classification/odp_classification_test_pmr.c   | 27
> ----------------------
>  .../classification/odp_classification_tests.c      | 27
> ----------------------
>  .../classification/odp_classification_testsuites.h |  2 +-
>  4 files changed, 28 insertions(+), 55 deletions(-)
>
> diff --git a/test/validation/classification/odp_classification_common.c
> b/test/validation/classification/odp_classification_common.c
> index b975dfb..9966d5f 100644
> --- a/test/validation/classification/odp_classification_common.c
> +++ b/test/validation/classification/odp_classification_common.c
> @@ -17,6 +17,33 @@ typedef struct cls_test_packet {
>         uint32be_t seq;
>  } cls_test_packet_t;
>
> +int destroy_inq(odp_pktio_t pktio)
> +{
> +       odp_queue_t inq;
> +       odp_event_t ev;
> +
> +       inq = odp_pktio_inq_getdef(pktio);
> +
> +       if (inq == ODP_QUEUE_INVALID) {
> +               CU_FAIL("attempting to destroy invalid inq");
> +               return -1;
> +       }
> +
> +       if (0 > odp_pktio_inq_remdef(pktio))
> +               return -1;
> +
> +       while (1) {
> +               ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
> +
> +               if (ev != ODP_EVENT_INVALID)
> +                       odp_event_free(ev);
> +               else
> +                       break;
> +       }
> +
> +       return odp_queue_destroy(inq);
> +}
> +
>  int cls_pkt_set_seq(odp_packet_t pkt)
>  {
>         static uint32_t seq;
> diff --git a/test/validation/classification/odp_classification_test_pmr.c
> b/test/validation/classification/odp_classification_test_pmr.c
> index e794bda..c6b733c 100644
> --- a/test/validation/classification/odp_classification_test_pmr.c
> +++ b/test/validation/classification/odp_classification_test_pmr.c
> @@ -17,33 +17,6 @@ static odp_pool_t pool_default;
>  /** sequence number of IP packets */
>  odp_atomic_u32_t seq;
>
> -static int destroy_inq(odp_pktio_t pktio)
> -{
> -       odp_queue_t inq;
> -       odp_event_t ev;
> -
> -       inq = odp_pktio_inq_getdef(pktio);
> -
> -       if (inq == ODP_QUEUE_INVALID) {
> -               CU_FAIL("attempting to destroy invalid inq");
> -               return -1;
> -       }
> -
> -       if (0 > odp_pktio_inq_remdef(pktio))
> -               return -1;
> -
> -       while (1) {
> -               ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
> -
> -               if (ev != ODP_EVENT_INVALID)
> -                       odp_buffer_free(odp_buffer_from_event(ev));
> -               else
> -                       break;
> -       }
> -
> -       return odp_queue_destroy(inq);
> -}
> -
>  int classification_suite_pmr_init(void)
>  {
>         odp_pool_t pool;
> diff --git a/test/validation/classification/odp_classification_tests.c
> b/test/validation/classification/odp_classification_tests.c
> index fe55419..03a855e 100644
> --- a/test/validation/classification/odp_classification_tests.c
> +++ b/test/validation/classification/odp_classification_tests.c
> @@ -22,33 +22,6 @@ static odp_pktio_t pktio_loop;
>  /** sequence number of IP packets */
>  odp_atomic_u32_t seq;
>
> -static int destroy_inq(odp_pktio_t pktio)
> -{
> -       odp_queue_t inq;
> -       odp_event_t ev;
> -
> -       inq = odp_pktio_inq_getdef(pktio);
> -
> -       if (inq == ODP_QUEUE_INVALID) {
> -               CU_FAIL("attempting to destroy invalid inq");
> -               return -1;
> -       }
> -
> -       if (0 > odp_pktio_inq_remdef(pktio))
> -               return -1;
> -
> -       while (1) {
> -               ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
> -
> -               if (ev != ODP_EVENT_INVALID)
> -                       odp_event_free(ev);
> -               else
> -                       break;
> -       }
> -
> -       return odp_queue_destroy(inq);
> -}
> -
>  int classification_suite_init(void)
>  {
>         odp_pool_param_t param;
> diff --git
> a/test/validation/classification/odp_classification_testsuites.h
> b/test/validation/classification/odp_classification_testsuites.h
> index 33547a7..a7a8baa 100644
> --- a/test/validation/classification/odp_classification_testsuites.h
> +++ b/test/validation/classification/odp_classification_testsuites.h
> @@ -43,6 +43,6 @@ void configure_pmr_cos(void);
>  void test_pmr_cos(void);
>  void configure_pktio_pmr_match_set_cos(void);
>  void test_pktio_pmr_match_set_cos(void);
> -
> +int destroy_inq(odp_pktio_t pktio);
>
>  #endif /* ODP_BUFFER_TESTSUITES_H_ */
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Ivan Khoronzhuk Oct. 21, 2015, 11:13 a.m. UTC | #2
On 21.10.15 08:14, Balasubramanian Manoharan wrote:
> Common in-queue destroy function destroy_inq() is moved to
> odp_classification_common.c file
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

> ---
>   .../classification/odp_classification_common.c     | 27 ++++++++++++++++++++++
>   .../classification/odp_classification_test_pmr.c   | 27 ----------------------
>   .../classification/odp_classification_tests.c      | 27 ----------------------
>   .../classification/odp_classification_testsuites.h |  2 +-
>   4 files changed, 28 insertions(+), 55 deletions(-)
>
> diff --git a/test/validation/classification/odp_classification_common.c b/test/validation/classification/odp_classification_common.c
> index b975dfb..9966d5f 100644
> --- a/test/validation/classification/odp_classification_common.c
> +++ b/test/validation/classification/odp_classification_common.c
> @@ -17,6 +17,33 @@ typedef struct cls_test_packet {
>   	uint32be_t seq;
>   } cls_test_packet_t;
>
> +int destroy_inq(odp_pktio_t pktio)
> +{
> +	odp_queue_t inq;
> +	odp_event_t ev;
> +
> +	inq = odp_pktio_inq_getdef(pktio);
> +
> +	if (inq == ODP_QUEUE_INVALID) {
> +		CU_FAIL("attempting to destroy invalid inq");
> +		return -1;
> +	}
> +
> +	if (0 > odp_pktio_inq_remdef(pktio))
> +		return -1;
> +
> +	while (1) {
> +		ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
> +
> +		if (ev != ODP_EVENT_INVALID)
> +			odp_event_free(ev);
> +		else
> +			break;
> +	}
> +
> +	return odp_queue_destroy(inq);
> +}
> +
>   int cls_pkt_set_seq(odp_packet_t pkt)
>   {
>   	static uint32_t seq;
> diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c
> index e794bda..c6b733c 100644
> --- a/test/validation/classification/odp_classification_test_pmr.c
> +++ b/test/validation/classification/odp_classification_test_pmr.c
> @@ -17,33 +17,6 @@ static odp_pool_t pool_default;
>   /** sequence number of IP packets */
>   odp_atomic_u32_t seq;
>
> -static int destroy_inq(odp_pktio_t pktio)
> -{
> -	odp_queue_t inq;
> -	odp_event_t ev;
> -
> -	inq = odp_pktio_inq_getdef(pktio);
> -
> -	if (inq == ODP_QUEUE_INVALID) {
> -		CU_FAIL("attempting to destroy invalid inq");
> -		return -1;
> -	}
> -
> -	if (0 > odp_pktio_inq_remdef(pktio))
> -		return -1;
> -
> -	while (1) {
> -		ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
> -
> -		if (ev != ODP_EVENT_INVALID)
> -			odp_buffer_free(odp_buffer_from_event(ev));
> -		else
> -			break;
> -	}
> -
> -	return odp_queue_destroy(inq);
> -}
> -
>   int classification_suite_pmr_init(void)
>   {
>   	odp_pool_t pool;
> diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
> index fe55419..03a855e 100644
> --- a/test/validation/classification/odp_classification_tests.c
> +++ b/test/validation/classification/odp_classification_tests.c
> @@ -22,33 +22,6 @@ static odp_pktio_t pktio_loop;
>   /** sequence number of IP packets */
>   odp_atomic_u32_t seq;
>
> -static int destroy_inq(odp_pktio_t pktio)
> -{
> -	odp_queue_t inq;
> -	odp_event_t ev;
> -
> -	inq = odp_pktio_inq_getdef(pktio);
> -
> -	if (inq == ODP_QUEUE_INVALID) {
> -		CU_FAIL("attempting to destroy invalid inq");
> -		return -1;
> -	}
> -
> -	if (0 > odp_pktio_inq_remdef(pktio))
> -		return -1;
> -
> -	while (1) {
> -		ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
> -
> -		if (ev != ODP_EVENT_INVALID)
> -			odp_event_free(ev);
> -		else
> -			break;
> -	}
> -
> -	return odp_queue_destroy(inq);
> -}
> -
>   int classification_suite_init(void)
>   {
>   	odp_pool_param_t param;
> diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h
> index 33547a7..a7a8baa 100644
> --- a/test/validation/classification/odp_classification_testsuites.h
> +++ b/test/validation/classification/odp_classification_testsuites.h
> @@ -43,6 +43,6 @@ void configure_pmr_cos(void);
>   void test_pmr_cos(void);
>   void configure_pktio_pmr_match_set_cos(void);
>   void test_pktio_pmr_match_set_cos(void);
> -
> +int destroy_inq(odp_pktio_t pktio);
>
>   #endif /* ODP_BUFFER_TESTSUITES_H_ */
>
Maxim Uvarov Oct. 22, 2015, 1:30 p.m. UTC | #3
Merged,
Maxim.

On 10/21/2015 14:13, Ivan Khoronzhuk wrote:
>
>
> On 21.10.15 08:14, Balasubramanian Manoharan wrote:
>> Common in-queue destroy function destroy_inq() is moved to
>> odp_classification_common.c file
>>
>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>
> Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>
>> ---
>>   .../classification/odp_classification_common.c     | 27 
>> ++++++++++++++++++++++
>>   .../classification/odp_classification_test_pmr.c   | 27 
>> ----------------------
>>   .../classification/odp_classification_tests.c      | 27 
>> ----------------------
>>   .../classification/odp_classification_testsuites.h |  2 +-
>>   4 files changed, 28 insertions(+), 55 deletions(-)
>>
>> diff --git 
>> a/test/validation/classification/odp_classification_common.c 
>> b/test/validation/classification/odp_classification_common.c
>> index b975dfb..9966d5f 100644
>> --- a/test/validation/classification/odp_classification_common.c
>> +++ b/test/validation/classification/odp_classification_common.c
>> @@ -17,6 +17,33 @@ typedef struct cls_test_packet {
>>       uint32be_t seq;
>>   } cls_test_packet_t;
>>
>> +int destroy_inq(odp_pktio_t pktio)
>> +{
>> +    odp_queue_t inq;
>> +    odp_event_t ev;
>> +
>> +    inq = odp_pktio_inq_getdef(pktio);
>> +
>> +    if (inq == ODP_QUEUE_INVALID) {
>> +        CU_FAIL("attempting to destroy invalid inq");
>> +        return -1;
>> +    }
>> +
>> +    if (0 > odp_pktio_inq_remdef(pktio))
>> +        return -1;
>> +
>> +    while (1) {
>> +        ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
>> +
>> +        if (ev != ODP_EVENT_INVALID)
>> +            odp_event_free(ev);
>> +        else
>> +            break;
>> +    }
>> +
>> +    return odp_queue_destroy(inq);
>> +}
>> +
>>   int cls_pkt_set_seq(odp_packet_t pkt)
>>   {
>>       static uint32_t seq;
>> diff --git 
>> a/test/validation/classification/odp_classification_test_pmr.c 
>> b/test/validation/classification/odp_classification_test_pmr.c
>> index e794bda..c6b733c 100644
>> --- a/test/validation/classification/odp_classification_test_pmr.c
>> +++ b/test/validation/classification/odp_classification_test_pmr.c
>> @@ -17,33 +17,6 @@ static odp_pool_t pool_default;
>>   /** sequence number of IP packets */
>>   odp_atomic_u32_t seq;
>>
>> -static int destroy_inq(odp_pktio_t pktio)
>> -{
>> -    odp_queue_t inq;
>> -    odp_event_t ev;
>> -
>> -    inq = odp_pktio_inq_getdef(pktio);
>> -
>> -    if (inq == ODP_QUEUE_INVALID) {
>> -        CU_FAIL("attempting to destroy invalid inq");
>> -        return -1;
>> -    }
>> -
>> -    if (0 > odp_pktio_inq_remdef(pktio))
>> -        return -1;
>> -
>> -    while (1) {
>> -        ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
>> -
>> -        if (ev != ODP_EVENT_INVALID)
>> -            odp_buffer_free(odp_buffer_from_event(ev));
>> -        else
>> -            break;
>> -    }
>> -
>> -    return odp_queue_destroy(inq);
>> -}
>> -
>>   int classification_suite_pmr_init(void)
>>   {
>>       odp_pool_t pool;
>> diff --git 
>> a/test/validation/classification/odp_classification_tests.c 
>> b/test/validation/classification/odp_classification_tests.c
>> index fe55419..03a855e 100644
>> --- a/test/validation/classification/odp_classification_tests.c
>> +++ b/test/validation/classification/odp_classification_tests.c
>> @@ -22,33 +22,6 @@ static odp_pktio_t pktio_loop;
>>   /** sequence number of IP packets */
>>   odp_atomic_u32_t seq;
>>
>> -static int destroy_inq(odp_pktio_t pktio)
>> -{
>> -    odp_queue_t inq;
>> -    odp_event_t ev;
>> -
>> -    inq = odp_pktio_inq_getdef(pktio);
>> -
>> -    if (inq == ODP_QUEUE_INVALID) {
>> -        CU_FAIL("attempting to destroy invalid inq");
>> -        return -1;
>> -    }
>> -
>> -    if (0 > odp_pktio_inq_remdef(pktio))
>> -        return -1;
>> -
>> -    while (1) {
>> -        ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
>> -
>> -        if (ev != ODP_EVENT_INVALID)
>> -            odp_event_free(ev);
>> -        else
>> -            break;
>> -    }
>> -
>> -    return odp_queue_destroy(inq);
>> -}
>> -
>>   int classification_suite_init(void)
>>   {
>>       odp_pool_param_t param;
>> diff --git 
>> a/test/validation/classification/odp_classification_testsuites.h 
>> b/test/validation/classification/odp_classification_testsuites.h
>> index 33547a7..a7a8baa 100644
>> --- a/test/validation/classification/odp_classification_testsuites.h
>> +++ b/test/validation/classification/odp_classification_testsuites.h
>> @@ -43,6 +43,6 @@ void configure_pmr_cos(void);
>>   void test_pmr_cos(void);
>>   void configure_pktio_pmr_match_set_cos(void);
>>   void test_pktio_pmr_match_set_cos(void);
>> -
>> +int destroy_inq(odp_pktio_t pktio);
>>
>>   #endif /* ODP_BUFFER_TESTSUITES_H_ */
>>
>
diff mbox

Patch

diff --git a/test/validation/classification/odp_classification_common.c b/test/validation/classification/odp_classification_common.c
index b975dfb..9966d5f 100644
--- a/test/validation/classification/odp_classification_common.c
+++ b/test/validation/classification/odp_classification_common.c
@@ -17,6 +17,33 @@  typedef struct cls_test_packet {
 	uint32be_t seq;
 } cls_test_packet_t;
 
+int destroy_inq(odp_pktio_t pktio)
+{
+	odp_queue_t inq;
+	odp_event_t ev;
+
+	inq = odp_pktio_inq_getdef(pktio);
+
+	if (inq == ODP_QUEUE_INVALID) {
+		CU_FAIL("attempting to destroy invalid inq");
+		return -1;
+	}
+
+	if (0 > odp_pktio_inq_remdef(pktio))
+		return -1;
+
+	while (1) {
+		ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
+
+		if (ev != ODP_EVENT_INVALID)
+			odp_event_free(ev);
+		else
+			break;
+	}
+
+	return odp_queue_destroy(inq);
+}
+
 int cls_pkt_set_seq(odp_packet_t pkt)
 {
 	static uint32_t seq;
diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c
index e794bda..c6b733c 100644
--- a/test/validation/classification/odp_classification_test_pmr.c
+++ b/test/validation/classification/odp_classification_test_pmr.c
@@ -17,33 +17,6 @@  static odp_pool_t pool_default;
 /** sequence number of IP packets */
 odp_atomic_u32_t seq;
 
-static int destroy_inq(odp_pktio_t pktio)
-{
-	odp_queue_t inq;
-	odp_event_t ev;
-
-	inq = odp_pktio_inq_getdef(pktio);
-
-	if (inq == ODP_QUEUE_INVALID) {
-		CU_FAIL("attempting to destroy invalid inq");
-		return -1;
-	}
-
-	if (0 > odp_pktio_inq_remdef(pktio))
-		return -1;
-
-	while (1) {
-		ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
-
-		if (ev != ODP_EVENT_INVALID)
-			odp_buffer_free(odp_buffer_from_event(ev));
-		else
-			break;
-	}
-
-	return odp_queue_destroy(inq);
-}
-
 int classification_suite_pmr_init(void)
 {
 	odp_pool_t pool;
diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
index fe55419..03a855e 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -22,33 +22,6 @@  static odp_pktio_t pktio_loop;
 /** sequence number of IP packets */
 odp_atomic_u32_t seq;
 
-static int destroy_inq(odp_pktio_t pktio)
-{
-	odp_queue_t inq;
-	odp_event_t ev;
-
-	inq = odp_pktio_inq_getdef(pktio);
-
-	if (inq == ODP_QUEUE_INVALID) {
-		CU_FAIL("attempting to destroy invalid inq");
-		return -1;
-	}
-
-	if (0 > odp_pktio_inq_remdef(pktio))
-		return -1;
-
-	while (1) {
-		ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
-
-		if (ev != ODP_EVENT_INVALID)
-			odp_event_free(ev);
-		else
-			break;
-	}
-
-	return odp_queue_destroy(inq);
-}
-
 int classification_suite_init(void)
 {
 	odp_pool_param_t param;
diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h
index 33547a7..a7a8baa 100644
--- a/test/validation/classification/odp_classification_testsuites.h
+++ b/test/validation/classification/odp_classification_testsuites.h
@@ -43,6 +43,6 @@  void configure_pmr_cos(void);
 void test_pmr_cos(void);
 void configure_pktio_pmr_match_set_cos(void);
 void test_pktio_pmr_match_set_cos(void);
-
+int destroy_inq(odp_pktio_t pktio);
 
 #endif /* ODP_BUFFER_TESTSUITES_H_ */