| 155 | } |
| 156 | |
| 157 | static int |
| 158 | dma_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 | |
| 183 | static int |
| 184 | dma_shared_data_prepare(void) |
no test coverage detected