* Main init function for the multi-process server app, * calls subfunctions to do each stage of the initialisation. */
| 305 | * calls subfunctions to do each stage of the initialisation. |
| 306 | */ |
| 307 | int |
| 308 | init(int argc, char *argv[]) |
| 309 | { |
| 310 | int retval; |
| 311 | const struct rte_memzone *mz; |
| 312 | uint8_t i, total_ports; |
| 313 | |
| 314 | /* init EAL, parsing EAL args */ |
| 315 | retval = rte_eal_init(argc, argv); |
| 316 | if (retval < 0) |
| 317 | return -1; |
| 318 | argc -= retval; |
| 319 | argv += retval; |
| 320 | |
| 321 | /* get total number of ports */ |
| 322 | total_ports = rte_eth_dev_count_avail(); |
| 323 | |
| 324 | /* set up array for port data */ |
| 325 | mz = rte_memzone_reserve(MZ_SHARED_INFO, sizeof(*info), |
| 326 | rte_socket_id(), NO_FLAGS); |
| 327 | if (mz == NULL) |
| 328 | rte_exit(EXIT_FAILURE, "Cannot reserve memory zone " |
| 329 | "for port information\n"); |
| 330 | memset(mz->addr, 0, sizeof(*info)); |
| 331 | info = mz->addr; |
| 332 | |
| 333 | /* parse additional, application arguments */ |
| 334 | retval = parse_app_args(total_ports, argc, argv); |
| 335 | if (retval != 0) |
| 336 | return -1; |
| 337 | |
| 338 | /* initialise mbuf pools */ |
| 339 | retval = init_mbuf_pools(); |
| 340 | if (retval != 0) |
| 341 | rte_exit(EXIT_FAILURE, "Cannot create needed mbuf pools\n"); |
| 342 | |
| 343 | /* now initialise the ports we will use */ |
| 344 | for (i = 0; i < info->num_ports; i++) { |
| 345 | retval = init_port(info->id[i]); |
| 346 | if (retval != 0) |
| 347 | rte_exit(EXIT_FAILURE, "Cannot initialise port %u\n", |
| 348 | (unsigned int) i); |
| 349 | } |
| 350 | |
| 351 | check_all_ports_link_status(info->num_ports, (~0x0)); |
| 352 | |
| 353 | /* initialise the node queues/rings for inter-eu comms */ |
| 354 | init_shm_rings(); |
| 355 | |
| 356 | /* Create the EFD table */ |
| 357 | create_efd_table(); |
| 358 | |
| 359 | /* Populate the EFD table */ |
| 360 | populate_efd_table(); |
| 361 | |
| 362 | /* Share the total number of nodes */ |
| 363 | info->num_nodes = num_nodes; |
| 364 |
no test coverage detected