git: a0d7d2476f64 - main - frag6: use callout(9) directly instead of pr_slowtimo
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Aug 2022 18:52:19 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a0d7d2476f64b295978463e57f87f9f87b3c701f commit a0d7d2476f64b295978463e57f87f9f87b3c701f Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-08-17 18:50:31 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2022-08-17 18:50:31 +0000 frag6: use callout(9) directly instead of pr_slowtimo Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36162 --- sys/netinet6/frag6.c | 20 +++++++++++++++++--- sys/netinet6/in6_proto.c | 1 - sys/netinet6/ip6_var.h | 1 - 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index e0857d3af3e8..9f12d4d691b6 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -883,8 +883,9 @@ dropfrag2: * IPv6 reassembling timer processing; * if a timer expires on a reassembly queue, discard it. */ -void -frag6_slowtimo(void) +static struct callout frag6_callout; +static void +frag6_slowtimo(void *arg __unused) { VNET_ITERATOR_DECL(vnet_iter); struct ip6qhead *head; @@ -892,7 +893,7 @@ frag6_slowtimo(void) uint32_t bucket; if (atomic_load_int(&frag6_nfrags) == 0) - return; + goto done; VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { @@ -949,7 +950,20 @@ frag6_slowtimo(void) CURVNET_RESTORE(); } VNET_LIST_RUNLOCK_NOSLEEP(); +done: + callout_reset_sbt(&frag6_callout, SBT_1MS * 500, SBT_1MS * 10, + frag6_slowtimo, NULL, 0); +} + +static void +frag6_slowtimo_init(void *arg __unused) +{ + + callout_init(&frag6_callout, 1); + callout_reset_sbt(&frag6_callout, SBT_1MS * 500, SBT_1MS * 10, + frag6_slowtimo, NULL, 0); } +SYSINIT(frag6, SI_SUB_VNET_DONE, SI_ORDER_ANY, frag6_slowtimo_init, NULL); /* * Eventhandler to adjust limits in case nmbclusters change. diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index f437234b71a3..52534c579003 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -146,7 +146,6 @@ struct protosw inet6sw[] = { .pr_domain = &inet6domain, .pr_protocol = IPPROTO_IPV6, .pr_flags = PR_CAPATTACH, - .pr_slowtimo = frag6_slowtimo, .pr_drain = frag6_drain, .pr_usrreqs = &nousrreqs, }, diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 9d997e772ba4..c78cf52946fe 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -391,7 +391,6 @@ int route6_input(struct mbuf **, int *, int); void frag6_init(void); void frag6_destroy(void); int frag6_input(struct mbuf **, int *, int); -void frag6_slowtimo(void); void frag6_drain(void); void rip6_init(void);