diff mbox

test: odp_crypto add termination path

Message ID 1468938058-14659-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 197710ffc229f3db775a97c27e09c2dc063497c4
Headers show

Commit Message

Maxim Uvarov July 19, 2016, 2:20 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
 test/performance/odp_crypto.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

-- 
2.7.1.250.gff4ea60

Comments

Mike Holmes July 19, 2016, 9:15 p.m. UTC | #1
On 19 July 2016 at 10:20, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

>


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



> ---

>  test/performance/odp_crypto.c | 29 ++++++++++++++++++++++++-----

>  1 file changed, 24 insertions(+), 5 deletions(-)

>

> diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c

> index 404984d..b7818ea 100644

> --- a/test/performance/odp_crypto.c

> +++ b/test/performance/odp_crypto.c

> @@ -545,9 +545,11 @@ run_measure_one(crypto_args_t *cargs,

>                                  * every time.

>                                  * Note we leaked one packet here.

>                                  */

> -                               pkt = odp_packet_alloc(pkt_pool,

> -                                                      payload_length);

> -                               if (pkt == ODP_PACKET_INVALID) {

> +                               odp_packet_t newpkt;

> +

> +                               newpkt = odp_packet_alloc(pkt_pool,

> +                                                         payload_length);

> +                               if (newpkt == ODP_PACKET_INVALID) {

>                                         app_err("failed to allocate

> buffer\n");

>                                         return -1;

>                                 } else {

> @@ -555,8 +557,8 @@ run_measure_one(crypto_args_t *cargs,

>

>                                         memset(mem, 1, payload_length);

>                                 }

> -                               params.pkt = pkt;

> -                               params.out_pkt = cargs->in_place ? pkt :

> +                               params.pkt = newpkt;

> +                               params.out_pkt = cargs->in_place ? newpkt :

>                                                  ODP_PACKET_INVALID;

>                         }

>

> @@ -650,6 +652,8 @@ run_measure_one(crypto_args_t *cargs,

>                                         cargs->iteration_count;

>         }

>

> +       odp_packet_free(pkt);

> +

>         return rc;

>  }

>

> @@ -821,6 +825,21 @@ int main(int argc, char *argv[])

>                 }

>         }

>

> +       if (odp_pool_destroy(pool)) {

> +               app_err("Error: pool destroy\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       if (odp_term_local()) {

> +               app_err("Error: term local\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

> +       if (odp_term_global(instance)) {

> +               app_err("Error: term global\n");

> +               exit(EXIT_FAILURE);

> +       }

> +

>         return 0;

>  }

>

> --

> 2.7.1.250.gff4ea60

>

>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Maxim Uvarov July 20, 2016, 1:02 p.m. UTC | #2
Merged,
Maxim.


On 07/20/16 00:15, Mike Holmes wrote:
>

>

> On 19 July 2016 at 10:20, Maxim Uvarov <maxim.uvarov@linaro.org 

> <mailto:maxim.uvarov@linaro.org>> wrote:

>

>     Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org

>     <mailto:maxim.uvarov@linaro.org>>

>

>

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

> <mailto:mike.holmes@linaro.org>

>

>     ---

>      test/performance/odp_crypto.c | 29 ++++++++++++++++++++++++-----

>      1 file changed, 24 insertions(+), 5 deletions(-)

>

>     diff --git a/test/performance/odp_crypto.c

>     b/test/performance/odp_crypto.c

>     index 404984d..b7818ea 100644

>     --- a/test/performance/odp_crypto.c

>     +++ b/test/performance/odp_crypto.c

>     @@ -545,9 +545,11 @@ run_measure_one(crypto_args_t *cargs,

>                                      * every time.

>                                      * Note we leaked one packet here.

>                                      */

>     -                               pkt = odp_packet_alloc(pkt_pool,

>     - payload_length);

>     -                               if (pkt == ODP_PACKET_INVALID) {

>     +                               odp_packet_t newpkt;

>     +

>     +                               newpkt = odp_packet_alloc(pkt_pool,

>     +  payload_length);

>     +                               if (newpkt == ODP_PACKET_INVALID) {

>                                             app_err("failed to

>     allocate buffer\n");

>                                             return -1;

>                                     } else {

>     @@ -555,8 +557,8 @@ run_measure_one(crypto_args_t *cargs,

>

>                                             memset(mem, 1,

>     payload_length);

>                                     }

>     -                               params.pkt = pkt;

>     -                               params.out_pkt = cargs->in_place ?

>     pkt :

>     +                               params.pkt = newpkt;

>     +                               params.out_pkt = cargs->in_place ?

>     newpkt :

>      ODP_PACKET_INVALID;

>                             }

>

>     @@ -650,6 +652,8 @@ run_measure_one(crypto_args_t *cargs,

>     cargs->iteration_count;

>             }

>

>     +       odp_packet_free(pkt);

>     +

>             return rc;

>      }

>

>     @@ -821,6 +825,21 @@ int main(int argc, char *argv[])

>                     }

>             }

>

>     +       if (odp_pool_destroy(pool)) {

>     +               app_err("Error: pool destroy\n");

>     +               exit(EXIT_FAILURE);

>     +       }

>     +

>     +       if (odp_term_local()) {

>     +               app_err("Error: term local\n");

>     +               exit(EXIT_FAILURE);

>     +       }

>     +

>     +       if (odp_term_global(instance)) {

>     +               app_err("Error: term global\n");

>     +               exit(EXIT_FAILURE);

>     +       }

>     +

>             return 0;

>      }

>

>     --

>     2.7.1.250.gff4ea60

>

>

>

>

> -- 

> Mike Holmes

> Technical Manager - Linaro Networking Group

> Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs

> "Work should be fun and collaborative, the rest follows"

>
diff mbox

Patch

diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c
index 404984d..b7818ea 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -545,9 +545,11 @@  run_measure_one(crypto_args_t *cargs,
 				 * every time.
 				 * Note we leaked one packet here.
 				 */
-				pkt = odp_packet_alloc(pkt_pool,
-						       payload_length);
-				if (pkt == ODP_PACKET_INVALID) {
+				odp_packet_t newpkt;
+
+				newpkt = odp_packet_alloc(pkt_pool,
+							  payload_length);
+				if (newpkt == ODP_PACKET_INVALID) {
 					app_err("failed to allocate buffer\n");
 					return -1;
 				} else {
@@ -555,8 +557,8 @@  run_measure_one(crypto_args_t *cargs,
 
 					memset(mem, 1, payload_length);
 				}
-				params.pkt = pkt;
-				params.out_pkt = cargs->in_place ? pkt :
+				params.pkt = newpkt;
+				params.out_pkt = cargs->in_place ? newpkt :
 						 ODP_PACKET_INVALID;
 			}
 
@@ -650,6 +652,8 @@  run_measure_one(crypto_args_t *cargs,
 					cargs->iteration_count;
 	}
 
+	odp_packet_free(pkt);
+
 	return rc;
 }
 
@@ -821,6 +825,21 @@  int main(int argc, char *argv[])
 		}
 	}
 
+	if (odp_pool_destroy(pool)) {
+		app_err("Error: pool destroy\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_term_local()) {
+		app_err("Error: term local\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_term_global(instance)) {
+		app_err("Error: term global\n");
+		exit(EXIT_FAILURE);
+	}
+
 	return 0;
 }