main processing loop */
| 1075 | |
| 1076 | /* main processing loop */ |
| 1077 | static int |
| 1078 | main_telemetry_loop(__rte_unused void *dummy) |
| 1079 | { |
| 1080 | struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; |
| 1081 | unsigned int lcore_id; |
| 1082 | uint64_t prev_tsc, diff_tsc, cur_tsc, prev_tel_tsc; |
| 1083 | int i, j, nb_rx; |
| 1084 | uint16_t portid, queueid; |
| 1085 | struct lcore_conf *qconf; |
| 1086 | struct lcore_rx_queue *rx_queue; |
| 1087 | uint64_t ep_nep[2] = {0}, fp_nfp[2] = {0}; |
| 1088 | uint64_t poll_count; |
| 1089 | enum busy_rate br; |
| 1090 | |
| 1091 | const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / |
| 1092 | US_PER_S * BURST_TX_DRAIN_US; |
| 1093 | |
| 1094 | poll_count = 0; |
| 1095 | prev_tsc = 0; |
| 1096 | prev_tel_tsc = 0; |
| 1097 | |
| 1098 | lcore_id = rte_lcore_id(); |
| 1099 | qconf = &lcore_conf[lcore_id]; |
| 1100 | |
| 1101 | if (qconf->n_rx_queue == 0) { |
| 1102 | RTE_LOG(INFO, L3FWD_POWER, "lcore %u has nothing to do\n", |
| 1103 | lcore_id); |
| 1104 | return 0; |
| 1105 | } |
| 1106 | |
| 1107 | RTE_LOG(INFO, L3FWD_POWER, "entering main telemetry loop on lcore %u\n", |
| 1108 | lcore_id); |
| 1109 | |
| 1110 | for (i = 0; i < qconf->n_rx_queue; i++) { |
| 1111 | portid = qconf->rx_queue_list[i].port_id; |
| 1112 | queueid = qconf->rx_queue_list[i].queue_id; |
| 1113 | RTE_LOG(INFO, L3FWD_POWER, " -- lcoreid=%u portid=%u " |
| 1114 | "rxqueueid=%" PRIu16 "\n", lcore_id, portid, queueid); |
| 1115 | } |
| 1116 | |
| 1117 | while (!is_done()) { |
| 1118 | |
| 1119 | cur_tsc = rte_rdtsc(); |
| 1120 | /* |
| 1121 | * TX burst queue drain |
| 1122 | */ |
| 1123 | diff_tsc = cur_tsc - prev_tsc; |
| 1124 | if (unlikely(diff_tsc > drain_tsc)) { |
| 1125 | for (i = 0; i < qconf->n_tx_port; ++i) { |
| 1126 | portid = qconf->tx_port_id[i]; |
| 1127 | rte_eth_tx_buffer_flush(portid, |
| 1128 | qconf->tx_queue_id[portid], |
| 1129 | qconf->tx_buffer[portid]); |
| 1130 | } |
| 1131 | prev_tsc = cur_tsc; |
| 1132 | } |
| 1133 | |
| 1134 | /* |
nothing calls this directly
no test coverage detected