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 24FCB1CEFB for ; Fri, 6 Apr 2018 20:52:44 +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:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,416,1517904000"; d="scan'208";a="189275770" 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:42 -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:52:00 +0100 Message-Id: <1523040732-3290-19-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 18/30] crypto/qat: move sgl related element to appropriate files 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:44 -0000 Move SGL (Scatter-Gather List) related functions to common file Move qat_sym_op_cookie struct to sym header file Signed-off-by: ArkadiuszX Kusztal Signed-off-by: Fiona Trahe --- drivers/crypto/qat/Makefile | 1 + drivers/crypto/qat/meson.build | 1 + drivers/crypto/qat/qat_common.c | 53 +++++++++++++++++++++++++++++++++++++++++ drivers/crypto/qat/qat_common.h | 11 ++++----- drivers/crypto/qat/qat_sym.c | 47 ------------------------------------ drivers/crypto/qat/qat_sym.h | 7 ++++++ 6 files changed, 67 insertions(+), 53 deletions(-) create mode 100644 drivers/crypto/qat/qat_common.c diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile index 8cb802b9d..902c47ff4 100644 --- a/drivers/crypto/qat/Makefile +++ b/drivers/crypto/qat/Makefile @@ -25,6 +25,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_device.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_qp.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += rte_qat_cryptodev.c # export include files diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build index e596006da..12910c377 100644 --- a/drivers/crypto/qat/meson.build +++ b/drivers/crypto/qat/meson.build @@ -7,6 +7,7 @@ if not dep.found() endif sources = files('qat_sym.c', 'qat_qp.c', 'qat_sym_session.c', + 'qat_common.c', 'rte_qat_cryptodev.c', 'qat_device.c') includes += include_directories('qat_adf') diff --git a/drivers/crypto/qat/qat_common.c b/drivers/crypto/qat/qat_common.c new file mode 100644 index 000000000..a8865904f --- /dev/null +++ b/drivers/crypto/qat/qat_common.c @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#include "qat_common.h" +#include "qat_logs.h" + +int +qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buf_start, + struct qat_sgl *list, uint32_t data_len) +{ + int nr = 1; + + uint32_t buf_len = rte_pktmbuf_iova(buf) - + buf_start + rte_pktmbuf_data_len(buf); + + list->buffers[0].addr = buf_start; + list->buffers[0].resrvd = 0; + list->buffers[0].len = buf_len; + + if (data_len <= buf_len) { + list->num_bufs = nr; + list->buffers[0].len = data_len; + return 0; + } + + buf = buf->next; + while (buf) { + if (unlikely(nr == QAT_SGL_MAX_NUMBER)) { + PMD_DRV_LOG(ERR, + "QAT PMD exceeded size of QAT SGL entry(%u)", + QAT_SGL_MAX_NUMBER); + return -EINVAL; + } + + list->buffers[nr].len = rte_pktmbuf_data_len(buf); + list->buffers[nr].resrvd = 0; + list->buffers[nr].addr = rte_pktmbuf_iova(buf); + + buf_len += list->buffers[nr].len; + buf = buf->next; + + if (buf_len > data_len) { + list->buffers[nr].len -= + buf_len - data_len; + buf = NULL; + } + ++nr; + } + list->num_bufs = nr; + + return 0; +} diff --git a/drivers/crypto/qat/qat_common.h b/drivers/crypto/qat/qat_common.h index 193639550..77ffc8f72 100644 --- a/drivers/crypto/qat/qat_common.h +++ b/drivers/crypto/qat/qat_common.h @@ -6,6 +6,8 @@ #include +#include + /**< Intel(R) QAT Symmetric Crypto PMD device name */ #define CRYPTODEV_NAME_QAT_SYM_PMD crypto_qat @@ -45,11 +47,8 @@ struct qat_sgl { struct qat_flat_buf buffers[QAT_SGL_MAX_NUMBER]; } __rte_packed __rte_cache_aligned; -struct qat_sym_op_cookie { - struct qat_sgl qat_sgl_src; - struct qat_sgl qat_sgl_dst; - phys_addr_t qat_sgl_src_phys_addr; - phys_addr_t qat_sgl_dst_phys_addr; -}; +int +qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buf_start, + struct qat_sgl *list, uint32_t data_len); #endif /* _QAT_COMMON_H_ */ diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index a9beff064..b74dfa634 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -248,53 +248,6 @@ qat_sym_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops, return qat_dequeue_op_burst(qp, (void **)ops, nb_ops); } -static inline int -qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buff_start, - struct qat_sgl *list, uint32_t data_len) -{ - int nr = 1; - - uint32_t buf_len = rte_pktmbuf_iova(buf) - - buff_start + rte_pktmbuf_data_len(buf); - - list->buffers[0].addr = buff_start; - list->buffers[0].resrvd = 0; - list->buffers[0].len = buf_len; - - if (data_len <= buf_len) { - list->num_bufs = nr; - list->buffers[0].len = data_len; - return 0; - } - - buf = buf->next; - while (buf) { - if (unlikely(nr == QAT_SGL_MAX_NUMBER)) { - PMD_DRV_LOG(ERR, "QAT PMD exceeded size of QAT SGL" - " entry(%u)", - QAT_SGL_MAX_NUMBER); - return -EINVAL; - } - - list->buffers[nr].len = rte_pktmbuf_data_len(buf); - list->buffers[nr].resrvd = 0; - list->buffers[nr].addr = rte_pktmbuf_iova(buf); - - buf_len += list->buffers[nr].len; - buf = buf->next; - - if (buf_len > data_len) { - list->buffers[nr].len -= - buf_len - data_len; - buf = NULL; - } - ++nr; - } - list->num_bufs = nr; - - return 0; -} - static inline void set_cipher_iv(uint16_t iv_length, uint16_t iv_offset, struct icp_qat_fw_la_cipher_req_params *cipher_param, diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h index b92ec72de..37bec3ce3 100644 --- a/drivers/crypto/qat/qat_sym.h +++ b/drivers/crypto/qat/qat_sym.h @@ -22,6 +22,13 @@ struct qat_sym_session; +struct qat_sym_op_cookie { + struct qat_sgl qat_sgl_src; + struct qat_sgl qat_sgl_dst; + phys_addr_t qat_sgl_src_phys_addr; + phys_addr_t qat_sgl_dst_phys_addr; +}; + int qat_sym_build_request(void *in_op, uint8_t *out_msg, void *op_cookie, enum qat_device_gen qat_dev_gen); -- 2.13.6