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

Function rte_cryptodev_data_free

dpdk/lib/cryptodev/rte_cryptodev.c:1009–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007}
1008
1009static inline int
1010rte_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
1040static uint8_t
1041rte_cryptodev_find_free_device_index(void)

Callers 1

Calls 4

snprintfFunction · 0.85
rte_memzone_lookupFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_memzone_freeFunction · 0.85

Tested by

no test coverage detected