* Application main function - loops through * receiving and processing packets. Never returns */
| 303 | * receiving and processing packets. Never returns |
| 304 | */ |
| 305 | int |
| 306 | main(int argc, char *argv[]) |
| 307 | { |
| 308 | const struct rte_memzone *mz; |
| 309 | struct rte_ring *rx_ring; |
| 310 | struct rte_hash *h; |
| 311 | struct rte_mempool *mp; |
| 312 | struct shared_info *info; |
| 313 | int need_flush = 0; /* indicates whether we have unsent packets */ |
| 314 | int retval; |
| 315 | void *pkts[PKT_READ_SIZE]; |
| 316 | uint16_t sent; |
| 317 | |
| 318 | retval = rte_eal_init(argc, argv); |
| 319 | if (retval < 0) |
| 320 | return -1; |
| 321 | argc -= retval; |
| 322 | argv += retval; |
| 323 | |
| 324 | if (parse_app_args(argc, argv) < 0) |
| 325 | rte_exit(EXIT_FAILURE, "Invalid command-line arguments\n"); |
| 326 | |
| 327 | if (rte_eth_dev_count_avail() == 0) |
| 328 | rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); |
| 329 | |
| 330 | /* Attaching to the server process memory. 8< */ |
| 331 | rx_ring = rte_ring_lookup(get_rx_queue_name(node_id)); |
| 332 | if (rx_ring == NULL) |
| 333 | rte_exit(EXIT_FAILURE, "Cannot get RX ring - " |
| 334 | "is server process running?\n"); |
| 335 | |
| 336 | mp = rte_mempool_lookup(PKTMBUF_POOL_NAME); |
| 337 | if (mp == NULL) |
| 338 | rte_exit(EXIT_FAILURE, "Cannot get mempool for mbufs\n"); |
| 339 | |
| 340 | mz = rte_memzone_lookup(MZ_SHARED_INFO); |
| 341 | if (mz == NULL) |
| 342 | rte_exit(EXIT_FAILURE, "Cannot get port info structure\n"); |
| 343 | info = mz->addr; |
| 344 | tx_stats = &(info->tx_stats[node_id]); |
| 345 | filter_stats = &(info->filter_stats[node_id]); |
| 346 | /* >8 End of attaching to the server process memory. */ |
| 347 | |
| 348 | configure_output_ports(info); |
| 349 | |
| 350 | h = create_hash_table(info); |
| 351 | |
| 352 | populate_hash_table(h, info); |
| 353 | |
| 354 | RTE_LOG(INFO, APP, "Finished Process Init.\n"); |
| 355 | |
| 356 | printf("\nNode process %d handling packets\n", node_id); |
| 357 | printf("[Press Ctrl-C to quit ...]\n"); |
| 358 | |
| 359 | for (;;) { |
| 360 | uint16_t rx_pkts = PKT_READ_SIZE; |
| 361 | uint16_t port; |
| 362 |
nothing calls this directly
no test coverage detected