cryptodev: pass IV as offset
[dpdk.git] / drivers / crypto / dpaa2_sec / dpaa2_sec_dpseci.c
index 4e01fe8..1605701 100644 (file)
@@ -87,6 +87,8 @@ build_authenc_fd(dpaa2_sec_session *sess,
        int icv_len = sym_op->auth.digest.length;
        uint8_t *old_icv;
        uint32_t mem_len = (7 * sizeof(struct qbman_fle)) + icv_len;
+       uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
+                       op->sym->cipher.iv.offset);
 
        PMD_INIT_FUNC_TRACE();
 
@@ -178,7 +180,7 @@ build_authenc_fd(dpaa2_sec_session *sess,
                         sym_op->auth.digest.length);
 
        /* Configure Input SGE for Encap/Decap */
-       DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(sym_op->cipher.iv.data));
+       DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(iv_ptr));
        sge->length = sym_op->cipher.iv.length;
        sge++;
 
@@ -307,6 +309,8 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
        uint32_t mem_len = (5 * sizeof(struct qbman_fle));
        struct sec_flow_context *flc;
        struct ctxt_priv *priv = sess->ctxt;
+       uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
+                       op->sym->cipher.iv.offset);
 
        PMD_INIT_FUNC_TRACE();
 
@@ -369,7 +373,7 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 
        DPAA2_SET_FLE_SG_EXT(fle);
 
-       DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(sym_op->cipher.iv.data));
+       DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(iv_ptr));
        sge->length = sym_op->cipher.iv.length;
 
        sge++;
@@ -437,7 +441,7 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
        if (unlikely(nb_ops == 0))
                return 0;
 
-       if (ops[0]->sym->sess_type != RTE_CRYPTO_SYM_OP_WITH_SESSION) {
+       if (ops[0]->sess_type != RTE_CRYPTO_OP_WITH_SESSION) {
                RTE_LOG(ERR, PMD, "sessionless crypto op not supported\n");
                return 0;
        }
@@ -1481,8 +1485,7 @@ static struct rte_cryptodev_ops crypto_ops = {
 };
 
 static int
-dpaa2_sec_uninit(const struct rte_cryptodev_driver *crypto_drv __rte_unused,
-                struct rte_cryptodev *dev)
+dpaa2_sec_uninit(const struct rte_cryptodev *dev)
 {
        PMD_INIT_LOG(INFO, "Closing DPAA2_SEC device %s on numa socket %u\n",
                     dev->data->name, rte_socket_id());
@@ -1571,7 +1574,7 @@ init_error:
 }
 
 static int
-cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv,
+cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
                          struct rte_dpaa2_device *dpaa2_dev)
 {
        struct rte_cryptodev *cryptodev;
@@ -1599,7 +1602,6 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv,
 
        dpaa2_dev->cryptodev = cryptodev;
        cryptodev->device = &dpaa2_dev->device;
-       cryptodev->driver = (struct rte_cryptodev_driver *)dpaa2_drv;
 
        /* init user callbacks */
        TAILQ_INIT(&(cryptodev->link_intr_cbs));
@@ -1627,7 +1629,7 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
        if (cryptodev == NULL)
                return -ENODEV;
 
-       ret = dpaa2_sec_uninit(NULL, cryptodev);
+       ret = dpaa2_sec_uninit(cryptodev);
        if (ret)
                return ret;
 
@@ -1638,7 +1640,6 @@ cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
                rte_free(cryptodev->data->dev_private);
 
        cryptodev->device = NULL;
-       cryptodev->driver = NULL;
        cryptodev->data = NULL;
 
        return 0;