| 1551 | } |
| 1552 | |
| 1553 | static int32_t |
| 1554 | add_cdev_mapping(const struct rte_cryptodev_info *dev_info, uint16_t cdev_id, |
| 1555 | uint16_t qp, struct lcore_params *params) |
| 1556 | { |
| 1557 | int32_t ret = 0; |
| 1558 | const struct rte_cryptodev_capabilities *i, *j; |
| 1559 | struct lcore_conf *qconf; |
| 1560 | struct ipsec_ctx *ipsec_ctx; |
| 1561 | const char *str; |
| 1562 | void *sec_ctx; |
| 1563 | const struct rte_security_capability *sec_cap; |
| 1564 | |
| 1565 | qconf = &lcore_conf[params->lcore_id]; |
| 1566 | |
| 1567 | if (!is_unprotected_port(params->port_id)) { |
| 1568 | ipsec_ctx = &qconf->outbound; |
| 1569 | ipsec_ctx->cdev_map = cdev_map_out; |
| 1570 | str = "Outbound"; |
| 1571 | } else { |
| 1572 | ipsec_ctx = &qconf->inbound; |
| 1573 | ipsec_ctx->cdev_map = cdev_map_in; |
| 1574 | str = "Inbound"; |
| 1575 | } |
| 1576 | |
| 1577 | /* Required cryptodevs with operation chaining */ |
| 1578 | if (!(dev_info->feature_flags & RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING) && |
| 1579 | !(dev_info->feature_flags & RTE_CRYPTODEV_FF_SECURITY)) |
| 1580 | return ret; |
| 1581 | |
| 1582 | for (i = dev_info->capabilities; |
| 1583 | i->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; i++) { |
| 1584 | if (i->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC) |
| 1585 | continue; |
| 1586 | |
| 1587 | if (i->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AEAD) { |
| 1588 | ret |= add_mapping(str, cdev_id, qp, params, |
| 1589 | ipsec_ctx, NULL, NULL, i); |
| 1590 | continue; |
| 1591 | } |
| 1592 | |
| 1593 | if (i->sym.xform_type != RTE_CRYPTO_SYM_XFORM_CIPHER) |
| 1594 | continue; |
| 1595 | |
| 1596 | for (j = dev_info->capabilities; |
| 1597 | j->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; j++) { |
| 1598 | if (j->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC) |
| 1599 | continue; |
| 1600 | |
| 1601 | if (j->sym.xform_type != RTE_CRYPTO_SYM_XFORM_AUTH) |
| 1602 | continue; |
| 1603 | |
| 1604 | ret |= add_mapping(str, cdev_id, qp, params, |
| 1605 | ipsec_ctx, i, j, NULL); |
| 1606 | } |
| 1607 | } |
| 1608 | |
| 1609 | sec_ctx = rte_cryptodev_get_sec_ctx(cdev_id); |
| 1610 | if (sec_ctx == NULL) |
no test coverage detected