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

Function dma_fp_data_prepare

dpdk/lib/dmadev/rte_dmadev.c:127–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125static void dma_fp_object_dummy(struct rte_dma_fp_object *obj);
126
127static int
128dma_fp_data_prepare(void)
129{
130 size_t size;
131 void *ptr;
132 int i;
133
134 if (rte_dma_fp_objs != NULL)
135 return 0;
136
137 /* Fast-path object must align cacheline, but the return value of malloc
138 * may not be aligned to the cache line. Therefore, extra memory is
139 * applied for realignment.
140 * note: We do not call posix_memalign/aligned_alloc because it is
141 * version dependent on libc.
142 */
143 size = dma_devices_max * sizeof(struct rte_dma_fp_object) +
144 RTE_CACHE_LINE_SIZE;
145 ptr = malloc(size);
146 if (ptr == NULL)
147 return -ENOMEM;
148 memset(ptr, 0, size);
149
150 rte_dma_fp_objs = RTE_PTR_ALIGN(ptr, RTE_CACHE_LINE_SIZE);
151 for (i = 0; i < dma_devices_max; i++)
152 dma_fp_object_dummy(&rte_dma_fp_objs[i]);
153
154 return 0;
155}
156
157static int
158dma_dev_data_prepare(void)

Callers 1

dma_data_prepareFunction · 0.85

Calls 3

mallocFunction · 0.85
memsetFunction · 0.85
dma_fp_object_dummyFunction · 0.85

Tested by

no test coverage detected