| 181 | } |
| 182 | |
| 183 | static int |
| 184 | dma_shared_data_prepare(void) |
| 185 | { |
| 186 | const char *mz_name = "rte_dma_dev_data"; |
| 187 | const struct rte_memzone *mz; |
| 188 | size_t size; |
| 189 | |
| 190 | if (dma_devices_shared_data != NULL) |
| 191 | return 0; |
| 192 | |
| 193 | size = sizeof(*dma_devices_shared_data) + |
| 194 | sizeof(struct rte_dma_dev_data) * dma_devices_max; |
| 195 | |
| 196 | if (rte_eal_process_type() == RTE_PROC_PRIMARY) |
| 197 | mz = rte_memzone_reserve(mz_name, size, rte_socket_id(), 0); |
| 198 | else |
| 199 | mz = rte_memzone_lookup(mz_name); |
| 200 | if (mz == NULL) |
| 201 | return -ENOMEM; |
| 202 | |
| 203 | dma_devices_shared_data = mz->addr; |
| 204 | if (rte_eal_process_type() == RTE_PROC_PRIMARY) { |
| 205 | memset(dma_devices_shared_data, 0, size); |
| 206 | dma_devices_shared_data->dev_max = dma_devices_max; |
| 207 | } else { |
| 208 | dma_devices_max = dma_devices_shared_data->dev_max; |
| 209 | } |
| 210 | |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | static int |
| 215 | dma_data_prepare(void) |
no test coverage detected