diff mbox

[API-NEXT/PATCHv1,3/4] validation: classification: remove redundant pool lookup function

Message ID 1445404495-14144-3-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit dd540d96ae9d065b66327ee650c84a60fbb9878c
Headers show

Commit Message

Balasubramanian Manoharan Oct. 21, 2015, 5:14 a.m. UTC
pool lookup function is removed and pool_default variable is updated
directly during pool create

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 .../classification/odp_classification_test_pmr.c        | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

Comments

Ivan Khoronzhuk Oct. 21, 2015, 11:16 a.m. UTC | #1
On 21.10.15 08:14, Balasubramanian Manoharan wrote:
> pool lookup function is removed and pool_default variable is updated
> directly during pool create
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

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

> ---
>   .../classification/odp_classification_test_pmr.c        | 17 +++++------------
>   1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c
> index c6b733c..c058caf 100644
> --- a/test/validation/classification/odp_classification_test_pmr.c
> +++ b/test/validation/classification/odp_classification_test_pmr.c
> @@ -19,7 +19,6 @@ odp_atomic_u32_t seq;
>
>   int classification_suite_pmr_init(void)
>   {
> -	odp_pool_t pool;
>   	odp_pool_param_t param;
>
>   	odp_pool_param_init(&param);
> @@ -28,16 +27,12 @@ int classification_suite_pmr_init(void)
>   	param.pkt.num     = SHM_PKT_NUM_BUFS;
>   	param.type        = ODP_POOL_PACKET;
>
> -	pool = odp_pool_create("classification_pmr_pool", &param);
> -	if (ODP_POOL_INVALID == pool) {
> +	pool_default = odp_pool_create("classification_pmr_pool", &param);
> +	if (ODP_POOL_INVALID == pool_default) {
>   		fprintf(stderr, "Packet pool creation failed.\n");
>   		return -1;
>   	}
>
> -	pool_default = odp_pool_lookup("classification_pmr_pool");
> -	if (pool_default == ODP_POOL_INVALID)
> -		return -1;
> -
>   	odp_atomic_init_u32(&seq, 0);
>   	return 0;
>   }
> @@ -46,11 +41,9 @@ odp_pktio_t create_pktio(odp_queue_type_t q_type)
>   {
>   	odp_pktio_t pktio;
>   	odp_pktio_param_t pktio_param;
> -	odp_pool_t pool;
>   	int ret;
>
> -	pool = odp_pool_lookup("classification_pmr_pool");
> -	if (pool == ODP_POOL_INVALID)
> +	if (pool_default == ODP_POOL_INVALID)
>   		return ODP_PKTIO_INVALID;
>
>   	odp_pktio_param_init(&pktio_param);
> @@ -59,9 +52,9 @@ odp_pktio_t create_pktio(odp_queue_type_t q_type)
>   	else
>   		pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
>
> -	pktio = odp_pktio_open("loop", pool, &pktio_param);
> +	pktio = odp_pktio_open("loop", pool_default, &pktio_param);
>   	if (pktio == ODP_PKTIO_INVALID) {
> -		ret = odp_pool_destroy(pool);
> +		ret = odp_pool_destroy(pool_default);
>   		if (ret)
>   			fprintf(stderr, "unable to destroy pool.\n");
>   		return ODP_PKTIO_INVALID;
>
diff mbox

Patch

diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c
index c6b733c..c058caf 100644
--- a/test/validation/classification/odp_classification_test_pmr.c
+++ b/test/validation/classification/odp_classification_test_pmr.c
@@ -19,7 +19,6 @@  odp_atomic_u32_t seq;
 
 int classification_suite_pmr_init(void)
 {
-	odp_pool_t pool;
 	odp_pool_param_t param;
 
 	odp_pool_param_init(&param);
@@ -28,16 +27,12 @@  int classification_suite_pmr_init(void)
 	param.pkt.num     = SHM_PKT_NUM_BUFS;
 	param.type        = ODP_POOL_PACKET;
 
-	pool = odp_pool_create("classification_pmr_pool", &param);
-	if (ODP_POOL_INVALID == pool) {
+	pool_default = odp_pool_create("classification_pmr_pool", &param);
+	if (ODP_POOL_INVALID == pool_default) {
 		fprintf(stderr, "Packet pool creation failed.\n");
 		return -1;
 	}
 
-	pool_default = odp_pool_lookup("classification_pmr_pool");
-	if (pool_default == ODP_POOL_INVALID)
-		return -1;
-
 	odp_atomic_init_u32(&seq, 0);
 	return 0;
 }
@@ -46,11 +41,9 @@  odp_pktio_t create_pktio(odp_queue_type_t q_type)
 {
 	odp_pktio_t pktio;
 	odp_pktio_param_t pktio_param;
-	odp_pool_t pool;
 	int ret;
 
-	pool = odp_pool_lookup("classification_pmr_pool");
-	if (pool == ODP_POOL_INVALID)
+	if (pool_default == ODP_POOL_INVALID)
 		return ODP_PKTIO_INVALID;
 
 	odp_pktio_param_init(&pktio_param);
@@ -59,9 +52,9 @@  odp_pktio_t create_pktio(odp_queue_type_t q_type)
 	else
 		pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
 
-	pktio = odp_pktio_open("loop", pool, &pktio_param);
+	pktio = odp_pktio_open("loop", pool_default, &pktio_param);
 	if (pktio == ODP_PKTIO_INVALID) {
-		ret = odp_pool_destroy(pool);
+		ret = odp_pool_destroy(pool_default);
 		if (ret)
 			fprintf(stderr, "unable to destroy pool.\n");
 		return ODP_PKTIO_INVALID;