diff mbox series

[v4,3/3] test/event_crypto: use crypto adapter enqueue API

Message ID 3a6ffaa3fce062ff335ed90c81bdb50b02e7e6fa.1617382596.git.sthotton@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers show
Series Enhancements to crypto adapter forward mode | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Shijith Thotton April 2, 2021, 5:01 p.m. UTC
Use rte_event_crypto_adapter_enqueue() API to enqueue events to crypto
adapter if forward mode is supported in driver.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 app/test/test_event_crypto_adapter.c | 29 +++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

Comments

Gujjar, Abhinandan S April 3, 2021, 11:08 a.m. UTC | #1
> -----Original Message-----
> From: Shijith Thotton <sthotton@marvell.com>
> Sent: Friday, April 2, 2021 10:31 PM
> To: dev@dpdk.org
> Cc: Shijith Thotton <sthotton@marvell.com>; thomas@monjalon.net;
> jerinj@marvell.com; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>;
> hemant.agrawal@nxp.com; nipun.gupta@nxp.com;
> sachin.saxena@oss.nxp.com; anoobj@marvell.com; matan@nvidia.com;
> Zhang, Roy Fan <roy.fan.zhang@intel.com>; g.singh@nxp.com; Carrillo, Erik
> G <erik.g.carrillo@intel.com>; Jayatheerthan, Jay
> <jay.jayatheerthan@intel.com>; pbhagavatula@marvell.com; Van Haaren,
> Harry <harry.van.haaren@intel.com>; Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH v4 3/3] test/event_crypto: use crypto adapter enqueue API
> 
> Use rte_event_crypto_adapter_enqueue() API to enqueue events to crypto
> adapter if forward mode is supported in driver.
> 
> Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> ---
>  app/test/test_event_crypto_adapter.c | 29 +++++++++++++++++++---------
>  1 file changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/app/test/test_event_crypto_adapter.c
> b/app/test/test_event_crypto_adapter.c
> index 335211cd8..2b07f1582 100644
> --- a/app/test/test_event_crypto_adapter.c
> +++ b/app/test/test_event_crypto_adapter.c
> @@ -64,6 +64,7 @@ struct event_crypto_adapter_test_params {
>  	struct rte_mempool *session_priv_mpool;
>  	struct rte_cryptodev_config *config;
>  	uint8_t crypto_event_port_id;
> +	uint8_t internal_port_op_fwd;
>  };
> 
>  struct rte_event response_info = {
> @@ -110,9 +111,12 @@ send_recv_ev(struct rte_event *ev)
>  	struct rte_event recv_ev;
>  	int ret;
> 
> -	ret = rte_event_enqueue_burst(evdev, TEST_APP_PORT_ID, ev,
> NUM);
> -	TEST_ASSERT_EQUAL(ret, NUM,
> -			  "Failed to send event to crypto adapter\n");
> +	if (params.internal_port_op_fwd)
> +		ret = rte_event_crypto_adapter_enqueue(evdev,
> TEST_APP_PORT_ID,
> +						       ev, NUM);
> +	else
> +		ret = rte_event_enqueue_burst(evdev,
> TEST_APP_PORT_ID, ev, NUM);
> +	TEST_ASSERT_EQUAL(ret, NUM, "Failed to send event to crypto
> +adapter\n");
> 
>  	while (rte_event_dequeue_burst(evdev,
>  			TEST_APP_PORT_ID, &recv_ev, NUM, 0) == 0) @@ -
> 741,6 +745,11 @@ configure_event_crypto_adapter(enum
> rte_event_crypto_adapter_mode mode)
>  	ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
> &cap);
>  	TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
> 
> +	if (cap &
> RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD)
> +		params.internal_port_op_fwd = 1;
> +	else
> +		params.internal_port_op_fwd = 0;
> +
There is a check at line 760 for FWD mode. Can't this be set there?

>  	/* Skip mode and capability mismatch check for SW eventdev */
>  	if (!(cap &
> RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW) &&
>  	    !(cap &
> RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) && @@ -
> 771,9 +780,11 @@ configure_event_crypto_adapter(enum
> rte_event_crypto_adapter_mode mode)
> 
>  	TEST_ASSERT_SUCCESS(ret, "Failed to add queue pair\n");
> 
> -	ret =
> rte_event_crypto_adapter_event_port_get(TEST_ADAPTER_ID,
> -				&params.crypto_event_port_id);
> -	TEST_ASSERT_SUCCESS(ret, "Failed to get event port\n");
> +	if (!params.internal_port_op_fwd) {
> +		ret =
> rte_event_crypto_adapter_event_port_get(TEST_ADAPTER_ID,
> +
> 	&params.crypto_event_port_id);
> +		TEST_ASSERT_SUCCESS(ret, "Failed to get event port\n");
> +	}
> 
>  	return TEST_SUCCESS;
>  }
> @@ -809,15 +820,15 @@ test_crypto_adapter_conf(enum
> rte_event_crypto_adapter_mode mode)
> 
>  	if (!crypto_adapter_setup_done) {
>  		ret = configure_event_crypto_adapter(mode);
> -		if (!ret) {
> +		if (ret)
> +			return ret;
> +		if (!params.internal_port_op_fwd) {
>  			qid = TEST_CRYPTO_EV_QUEUE_ID;
>  			ret = rte_event_port_link(evdev,
>  				params.crypto_event_port_id, &qid, NULL,
> 1);
>  			TEST_ASSERT(ret >= 0, "Failed to link queue %d "
>  					"port=%u\n", qid,
>  					params.crypto_event_port_id);
> -		} else {
> -			return ret;
>  		}
>  		crypto_adapter_setup_done = 1;
>  	}
> --
> 2.25.1
Shijith Thotton April 5, 2021, 6:10 a.m. UTC | #2
On Sat, Apr 03, 2021 at 11:08:28AM +0000, Gujjar, Abhinandan S wrote:
> 
> 
> > -----Original Message-----
> > From: Shijith Thotton <sthotton@marvell.com>
> > Sent: Friday, April 2, 2021 10:31 PM
> > To: dev@dpdk.org
> > Cc: Shijith Thotton <sthotton@marvell.com>; thomas@monjalon.net;
> > jerinj@marvell.com; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>;
> > hemant.agrawal@nxp.com; nipun.gupta@nxp.com;
> > sachin.saxena@oss.nxp.com; anoobj@marvell.com; matan@nvidia.com;
> > Zhang, Roy Fan <roy.fan.zhang@intel.com>; g.singh@nxp.com; Carrillo, Erik
> > G <erik.g.carrillo@intel.com>; Jayatheerthan, Jay
> > <jay.jayatheerthan@intel.com>; pbhagavatula@marvell.com; Van Haaren,
> > Harry <harry.van.haaren@intel.com>; Akhil Goyal <gakhil@marvell.com>
> > Subject: [PATCH v4 3/3] test/event_crypto: use crypto adapter enqueue API
> > 
> > Use rte_event_crypto_adapter_enqueue() API to enqueue events to crypto
> > adapter if forward mode is supported in driver.
> > 
> > Signed-off-by: Shijith Thotton <sthotton@marvell.com>
> > ---
> >  app/test/test_event_crypto_adapter.c | 29 +++++++++++++++++++---------
> >  1 file changed, 20 insertions(+), 9 deletions(-)
> > 
> > diff --git a/app/test/test_event_crypto_adapter.c
> > b/app/test/test_event_crypto_adapter.c
> > index 335211cd8..2b07f1582 100644
> > --- a/app/test/test_event_crypto_adapter.c
> > +++ b/app/test/test_event_crypto_adapter.c
> > @@ -64,6 +64,7 @@ struct event_crypto_adapter_test_params {
> >  	struct rte_mempool *session_priv_mpool;
> >  	struct rte_cryptodev_config *config;
> >  	uint8_t crypto_event_port_id;
> > +	uint8_t internal_port_op_fwd;
> >  };
> > 
> >  struct rte_event response_info = {
> > @@ -110,9 +111,12 @@ send_recv_ev(struct rte_event *ev)
> >  	struct rte_event recv_ev;
> >  	int ret;
> > 
> > -	ret = rte_event_enqueue_burst(evdev, TEST_APP_PORT_ID, ev,
> > NUM);
> > -	TEST_ASSERT_EQUAL(ret, NUM,
> > -			  "Failed to send event to crypto adapter\n");
> > +	if (params.internal_port_op_fwd)
> > +		ret = rte_event_crypto_adapter_enqueue(evdev,
> > TEST_APP_PORT_ID,
> > +						       ev, NUM);
> > +	else
> > +		ret = rte_event_enqueue_burst(evdev,
> > TEST_APP_PORT_ID, ev, NUM);
> > +	TEST_ASSERT_EQUAL(ret, NUM, "Failed to send event to crypto
> > +adapter\n");
> > 
> >  	while (rte_event_dequeue_burst(evdev,
> >  			TEST_APP_PORT_ID, &recv_ev, NUM, 0) == 0) @@ -
> > 741,6 +745,11 @@ configure_event_crypto_adapter(enum
> > rte_event_crypto_adapter_mode mode)
> >  	ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID,
> > &cap);
> >  	TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
> > 
> > +	if (cap &
> > RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD)
> > +		params.internal_port_op_fwd = 1;
> > +	else
> > +		params.internal_port_op_fwd = 0;
> > +
> There is a check at line 760 for FWD mode. Can't this be set there?
>

Yes, I will move it over there.

> >  	/* Skip mode and capability mismatch check for SW eventdev */
> >  	if (!(cap &
> > RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW) &&
> >  	    !(cap &
> > RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) && @@ -
> > 771,9 +780,11 @@ configure_event_crypto_adapter(enum
> > rte_event_crypto_adapter_mode mode)
> > 
> >  	TEST_ASSERT_SUCCESS(ret, "Failed to add queue pair\n");
> > 
> > -	ret =
> > rte_event_crypto_adapter_event_port_get(TEST_ADAPTER_ID,
> > -				&params.crypto_event_port_id);
> > -	TEST_ASSERT_SUCCESS(ret, "Failed to get event port\n");
> > +	if (!params.internal_port_op_fwd) {
> > +		ret =
> > rte_event_crypto_adapter_event_port_get(TEST_ADAPTER_ID,
> > +
> > 	&params.crypto_event_port_id);
> > +		TEST_ASSERT_SUCCESS(ret, "Failed to get event port\n");
> > +	}
> > 
> >  	return TEST_SUCCESS;
> >  }
> > @@ -809,15 +820,15 @@ test_crypto_adapter_conf(enum
> > rte_event_crypto_adapter_mode mode)
> > 
> >  	if (!crypto_adapter_setup_done) {
> >  		ret = configure_event_crypto_adapter(mode);
> > -		if (!ret) {
> > +		if (ret)
> > +			return ret;
> > +		if (!params.internal_port_op_fwd) {
> >  			qid = TEST_CRYPTO_EV_QUEUE_ID;
> >  			ret = rte_event_port_link(evdev,
> >  				params.crypto_event_port_id, &qid, NULL,
> > 1);
> >  			TEST_ASSERT(ret >= 0, "Failed to link queue %d "
> >  					"port=%u\n", qid,
> >  					params.crypto_event_port_id);
> > -		} else {
> > -			return ret;
> >  		}
> >  		crypto_adapter_setup_done = 1;
> >  	}
> > --
> > 2.25.1
>
diff mbox series

Patch

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 335211cd8..2b07f1582 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -64,6 +64,7 @@  struct event_crypto_adapter_test_params {
 	struct rte_mempool *session_priv_mpool;
 	struct rte_cryptodev_config *config;
 	uint8_t crypto_event_port_id;
+	uint8_t internal_port_op_fwd;
 };
 
 struct rte_event response_info = {
@@ -110,9 +111,12 @@  send_recv_ev(struct rte_event *ev)
 	struct rte_event recv_ev;
 	int ret;
 
-	ret = rte_event_enqueue_burst(evdev, TEST_APP_PORT_ID, ev, NUM);
-	TEST_ASSERT_EQUAL(ret, NUM,
-			  "Failed to send event to crypto adapter\n");
+	if (params.internal_port_op_fwd)
+		ret = rte_event_crypto_adapter_enqueue(evdev, TEST_APP_PORT_ID,
+						       ev, NUM);
+	else
+		ret = rte_event_enqueue_burst(evdev, TEST_APP_PORT_ID, ev, NUM);
+	TEST_ASSERT_EQUAL(ret, NUM, "Failed to send event to crypto adapter\n");
 
 	while (rte_event_dequeue_burst(evdev,
 			TEST_APP_PORT_ID, &recv_ev, NUM, 0) == 0)
@@ -741,6 +745,11 @@  configure_event_crypto_adapter(enum rte_event_crypto_adapter_mode mode)
 	ret = rte_event_crypto_adapter_caps_get(evdev, TEST_CDEV_ID, &cap);
 	TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
 
+	if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD)
+		params.internal_port_op_fwd = 1;
+	else
+		params.internal_port_op_fwd = 0;
+
 	/* Skip mode and capability mismatch check for SW eventdev */
 	if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW) &&
 	    !(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) &&
@@ -771,9 +780,11 @@  configure_event_crypto_adapter(enum rte_event_crypto_adapter_mode mode)
 
 	TEST_ASSERT_SUCCESS(ret, "Failed to add queue pair\n");
 
-	ret = rte_event_crypto_adapter_event_port_get(TEST_ADAPTER_ID,
-				&params.crypto_event_port_id);
-	TEST_ASSERT_SUCCESS(ret, "Failed to get event port\n");
+	if (!params.internal_port_op_fwd) {
+		ret = rte_event_crypto_adapter_event_port_get(TEST_ADAPTER_ID,
+						&params.crypto_event_port_id);
+		TEST_ASSERT_SUCCESS(ret, "Failed to get event port\n");
+	}
 
 	return TEST_SUCCESS;
 }
@@ -809,15 +820,15 @@  test_crypto_adapter_conf(enum rte_event_crypto_adapter_mode mode)
 
 	if (!crypto_adapter_setup_done) {
 		ret = configure_event_crypto_adapter(mode);
-		if (!ret) {
+		if (ret)
+			return ret;
+		if (!params.internal_port_op_fwd) {
 			qid = TEST_CRYPTO_EV_QUEUE_ID;
 			ret = rte_event_port_link(evdev,
 				params.crypto_event_port_id, &qid, NULL, 1);
 			TEST_ASSERT(ret >= 0, "Failed to link queue %d "
 					"port=%u\n", qid,
 					params.crypto_event_port_id);
-		} else {
-			return ret;
 		}
 		crypto_adapter_setup_done = 1;
 	}