| 2214 | } |
| 2215 | |
| 2216 | static int |
| 2217 | main_loop(void *arg) |
| 2218 | { |
| 2219 | struct loop_routine *lr = (struct loop_routine *)arg; |
| 2220 | |
| 2221 | struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; |
| 2222 | uint64_t prev_tsc, diff_tsc, cur_tsc, usch_tsc, div_tsc, usr_tsc, sys_tsc, end_tsc, idle_sleep_tsc; |
| 2223 | int i, j, nb_rx, idle; |
| 2224 | uint16_t port_id, queue_id; |
| 2225 | struct lcore_conf *qconf; |
| 2226 | uint64_t drain_tsc = 0; |
| 2227 | struct ff_dpdk_if_context *ctx; |
| 2228 | |
| 2229 | if (pkt_tx_delay) { |
| 2230 | drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * pkt_tx_delay; |
| 2231 | } |
| 2232 | |
| 2233 | prev_tsc = 0; |
| 2234 | usch_tsc = 0; |
| 2235 | |
| 2236 | qconf = &lcore_conf; |
| 2237 | |
| 2238 | while (1) { |
| 2239 | |
| 2240 | if (unlikely(stop_loop)) { |
| 2241 | break; |
| 2242 | } |
| 2243 | |
| 2244 | cur_tsc = rte_rdtsc(); |
| 2245 | if (unlikely(freebsd_clock.expire < cur_tsc)) { |
| 2246 | rte_timer_manage(); |
| 2247 | |
| 2248 | #ifdef FF_KNI |
| 2249 | /* reset kni ratelimt */ |
| 2250 | if (enable_kni && |
| 2251 | (ff_global_cfg.kni.console_packets_ratelimit || |
| 2252 | ff_global_cfg.kni.general_packets_ratelimit || |
| 2253 | ff_global_cfg.kni.kernel_packets_ratelimit)) { |
| 2254 | static time_t last_sec = 0; |
| 2255 | time_t sec; |
| 2256 | long nsec; |
| 2257 | |
| 2258 | ff_get_current_time(&sec, &nsec); |
| 2259 | if (sec > last_sec) { |
| 2260 | if (kni_rate_limt.gerneal_packets > (uint64_t)ff_global_cfg.kni.general_packets_ratelimit || |
| 2261 | kni_rate_limt.console_packets > (uint64_t)ff_global_cfg.kni.console_packets_ratelimit || |
| 2262 | kni_rate_limt.kernel_packets > (uint64_t)ff_global_cfg.kni.kernel_packets_ratelimit) { |
| 2263 | ff_log(FF_LOG_NOTICE, FF_LOGTYPE_FSTACK_LIB, "kni ratelimit, general:%lu/%d, console:%lu/%d, kernel:%lu/%d, last sec:%ld, sec:%ld\n", |
| 2264 | kni_rate_limt.gerneal_packets, ff_global_cfg.kni.general_packets_ratelimit, |
| 2265 | kni_rate_limt.console_packets, ff_global_cfg.kni.console_packets_ratelimit, |
| 2266 | kni_rate_limt.kernel_packets, ff_global_cfg.kni.kernel_packets_ratelimit, last_sec, sec); |
| 2267 | } |
| 2268 | last_sec = sec; |
| 2269 | kni_rate_limt.gerneal_packets = 0; |
| 2270 | kni_rate_limt.console_packets = 0; |
| 2271 | kni_rate_limt.kernel_packets = 0; |
| 2272 | } |
| 2273 | } |
nothing calls this directly
no test coverage detected