crypto/qat: rename functions for consistency
authorFiona Trahe <fiona.trahe@intel.com>
Wed, 13 Jun 2018 12:13:50 +0000 (14:13 +0200)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 27 Jun 2018 23:25:33 +0000 (01:25 +0200)
Rename fn names to shorten them, i.e.
  qat_crypto_sym_xxx to qat_sym_xxx
  _content_desc_ to _cd_
Renaming symmetric crypto specific with consistent names:
  qat_crypto_set_session_parameters->qat_sym_set_session_parameters
  qat_write_hw_desc_entry()->qat_sym_build_request()
  qat_alg_xxx ->qat_sym_xxx
  qat_sym_xxx_session_yyy()->qat_sym_session_xxx_yyy()
Removed unused prototypes:
  qat_get_inter_state_size()
  qat_pmd_session_mempool_create()
Removed 2 unnecessary extern declarations

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
drivers/crypto/qat/qat_device.c
drivers/crypto/qat/qat_device.h
drivers/crypto/qat/qat_qp.c
drivers/crypto/qat/qat_sym.c
drivers/crypto/qat/qat_sym.h
drivers/crypto/qat/qat_sym_session.c
drivers/crypto/qat/qat_sym_session.h
drivers/crypto/qat/rte_qat_cryptodev.c

index c2bf9b7..ac6bd1a 100644 (file)
@@ -30,7 +30,7 @@ int qat_dev_close(struct rte_cryptodev *dev)
        PMD_INIT_FUNC_TRACE();
 
        for (i = 0; i < dev->data->nb_queue_pairs; i++) {
-               ret = qat_crypto_sym_qp_release(dev, i);
+               ret = qat_sym_qp_release(dev, i);
                if (ret < 0)
                        return ret;
        }
index 5c48fdb..2cb8e76 100644 (file)
@@ -11,7 +11,7 @@
 
 extern uint8_t cryptodev_qat_driver_id;
 
-extern int qat_crypto_sym_qp_release(struct rte_cryptodev *dev,
+extern int qat_sym_qp_release(struct rte_cryptodev *dev,
        uint16_t queue_pair_id);
 
 /** private data structure for each QAT device */
index 794a8d7..23a9d5f 100644 (file)
@@ -79,7 +79,7 @@ queue_dma_zone_reserve(const char *queue_name, uint32_t queue_size,
                socket_id, RTE_MEMZONE_IOVA_CONTIG, queue_size);
 }
 
-int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
+int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
        const struct rte_cryptodev_qp_conf *qp_conf,
        int socket_id, struct rte_mempool *session_pool __rte_unused)
 {
@@ -93,7 +93,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
 
        /* If qp is already in use free ring memory and qp metadata. */
        if (dev->data->queue_pairs[queue_pair_id] != NULL) {
-               ret = qat_crypto_sym_qp_release(dev, queue_pair_id);
+               ret = qat_sym_qp_release(dev, queue_pair_id);
                if (ret < 0)
                        return ret;
        }
@@ -209,7 +209,7 @@ create_err:
        return -EFAULT;
 }
 
-int qat_crypto_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
+int qat_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)
 {
        struct qat_qp *qp =
                        (struct qat_qp *)dev->data->queue_pairs[queue_pair_id];
index f5d542a..ae521c2 100644 (file)
@@ -87,7 +87,7 @@ static inline uint32_t
 adf_modulo(uint32_t data, uint32_t shift);
 
 static inline int
-qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
+qat_sym_build_request(struct rte_crypto_op *op, uint8_t *out_msg,
                struct qat_crypto_op_cookie *qat_op_cookie, struct qat_qp *qp);
 
 static inline uint32_t
@@ -210,7 +210,7 @@ txq_write_tail(struct qat_qp *qp, struct qat_queue *q) {
 }
 
 uint16_t
-qat_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
+qat_sym_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
                uint16_t nb_ops)
 {
        register struct qat_queue *queue;
@@ -242,7 +242,7 @@ qat_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
        }
 
        while (nb_ops_sent != nb_ops_possible) {
-               ret = qat_write_hw_desc_entry(*cur_op, base_addr + tail,
+               ret = qat_sym_build_request(*cur_op, base_addr + tail,
                        tmp_qp->op_cookies[tail / queue->msg_size], tmp_qp);
                if (ret != 0) {
                        tmp_qp->stats.enqueue_err_count++;
@@ -299,7 +299,7 @@ void rxq_free_desc(struct qat_qp *qp, struct qat_queue *q)
 }
 
 uint16_t
-qat_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops,
+qat_sym_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops,
                uint16_t nb_ops)
 {
        struct qat_queue *rx_queue, *tx_queue;
@@ -456,7 +456,7 @@ set_cipher_iv_ccm(uint16_t iv_length, uint16_t iv_offset,
 }
 
 static inline int
-qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
+qat_sym_build_request(struct rte_crypto_op *op, uint8_t *out_msg,
                struct qat_crypto_op_cookie *qat_op_cookie, struct qat_qp *qp)
 {
        int ret = 0;
@@ -883,7 +883,7 @@ static inline uint32_t adf_modulo(uint32_t data, uint32_t shift)
        return data - mult;
 }
 
-void qat_crypto_sym_stats_get(struct rte_cryptodev *dev,
+void qat_sym_stats_get(struct rte_cryptodev *dev,
                struct rte_cryptodev_stats *stats)
 {
        int i;
@@ -907,7 +907,7 @@ void qat_crypto_sym_stats_get(struct rte_cryptodev *dev,
        }
 }
 
-void qat_crypto_sym_stats_reset(struct rte_cryptodev *dev)
+void qat_sym_stats_reset(struct rte_cryptodev *dev)
 {
        int i;
        struct qat_qp **qp = (struct qat_qp **)(dev->data->queue_pairs);
index e387317..811ba86 100644 (file)
@@ -2,8 +2,8 @@
  * Copyright(c) 2015-2018 Intel Corporation
  */
 
-#ifndef _QAT_CRYPTO_H_
-#define _QAT_CRYPTO_H_
+#ifndef _QAT_SYM_H_
+#define _QAT_SYM_H_
 
 #include <rte_cryptodev_pmd.h>
 #include <rte_memzone.h>
@@ -65,23 +65,23 @@ struct qat_qp {
        enum qat_device_gen qat_dev_gen;
 } __rte_cache_aligned;
 
-void qat_crypto_sym_stats_get(struct rte_cryptodev *dev,
+void qat_sym_stats_get(struct rte_cryptodev *dev,
        struct rte_cryptodev_stats *stats);
-void qat_crypto_sym_stats_reset(struct rte_cryptodev *dev);
+void qat_sym_stats_reset(struct rte_cryptodev *dev);
 
-int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
+int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
        const struct rte_cryptodev_qp_conf *rx_conf, int socket_id,
        struct rte_mempool *session_pool);
-int qat_crypto_sym_qp_release(struct rte_cryptodev *dev,
+int qat_sym_qp_release(struct rte_cryptodev *dev,
        uint16_t queue_pair_id);
 
 
-extern uint16_t
-qat_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
+uint16_t
+qat_sym_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
                uint16_t nb_ops);
 
-extern uint16_t
-qat_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops,
+uint16_t
+qat_sym_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops,
                uint16_t nb_ops);
 
-#endif /* _QAT_CRYPTO_H_ */
+#endif /* _QAT_SYM_H_ */
index 5caac5a..f598d14 100644 (file)
@@ -105,7 +105,7 @@ qat_is_auth_alg_supported(enum rte_crypto_auth_algorithm algo,
 }
 
 void
-qat_crypto_sym_clear_session(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev,
                struct rte_cryptodev_sym_session *sess)
 {
        PMD_INIT_FUNC_TRACE();
@@ -116,7 +116,7 @@ qat_crypto_sym_clear_session(struct rte_cryptodev *dev,
        if (sess_priv) {
                if (s->bpi_ctx)
                        bpi_cipher_ctx_free(s->bpi_ctx);
-               memset(s, 0, qat_crypto_sym_get_session_private_size(dev));
+               memset(s, 0, qat_sym_session_get_private_size(dev));
                struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
 
                set_session_private_data(sess, index, NULL);
@@ -197,7 +197,7 @@ qat_get_cipher_xform(struct rte_crypto_sym_xform *xform)
 }
 
 int
-qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
+qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
                struct rte_crypto_sym_xform *xform,
                struct qat_session *session)
 {
@@ -213,7 +213,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
 
        switch (cipher_xform->algo) {
        case RTE_CRYPTO_CIPHER_AES_CBC:
-               if (qat_alg_validate_aes_key(cipher_xform->key.length,
+               if (qat_sym_validate_aes_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid AES cipher key size");
                        ret = -EINVAL;
@@ -222,7 +222,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                session->qat_mode = ICP_QAT_HW_CIPHER_CBC_MODE;
                break;
        case RTE_CRYPTO_CIPHER_AES_CTR:
-               if (qat_alg_validate_aes_key(cipher_xform->key.length,
+               if (qat_sym_validate_aes_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid AES cipher key size");
                        ret = -EINVAL;
@@ -231,7 +231,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                session->qat_mode = ICP_QAT_HW_CIPHER_CTR_MODE;
                break;
        case RTE_CRYPTO_CIPHER_SNOW3G_UEA2:
-               if (qat_alg_validate_snow3g_key(cipher_xform->key.length,
+               if (qat_sym_validate_snow3g_key(cipher_xform->key.length,
                                        &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid SNOW 3G cipher key size");
                        ret = -EINVAL;
@@ -243,7 +243,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                session->qat_mode = ICP_QAT_HW_CIPHER_ECB_MODE;
                break;
        case RTE_CRYPTO_CIPHER_KASUMI_F8:
-               if (qat_alg_validate_kasumi_key(cipher_xform->key.length,
+               if (qat_sym_validate_kasumi_key(cipher_xform->key.length,
                                        &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid KASUMI cipher key size");
                        ret = -EINVAL;
@@ -252,7 +252,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                session->qat_mode = ICP_QAT_HW_CIPHER_F8_MODE;
                break;
        case RTE_CRYPTO_CIPHER_3DES_CBC:
-               if (qat_alg_validate_3des_key(cipher_xform->key.length,
+               if (qat_sym_validate_3des_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid 3DES cipher key size");
                        ret = -EINVAL;
@@ -261,7 +261,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                session->qat_mode = ICP_QAT_HW_CIPHER_CBC_MODE;
                break;
        case RTE_CRYPTO_CIPHER_DES_CBC:
-               if (qat_alg_validate_des_key(cipher_xform->key.length,
+               if (qat_sym_validate_des_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid DES cipher key size");
                        ret = -EINVAL;
@@ -270,7 +270,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                session->qat_mode = ICP_QAT_HW_CIPHER_CBC_MODE;
                break;
        case RTE_CRYPTO_CIPHER_3DES_CTR:
-               if (qat_alg_validate_3des_key(cipher_xform->key.length,
+               if (qat_sym_validate_3des_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid 3DES cipher key size");
                        ret = -EINVAL;
@@ -288,7 +288,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                        PMD_DRV_LOG(ERR, "failed to create DES BPI ctx");
                        goto error_out;
                }
-               if (qat_alg_validate_des_key(cipher_xform->key.length,
+               if (qat_sym_validate_des_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid DES cipher key size");
                        ret = -EINVAL;
@@ -306,7 +306,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                        PMD_DRV_LOG(ERR, "failed to create AES BPI ctx");
                        goto error_out;
                }
-               if (qat_alg_validate_aes_docsisbpi_key(cipher_xform->key.length,
+               if (qat_sym_validate_aes_docsisbpi_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid AES DOCSISBPI key size");
                        ret = -EINVAL;
@@ -323,7 +323,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                        ret = -ENOTSUP;
                        goto error_out;
                }
-               if (qat_alg_validate_zuc_key(cipher_xform->key.length,
+               if (qat_sym_validate_zuc_key(cipher_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid ZUC cipher key size");
                        ret = -EINVAL;
@@ -352,7 +352,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
        else
                session->qat_dir = ICP_QAT_HW_CIPHER_DECRYPT;
 
-       if (qat_alg_aead_session_create_content_desc_cipher(session,
+       if (qat_sym_session_aead_create_cd_cipher(session,
                                                cipher_xform->key.data,
                                                cipher_xform->key.length)) {
                ret = -EINVAL;
@@ -370,7 +370,7 @@ error_out:
 }
 
 int
-qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
+qat_sym_session_configure(struct rte_cryptodev *dev,
                struct rte_crypto_sym_xform *xform,
                struct rte_cryptodev_sym_session *sess,
                struct rte_mempool *mempool)
@@ -384,7 +384,7 @@ qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
                return -ENOMEM;
        }
 
-       ret = qat_crypto_set_session_parameters(dev, xform, sess_private_data);
+       ret = qat_sym_session_set_parameters(dev, xform, sess_private_data);
        if (ret != 0) {
                PMD_DRV_LOG(ERR,
                    "Crypto QAT PMD: failed to configure session parameters");
@@ -401,7 +401,7 @@ qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
 }
 
 int
-qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
+qat_sym_session_set_parameters(struct rte_cryptodev *dev,
                struct rte_crypto_sym_xform *xform, void *session_private)
 {
        struct qat_session *session = session_private;
@@ -425,29 +425,27 @@ qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
        session->qat_cmd = (enum icp_qat_fw_la_cmd_id)qat_cmd_id;
        switch (session->qat_cmd) {
        case ICP_QAT_FW_LA_CMD_CIPHER:
-               ret = qat_crypto_sym_configure_session_cipher(dev,
-                                                       xform, session);
+               ret = qat_sym_session_configure_cipher(dev, xform, session);
                if (ret < 0)
                        return ret;
                break;
        case ICP_QAT_FW_LA_CMD_AUTH:
-               ret = qat_crypto_sym_configure_session_auth(dev,
-                                                       xform, session);
+               ret = qat_sym_session_configure_auth(dev, xform, session);
                if (ret < 0)
                        return ret;
                break;
        case ICP_QAT_FW_LA_CMD_CIPHER_HASH:
                if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
-                       ret = qat_crypto_sym_configure_session_aead(xform,
+                       ret = qat_sym_session_configure_aead(xform,
                                        session);
                        if (ret < 0)
                                return ret;
                } else {
-                       ret = qat_crypto_sym_configure_session_cipher(dev,
+                       ret = qat_sym_session_configure_cipher(dev,
                                        xform, session);
                        if (ret < 0)
                                return ret;
-                       ret = qat_crypto_sym_configure_session_auth(dev,
+                       ret = qat_sym_session_configure_auth(dev,
                                        xform, session);
                        if (ret < 0)
                                return ret;
@@ -455,16 +453,16 @@ qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
                break;
        case ICP_QAT_FW_LA_CMD_HASH_CIPHER:
                if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
-                       ret = qat_crypto_sym_configure_session_aead(xform,
+                       ret = qat_sym_session_configure_aead(xform,
                                        session);
                        if (ret < 0)
                                return ret;
                } else {
-                       ret = qat_crypto_sym_configure_session_auth(dev,
+                       ret = qat_sym_session_configure_auth(dev,
                                        xform, session);
                        if (ret < 0)
                                return ret;
-                       ret = qat_crypto_sym_configure_session_cipher(dev,
+                       ret = qat_sym_session_configure_cipher(dev,
                                        xform, session);
                        if (ret < 0)
                                return ret;
@@ -492,7 +490,7 @@ qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
 }
 
 int
-qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
+qat_sym_session_configure_auth(struct rte_cryptodev *dev,
                                struct rte_crypto_sym_xform *xform,
                                struct qat_session *session)
 {
@@ -521,7 +519,7 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
                session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC;
                break;
        case RTE_CRYPTO_AUTH_AES_GMAC:
-               if (qat_alg_validate_aes_key(auth_xform->key.length,
+               if (qat_sym_validate_aes_key(auth_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid AES key size");
                        return -EINVAL;
@@ -579,14 +577,13 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
                         * It needs to create cipher desc content first,
                         * then authentication
                         */
-                       if (qat_alg_aead_session_create_content_desc_cipher(
-                                               session,
+
+                       if (qat_sym_session_aead_create_cd_cipher(session,
                                                auth_xform->key.data,
                                                auth_xform->key.length))
                                return -EINVAL;
 
-                       if (qat_alg_aead_session_create_content_desc_auth(
-                                               session,
+                       if (qat_sym_session_aead_create_cd_auth(session,
                                                key_data,
                                                key_length,
                                                0,
@@ -600,8 +597,8 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
                         * It needs to create authentication desc content first,
                         * then cipher
                         */
-                       if (qat_alg_aead_session_create_content_desc_auth(
-                                       session,
+
+                       if (qat_sym_session_aead_create_cd_auth(session,
                                        key_data,
                                        key_length,
                                        0,
@@ -609,8 +606,7 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
                                        auth_xform->op))
                                return -EINVAL;
 
-                       if (qat_alg_aead_session_create_content_desc_cipher(
-                                               session,
+                       if (qat_sym_session_aead_create_cd_cipher(session,
                                                auth_xform->key.data,
                                                auth_xform->key.length))
                                return -EINVAL;
@@ -618,7 +614,7 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
                /* Restore to authentication only only */
                session->qat_cmd = ICP_QAT_FW_LA_CMD_AUTH;
        } else {
-               if (qat_alg_aead_session_create_content_desc_auth(session,
+               if (qat_sym_session_aead_create_cd_auth(session,
                                key_data,
                                key_length,
                                0,
@@ -632,7 +628,7 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
 }
 
 int
-qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
+qat_sym_session_configure_aead(struct rte_crypto_sym_xform *xform,
                                struct qat_session *session)
 {
        struct rte_crypto_aead_xform *aead_xform = &xform->aead;
@@ -647,7 +643,7 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
 
        switch (aead_xform->algo) {
        case RTE_CRYPTO_AEAD_AES_GCM:
-               if (qat_alg_validate_aes_key(aead_xform->key.length,
+               if (qat_sym_validate_aes_key(aead_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid AES key size");
                        return -EINVAL;
@@ -656,7 +652,7 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
                session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_GALOIS_128;
                break;
        case RTE_CRYPTO_AEAD_AES_CCM:
-               if (qat_alg_validate_aes_key(aead_xform->key.length,
+               if (qat_sym_validate_aes_key(aead_xform->key.length,
                                &session->qat_cipher_alg) != 0) {
                        PMD_DRV_LOG(ERR, "Invalid AES key size");
                        return -EINVAL;
@@ -682,12 +678,12 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
                crypto_operation = aead_xform->algo == RTE_CRYPTO_AEAD_AES_GCM ?
                        RTE_CRYPTO_AUTH_OP_GENERATE : RTE_CRYPTO_AUTH_OP_VERIFY;
 
-               if (qat_alg_aead_session_create_content_desc_cipher(session,
+               if (qat_sym_session_aead_create_cd_cipher(session,
                                        aead_xform->key.data,
                                        aead_xform->key.length))
                        return -EINVAL;
 
-               if (qat_alg_aead_session_create_content_desc_auth(session,
+               if (qat_sym_session_aead_create_cd_auth(session,
                                        aead_xform->key.data,
                                        aead_xform->key.length,
                                        aead_xform->aad_length,
@@ -704,7 +700,7 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
                crypto_operation = aead_xform->algo == RTE_CRYPTO_AEAD_AES_GCM ?
                        RTE_CRYPTO_AUTH_OP_VERIFY : RTE_CRYPTO_AUTH_OP_GENERATE;
 
-               if (qat_alg_aead_session_create_content_desc_auth(session,
+               if (qat_sym_session_aead_create_cd_auth(session,
                                        aead_xform->key.data,
                                        aead_xform->key.length,
                                        aead_xform->aad_length,
@@ -712,7 +708,7 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
                                        crypto_operation))
                        return -EINVAL;
 
-               if (qat_alg_aead_session_create_content_desc_cipher(session,
+               if (qat_sym_session_aead_create_cd_cipher(session,
                                        aead_xform->key.data,
                                        aead_xform->key.length))
                        return -EINVAL;
@@ -722,7 +718,7 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
        return 0;
 }
 
-unsigned int qat_crypto_sym_get_session_private_size(
+unsigned int qat_sym_session_get_private_size(
                struct rte_cryptodev *dev __rte_unused)
 {
        return RTE_ALIGN_CEIL(sizeof(struct qat_session), 8);
@@ -996,7 +992,7 @@ static int partial_hash_compute(enum icp_qat_hw_auth_algo hash_alg,
 #define HMAC_OPAD_VALUE        0x5c
 #define HASH_XCBC_PRECOMP_KEY_NUM 3
 
-static int qat_alg_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
+static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
                                const uint8_t *auth_key,
                                uint16_t auth_keylen,
                                uint8_t *p_state_buf,
@@ -1126,7 +1122,8 @@ static int qat_alg_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
        return 0;
 }
 
-void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header,
+static void
+qat_sym_session_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header,
                enum qat_crypto_proto_flag proto_flags)
 {
        PMD_INIT_FUNC_TRACE();
@@ -1194,7 +1191,7 @@ qat_get_crypto_proto_flag(uint16_t flags)
        return qat_proto_flag;
 }
 
-int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc,
+int qat_sym_session_aead_create_cd_cipher(struct qat_session *cdesc,
                                                uint8_t *cipherkey,
                                                uint32_t cipherkeylen)
 {
@@ -1298,7 +1295,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc,
        cipher_cd_ctrl->cipher_cfg_offset = cipher_offset >> 3;
 
        header->service_cmd_id = cdesc->qat_cmd;
-       qat_alg_init_common_hdr(header, qat_proto_flag);
+       qat_sym_session_init_common_hdr(header, qat_proto_flag);
 
        cipher = (struct icp_qat_hw_cipher_algo_blk *)cdesc->cd_cur_ptr;
        cipher->cipher_config.val =
@@ -1342,7 +1339,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc,
        return 0;
 }
 
-int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
+int qat_sym_session_aead_create_cd_auth(struct qat_session *cdesc,
                                                uint8_t *authkey,
                                                uint32_t authkeylen,
                                                uint32_t aad_length,
@@ -1431,7 +1428,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
         */
        switch (cdesc->qat_hash_alg) {
        case ICP_QAT_HW_AUTH_ALGO_SHA1:
-               if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA1,
+               if (qat_sym_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA1,
                        authkey, authkeylen, cdesc->cd_cur_ptr, &state1_size)) {
                        PMD_DRV_LOG(ERR, "(SHA)precompute failed");
                        return -EFAULT;
@@ -1439,7 +1436,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
                state2_size = RTE_ALIGN_CEIL(ICP_QAT_HW_SHA1_STATE2_SZ, 8);
                break;
        case ICP_QAT_HW_AUTH_ALGO_SHA224:
-               if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA224,
+               if (qat_sym_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA224,
                        authkey, authkeylen, cdesc->cd_cur_ptr, &state1_size)) {
                        PMD_DRV_LOG(ERR, "(SHA)precompute failed");
                        return -EFAULT;
@@ -1447,7 +1444,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
                state2_size = ICP_QAT_HW_SHA224_STATE2_SZ;
                break;
        case ICP_QAT_HW_AUTH_ALGO_SHA256:
-               if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA256,
+               if (qat_sym_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA256,
                        authkey, authkeylen, cdesc->cd_cur_ptr, &state1_size)) {
                        PMD_DRV_LOG(ERR, "(SHA)precompute failed");
                        return -EFAULT;
@@ -1455,7 +1452,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
                state2_size = ICP_QAT_HW_SHA256_STATE2_SZ;
                break;
        case ICP_QAT_HW_AUTH_ALGO_SHA384:
-               if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA384,
+               if (qat_sym_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA384,
                        authkey, authkeylen, cdesc->cd_cur_ptr, &state1_size)) {
                        PMD_DRV_LOG(ERR, "(SHA)precompute failed");
                        return -EFAULT;
@@ -1463,7 +1460,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
                state2_size = ICP_QAT_HW_SHA384_STATE2_SZ;
                break;
        case ICP_QAT_HW_AUTH_ALGO_SHA512:
-               if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA512,
+               if (qat_sym_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA512,
                        authkey, authkeylen, cdesc->cd_cur_ptr, &state1_size)) {
                        PMD_DRV_LOG(ERR, "(SHA)precompute failed");
                        return -EFAULT;
@@ -1472,7 +1469,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
                break;
        case ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC:
                state1_size = ICP_QAT_HW_AES_XCBC_MAC_STATE1_SZ;
-               if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC,
+               if (qat_sym_do_precomputes(ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC,
                        authkey, authkeylen, cdesc->cd_cur_ptr + state1_size,
                        &state2_size)) {
                        PMD_DRV_LOG(ERR, "(XCBC)precompute failed");
@@ -1483,7 +1480,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
        case ICP_QAT_HW_AUTH_ALGO_GALOIS_64:
                qat_proto_flag = QAT_CRYPTO_PROTO_FLAG_GCM;
                state1_size = ICP_QAT_HW_GALOIS_128_STATE1_SZ;
-               if (qat_alg_do_precomputes(cdesc->qat_hash_alg,
+               if (qat_sym_do_precomputes(cdesc->qat_hash_alg,
                        authkey, authkeylen, cdesc->cd_cur_ptr + state1_size,
                        &state2_size)) {
                        PMD_DRV_LOG(ERR, "(GCM)precompute failed");
@@ -1543,7 +1540,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
 
                break;
        case ICP_QAT_HW_AUTH_ALGO_MD5:
-               if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_MD5,
+               if (qat_sym_do_precomputes(ICP_QAT_HW_AUTH_ALGO_MD5,
                        authkey, authkeylen, cdesc->cd_cur_ptr,
                        &state1_size)) {
                        PMD_DRV_LOG(ERR, "(MD5)precompute failed");
@@ -1606,7 +1603,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
        }
 
        /* Request template setup */
-       qat_alg_init_common_hdr(header, qat_proto_flag);
+       qat_sym_session_init_common_hdr(header, qat_proto_flag);
        header->service_cmd_id = cdesc->qat_cmd;
 
        /* Auth CD config setup */
@@ -1632,7 +1629,7 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
        return 0;
 }
 
-int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
+int qat_sym_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
        case ICP_QAT_HW_AES_128_KEY_SZ:
@@ -1650,7 +1647,7 @@ int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
        return 0;
 }
 
-int qat_alg_validate_aes_docsisbpi_key(int key_len,
+int qat_sym_validate_aes_docsisbpi_key(int key_len,
                enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
@@ -1663,7 +1660,7 @@ int qat_alg_validate_aes_docsisbpi_key(int key_len,
        return 0;
 }
 
-int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
+int qat_sym_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
        case ICP_QAT_HW_SNOW_3G_UEA2_KEY_SZ:
@@ -1675,7 +1672,7 @@ int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
        return 0;
 }
 
-int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
+int qat_sym_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
        case ICP_QAT_HW_KASUMI_KEY_SZ:
@@ -1687,7 +1684,7 @@ int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
        return 0;
 }
 
-int qat_alg_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
+int qat_sym_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
        case ICP_QAT_HW_DES_KEY_SZ:
@@ -1699,7 +1696,7 @@ int qat_alg_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
        return 0;
 }
 
-int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
+int qat_sym_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
        case QAT_3DES_KEY_SZ_OPT1:
@@ -1712,7 +1709,7 @@ int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
        return 0;
 }
 
-int qat_alg_validate_zuc_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
+int qat_sym_validate_zuc_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
        case ICP_QAT_HW_ZUC_3G_EEA3_KEY_SZ:
index f90b182..493036e 100644 (file)
@@ -76,67 +76,68 @@ struct qat_session {
 };
 
 int
-qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
+qat_sym_session_configure(struct rte_cryptodev *dev,
                struct rte_crypto_sym_xform *xform,
                struct rte_cryptodev_sym_session *sess,
                struct rte_mempool *mempool);
 
 int
-qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
+qat_sym_session_set_parameters(struct rte_cryptodev *dev,
                struct rte_crypto_sym_xform *xform, void *session_private);
 
 int
-qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform,
+qat_sym_session_configure_aead(struct rte_crypto_sym_xform *xform,
                                struct qat_session *session);
 
 int
-qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
+qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
                struct rte_crypto_sym_xform *xform,
                struct qat_session *session);
 
 int
-qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
+qat_sym_session_configure_auth(struct rte_cryptodev *dev,
                                struct rte_crypto_sym_xform *xform,
                                struct qat_session *session);
 
 int
-qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cd,
+qat_sym_session_aead_create_cd_cipher(struct qat_session *cd,
                                                uint8_t *enckey,
                                                uint32_t enckeylen);
 
 int
-qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
+qat_sym_session_aead_create_cd_auth(struct qat_session *cdesc,
                                                uint8_t *authkey,
                                                uint32_t authkeylen,
                                                uint32_t aad_length,
                                                uint32_t digestsize,
                                                unsigned int operation);
 
-int
-qat_pmd_session_mempool_create(struct rte_cryptodev *dev,
-       unsigned int nb_objs, unsigned int obj_cache_size, int socket_id);
-
 void
-qat_crypto_sym_clear_session(struct rte_cryptodev *dev,
+qat_sym_session_clear(struct rte_cryptodev *dev,
                struct rte_cryptodev_sym_session *session);
 
 unsigned int
-qat_crypto_sym_get_session_private_size(struct rte_cryptodev *dev);
-
-int qat_get_inter_state_size(enum icp_qat_hw_auth_algo qat_hash_alg);
-
+qat_sym_session_get_private_size(struct rte_cryptodev *dev);
 
-void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header,
+void
+qat_sym_sesssion_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header,
                                        enum qat_crypto_proto_flag proto_flags);
-
-int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
-int qat_alg_validate_aes_docsisbpi_key(int key_len,
+int
+qat_sym_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int
+qat_sym_validate_aes_docsisbpi_key(int key_len,
                                        enum icp_qat_hw_cipher_algo *alg);
-int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
-int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
-int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
-int qat_alg_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
-int qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg);
-int qat_alg_validate_zuc_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int
+qat_sym_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int
+qat_sym_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int
+qat_sym_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int
+qat_sym_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int
+qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg);
+int
+qat_sym_validate_zuc_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 
 #endif /* _QAT_SYM_SESSION_H_ */
index 45f8a25..42011dc 100644 (file)
@@ -35,18 +35,18 @@ static struct rte_cryptodev_ops crypto_qat_ops = {
                .dev_close              = qat_dev_close,
                .dev_infos_get          = qat_dev_info_get,
 
-               .stats_get              = qat_crypto_sym_stats_get,
-               .stats_reset            = qat_crypto_sym_stats_reset,
-               .queue_pair_setup       = qat_crypto_sym_qp_setup,
-               .queue_pair_release     = qat_crypto_sym_qp_release,
+               .stats_get              = qat_sym_stats_get,
+               .stats_reset            = qat_sym_stats_reset,
+               .queue_pair_setup       = qat_sym_qp_setup,
+               .queue_pair_release     = qat_sym_qp_release,
                .queue_pair_start       = NULL,
                .queue_pair_stop        = NULL,
                .queue_pair_count       = NULL,
 
                /* Crypto related operations */
-               .session_get_size       = qat_crypto_sym_get_session_private_size,
-               .session_configure      = qat_crypto_sym_configure_session,
-               .session_clear          = qat_crypto_sym_clear_session
+               .session_get_size       = qat_sym_session_get_private_size,
+               .session_configure      = qat_sym_session_configure,
+               .session_clear          = qat_sym_session_clear
 };
 
 /*
@@ -86,8 +86,8 @@ crypto_qat_create(const char *name, struct rte_pci_device *pci_dev,
        cryptodev->driver_id = cryptodev_qat_driver_id;
        cryptodev->dev_ops = &crypto_qat_ops;
 
-       cryptodev->enqueue_burst = qat_pmd_enqueue_op_burst;
-       cryptodev->dequeue_burst = qat_pmd_dequeue_op_burst;
+       cryptodev->enqueue_burst = qat_sym_pmd_enqueue_op_burst;
+       cryptodev->dequeue_burst = qat_sym_pmd_dequeue_op_burst;
 
        cryptodev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
                        RTE_CRYPTODEV_FF_HW_ACCELERATED |