main processing loop */
| 194 | |
| 195 | /* main processing loop */ |
| 196 | static void |
| 197 | lsi_main_loop(void) |
| 198 | { |
| 199 | struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; |
| 200 | struct rte_mbuf *m; |
| 201 | unsigned lcore_id; |
| 202 | unsigned sent; |
| 203 | uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc; |
| 204 | unsigned i, j, portid, nb_rx; |
| 205 | struct lcore_queue_conf *qconf; |
| 206 | const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * |
| 207 | BURST_TX_DRAIN_US; |
| 208 | struct rte_eth_dev_tx_buffer *buffer; |
| 209 | |
| 210 | prev_tsc = 0; |
| 211 | timer_tsc = 0; |
| 212 | |
| 213 | lcore_id = rte_lcore_id(); |
| 214 | qconf = &lcore_queue_conf[lcore_id]; |
| 215 | |
| 216 | if (qconf->n_rx_port == 0) { |
| 217 | RTE_LOG(INFO, LSI, "lcore %u has nothing to do\n", lcore_id); |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | RTE_LOG(INFO, LSI, "entering main loop on lcore %u\n", lcore_id); |
| 222 | |
| 223 | for (i = 0; i < qconf->n_rx_port; i++) { |
| 224 | |
| 225 | portid = qconf->rx_port_list[i]; |
| 226 | RTE_LOG(INFO, LSI, " -- lcoreid=%u portid=%u\n", lcore_id, |
| 227 | portid); |
| 228 | } |
| 229 | |
| 230 | while (1) { |
| 231 | |
| 232 | /* Draining TX queue in its main loop. 8< */ |
| 233 | cur_tsc = rte_rdtsc(); |
| 234 | |
| 235 | /* |
| 236 | * TX burst queue drain |
| 237 | */ |
| 238 | diff_tsc = cur_tsc - prev_tsc; |
| 239 | if (unlikely(diff_tsc > drain_tsc)) { |
| 240 | |
| 241 | for (i = 0; i < qconf->n_rx_port; i++) { |
| 242 | |
| 243 | portid = lsi_dst_ports[qconf->rx_port_list[i]]; |
| 244 | buffer = tx_buffer[portid]; |
| 245 | |
| 246 | sent = rte_eth_tx_buffer_flush(portid, 0, buffer); |
| 247 | if (sent) |
| 248 | port_statistics[portid].tx += sent; |
| 249 | |
| 250 | } |
| 251 | |
| 252 | /* if timer is enabled */ |
| 253 | if (timer_period > 0) { |
no test coverage detected