mirror of https://github.com/F-Stack/f-stack.git
Add ff_stop_run to stop the poll loop
This commit is contained in:
parent
8b0b62dd23
commit
90b9053c56
|
@ -49,6 +49,12 @@ However, it is supported only before F-Stack is started.
|
||||||
The ioctl() function manipulates the underlying device parameters of special files.
|
The ioctl() function manipulates the underlying device parameters of special files.
|
||||||
more info see man ioctl.
|
more info see man ioctl.
|
||||||
|
|
||||||
|
#### ff_stop_run
|
||||||
|
|
||||||
|
void ff_stop_run();
|
||||||
|
|
||||||
|
Stop the infinite poll loop started by `ff_run`.
|
||||||
|
|
||||||
### Network API
|
### Network API
|
||||||
|
|
||||||
#### ff_socket
|
#### ff_socket
|
||||||
|
|
|
@ -55,6 +55,8 @@ int ff_init(int argc, char * const argv[]);
|
||||||
|
|
||||||
void ff_run(loop_func_t loop, void *arg);
|
void ff_run(loop_func_t loop, void *arg);
|
||||||
|
|
||||||
|
void ff_stop_run(void);
|
||||||
|
|
||||||
/* POSIX-LIKE api begin */
|
/* POSIX-LIKE api begin */
|
||||||
|
|
||||||
int ff_fcntl(int fd, int cmd, ...);
|
int ff_fcntl(int fd, int cmd, ...);
|
||||||
|
|
|
@ -80,6 +80,7 @@ static int numa_on;
|
||||||
static unsigned idle_sleep;
|
static unsigned idle_sleep;
|
||||||
static unsigned pkt_tx_delay;
|
static unsigned pkt_tx_delay;
|
||||||
static uint64_t usr_cb_tsc;
|
static uint64_t usr_cb_tsc;
|
||||||
|
static int stop_loop;
|
||||||
|
|
||||||
static struct rte_timer freebsd_clock;
|
static struct rte_timer freebsd_clock;
|
||||||
|
|
||||||
|
@ -2005,6 +2006,11 @@ main_loop(void *arg)
|
||||||
qconf = &lcore_conf;
|
qconf = &lcore_conf;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
if (unlikely(stop_loop)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
cur_tsc = rte_rdtsc();
|
cur_tsc = rte_rdtsc();
|
||||||
if (unlikely(freebsd_clock.expire < cur_tsc)) {
|
if (unlikely(freebsd_clock.expire < cur_tsc)) {
|
||||||
rte_timer_manage();
|
rte_timer_manage();
|
||||||
|
@ -2136,6 +2142,7 @@ void
|
||||||
ff_dpdk_run(loop_func_t loop, void *arg) {
|
ff_dpdk_run(loop_func_t loop, void *arg) {
|
||||||
struct loop_routine *lr = rte_malloc(NULL,
|
struct loop_routine *lr = rte_malloc(NULL,
|
||||||
sizeof(struct loop_routine), 0);
|
sizeof(struct loop_routine), 0);
|
||||||
|
stop_loop = 0;
|
||||||
lr->loop = loop;
|
lr->loop = loop;
|
||||||
lr->arg = arg;
|
lr->arg = arg;
|
||||||
rte_eal_mp_remote_launch(main_loop, lr, CALL_MAIN);
|
rte_eal_mp_remote_launch(main_loop, lr, CALL_MAIN);
|
||||||
|
@ -2143,6 +2150,11 @@ ff_dpdk_run(loop_func_t loop, void *arg) {
|
||||||
rte_free(lr);
|
rte_free(lr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ff_dpdk_stop(void) {
|
||||||
|
stop_loop = 1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ff_dpdk_pktmbuf_free(void *m)
|
ff_dpdk_pktmbuf_free(void *m)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,7 @@ struct loop_routine {
|
||||||
int ff_dpdk_init(int argc, char **argv);
|
int ff_dpdk_init(int argc, char **argv);
|
||||||
int ff_dpdk_if_up(void);
|
int ff_dpdk_if_up(void);
|
||||||
void ff_dpdk_run(loop_func_t loop, void *arg);
|
void ff_dpdk_run(loop_func_t loop, void *arg);
|
||||||
|
void ff_dpdk_stop(void);
|
||||||
|
|
||||||
struct ff_dpdk_if_context;
|
struct ff_dpdk_if_context;
|
||||||
struct ff_port_cfg;
|
struct ff_port_cfg;
|
||||||
|
|
|
@ -61,3 +61,9 @@ ff_run(loop_func_t loop, void *arg)
|
||||||
ff_dpdk_run(loop, arg);
|
ff_dpdk_run(loop, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ff_stop_run(void)
|
||||||
|
{
|
||||||
|
ff_dpdk_stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue