mirror of https://github.com/F-Stack/f-stack.git
user prosess lr->loop called every 100us when idle
This commit is contained in:
parent
a1720b1d7a
commit
8fecf4dd08
|
@ -1147,7 +1147,7 @@ main_loop(void *arg)
|
||||||
|
|
||||||
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
|
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
|
||||||
unsigned lcore_id;
|
unsigned lcore_id;
|
||||||
uint64_t prev_tsc, diff_tsc, cur_tsc, div_tsc, usr_tsc, sys_tsc, end_tsc;
|
uint64_t prev_tsc, diff_tsc, cur_tsc, usch_tsc, div_tsc, usr_tsc, sys_tsc, end_tsc;
|
||||||
int i, j, nb_rx, idle;
|
int i, j, nb_rx, idle;
|
||||||
uint8_t port_id, queue_id;
|
uint8_t port_id, queue_id;
|
||||||
struct lcore_conf *qconf;
|
struct lcore_conf *qconf;
|
||||||
|
@ -1156,6 +1156,7 @@ main_loop(void *arg)
|
||||||
struct ff_dpdk_if_context *ctx;
|
struct ff_dpdk_if_context *ctx;
|
||||||
|
|
||||||
prev_tsc = 0;
|
prev_tsc = 0;
|
||||||
|
usch_tsc = 0;
|
||||||
|
|
||||||
lcore_id = rte_lcore_id();
|
lcore_id = rte_lcore_id();
|
||||||
qconf = &lcore_conf;
|
qconf = &lcore_conf;
|
||||||
|
@ -1242,12 +1243,16 @@ main_loop(void *arg)
|
||||||
|
|
||||||
div_tsc = rte_rdtsc();
|
div_tsc = rte_rdtsc();
|
||||||
|
|
||||||
if (likely(lr->loop != NULL)) {
|
if (likely(lr->loop != NULL && (!idle || cur_tsc - usch_tsc > drain_tsc))) {
|
||||||
|
usch_tsc = cur_tsc;
|
||||||
lr->loop(lr->arg);
|
lr->loop(lr->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
end_tsc = rte_rdtsc();
|
end_tsc = rte_rdtsc();
|
||||||
usr_tsc = end_tsc - div_tsc;
|
|
||||||
|
if (usch_tsc == cur_tsc) {
|
||||||
|
usr_tsc = end_tsc - div_tsc;
|
||||||
|
}
|
||||||
|
|
||||||
if (!idle) {
|
if (!idle) {
|
||||||
sys_tsc = div_tsc - cur_tsc;
|
sys_tsc = div_tsc - cur_tsc;
|
||||||
|
|
Loading…
Reference in New Issue