MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dpaa_sec_dev_init

Function dpaa_sec_dev_init

dpdk/drivers/crypto/dpaa_sec/dpaa_sec.c:3613–3719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3611}
3612
3613static int
3614dpaa_sec_dev_init(struct rte_cryptodev *cryptodev)
3615{
3616 struct dpaa_sec_dev_private *internals;
3617 struct rte_security_ctx *security_instance;
3618 struct dpaa_sec_qp *qp;
3619 uint32_t i, flags;
3620 int ret;
3621 void *cmd_map;
3622 int map_fd = -1;
3623
3624 PMD_INIT_FUNC_TRACE();
3625
3626 internals = cryptodev->data->dev_private;
3627 map_fd = open("/dev/mem", O_RDWR);
3628 if (unlikely(map_fd < 0)) {
3629 DPAA_SEC_ERR("Unable to open (/dev/mem)");
3630 return map_fd;
3631 }
3632 internals->sec_hw = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE,
3633 MAP_SHARED, map_fd, SEC_BASE_ADDR);
3634 if (internals->sec_hw == MAP_FAILED) {
3635 DPAA_SEC_ERR("Memory map failed");
3636 close(map_fd);
3637 return -EINVAL;
3638 }
3639 cmd_map = (uint8_t *)internals->sec_hw +
3640 (BLOCK_OFFSET * QI_BLOCK_NUMBER) + CMD_REG;
3641 if (!(be32_to_cpu(rte_read32(cmd_map)) & QICTL_DQEN))
3642 /* enable QI interface */
3643 rte_write32(cpu_to_be32(QICTL_DQEN), cmd_map);
3644
3645 ret = munmap(internals->sec_hw, MAP_SIZE);
3646 if (ret)
3647 DPAA_SEC_WARN("munmap failed");
3648
3649 close(map_fd);
3650 cryptodev->driver_id = dpaa_cryptodev_driver_id;
3651 cryptodev->dev_ops = &crypto_ops;
3652
3653 cryptodev->enqueue_burst = dpaa_sec_enqueue_burst;
3654 cryptodev->dequeue_burst = dpaa_sec_dequeue_burst;
3655 cryptodev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
3656 RTE_CRYPTODEV_FF_HW_ACCELERATED |
3657 RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
3658 RTE_CRYPTODEV_FF_SECURITY |
3659 RTE_CRYPTODEV_FF_SYM_RAW_DP |
3660 RTE_CRYPTODEV_FF_IN_PLACE_SGL |
3661 RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
3662 RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
3663 RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT |
3664 RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;
3665
3666 internals->max_nb_queue_pairs = RTE_DPAA_MAX_NB_SEC_QPS;
3667 internals->max_nb_sessions = RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS;
3668
3669 /*
3670 * For secondary processes, we don't initialise any further as primary

Callers 1

cryptodev_dpaa_sec_probeFunction · 0.85

Calls 10

rte_eal_process_typeFunction · 0.85
rte_mallocFunction · 0.85
rte_spinlock_initFunction · 0.85
dpaa_sec_init_txFunction · 0.85
dpaa_sec_get_devargsFunction · 0.85
rte_freeFunction · 0.85
closeFunction · 0.50
rte_read32Function · 0.50
rte_write32Function · 0.50
qman_create_fqFunction · 0.50

Tested by

no test coverage detected