struct qat_sym_dev_private *sym_dev;
/**< link back to cryptodev private data */
+ int qat_sym_driver_id;
+ /**< Symmetric driver id used by this device */
+
/* Data relating to asymmetric crypto service */
struct qat_asym_dev_private *asym_dev;
/**< link back to cryptodev private data */
+ int qat_asym_driver_id;
+ /**< Symmetric driver id used by this device */
+
/* Data relating to compression service */
struct qat_comp_dev_private *comp_dev;
/**< link back to compressdev private data */
if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
ctx = (struct qat_asym_session *)
get_asym_session_private_data(
- op->asym->session, cryptodev_qat_asym_driver_id);
+ op->asym->session, qat_asym_driver_id);
if (unlikely(ctx == NULL)) {
QAT_LOG(ERR, "Session has not been created for this device");
goto error;
if (rx_op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
ctx = (struct qat_asym_session *)get_asym_session_private_data(
- rx_op->asym->session, cryptodev_qat_asym_driver_id);
+ rx_op->asym->session, qat_asym_driver_id);
qat_asym_collect_response(rx_op, cookie, ctx->xform);
} else if (rx_op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
qat_asym_collect_response(rx_op, cookie, rx_op->asym->xform);
#include "qat_sym_capabilities.h"
#include "qat_asym_capabilities.h"
-uint8_t cryptodev_qat_asym_driver_id;
+uint8_t qat_asym_driver_id;
static const struct rte_cryptodev_capabilities qat_gen1_asym_capabilities[] = {
QAT_BASE_GEN1_ASYM_CAPABILITIES,
QAT_SERVICE_ASYMMETRIC);
info->feature_flags = dev->feature_flags;
info->capabilities = internals->qat_dev_capabilities;
- info->driver_id = cryptodev_qat_asym_driver_id;
+ info->driver_id = qat_asym_driver_id;
/* No limit of number of sessions */
info->sym.max_nb_sessions = 0;
}
struct rte_cryptodev *cryptodev;
struct qat_asym_dev_private *internals;
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ qat_pci_dev->qat_asym_driver_id =
+ qat_asym_driver_id;
+ } else if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+ if (qat_pci_dev->qat_asym_driver_id !=
+ qat_asym_driver_id) {
+ QAT_LOG(ERR,
+ "Device %s have different driver id than corresponding device in primary process",
+ name);
+ return -(EFAULT);
+ }
+ }
+
snprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s_%s",
qat_pci_dev->name, "asym");
QAT_LOG(DEBUG, "Creating QAT ASYM device %s\n", name);
return -ENODEV;
qat_dev_instance->asym_rte_dev.name = cryptodev->data->name;
- cryptodev->driver_id = cryptodev_qat_asym_driver_id;
+ cryptodev->driver_id = qat_asym_driver_id;
cryptodev->dev_ops = &crypto_qat_ops;
cryptodev->enqueue_burst = qat_asym_pmd_enqueue_op_burst;
static struct cryptodev_driver qat_crypto_drv;
RTE_PMD_REGISTER_CRYPTO_DRIVER(qat_crypto_drv,
cryptodev_qat_asym_driver,
- cryptodev_qat_asym_driver_id);
+ qat_asym_driver_id);
#define CRYPTODEV_NAME_QAT_ASYM_PMD crypto_qat_asym
-extern uint8_t cryptodev_qat_asym_driver_id;
+extern uint8_t qat_asym_driver_id;
/** private data structure for a QAT device.
* This QAT device is a device offering only asymmetric crypto service,
return -EINVAL;
} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
ctx = (struct qat_sym_session *)get_sym_session_private_data(
- op->sym->session, cryptodev_qat_driver_id);
+ op->sym->session, qat_sym_driver_id);
#ifdef RTE_LIBRTE_SECURITY
} else {
ctx = (struct qat_sym_session *)get_sec_session_private_data(
sess = (struct qat_sym_session *)
get_sym_session_private_data(
rx_op->sym->session,
- cryptodev_qat_driver_id);
+ qat_sym_driver_id);
}
rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
#define MIXED_CRYPTO_MIN_FW_VER 0x04090000
-uint8_t cryptodev_qat_driver_id;
+uint8_t qat_sym_driver_id;
static const struct rte_cryptodev_capabilities qat_gen1_sym_capabilities[] = {
QAT_BASE_GEN1_SYM_CAPABILITIES,
qat_qps_per_service(sym_hw_qps, QAT_SERVICE_SYMMETRIC);
info->feature_flags = dev->feature_flags;
info->capabilities = internals->qat_dev_capabilities;
- info->driver_id = cryptodev_qat_driver_id;
+ info->driver_id = qat_sym_driver_id;
/* No limit of number of sessions */
info->sym.max_nb_sessions = 0;
}
struct rte_cryptodev *cryptodev;
struct qat_sym_dev_private *internals;
+ /*
+ * All processes must use same driver id so they can share sessions.
+ * Store driver_id so we can validate that all processes have the same
+ * value, typically they have, but could differ if binaries built
+ * separately.
+ */
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ qat_pci_dev->qat_sym_driver_id =
+ qat_sym_driver_id;
+ } else if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+ if (qat_pci_dev->qat_sym_driver_id !=
+ qat_sym_driver_id) {
+ QAT_LOG(ERR,
+ "Device %s have different driver id than corresponding device in primary process",
+ name);
+ return -(EFAULT);
+ }
+ }
+
#ifdef RTE_LIBRTE_SECURITY
struct rte_security_ctx *security_instance;
#endif
return -ENODEV;
qat_dev_instance->sym_rte_dev.name = cryptodev->data->name;
- cryptodev->driver_id = cryptodev_qat_driver_id;
+ cryptodev->driver_id = qat_sym_driver_id;
cryptodev->dev_ops = &crypto_qat_ops;
cryptodev->enqueue_burst = qat_sym_pmd_enqueue_op_burst;
static struct cryptodev_driver qat_crypto_drv;
RTE_PMD_REGISTER_CRYPTO_DRIVER(qat_crypto_drv,
cryptodev_qat_sym_driver,
- cryptodev_qat_driver_id);
+ qat_sym_driver_id);
#define QAT_SYM_CAP_MIXED_CRYPTO (1 << 0)
#define QAT_SYM_CAP_VALID (1 << 31)
-extern uint8_t cryptodev_qat_driver_id;
+extern uint8_t qat_sym_driver_id;
/** private data structure for a QAT device.
* This QAT device is a device offering only symmetric crypto service,