[v2,3/3] test/event_crypto_adapter: free resources during exit

Message ID 20200925072841.17578-4-adwivedi@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series Bug fixes in event crypto adapter test application |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Ankur Dwivedi Sept. 25, 2020, 7:28 a.m. UTC
  The resources held by crypto adapter should be freed when the
test suite exits.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 app/test/test_event_crypto_adapter.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
  

Comments

Gujjar, Abhinandan S Oct. 6, 2020, 10:21 a.m. UTC | #1
Hi Ankur,

Please see comment below.

> -----Original Message-----
> From: Ankur Dwivedi <adwivedi@marvell.com>
> Sent: Friday, September 25, 2020 12:59 PM
> To: dev@dpdk.org
> Cc: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>;
> jerinj@marvell.com; anoobj@marvell.com; Ankur Dwivedi
> <adwivedi@marvell.com>
> Subject: [PATCH v2 3/3] test/event_crypto_adapter: free resources during
> exit
> 
> The resources held by crypto adapter should be freed when the test suite
> exits.
> 
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> ---
>  app/test/test_event_crypto_adapter.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/app/test/test_event_crypto_adapter.c
> b/app/test/test_event_crypto_adapter.c
> index 572ef9c27..4b09ab3b7 100644
> --- a/app/test/test_event_crypto_adapter.c
> +++ b/app/test/test_event_crypto_adapter.c
> @@ -899,6 +899,20 @@ testsuite_setup(void)
>  	return TEST_SUCCESS;
>  }
> 
> +static void
> +crypto_adapter_teardown(void)
> +{
> +	int ret;
> +
> +	crypto_adapter_setup_done = 0;
Call rte_event_crypto_adapter_stop() here?
> +	ret =
> rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
> +					TEST_CDEV_ID, TEST_CDEV_QP_ID);
> +	if (ret < 0)
> +		RTE_LOG(ERR, USER1, "Failed to delete queue pair!");
> +
> +	rte_event_crypto_adapter_free(TEST_ADAPTER_ID);
> +}
> +
>  static void
>  crypto_teardown(void)
>  {
> @@ -941,6 +955,7 @@ eventdev_teardown(void)  static void
>  testsuite_teardown(void)
>  {
> +	crypto_adapter_teardown();
>  	crypto_teardown();
>  	eventdev_teardown();
>  }
> --
> 2.28.0
  
Gujjar, Abhinandan S Oct. 6, 2020, 10:29 a.m. UTC | #2
> -----Original Message-----
> From: Gujjar, Abhinandan S
> Sent: Tuesday, October 6, 2020 3:52 PM
> To: 'Ankur Dwivedi' <adwivedi@marvell.com>; dev@dpdk.org
> Cc: jerinj@marvell.com; anoobj@marvell.com
> Subject: RE: [PATCH v2 3/3] test/event_crypto_adapter: free resources
> during exit
> 
> Hi Ankur,
> 
> Please see comment below.
> 
> > -----Original Message-----
> > From: Ankur Dwivedi <adwivedi@marvell.com>
> > Sent: Friday, September 25, 2020 12:59 PM
> > To: dev@dpdk.org
> > Cc: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>;
> > jerinj@marvell.com; anoobj@marvell.com; Ankur Dwivedi
> > <adwivedi@marvell.com>
> > Subject: [PATCH v2 3/3] test/event_crypto_adapter: free resources
> > during exit
> >
> > The resources held by crypto adapter should be freed when the test
> > suite exits.
> >
> > Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> > ---
> >  app/test/test_event_crypto_adapter.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/app/test/test_event_crypto_adapter.c
> > b/app/test/test_event_crypto_adapter.c
> > index 572ef9c27..4b09ab3b7 100644
> > --- a/app/test/test_event_crypto_adapter.c
> > +++ b/app/test/test_event_crypto_adapter.c
> > @@ -899,6 +899,20 @@ testsuite_setup(void)
> >  	return TEST_SUCCESS;
> >  }
> >
> > +static void
> > +crypto_adapter_teardown(void)
> > +{
> > +	int ret;
> > +

Below APIs could return error. So, set this flag at the end?
> > +	crypto_adapter_setup_done = 0; 

> Call rte_event_crypto_adapter_stop() here?
> > +	ret =
> > rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
> > +					TEST_CDEV_ID, TEST_CDEV_QP_ID);
> > +	if (ret < 0)
> > +		RTE_LOG(ERR, USER1, "Failed to delete queue pair!");
> > +
> > +	rte_event_crypto_adapter_free(TEST_ADAPTER_ID);
> > +}
> > +
> >  static void
> >  crypto_teardown(void)
> >  {
> > @@ -941,6 +955,7 @@ eventdev_teardown(void)  static void
> >  testsuite_teardown(void)
> >  {
> > +	crypto_adapter_teardown();
> >  	crypto_teardown();
> >  	eventdev_teardown();
> >  }
> > --
> > 2.28.0
  
Ankur Dwivedi Oct. 6, 2020, 1 p.m. UTC | #3
Hi Abhinandan,

Please see my comments inline.

Thanks
Ankur

>-----Original Message-----
>From: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
>Sent: Tuesday, October 6, 2020 4:00 PM
>To: Ankur Dwivedi <adwivedi@marvell.com>; dev@dpdk.org
>Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Anoob Joseph
><anoobj@marvell.com>
>Subject: [EXT] RE: [PATCH v2 3/3] test/event_crypto_adapter: free resources
>during exit
>
>External Email
>
>----------------------------------------------------------------------
>
>
>> -----Original Message-----
>> From: Gujjar, Abhinandan S
>> Sent: Tuesday, October 6, 2020 3:52 PM
>> To: 'Ankur Dwivedi' <adwivedi@marvell.com>; dev@dpdk.org
>> Cc: jerinj@marvell.com; anoobj@marvell.com
>> Subject: RE: [PATCH v2 3/3] test/event_crypto_adapter: free resources
>> during exit
>>
>> Hi Ankur,
>>
>> Please see comment below.
>>
>> > -----Original Message-----
>> > From: Ankur Dwivedi <adwivedi@marvell.com>
>> > Sent: Friday, September 25, 2020 12:59 PM
>> > To: dev@dpdk.org
>> > Cc: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>;
>> > jerinj@marvell.com; anoobj@marvell.com; Ankur Dwivedi
>> > <adwivedi@marvell.com>
>> > Subject: [PATCH v2 3/3] test/event_crypto_adapter: free resources
>> > during exit
>> >
>> > The resources held by crypto adapter should be freed when the test
>> > suite exits.
>> >
>> > Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
>> > ---
>> >  app/test/test_event_crypto_adapter.c | 15 +++++++++++++++
>> >  1 file changed, 15 insertions(+)
>> >
>> > diff --git a/app/test/test_event_crypto_adapter.c
>> > b/app/test/test_event_crypto_adapter.c
>> > index 572ef9c27..4b09ab3b7 100644
>> > --- a/app/test/test_event_crypto_adapter.c
>> > +++ b/app/test/test_event_crypto_adapter.c
>> > @@ -899,6 +899,20 @@ testsuite_setup(void)
>> >  	return TEST_SUCCESS;
>> >  }
>> >
>> > +static void
>> > +crypto_adapter_teardown(void)
>> > +{
>> > +	int ret;
>> > +
>
>Below APIs could return error. So, set this flag at the end?
[Ankur] Will make the change in v3.
>> > +	crypto_adapter_setup_done = 0;
>
>> Call rte_event_crypto_adapter_stop() here?
[Ankur] Will make the change in v3.
>> > +	ret =
>> > rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
>> > +					TEST_CDEV_ID, TEST_CDEV_QP_ID);
>> > +	if (ret < 0)
>> > +		RTE_LOG(ERR, USER1, "Failed to delete queue pair!");
>> > +
>> > +	rte_event_crypto_adapter_free(TEST_ADAPTER_ID);
>> > +}
>> > +
>> >  static void
>> >  crypto_teardown(void)
>> >  {
>> > @@ -941,6 +955,7 @@ eventdev_teardown(void)  static void
>> >  testsuite_teardown(void)
>> >  {
>> > +	crypto_adapter_teardown();
>> >  	crypto_teardown();
>> >  	eventdev_teardown();
>> >  }
>> > --
>> > 2.28.0
  

Patch

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 572ef9c27..4b09ab3b7 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -899,6 +899,20 @@  testsuite_setup(void)
 	return TEST_SUCCESS;
 }
 
+static void
+crypto_adapter_teardown(void)
+{
+	int ret;
+
+	crypto_adapter_setup_done = 0;
+	ret = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+					TEST_CDEV_ID, TEST_CDEV_QP_ID);
+	if (ret < 0)
+		RTE_LOG(ERR, USER1, "Failed to delete queue pair!");
+
+	rte_event_crypto_adapter_free(TEST_ADAPTER_ID);
+}
+
 static void
 crypto_teardown(void)
 {
@@ -941,6 +955,7 @@  eventdev_teardown(void)
 static void
 testsuite_teardown(void)
 {
+	crypto_adapter_teardown();
 	crypto_teardown();
 	eventdev_teardown();
 }