mirror of
https://github.com/opnsense/src.git
synced 2026-06-06 23:32:52 -04:00
Convert ipfilter from timeout(9) to callout(9).
Submitted by: jhb Approved by: glebius (mentor) Approved by: re (blanket)
This commit is contained in:
parent
a37a846869
commit
ea3022cbbd
2 changed files with 14 additions and 4 deletions
|
|
@ -1654,7 +1654,7 @@ typedef struct ipf_main_softc_s {
|
||||||
ipftoken_t **ipf_token_tail;
|
ipftoken_t **ipf_token_tail;
|
||||||
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000) && \
|
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000) && \
|
||||||
defined(_KERNEL)
|
defined(_KERNEL)
|
||||||
struct callout_handle ipf_slow_ch;
|
struct callout ipf_slow_ch;
|
||||||
#endif
|
#endif
|
||||||
#if defined(linux) && defined(_KERNEL)
|
#if defined(linux) && defined(_KERNEL)
|
||||||
struct timer_list ipf_timer;
|
struct timer_list ipf_timer;
|
||||||
|
|
|
||||||
|
|
@ -178,11 +178,13 @@ ipf_timer_func(arg)
|
||||||
ipf_slowtimer(softc);
|
ipf_slowtimer(softc);
|
||||||
|
|
||||||
if (softc->ipf_running == -1 || softc->ipf_running == 1) {
|
if (softc->ipf_running == -1 || softc->ipf_running == 1) {
|
||||||
#if FREEBSD_GE_REV(300000)
|
#if 0
|
||||||
softc->ipf_slow_ch = timeout(ipf_timer_func, softc, hz/2);
|
softc->ipf_slow_ch = timeout(ipf_timer_func, softc, hz/2);
|
||||||
#else
|
|
||||||
timeout(ipf_timer_func, softc, hz/2);
|
|
||||||
#endif
|
#endif
|
||||||
|
callout_init(&softc->ipf_slow_ch, CALLOUT_MPSAFE);
|
||||||
|
callout_reset(&softc->ipf_slow_ch,
|
||||||
|
(hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT,
|
||||||
|
ipf_timer_func, softc);
|
||||||
}
|
}
|
||||||
RWLOCK_EXIT(&softc->ipf_global);
|
RWLOCK_EXIT(&softc->ipf_global);
|
||||||
SPL_X(s);
|
SPL_X(s);
|
||||||
|
|
@ -223,8 +225,13 @@ ipfattach(softc)
|
||||||
ipid = 0;
|
ipid = 0;
|
||||||
|
|
||||||
SPL_X(s);
|
SPL_X(s);
|
||||||
|
#if 0
|
||||||
softc->ipf_slow_ch = timeout(ipf_timer_func, softc,
|
softc->ipf_slow_ch = timeout(ipf_timer_func, softc,
|
||||||
(hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT);
|
(hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT);
|
||||||
|
#endif
|
||||||
|
callout_init(&softc->ipf_slow_ch, CALLOUT_MPSAFE);
|
||||||
|
callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT,
|
||||||
|
ipf_timer_func, softc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,9 +253,12 @@ ipfdetach(softc)
|
||||||
|
|
||||||
SPL_NET(s);
|
SPL_NET(s);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (softc->ipf_slow_ch.callout != NULL)
|
if (softc->ipf_slow_ch.callout != NULL)
|
||||||
untimeout(ipf_timer_func, softc, softc->ipf_slow_ch);
|
untimeout(ipf_timer_func, softc, softc->ipf_slow_ch);
|
||||||
bzero(&softc->ipf_slow, sizeof(softc->ipf_slow));
|
bzero(&softc->ipf_slow, sizeof(softc->ipf_slow));
|
||||||
|
#endif
|
||||||
|
callout_drain(&softc->ipf_slow_ch);
|
||||||
|
|
||||||
#ifndef NETBSD_PF
|
#ifndef NETBSD_PF
|
||||||
if (ipf_checkp != NULL)
|
if (ipf_checkp != NULL)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue