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

Function rte_compressdev_data_alloc

dpdk/lib/compressdev/rte_compressdev.c:181–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181static inline int
182rte_compressdev_data_alloc(uint8_t dev_id, struct rte_compressdev_data **data,
183 int socket_id)
184{
185 char mz_name[RTE_COMPRESSDEV_NAME_MAX_LEN];
186 const struct rte_memzone *mz;
187 int n;
188
189 /* generate memzone name */
190 n = snprintf(mz_name, sizeof(mz_name),
191 "rte_compressdev_data_%u", dev_id);
192 if (n >= (int)sizeof(mz_name))
193 return -EINVAL;
194
195 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
196 mz = rte_memzone_reserve(mz_name,
197 sizeof(struct rte_compressdev_data),
198 socket_id, 0);
199 } else
200 mz = rte_memzone_lookup(mz_name);
201
202 if (mz == NULL)
203 return -ENOMEM;
204
205 *data = mz->addr;
206 if (rte_eal_process_type() == RTE_PROC_PRIMARY)
207 memset(*data, 0, sizeof(struct rte_compressdev_data));
208
209 return 0;
210}
211
212static uint8_t
213rte_compressdev_find_free_device_index(void)

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