From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4073D1CE66 for ; Fri, 6 Apr 2018 20:52:27 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2018 11:52:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,416,1517904000"; d="scan'208";a="189275639" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga004.jf.intel.com with ESMTP; 06 Apr 2018 11:52:25 -0700 From: Fiona Trahe To: dev@dpdk.org, pablo.de.lara.guarch@intel.com Cc: fiona.trahe@intel.com, tomaszx.jozwiak@intel.com Date: Fri, 6 Apr 2018 19:51:49 +0100 Message-Id: <1523040732-3290-8-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1523040732-3290-1-git-send-email-fiona.trahe@intel.com> References: <1523040732-3290-1-git-send-email-fiona.trahe@intel.com> Subject: [dpdk-dev] [PATCH 07/30] crypto/qat: rename fns for consistency X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:52:27 -0000 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 --- drivers/crypto/qat/qat_device.c | 2 +- drivers/crypto/qat/qat_device.h | 2 +- drivers/crypto/qat/qat_qp.c | 6 +- drivers/crypto/qat/qat_sym.c | 14 ++-- drivers/crypto/qat/qat_sym.h | 22 +++--- drivers/crypto/qat/qat_sym_session.c | 131 ++++++++++++++++----------------- drivers/crypto/qat/qat_sym_session.h | 53 ++++++------- drivers/crypto/qat/rte_qat_cryptodev.c | 18 ++--- 8 files changed, 123 insertions(+), 125 deletions(-) diff --git a/drivers/crypto/qat/qat_device.c b/drivers/crypto/qat/qat_device.c index c2bf9b7a7..ac6bd1af6 100644 --- a/drivers/crypto/qat/qat_device.c +++ b/drivers/crypto/qat/qat_device.c @@ -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; } diff --git a/drivers/crypto/qat/qat_device.h b/drivers/crypto/qat/qat_device.h index 5c48fdb93..2cb8e7612 100644 --- a/drivers/crypto/qat/qat_device.h +++ b/drivers/crypto/qat/qat_device.h @@ -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 */ diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c index 927c78111..7e4dc93c9 100644 --- a/drivers/crypto/qat/qat_qp.c +++ b/drivers/crypto/qat/qat_qp.c @@ -98,7 +98,7 @@ queue_dma_zone_reserve(const char *queue_name, uint32_t queue_size, memzone_flags, 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) { @@ -112,7 +112,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; } @@ -228,7 +228,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id, 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]; diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index f5d542ae3..ae521c2b1 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -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); diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h index e3873171c..811ba8619 100644 --- a/drivers/crypto/qat/qat_sym.h +++ b/drivers/crypto/qat/qat_sym.h @@ -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 #include @@ -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_ */ diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index a67e22919..4977b0a11 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -103,7 +103,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(); @@ -114,7 +114,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); @@ -195,7 +195,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) { @@ -211,7 +211,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; @@ -220,7 +220,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; @@ -229,7 +229,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; @@ -241,7 +241,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; @@ -250,7 +250,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; @@ -259,7 +259,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; @@ -268,7 +268,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; @@ -286,7 +286,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; @@ -304,7 +304,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; @@ -321,7 +321,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; @@ -350,7 +350,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; @@ -368,7 +368,7 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev, } 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) @@ -382,7 +382,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"); @@ -399,7 +399,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; @@ -423,29 +423,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; @@ -453,16 +451,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; @@ -490,7 +488,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) { @@ -519,7 +517,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; @@ -577,14 +575,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, @@ -598,8 +595,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, @@ -607,8 +604,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; @@ -616,7 +612,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, @@ -630,7 +626,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; @@ -645,7 +641,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; @@ -654,7 +650,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; @@ -680,12 +676,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, @@ -702,7 +698,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, @@ -710,7 +706,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; @@ -720,7 +716,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); @@ -994,7 +990,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, @@ -1124,7 +1120,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(); @@ -1192,7 +1189,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) { @@ -1296,7 +1293,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 = @@ -1340,7 +1337,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, @@ -1429,7 +1426,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; @@ -1437,7 +1434,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; @@ -1445,7 +1442,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; @@ -1453,7 +1450,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; @@ -1461,7 +1458,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; @@ -1470,7 +1467,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"); @@ -1481,7 +1478,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"); @@ -1541,7 +1538,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"); @@ -1604,7 +1601,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 */ @@ -1630,7 +1627,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: @@ -1648,7 +1645,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) { @@ -1661,7 +1658,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: @@ -1673,7 +1670,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: @@ -1685,7 +1682,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: @@ -1697,7 +1694,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: @@ -1710,7 +1707,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: diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h index f90b1821d..493036ebf 100644 --- a/drivers/crypto/qat/qat_sym_session.h +++ b/drivers/crypto/qat/qat_sym_session.h @@ -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_ */ diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c index 45f8a253b..42011dcd9 100644 --- a/drivers/crypto/qat/rte_qat_cryptodev.c +++ b/drivers/crypto/qat/rte_qat_cryptodev.c @@ -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 | -- 2.13.6