main processing loop */
| 393 | |
| 394 | /* main processing loop */ |
| 395 | static int |
| 396 | main_loop(__rte_unused void *dummy) |
| 397 | { |
| 398 | struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; |
| 399 | unsigned lcore_id; |
| 400 | int i, j, nb_rx; |
| 401 | uint16_t portid; |
| 402 | struct lcore_queue_conf *qconf; |
| 403 | |
| 404 | lcore_id = rte_lcore_id(); |
| 405 | qconf = &lcore_queue_conf[lcore_id]; |
| 406 | |
| 407 | |
| 408 | if (qconf->n_rx_queue == 0) { |
| 409 | RTE_LOG(INFO, IPv4_MULTICAST, "lcore %u has nothing to do\n", |
| 410 | lcore_id); |
| 411 | return 0; |
| 412 | } |
| 413 | |
| 414 | RTE_LOG(INFO, IPv4_MULTICAST, "entering main loop on lcore %u\n", |
| 415 | lcore_id); |
| 416 | |
| 417 | for (i = 0; i < qconf->n_rx_queue; i++) { |
| 418 | |
| 419 | portid = qconf->rx_queue_list[i]; |
| 420 | RTE_LOG(INFO, IPv4_MULTICAST, " -- lcoreid=%u portid=%d\n", |
| 421 | lcore_id, portid); |
| 422 | } |
| 423 | |
| 424 | while (1) { |
| 425 | |
| 426 | /* |
| 427 | * Read packet from RX queues |
| 428 | */ |
| 429 | for (i = 0; i < qconf->n_rx_queue; i++) { |
| 430 | |
| 431 | portid = qconf->rx_queue_list[i]; |
| 432 | nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst, |
| 433 | MAX_PKT_BURST); |
| 434 | |
| 435 | /* Prefetch first packets */ |
| 436 | for (j = 0; j < PREFETCH_OFFSET && j < nb_rx; j++) { |
| 437 | rte_prefetch0(rte_pktmbuf_mtod( |
| 438 | pkts_burst[j], void *)); |
| 439 | } |
| 440 | |
| 441 | /* Prefetch and forward already prefetched packets */ |
| 442 | for (j = 0; j < (nb_rx - PREFETCH_OFFSET); j++) { |
| 443 | rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[ |
| 444 | j + PREFETCH_OFFSET], void *)); |
| 445 | mcast_forward(pkts_burst[j], qconf); |
| 446 | } |
| 447 | |
| 448 | /* Forward remaining prefetched packets */ |
| 449 | for (; j < nb_rx; j++) { |
| 450 | mcast_forward(pkts_burst[j], qconf); |
| 451 | } |
| 452 | } |
nothing calls this directly
no test coverage detected