git: aea0cd0432f0 - main - ip_reass: separate ipreass_init() into global and VIMAGE parts
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Aug 2022 18:52:24 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=aea0cd0432f0bb21f78ed7dbf44a64d0cd05c941 commit aea0cd0432f0bb21f78ed7dbf44a64d0cd05c941 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 ip_reass: separate ipreass_init() into global and VIMAGE parts Should have been done in 89128ff3e42. --- sys/netinet/ip_input.c | 5 ++++- sys/netinet/ip_reass.c | 24 ++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index e17d6fccb202..059f26869e0e 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -101,6 +101,7 @@ CTASSERT(sizeof(struct ip) == 20); /* IP reassembly functions are defined in ip_reass.c. */ extern void ipreass_init(void); +extern void ipreass_vnet_init(void); #ifdef VIMAGE extern void ipreass_destroy(void); #endif @@ -315,7 +316,7 @@ ip_vnet_init(void *arg __unused) V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask); /* Initialize IP reassembly queue. */ - ipreass_init(); + ipreass_vnet_init(); /* Initialize packet filter hooks. */ args.pa_version = PFIL_VERSION; @@ -349,6 +350,8 @@ static void ip_init(const void *unused __unused) { + ipreass_init(); + /* * Register statically compiled protocols, that are unlikely to * ever become dynamic. diff --git a/sys/netinet/ip_reass.c b/sys/netinet/ip_reass.c index a0a8dd42b758..0420091e0a2a 100644 --- a/sys/netinet/ip_reass.c +++ b/sys/netinet/ip_reass.c @@ -92,6 +92,7 @@ VNET_DEFINE_STATIC(int, ipreass_maxbucketsize); #define V_ipreass_maxbucketsize VNET(ipreass_maxbucketsize) void ipreass_init(void); +void ipreass_vnet_init(void); #ifdef VIMAGE void ipreass_destroy(void); #endif @@ -625,7 +626,7 @@ ipreass_drain(void) * Initialize IP reassembly structures. */ void -ipreass_init(void) +ipreass_vnet_init(void) { int max; @@ -642,16 +643,19 @@ ipreass_init(void) max = IP_MAXFRAGPACKETS; max = uma_zone_set_max(V_ipq_zone, max); V_ipreass_maxbucketsize = imax(max / (IPREASS_NHASH / 2), 1); +} - if (IS_DEFAULT_VNET(curvnet)) { - maxfrags = IP_MAXFRAGS; - EVENTHANDLER_REGISTER(nmbclusters_change, ipreass_zone_change, - NULL, EVENTHANDLER_PRI_ANY); - EVENTHANDLER_REGISTER(vm_lowmem, ipreass_drain, NULL, - LOWMEM_PRI_DEFAULT); - EVENTHANDLER_REGISTER(mbuf_lowmem, ipreass_drain, NULL, - LOWMEM_PRI_DEFAULT); - } +void +ipreass_init(void) +{ + + maxfrags = IP_MAXFRAGS; + EVENTHANDLER_REGISTER(nmbclusters_change, ipreass_zone_change, + NULL, EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER(vm_lowmem, ipreass_drain, NULL, + LOWMEM_PRI_DEFAULT); + EVENTHANDLER_REGISTER(mbuf_lowmem, ipreass_drain, NULL, + LOWMEM_PRI_DEFAULT); } /*