Skip to contentSkip to conversation

app/test: handle -ENOTSUP from session init

PATCH In review Ankur Dwivedi 3 participants 4 messages May 4, 2020 – May 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/test: handle -ENOTSUP from session init

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.

---
 app/test/test_cryptodev_blockcipher.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
app/test/test_cryptodev_blockcipher.c +5 -3
index 473dad9..5717194 100644
@@ -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");
Signature · 1 line
1.9.3
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines

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.

Quoted 27 lines
---
 app/test/test_cryptodev_blockcipher.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
app/test/test_cryptodev_blockcipher.c +5 -3
index 473dad9..5717194 100644
@@ -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 "

app/test/test_cryptodev_blockcipher.c +0 -1
 				"FAILED: %s", __LINE__,
 				"Session creation failed");
--

1.9.3

#2 lore raw

PATCH 1/1 app/test: handle -ENOTSUP from session init

In reply to Ankur Dwivedi

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.

---
v2:
* Updated test_msg to print UNSUPPORTED for the test case.

 app/test/test_cryptodev_blockcipher.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
app/test/test_cryptodev_blockcipher.c +7 -3
index 473dad9..3ea1175 100644
@@ -427,9 +427,13 @@
 			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) {
+			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "UNSUPPORTED");
+			goto error_exit;
+		}
+		if (!sess || status < 0) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
 				"Session creation failed");
Signature · 1 line
1.9.3
Applied
#3 lore raw
Quoted 9 lines

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.

Applied to dpdk-next-crypto

Thanks.