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

Function rte_bbdev_data_alloc

dpdk/lib/bbdev/rte_bbdev.c:113–136  ·  view source on GitHub ↗

Allocate global data array */

Source from the content-addressed store, hash-verified

111
112/* Allocate global data array */
113static int
114rte_bbdev_data_alloc(void)
115{
116 const unsigned int flags = 0;
117 const struct rte_memzone *mz;
118
119 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
120 mz = rte_memzone_reserve(MZ_RTE_BBDEV_DATA,
121 RTE_BBDEV_MAX_DEVS * sizeof(*rte_bbdev_data),
122 rte_socket_id(), flags);
123 } else
124 mz = rte_memzone_lookup(MZ_RTE_BBDEV_DATA);
125 if (mz == NULL) {
126 rte_bbdev_log(CRIT,
127 "Cannot allocate memzone for bbdev port data");
128 return -ENOMEM;
129 }
130
131 rte_bbdev_data = mz->addr;
132 if (rte_eal_process_type() == RTE_PROC_PRIMARY)
133 memset(rte_bbdev_data, 0,
134 RTE_BBDEV_MAX_DEVS * sizeof(*rte_bbdev_data));
135 return 0;
136}
137
138/*
139 * Find data allocated for the device or if not found return first unused bbdev

Callers 1

rte_bbdev_allocateFunction · 0.85

Calls 5

rte_eal_process_typeFunction · 0.85
rte_memzone_reserveFunction · 0.85
rte_socket_idFunction · 0.85
rte_memzone_lookupFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected