@@ -70,8 +70,8 @@ if qat_compress
endif
if qat_crypto
- foreach f: ['qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c',
- 'qat_sym_hw_dp.c', 'qat_asym_pmd.c', 'qat_asym.c', 'qat_crypto.c',
+ foreach f: ['qat_sym_refactor.c', 'qat_sym_session.c',
+ 'qat_sym_hw_dp.c', 'qat_asym_refactor.c', 'qat_crypto.c',
'dev/qat_sym_pmd_gen1.c',
'dev/qat_asym_pmd_gen1.c',
'dev/qat_crypto_pmd_gen2.c',
@@ -15,8 +15,8 @@
#include "qat_logs.h"
#include "qat_device.h"
#include "qat_qp.h"
-#include "qat_sym.h"
-#include "qat_asym.h"
+#include "qat_sym_refactor.h"
+#include "qat_asym_refactor.h"
#include "qat_comp.h"
#define QAT_CQ_MAX_DEQ_RETRIES 10
@@ -550,23 +550,8 @@ adf_modulo(uint32_t data, uint32_t modulo_mask)
}
uint16_t
-refactor_qat_enqueue_op_burst(__rte_unused void *qp,
- __rte_unused qat_op_build_request_t op_build_request,
- __rte_unused void **ops, __rte_unused uint16_t nb_ops)
-{
- return 0;
-}
-
-uint16_t
-refactor_qat_dequeue_op_burst(__rte_unused void *qp, __rte_unused void **ops,
- __rte_unused qat_op_dequeue_t qat_dequeue_process_response,
- __rte_unused uint16_t nb_ops)
-{
- return 0;
-}
-
-uint16_t
-qat_enqueue_op_burst(void *qp, void **ops, uint16_t nb_ops)
+qat_enqueue_op_burst(void *qp, qat_op_build_request_t op_build_request,
+ void **ops, uint16_t nb_ops)
{
register struct qat_queue *queue;
struct qat_qp *tmp_qp = (struct qat_qp *)qp;
@@ -616,29 +601,18 @@ qat_enqueue_op_burst(void *qp, void **ops, uint16_t nb_ops)
}
}
-#ifdef BUILD_QAT_SYM
+#ifdef RTE_LIB_SECURITY
if (tmp_qp->service_type == QAT_SERVICE_SYMMETRIC)
qat_sym_preprocess_requests(ops, nb_ops_possible);
#endif
+ memset(tmp_qp->opaque, 0xff, sizeof(tmp_qp->opaque));
+
while (nb_ops_sent != nb_ops_possible) {
- if (tmp_qp->service_type == QAT_SERVICE_SYMMETRIC) {
-#ifdef BUILD_QAT_SYM
- ret = qat_sym_build_request(*ops, base_addr + tail,
- tmp_qp->op_cookies[tail >> queue->trailz],
- tmp_qp->qat_dev_gen);
-#endif
- } else if (tmp_qp->service_type == QAT_SERVICE_COMPRESSION) {
- ret = qat_comp_build_request(*ops, base_addr + tail,
- tmp_qp->op_cookies[tail >> queue->trailz],
- tmp_qp->qat_dev_gen);
- } else if (tmp_qp->service_type == QAT_SERVICE_ASYMMETRIC) {
-#ifdef BUILD_QAT_ASYM
- ret = qat_asym_build_request(*ops, base_addr + tail,
+ ret = op_build_request(*ops, base_addr + tail,
tmp_qp->op_cookies[tail >> queue->trailz],
- tmp_qp->qat_dev_gen);
-#endif
- }
+ tmp_qp->opaque, tmp_qp->qat_dev_gen);
+
if (ret != 0) {
tmp_qp->stats.enqueue_err_count++;
/* This message cannot be enqueued */
@@ -833,7 +807,8 @@ qat_enqueue_comp_op_burst(void *qp, void **ops, uint16_t nb_ops)
}
uint16_t
-qat_dequeue_op_burst(void *qp, void **ops, uint16_t nb_ops)
+qat_dequeue_op_burst(void *qp, void **ops,
+ qat_op_dequeue_t qat_dequeue_process_response, uint16_t nb_ops)
{
struct qat_queue *rx_queue;
struct qat_qp *tmp_qp = (struct qat_qp *)qp;
@@ -851,19 +826,10 @@ qat_dequeue_op_burst(void *qp, void **ops, uint16_t nb_ops)
nb_fw_responses = 1;
- if (tmp_qp->service_type == QAT_SERVICE_SYMMETRIC)
- qat_sym_process_response(ops, resp_msg,
- tmp_qp->op_cookies[head >> rx_queue->trailz]);
- else if (tmp_qp->service_type == QAT_SERVICE_COMPRESSION)
- nb_fw_responses = qat_comp_process_response(
+ nb_fw_responses = qat_dequeue_process_response(
ops, resp_msg,
tmp_qp->op_cookies[head >> rx_queue->trailz],
&tmp_qp->stats.dequeue_err_count);
-#ifdef BUILD_QAT_ASYM
- else if (tmp_qp->service_type == QAT_SERVICE_ASYMMETRIC)
- qat_asym_process_response(ops, resp_msg,
- tmp_qp->op_cookies[head >> rx_queue->trailz]);
-#endif
head = adf_modulo(head + rx_queue->msg_size,
rx_queue->modulo_mask);
@@ -14,6 +14,24 @@
struct qat_pci_device;
+/* Default qp configuration for GEN4 devices */
+#define QAT_GEN4_QP_DEFCON (QAT_SERVICE_SYMMETRIC | \
+ QAT_SERVICE_SYMMETRIC << 8 | \
+ QAT_SERVICE_SYMMETRIC << 16 | \
+ QAT_SERVICE_SYMMETRIC << 24)
+
+/* QAT GEN 4 specific macros */
+#define QAT_GEN4_BUNDLE_NUM 4
+#define QAT_GEN4_QPS_PER_BUNDLE_NUM 1
+
+/* Queue pair setup error codes */
+#define QAT_NOMEM 1
+#define QAT_QP_INVALID_DESC_NO 2
+#define QAT_QP_BUSY 3
+#define QAT_PCI_NO_RESOURCE 4
+
+#define ADF_ARB_RINGSRVARBEN_OFFSET 0x19C
+
/**
* Structure associated with each queue.
*/
@@ -92,21 +110,15 @@ struct qat_qp_config {
};
uint16_t
-refactor_qat_enqueue_op_burst(void *qp, qat_op_build_request_t op_build_request,
+qat_enqueue_op_burst(void *qp, qat_op_build_request_t op_build_request,
void **ops, uint16_t nb_ops);
-uint16_t
-refactor_qat_dequeue_op_burst(void *qp, void **ops,
- qat_op_dequeue_t qat_dequeue_process_response, uint16_t nb_ops);
-
-uint16_t
-qat_enqueue_op_burst(void *qp, void **ops, uint16_t nb_ops);
-
uint16_t
qat_enqueue_comp_op_burst(void *qp, void **ops, uint16_t nb_ops);
uint16_t
-qat_dequeue_op_burst(void *qp, void **ops, uint16_t nb_ops);
+qat_dequeue_op_burst(void *qp, void **ops,
+ qat_op_dequeue_t qat_dequeue_process_response, uint16_t nb_ops);
int
qat_qp_release(enum qat_device_gen qat_dev_gen, struct qat_qp **qp_addr);
@@ -118,7 +130,7 @@ qat_qp_setup(struct qat_pci_device *qat_dev,
int
qat_qps_per_service(struct qat_pci_device *qat_dev,
- enum qat_service_type service);
+ enum qat_service_type service);
const struct qat_qp_hw_data *
qat_qp_get_hw_data(struct qat_pci_device *qat_dev,
@@ -616,11 +616,18 @@ static struct rte_compressdev_ops compress_qat_dummy_ops = {
.private_xform_free = qat_comp_private_xform_free
};
+static uint16_t
+qat_comp_dequeue_burst(void *qp, struct rte_comp_op **ops, uint16_t nb_ops)
+{
+ return qat_dequeue_op_burst(qp, (void **)ops, qat_comp_process_response,
+ nb_ops);
+}
+
static uint16_t
qat_comp_pmd_dequeue_first_op_burst(void *qp, struct rte_comp_op **ops,
uint16_t nb_ops)
{
- uint16_t ret = qat_dequeue_op_burst(qp, (void **)ops, nb_ops);
+ uint16_t ret = qat_comp_dequeue_burst(qp, ops, nb_ops);
struct qat_qp *tmp_qp = (struct qat_qp *)qp;
if (ret) {
@@ -638,8 +645,7 @@ qat_comp_pmd_dequeue_first_op_burst(void *qp, struct rte_comp_op **ops,
} else {
tmp_qp->qat_dev->comp_dev->compressdev->dequeue_burst =
- (compressdev_dequeue_pkt_burst_t)
- qat_dequeue_op_burst;
+ qat_comp_dequeue_burst;
}
}
return ret;
@@ -5,8 +5,8 @@
#include <rte_cryptodev.h>
#include <cryptodev_pmd.h>
#include "qat_sym_session.h"
-#include "qat_sym.h"
-#include "qat_asym.h"
+#include "qat_sym_refactor.h"
+#include "qat_asym_refactor.h"
#include "qat_crypto.h"
#include "qat_crypto_pmd_gens.h"
@@ -5,8 +5,8 @@
#include <rte_cryptodev.h>
#include <cryptodev_pmd.h>
#include "qat_sym_session.h"
-#include "qat_sym.h"
-#include "qat_asym.h"
+#include "qat_sym_refactor.h"
+#include "qat_asym_refactor.h"
#include "qat_crypto.h"
#include "qat_crypto_pmd_gens.h"
@@ -13,7 +13,7 @@
#include "icp_qat_fw_la.h"
#include "qat_sym_session.h"
-#include "qat_sym.h"
+#include "qat_sym_refactor.h"
#include "qat_sym_session.h"
#include "qat_crypto.h"
#include "qat_crypto_pmd_gens.h"
@@ -5,7 +5,7 @@
#include <stdarg.h>
-#include <rte_cryptodev_pmd.h>
+#include <cryptodev_pmd.h>
#include "icp_qat_fw_pke.h"
#include "icp_qat_fw.h"
@@ -14,7 +14,7 @@
#include "qat_device.h"
#include "qat_logs.h"
-#include "qat_asym.h"
+#include "qat_asym_refactor.h"
uint8_t qat_asym_driver_id;
@@ -5,7 +5,7 @@
#ifndef _QAT_ASYM_H_
#define _QAT_ASYM_H_
-#include <rte_cryptodev_pmd.h>
+#include <cryptodev_pmd.h>
#include <rte_crypto_asym.h>
#include "icp_qat_fw_pke.h"
#include "qat_device.h"
@@ -8,7 +8,7 @@
#include "icp_qat_fw.h"
#include "icp_qat_fw_la.h"
-#include "qat_sym.h"
+#include "qat_sym_refactor.h"
#include "qat_sym_pmd.h"
#include "qat_sym_session.h"
#include "qat_qp.h"
@@ -10,7 +10,7 @@
#include <rte_bus_pci.h>
#include <rte_byteorder.h>
-#include "qat_sym.h"
+#include "qat_sym_refactor.h"
#include "qat_crypto.h"
#include "qat_qp.h"
@@ -354,55 +354,6 @@ qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev)
return 0;
}
-int
-qat_sym_configure_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
- struct rte_crypto_raw_dp_ctx *raw_dp_ctx,
- enum rte_crypto_op_sess_type sess_type,
- union rte_cryptodev_session_ctx session_ctx, uint8_t is_update)
-{
- struct qat_cryptodev_private *internals = dev->data->dev_private;
- enum qat_device_gen qat_dev_gen = internals->qat_dev->qat_dev_gen;
- struct qat_crypto_gen_dev_ops *gen_dev_ops =
- &qat_sym_gen_dev_ops[qat_dev_gen];
- struct qat_qp *qp;
- struct qat_sym_session *ctx;
- struct qat_sym_dp_ctx *dp_ctx;
-
- if (!gen_dev_ops->set_raw_dp_ctx) {
- QAT_LOG(ERR, "Device GEN %u does not support raw data path",
- qat_dev_gen);
- return -ENOTSUP;
- }
-
- qp = dev->data->queue_pairs[qp_id];
- dp_ctx = (struct qat_sym_dp_ctx *)raw_dp_ctx->drv_ctx_data;
-
- if (!is_update) {
- memset(raw_dp_ctx, 0, sizeof(*raw_dp_ctx) +
- sizeof(struct qat_sym_dp_ctx));
- raw_dp_ctx->qp_data = dev->data->queue_pairs[qp_id];
- dp_ctx->tail = qp->tx_q.tail;
- dp_ctx->head = qp->rx_q.head;
- dp_ctx->cached_enqueue = dp_ctx->cached_dequeue = 0;
- }
-
- if (sess_type != RTE_CRYPTO_OP_WITH_SESSION)
- return -EINVAL;
-
- ctx = (struct qat_sym_session *)get_sym_session_private_data(
- session_ctx.crypto_sess, qat_sym_driver_id);
-
- dp_ctx->session = ctx;
-
- return gen_dev_ops->set_raw_dp_ctx(raw_dp_ctx, ctx);
-}
-
-int
-qat_sym_get_dp_ctx_size(struct rte_cryptodev *dev __rte_unused)
-{
- return sizeof(struct qat_sym_dp_ctx);
-}
-
static struct cryptodev_driver qat_crypto_drv;
RTE_PMD_REGISTER_CRYPTO_DRIVER(qat_crypto_drv,
cryptodev_qat_sym_driver,
@@ -5,7 +5,7 @@
#ifndef _QAT_SYM_H_
#define _QAT_SYM_H_
-#include <rte_cryptodev_pmd.h>
+#include <cryptodev_pmd.h>
#ifdef RTE_LIB_SECURITY
#include <rte_net_crc.h>
#endif