| 1007 | } |
| 1008 | |
| 1009 | static inline int |
| 1010 | rte_cryptodev_data_free(uint8_t dev_id, struct rte_cryptodev_data **data) |
| 1011 | { |
| 1012 | char mz_name[RTE_MEMZONE_NAMESIZE]; |
| 1013 | const struct rte_memzone *mz; |
| 1014 | int n; |
| 1015 | |
| 1016 | /* generate memzone name */ |
| 1017 | n = snprintf(mz_name, sizeof(mz_name), "rte_cryptodev_data_%u", dev_id); |
| 1018 | if (n >= (int)sizeof(mz_name)) |
| 1019 | return -EINVAL; |
| 1020 | |
| 1021 | mz = rte_memzone_lookup(mz_name); |
| 1022 | if (mz == NULL) |
| 1023 | return -ENOMEM; |
| 1024 | |
| 1025 | RTE_ASSERT(*data == mz->addr); |
| 1026 | *data = NULL; |
| 1027 | |
| 1028 | if (rte_eal_process_type() == RTE_PROC_PRIMARY) { |
| 1029 | CDEV_LOG_DEBUG("PRIMARY:free memzone of %s (%p)", |
| 1030 | mz_name, mz); |
| 1031 | return rte_memzone_free(mz); |
| 1032 | } else { |
| 1033 | CDEV_LOG_DEBUG("SECONDARY:don't free memzone of %s (%p)", |
| 1034 | mz_name, mz); |
| 1035 | } |
| 1036 | |
| 1037 | return 0; |
| 1038 | } |
| 1039 | |
| 1040 | static uint8_t |
| 1041 | rte_cryptodev_find_free_device_index(void) |
no test coverage detected