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

Function dma_dev_data_prepare

dpdk/lib/dmadev/rte_dmadev.c:157–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157static int
158dma_dev_data_prepare(void)
159{
160 size_t size;
161 void *ptr;
162
163 if (rte_dma_devices != NULL)
164 return 0;
165
166 /* The DMA device object is expected to align cacheline,
167 * but the return value of malloc may not be aligned to the cache line.
168 * Therefore, extra memory is applied for realignment.
169 * Note: posix_memalign/aligned_alloc are not used
170 * because not always available, depending on libc.
171 */
172 size = dma_devices_max * sizeof(struct rte_dma_dev) + RTE_CACHE_LINE_SIZE;
173 ptr = malloc(size);
174 if (ptr == NULL)
175 return -ENOMEM;
176 memset(ptr, 0, size);
177
178 rte_dma_devices = RTE_PTR_ALIGN(ptr, RTE_CACHE_LINE_SIZE);
179
180 return 0;
181}
182
183static int
184dma_shared_data_prepare(void)

Callers 1

dma_data_prepareFunction · 0.85

Calls 2

mallocFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected