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

Function rte_cryptodev_data_alloc

dpdk/lib/cryptodev/rte_cryptodev.c:974–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

972}
973
974static inline int
975rte_cryptodev_data_alloc(uint8_t dev_id, struct rte_cryptodev_data **data,
976 int socket_id)
977{
978 char mz_name[RTE_MEMZONE_NAMESIZE];
979 const struct rte_memzone *mz;
980 int n;
981
982 /* generate memzone name */
983 n = snprintf(mz_name, sizeof(mz_name), "rte_cryptodev_data_%u", dev_id);
984 if (n >= (int)sizeof(mz_name))
985 return -EINVAL;
986
987 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
988 mz = rte_memzone_reserve(mz_name,
989 sizeof(struct rte_cryptodev_data),
990 socket_id, 0);
991 CDEV_LOG_DEBUG("PRIMARY:reserved memzone for %s (%p)",
992 mz_name, mz);
993 } else {
994 mz = rte_memzone_lookup(mz_name);
995 CDEV_LOG_DEBUG("SECONDARY:looked up memzone for %s (%p)",
996 mz_name, mz);
997 }
998
999 if (mz == NULL)
1000 return -ENOMEM;
1001
1002 *data = mz->addr;
1003 if (rte_eal_process_type() == RTE_PROC_PRIMARY)
1004 memset(*data, 0, sizeof(struct rte_cryptodev_data));
1005
1006 return 0;
1007}
1008
1009static inline int
1010rte_cryptodev_data_free(uint8_t dev_id, struct rte_cryptodev_data **data)

Callers 1

Calls 5

snprintfFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_memzone_reserveFunction · 0.85
rte_memzone_lookupFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected