#include <time.h>
#include <net/if.h>
+#include <unistd.h>
#include <rte_mbuf.h>
#include <rte_cryptodev.h>
/* Configure Output SGE for Encap/Decap */
DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(mbuf));
- DPAA2_SET_FLE_OFFSET(sge, mbuf->data_off + sym_op->aead.data.offset -
- auth_only_len);
+ DPAA2_SET_FLE_OFFSET(sge, mbuf->data_off +
+ RTE_ALIGN_CEIL(auth_only_len, 16) - auth_only_len);
sge->length = mbuf->data_len - sym_op->aead.data.offset + auth_only_len;
mbuf = mbuf->next;
/* Configure Output SGE for Encap/Decap */
DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(dst));
- DPAA2_SET_FLE_OFFSET(sge, sym_op->aead.data.offset +
- dst->data_off - auth_only_len);
+ DPAA2_SET_FLE_OFFSET(sge, dst->data_off +
+ RTE_ALIGN_CEIL(auth_only_len, 16) - auth_only_len);
sge->length = sym_op->aead.data.length + auth_only_len;
if (sess->dir == DIR_ENC) {
}
static inline struct rte_crypto_op *
-sec_simple_fd_to_mbuf(const struct qbman_fd *fd, __rte_unused uint8_t id)
+sec_simple_fd_to_mbuf(const struct qbman_fd *fd)
{
struct rte_crypto_op *op;
uint16_t len = DPAA2_GET_FD_LEN(fd);
}
static inline struct rte_crypto_op *
-sec_fd_to_mbuf(const struct qbman_fd *fd, uint8_t driver_id)
+sec_fd_to_mbuf(const struct qbman_fd *fd)
{
struct qbman_fle *fle;
struct rte_crypto_op *op;
struct rte_mbuf *dst, *src;
if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
- return sec_simple_fd_to_mbuf(fd, driver_id);
+ return sec_simple_fd_to_mbuf(fd);
fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
{
/* Function is responsible to receive frames for a given device and VQ*/
struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp;
- struct rte_cryptodev *dev =
- (struct rte_cryptodev *)(dpaa2_qp->rx_vq.dev);
struct qbman_result *dq_storage;
uint32_t fqid = dpaa2_qp->rx_vq.fqid;
int ret, num_rx = 0;
}
fd = qbman_result_DQ_fd(dq_storage);
- ops[num_rx] = sec_fd_to_mbuf(fd, dev->driver_id);
+ ops[num_rx] = sec_fd_to_mbuf(fd);
if (unlikely(fd->simple.frc)) {
/* TODO Parse SEC errors */
return -1;
}
- qp->rx_vq.dev = dev;
- qp->tx_vq.dev = dev;
+ qp->rx_vq.crypto_data = dev->data;
+ qp->tx_vq.crypto_data = dev->data;
qp->rx_vq.q_storage = rte_malloc("sec dq storage",
sizeof(struct queue_storage_info_t),
RTE_CACHE_LINE_SIZE);
session->dir = (xform->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
DIR_ENC : DIR_DEC;
- bufsize = cnstr_shdsc_blkcipher(priv->flc_desc[0].desc, 1, 0,
+ bufsize = cnstr_shdsc_blkcipher(priv->flc_desc[0].desc, 1, 0, SHR_NEVER,
&cipherdata, NULL, session->iv.length,
session->dir);
if (bufsize < 0) {
DPAA2_SEC_ERR("Crypto: Descriptor build failed");
goto error_out;
}
- flc->dhr = 0;
- flc->bpv0 = 0x1;
- flc->mode_bits = 0x8000;
flc->word1_sdl = (uint8_t)bufsize;
- flc->word2_rflc_31_0 = lower_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
- flc->word3_rflc_63_32 = upper_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
session->ctxt = priv;
for (i = 0; i < bufsize; i++)
DIR_ENC : DIR_DEC;
bufsize = cnstr_shdsc_hmac(priv->flc_desc[DESC_INITFINAL].desc,
- 1, 0, &authdata, !session->dir,
+ 1, 0, SHR_NEVER, &authdata, !session->dir,
session->digest_length);
if (bufsize < 0) {
DPAA2_SEC_ERR("Crypto: Invalid buffer length");
}
flc->word1_sdl = (uint8_t)bufsize;
- flc->word2_rflc_31_0 = lower_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
- flc->word3_rflc_63_32 = upper_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
session->ctxt = priv;
for (i = 0; i < bufsize; i++)
DPAA2_SEC_DEBUG("DESC[%d]:0x%x",
if (session->dir == DIR_ENC)
bufsize = cnstr_shdsc_gcm_encap(
- priv->flc_desc[0].desc, 1, 0,
+ priv->flc_desc[0].desc, 1, 0, SHR_NEVER,
&aeaddata, session->iv.length,
session->digest_length);
else
bufsize = cnstr_shdsc_gcm_decap(
- priv->flc_desc[0].desc, 1, 0,
+ priv->flc_desc[0].desc, 1, 0, SHR_NEVER,
&aeaddata, session->iv.length,
session->digest_length);
if (bufsize < 0) {
}
flc->word1_sdl = (uint8_t)bufsize;
- flc->word2_rflc_31_0 = lower_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
- flc->word3_rflc_63_32 = upper_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
session->ctxt = priv;
for (i = 0; i < bufsize; i++)
DPAA2_SEC_DEBUG("DESC[%d]:0x%x\n",
if (session->ctxt_type == DPAA2_SEC_CIPHER_HASH) {
bufsize = cnstr_shdsc_authenc(priv->flc_desc[0].desc, 1,
- 0, &cipherdata, &authdata,
+ 0, SHR_SERIAL,
+ &cipherdata, &authdata,
session->iv.length,
ctxt->auth_only_len,
session->digest_length,
}
flc->word1_sdl = (uint8_t)bufsize;
- flc->word2_rflc_31_0 = lower_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
- flc->word3_rflc_63_32 = upper_32_bits(
- (size_t)&(((struct dpaa2_sec_qp *)
- dev->data->queue_pairs[0])->rx_vq));
session->ctxt = priv;
for (i = 0; i < bufsize; i++)
DPAA2_SEC_DEBUG("DESC[%d]:0x%x",
rte_free(s->ctxt);
rte_free(s->cipher_key.data);
rte_free(s->auth_key.data);
- memset(sess, 0, sizeof(dpaa2_sec_session));
+ memset(s, 0, sizeof(dpaa2_sec_session));
set_sec_session_private_data(sess, NULL);
rte_mempool_put(sess_mp, sess_priv);
}
ev->sched_type = rxq->ev.sched_type;
ev->queue_id = rxq->ev.queue_id;
ev->priority = rxq->ev.priority;
- ev->event_ptr = sec_fd_to_mbuf(fd, ((struct rte_cryptodev *)
- (rxq->dev))->driver_id);
+ ev->event_ptr = sec_fd_to_mbuf(fd);
qbman_swp_dqrr_consume(swp, dq);
}
ev->queue_id = rxq->ev.queue_id;
ev->priority = rxq->ev.priority;
- ev->event_ptr = sec_fd_to_mbuf(fd, ((struct rte_cryptodev *)
- (rxq->dev))->driver_id);
+ ev->event_ptr = sec_fd_to_mbuf(fd);
dqrr_index = qbman_get_dqrr_idx(dq);
crypto_op->sym->m_src->seqn = dqrr_index + 1;
DPAA2_PER_LCORE_DQRR_SIZE++;
uint16_t token;
struct dpseci_attr attr;
int retcode, hw_id;
- char str[20];
+ char str[30];
PMD_INIT_FUNC_TRACE();
dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device);
internals->hw = dpseci;
internals->token = token;
- snprintf(str, sizeof(str), "fle_pool_%d", cryptodev->data->dev_id);
+ snprintf(str, sizeof(str), "sec_fle_pool_p%d_%d",
+ getpid(), cryptodev->data->dev_id);
internals->fle_pool = rte_mempool_create((const char *)str,
FLE_POOL_NUM_BUFS,
FLE_POOL_BUF_SIZE,