main processing loop */
| 991 | |
| 992 | /* main processing loop */ |
| 993 | int |
| 994 | acl_main_loop(__rte_unused void *dummy) |
| 995 | { |
| 996 | struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; |
| 997 | unsigned int lcore_id; |
| 998 | uint64_t prev_tsc, diff_tsc, cur_tsc; |
| 999 | int i, nb_rx; |
| 1000 | uint16_t portid; |
| 1001 | uint16_t queueid; |
| 1002 | struct lcore_conf *qconf; |
| 1003 | int socketid; |
| 1004 | const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) |
| 1005 | / US_PER_S * BURST_TX_DRAIN_US; |
| 1006 | |
| 1007 | prev_tsc = 0; |
| 1008 | lcore_id = rte_lcore_id(); |
| 1009 | qconf = &lcore_conf[lcore_id]; |
| 1010 | socketid = rte_lcore_to_socket_id(lcore_id); |
| 1011 | |
| 1012 | if (qconf->n_rx_queue == 0) { |
| 1013 | RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id); |
| 1014 | return 0; |
| 1015 | } |
| 1016 | |
| 1017 | RTE_LOG(INFO, L3FWD, "entering main loop on lcore %u\n", lcore_id); |
| 1018 | |
| 1019 | for (i = 0; i < qconf->n_rx_queue; i++) { |
| 1020 | |
| 1021 | portid = qconf->rx_queue_list[i].port_id; |
| 1022 | queueid = qconf->rx_queue_list[i].queue_id; |
| 1023 | RTE_LOG(INFO, L3FWD, |
| 1024 | " -- lcoreid=%u portid=%u rxqueueid=%" PRIu16 "\n", |
| 1025 | lcore_id, portid, queueid); |
| 1026 | } |
| 1027 | |
| 1028 | while (!force_quit) { |
| 1029 | |
| 1030 | cur_tsc = rte_rdtsc(); |
| 1031 | |
| 1032 | /* |
| 1033 | * TX burst queue drain |
| 1034 | */ |
| 1035 | diff_tsc = cur_tsc - prev_tsc; |
| 1036 | if (unlikely(diff_tsc > drain_tsc)) { |
| 1037 | |
| 1038 | for (i = 0; i < qconf->n_tx_port; ++i) { |
| 1039 | portid = qconf->tx_port_id[i]; |
| 1040 | if (qconf->tx_mbufs[portid].len == 0) |
| 1041 | continue; |
| 1042 | send_burst(qconf, |
| 1043 | qconf->tx_mbufs[portid].len, |
| 1044 | portid); |
| 1045 | qconf->tx_mbufs[portid].len = 0; |
| 1046 | } |
| 1047 | |
| 1048 | prev_tsc = cur_tsc; |
| 1049 | } |
| 1050 |
nothing calls this directly
no test coverage detected