app/test: handle -ENOTSUP from session init

Message ID 1588596047-14965-1-git-send-email-adwivedi@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series app/test: handle -ENOTSUP from session init |

Checks

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

Commit Message

Ankur Dwivedi May 4, 2020, 12:40 p.m. UTC
  The session init routine rte_cryptodev_sym_session_init(),
could return -ENOTSUP when the requested algo combination
is not supported by the PMD. This should be treated as
unsupported features. For other return values like -EINVAL
or -ENOMEM the test can be treated as failure.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 app/test/test_cryptodev_blockcipher.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Anoob Joseph May 4, 2020, 1:05 p.m. UTC | #1
> The session init routine rte_cryptodev_sym_session_init(), could return -
> ENOTSUP when the requested algo combination is not supported by the PMD.
> This should be treated as unsupported features. For other return values like -
> EINVAL or -ENOMEM the test can be treated as failure.
> 
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>

Acked-by: Anoob Joseph <anoobj@marvell.com> 

> ---
>  app/test/test_cryptodev_blockcipher.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test/test_cryptodev_blockcipher.c
> b/app/test/test_cryptodev_blockcipher.c
> index 473dad9..5717194 100644
> --- a/app/test/test_cryptodev_blockcipher.c
> +++ b/app/test/test_cryptodev_blockcipher.c
> @@ -427,9 +427,11 @@
>  			nb_iterates == 0) {
>  		sess = rte_cryptodev_sym_session_create(sess_mpool);
> 
> -		rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
> -				sess_priv_mpool);
> -		if (!sess) {
> +		status = rte_cryptodev_sym_session_init(dev_id, sess,
> +				init_xform, sess_priv_mpool);
> +		if (status == -ENOTSUP)
> +			goto error_exit;
> +		if (!sess || status < 0) {
>  			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line
> %u "
>  				"FAILED: %s", __LINE__,
>  				"Session creation failed");
> --
> 1.9.3
  

Patch

diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index 473dad9..5717194 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -427,9 +427,11 @@ 
 			nb_iterates == 0) {
 		sess = rte_cryptodev_sym_session_create(sess_mpool);
 
-		rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
-				sess_priv_mpool);
-		if (!sess) {
+		status = rte_cryptodev_sym_session_init(dev_id, sess,
+				init_xform, sess_priv_mpool);
+		if (status == -ENOTSUP)
+			goto error_exit;
+		if (!sess || status < 0) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
 				"Session creation failed");