From: Pablo de Lara Date: Sun, 2 Jul 2017 05:41:02 +0000 (+0100) Subject: cryptodev: move session type to generic crypto op X-Git-Tag: spdx-start~2698 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5209df0d3311e1fce783c86b4b39343ce927378e;p=dpdk.git cryptodev: move session type to generic crypto op Session type (operation with or without session) is not something specific to symmetric operations. Therefore, the variable is moved to the generic crypto operation structure. Since this is an ABI change, the cryptodev library version gets bumped. Signed-off-by: Pablo de Lara Acked-by: Declan Doherty Acked-by: Akhil Goyal Acked-by: Fiona Trahe --- diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 4f98f28cab..229cb7a27d 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -1,5 +1,5 @@ .. BSD LICENSE - Copyright(c) 2016 Intel Corporation. All rights reserved. + Copyright(c) 2016-2017 Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -359,11 +359,12 @@ Crypto operation to be processed on a particular Crypto device poll mode driver. .. figure:: img/crypto_op.* -The operation structure includes the operation type and the operation status, -a reference to the operation specific data, which can vary in size and content -depending on the operation being provisioned. It also contains the source -mempool for the operation, if it allocate from a mempool. Finally an -opaque pointer for user specific data is provided. +The operation structure includes the operation type, the operation status +and the session type (session-based/less), a reference to the operation +specific data, which can vary in size and content depending on the operation +being provisioned. It also contains the source mempool for the operation, +if it allocate from a mempool. Finally an opaque pointer for user specific +data is provided. If Crypto operations are allocated from a Crypto operation mempool, see next section, there is also the ability to allocate private memory with the @@ -512,9 +513,9 @@ buffer. It is used for either cipher, authentication, AEAD and chained operations. As a minimum the symmetric operation must have a source data buffer (``m_src``), -the session type (session-based/less), a valid session (or transform chain if in -session-less mode) and the minimum authentication/ cipher parameters required -depending on the type of operation specified in the session or the transform +a valid session (or transform chain if in session-less mode) and the minimum +authentication/ cipher parameters required depending on the type of operation +specified in the session or the transform chain. .. code-block:: c @@ -523,8 +524,6 @@ chain. struct rte_mbuf *m_src; struct rte_mbuf *m_dst; - enum rte_crypto_sym_op_sess_type type; - union { struct rte_cryptodev_sym_session *session; /**< Handle for the initialised session context */ diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 2e708dbe0d..511a898003 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -86,10 +86,6 @@ Deprecation Notices - ``rte_cryptodev_queue_pair_attach_sym_session`` - ``rte_cryptodev_queue_pair_detach_sym_session`` -* cryptodev: the structures ``rte_crypto_op``, ``rte_crypto_sym_op`` - and ``rte_crypto_sym_xform`` will be restructured in 17.08, - for correctness and improvement. - * librte_table: The ``key_mask`` parameter will be added to all the hash tables that currently do not have it, as well as to the hash compute function prototype. The non-"do-sig" versions of the hash tables will be removed diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst index 9b33da2f56..4e6a8bd5da 100644 --- a/doc/guides/rel_notes/release_17_08.rst +++ b/doc/guides/rel_notes/release_17_08.rst @@ -85,6 +85,18 @@ New Features Added support for firmwares with multiple Ethernet ports per physical port. +* **Reorganized the symmetric crypto operation structure.** + + The crypto operation (``rte_crypto_sym_op``) has been reorganized as follows: + + * Removed field ``rte_crypto_sym_op_sess_type``. + +* **Reorganized the crypto operation structure.** + + The crypto operation (``rte_crypto_op``) has been reorganized as follows: + + * Added field ``rte_crypto_op_sess_type``. + Resolved Issues --------------- @@ -168,6 +180,10 @@ ABI Changes Also, make sure to start the actual text at the margin. ========================================================= +* **Reorganized the crypto operation structures.** + + Some fields have been modified in the ``rte_crypto_op`` and ``rte_crypto_sym_op`` + structures, as described in the `New Features`_ section. Shared Library Versions @@ -192,7 +208,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_bitratestats.so.1 librte_cfgfile.so.2 librte_cmdline.so.2 - librte_cryptodev.so.2 + + librte_cryptodev.so.3 librte_distributor.so.1 librte_eal.so.4 librte_ethdev.so.6 diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index 1b95c23624..92a5027c7c 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -139,16 +139,17 @@ aesni_gcm_set_session_parameters(struct aesni_gcm_session *sess, /** Get gcm session */ static struct aesni_gcm_session * -aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_sym_op *op) +aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op) { struct aesni_gcm_session *sess = NULL; + struct rte_crypto_sym_op *sym_op = op->sym; - if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->session->dev_type + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { + if (unlikely(sym_op->session->dev_type != RTE_CRYPTODEV_AESNI_GCM_PMD)) return sess; - sess = (struct aesni_gcm_session *)op->session->_private; + sess = (struct aesni_gcm_session *)sym_op->session->_private; } else { void *_sess; @@ -159,7 +160,7 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_sym_op *op) ((struct rte_cryptodev_sym_session *)_sess)->_private; if (unlikely(aesni_gcm_set_session_parameters(sess, - op->xform) != 0)) { + sym_op->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); sess = NULL; } @@ -372,7 +373,7 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp, post_process_gcm_crypto_op(op); /* Free session if a session-less crypto op */ - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; } @@ -393,7 +394,7 @@ aesni_gcm_pmd_dequeue_burst(void *queue_pair, for (i = 0; i < nb_dequeued; i++) { - sess = aesni_gcm_get_session(qp, ops[i]->sym); + sess = aesni_gcm_get_session(qp, ops[i]); if (unlikely(sess == NULL)) { ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; qp->qp_stats.dequeue_err_count++; diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index a033889191..fa8112ae30 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015-2016 Intel Corporation. All rights reserved. + * Copyright(c) 2015-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -345,7 +345,7 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) { struct aesni_mb_session *sess = NULL; - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { if (unlikely(op->sym->session->dev_type != RTE_CRYPTODEV_AESNI_MB_PMD)) { return NULL; @@ -541,7 +541,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job) } /* Free session if a session-less crypto op */ - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; } diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c index 83dae87010..4a79b61d30 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd.c +++ b/drivers/crypto/armv8/rte_armv8_pmd.c @@ -545,7 +545,7 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op) { struct armv8_crypto_session *sess = NULL; - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { /* get existing session */ if (likely(op->sym->session != NULL && op->sym->session->dev_type == @@ -700,7 +700,7 @@ process_op(const struct armv8_crypto_qp *qp, struct rte_crypto_op *op, } /* Free session if a session-less crypto op */ - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { memset(sess, 0, sizeof(struct armv8_crypto_session)); rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index e32b27ee46..e1543951c6 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -437,7 +437,7 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, if (unlikely(nb_ops == 0)) return 0; - if (ops[0]->sym->sess_type != RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (ops[0]->sess_type != RTE_CRYPTO_OP_WITH_SESSION) { RTE_LOG(ERR, PMD, "sessionless crypto op not supported\n"); return 0; } diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 87e8cc3ffa..7edf81907c 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -143,7 +143,7 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op) { struct kasumi_session *sess; - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { if (unlikely(op->sym->session->dev_type != RTE_CRYPTODEV_KASUMI_PMD)) return NULL; @@ -353,7 +353,7 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session, if (ops[i]->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS; /* Free session if a session-less crypto op. */ - if (ops[i]->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, ops[i]->sym->session); ops[i]->sym->session = NULL; } @@ -405,7 +405,7 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session, op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; /* Free session if a session-less crypto op. */ - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; } diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index 53bdc3ed3d..39dffea8eb 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -90,16 +90,17 @@ process_op(const struct null_crypto_qp *qp, struct rte_crypto_op *op, } static struct null_crypto_session * -get_session(struct null_crypto_qp *qp, struct rte_crypto_sym_op *op) +get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op) { struct null_crypto_session *sess; + struct rte_crypto_sym_op *sym_op = op->sym; - if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->session == NULL || - op->session->dev_type != RTE_CRYPTODEV_NULL_PMD)) + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { + if (unlikely(sym_op->session == NULL || + sym_op->session->dev_type != RTE_CRYPTODEV_NULL_PMD)) return NULL; - sess = (struct null_crypto_session *)op->session->_private; + sess = (struct null_crypto_session *)sym_op->session->_private; } else { struct rte_cryptodev_session *c_sess = NULL; @@ -108,7 +109,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_sym_op *op) sess = (struct null_crypto_session *)c_sess->_private; - if (null_crypto_set_session_parameters(sess, op->xform) != 0) + if (null_crypto_set_session_parameters(sess, sym_op->xform) != 0) return NULL; } @@ -126,7 +127,7 @@ null_crypto_pmd_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops, int i, retval; for (i = 0; i < nb_ops; i++) { - sess = get_session(qp, ops[i]->sym); + sess = get_session(qp, ops[i]); if (unlikely(sess == NULL)) goto enqueue_err; diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 5d29171dd4..bfc237122e 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -446,7 +446,7 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op) { struct openssl_session *sess = NULL; - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { /* get existing session */ if (likely(op->sym->session != NULL && op->sym->session->dev_type == @@ -1196,7 +1196,7 @@ process_op(const struct openssl_qp *qp, struct rte_crypto_op *op, } /* Free session if a session-less crypto op */ - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { openssl_reset_session(sess); memset(sess, 0, sizeof(struct openssl_session)); rte_mempool_put(qp->sess_mp, op->sym->session); diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index f8e1d014c5..e05c31630d 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015-2016 Intel Corporation. All rights reserved. + * Copyright(c) 2015-2017 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -908,7 +908,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg, return -EINVAL; } #endif - if (unlikely(op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS)) { + if (unlikely(op->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) { PMD_DRV_LOG(ERR, "QAT PMD only supports session oriented" " requests, op (%p) is sessionless.", op); return -EINVAL; diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index 7151c21bdc..a8bcd9d41e 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -143,7 +143,7 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op) { struct snow3g_session *sess; - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { if (unlikely(op->sym->session->dev_type != RTE_CRYPTODEV_SNOW3G_PMD)) return NULL; @@ -357,7 +357,7 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session, if (ops[i]->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS; /* Free session if a session-less crypto op. */ - if (ops[i]->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, ops[i]->sym->session); ops[i]->sym->session = NULL; } @@ -409,7 +409,7 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session, op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; /* Free session if a session-less crypto op. */ - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; } diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c index ada4b687c6..25a959f7d9 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -142,7 +142,7 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op) { struct zuc_session *sess; - if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { if (unlikely(op->sym->session->dev_type != RTE_CRYPTODEV_ZUC_PMD)) return NULL; @@ -333,7 +333,7 @@ process_ops(struct rte_crypto_op **ops, struct zuc_session *session, if (ops[i]->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS; /* Free session if a session-less crypto op. */ - if (ops[i]->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, ops[i]->sym->session); ops[i]->sym->session = NULL; } diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index fc000ac6db..6ac331bc90 100644 --- a/lib/librte_cryptodev/Makefile +++ b/lib/librte_cryptodev/Makefile @@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_cryptodev.a # library version -LIBABIVER := 2 +LIBABIVER := 3 # build flags CFLAGS += -O3 diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte_crypto.h index 901951888c..b816b45580 100644 --- a/lib/librte_cryptodev/rte_crypto.h +++ b/lib/librte_cryptodev/rte_crypto.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -81,6 +81,16 @@ enum rte_crypto_op_status { /**< Error handling operation */ }; +/** + * Crypto operation session type. This is used to specify whether a crypto + * operation has session structure attached for immutable parameters or if all + * operation information is included in the operation data structure. + */ +enum rte_crypto_op_sess_type { + RTE_CRYPTO_OP_WITH_SESSION, /**< Session based crypto operation */ + RTE_CRYPTO_OP_SESSIONLESS /**< Session-less crypto operation */ +}; + /** * Cryptographic Operation. * @@ -102,6 +112,8 @@ struct rte_crypto_op { * will be set to RTE_CRYPTO_OP_STATUS_SUCCESS after crypto operation * is successfully processed by a crypto PMD */ + enum rte_crypto_op_sess_type sess_type; + /**< operation session type */ struct rte_mempool *mempool; /**< crypto operation mempool which operation is allocated from */ @@ -130,6 +142,7 @@ __rte_crypto_op_reset(struct rte_crypto_op *op, enum rte_crypto_op_type type) { op->type = type; op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; + op->sess_type = RTE_CRYPTO_OP_SESSIONLESS; switch (type) { case RTE_CRYPTO_OP_TYPE_SYMMETRIC: @@ -407,6 +420,8 @@ rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC)) return -1; + op->sess_type = RTE_CRYPTO_OP_WITH_SESSION; + return __rte_crypto_sym_op_attach_sym_session(op->sym, sess); } diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index 3a40844810..5950e866c6 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2016-2017 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -376,17 +376,6 @@ struct rte_crypto_sym_xform { }; }; -/** - * Crypto operation session type. This is used to specify whether a crypto - * operation has session structure attached for immutable parameters or if all - * operation information is included in the operation data structure. - */ -enum rte_crypto_sym_op_sess_type { - RTE_CRYPTO_SYM_OP_WITH_SESSION, /**< Session based crypto operation */ - RTE_CRYPTO_SYM_OP_SESSIONLESS /**< Session-less crypto operation */ -}; - - struct rte_cryptodev_sym_session; /** @@ -423,8 +412,6 @@ struct rte_crypto_sym_op { struct rte_mbuf *m_src; /**< source mbuf */ struct rte_mbuf *m_dst; /**< destination mbuf */ - enum rte_crypto_sym_op_sess_type sess_type; - RTE_STD_C11 union { struct rte_cryptodev_sym_session *session; @@ -665,8 +652,6 @@ static inline void __rte_crypto_sym_op_reset(struct rte_crypto_sym_op *op) { memset(op, 0, sizeof(*op)); - - op->sess_type = RTE_CRYPTO_SYM_OP_SESSIONLESS; } @@ -708,7 +693,6 @@ __rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op, struct rte_cryptodev_sym_session *sess) { sym_op->session = sess; - sym_op->sess_type = RTE_CRYPTO_SYM_OP_WITH_SESSION; return 0; } diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 8766cad020..25c6650a04 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -5556,8 +5556,8 @@ test_AES_GCM_authenticated_encryption_sessionless( ut_params->op->sym->m_src = ut_params->ibuf; - TEST_ASSERT_EQUAL(ut_params->op->sym->sess_type, - RTE_CRYPTO_SYM_OP_SESSIONLESS, + TEST_ASSERT_EQUAL(ut_params->op->sess_type, + RTE_CRYPTO_OP_SESSIONLESS, "crypto op session type not sessionless"); /* Process crypto operation */ @@ -5636,8 +5636,8 @@ test_AES_GCM_authenticated_decryption_sessionless( ut_params->op->sym->m_src = ut_params->ibuf; - TEST_ASSERT_EQUAL(ut_params->op->sym->sess_type, - RTE_CRYPTO_SYM_OP_SESSIONLESS, + TEST_ASSERT_EQUAL(ut_params->op->sess_type, + RTE_CRYPTO_OP_SESSIONLESS, "crypto op session type not sessionless"); /* Process crypto operation */