From 69c2d429c13b29b1cb66d1990d969d1314f5960f Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Wed, 20 Mar 2002 05:48:55 +0000 Subject: [PATCH] Switch vm_zone.h with uma.h. Change over to uma interfaces. --- sys/netinet/in_pcb.c | 8 ++++---- sys/netinet/in_pcb.h | 10 ++-------- sys/netinet/ip_divert.c | 7 ++++--- sys/netinet/raw_ip.c | 7 ++++--- sys/netinet/tcp_subr.c | 7 ++++--- sys/netinet/tcp_syncache.c | 17 +++++++++-------- sys/netinet/tcp_timewait.c | 7 ++++--- sys/netinet/udp_usrreq.c | 7 ++++--- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index ff124bc248a..c7e4ecbe2ee 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -52,7 +52,7 @@ #include -#include +#include #include #include @@ -144,7 +144,7 @@ in_pcballoc(so, pcbinfo, td) int error; #endif - inp = zalloc(pcbinfo->ipi_zone); + inp = uma_zalloc(pcbinfo->ipi_zone, M_WAITOK); if (inp == NULL) return (ENOBUFS); bzero((caddr_t)inp, sizeof(*inp)); @@ -154,7 +154,7 @@ in_pcballoc(so, pcbinfo, td) #ifdef IPSEC error = ipsec_init_policy(so, &inp->inp_sp); if (error != 0) { - zfree(pcbinfo->ipi_zone, inp); + uma_zfree(pcbinfo->ipi_zone, inp); return error; } #endif /*IPSEC*/ @@ -573,7 +573,7 @@ in_pcbdetach(inp) rtfree(inp->inp_route.ro_rt); ip_freemoptions(inp->inp_moptions); inp->inp_vflag = 0; - zfree(ipi->ipi_zone, inp); + uma_zfree(ipi->ipi_zone, inp); } /* diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 92a9a2210f9..36aaa079df9 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -41,7 +41,7 @@ #include #include /* for IPSEC */ -#include +#include #define in6pcb inpcb /* for KAME src sync over BSD*'s */ #define in6p_sp inp_sp /* for KAME src sync over BSD*'s */ @@ -119,12 +119,6 @@ struct in_conninfo { #define inc6_laddr inc_ie.ie6_laddr #define inc6_route inc_dependroute.inc6_route -/* - * NB: the zone allocator is type-stable EXCEPT FOR THE FIRST TWO LONGS - * of the structure. Therefore, it is important that the members in - * that position not contain any information which is required to be - * stable. - */ struct icmp6_filter; struct inpcb { @@ -242,7 +236,7 @@ struct inpcbinfo { /* XXX documentation, prefixes */ u_short lastport; u_short lastlow; u_short lasthi; - vm_zone_t ipi_zone; /* zone to allocate pcbs from */ + uma_zone_t ipi_zone; /* zone to allocate pcbs from */ u_int ipi_count; /* number of pcbs in this list */ u_quad_t ipi_gencnt; /* current generation count */ }; diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 2fa823f627f..25a532969ce 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include @@ -120,8 +120,9 @@ div_init(void) */ divcbinfo.hashbase = hashinit(1, M_PCB, &divcbinfo.hashmask); divcbinfo.porthashbase = hashinit(1, M_PCB, &divcbinfo.porthashmask); - divcbinfo.ipi_zone = zinit("divcb", sizeof(struct inpcb), - maxsockets, ZONE_INTERRUPT, 0); + divcbinfo.ipi_zone = uma_zcreate("divcb", sizeof(struct inpcb), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(divcbinfo.ipi_zone, maxsockets); } /* diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 709a919190f..1f533e184d6 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include @@ -102,8 +102,9 @@ rip_init() */ ripcbinfo.hashbase = hashinit(1, M_PCB, &ripcbinfo.hashmask); ripcbinfo.porthashbase = hashinit(1, M_PCB, &ripcbinfo.porthashmask); - ripcbinfo.ipi_zone = zinit("ripcb", sizeof(struct inpcb), - maxsockets, ZONE_INTERRUPT, 0); + ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(ripcbinfo.ipi_zone, maxsockets); } static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index cec858c3226..fb71ac77789 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -55,7 +55,7 @@ #include #include -#include +#include #include #include @@ -212,8 +212,9 @@ tcp_init() tcbinfo.hashbase = hashinit(hashsize, M_PCB, &tcbinfo.hashmask); tcbinfo.porthashbase = hashinit(hashsize, M_PCB, &tcbinfo.porthashmask); - tcbinfo.ipi_zone = zinit("tcpcb", sizeof(struct inp_tp), maxsockets, - ZONE_INTERRUPT, 0); + tcbinfo.ipi_zone = uma_zcreate("tcpcb", sizeof(struct inp_tp), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(tcbinfo.ipi_zone, maxsockets); #ifdef INET6 #define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) #else /* INET6 */ diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 3459fa13803..054586c6d8d 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -83,7 +83,7 @@ #endif /*IPSEC*/ #include -#include +#include static int tcp_syncookies = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies, CTLFLAG_RW, @@ -114,7 +114,7 @@ static struct syncache *syncookie_lookup(struct in_conninfo *, struct tcp_syncache { struct syncache_head *hashbase; - vm_zone_t zone; + uma_zone_t zone; u_int hashsize; u_int hashmask; u_int bucket_limit; @@ -204,7 +204,7 @@ syncache_free(struct syncache *sc) rt->rt_flags, NULL); RTFREE(rt); } - zfree(tcp_syncache.zone, sc); + uma_zfree(tcp_syncache.zone, sc); } void @@ -256,8 +256,9 @@ syncache_init(void) * older one. */ tcp_syncache.cache_limit -= 1; - tcp_syncache.zone = zinit("syncache", sizeof(struct syncache), - tcp_syncache.cache_limit, ZONE_INTERRUPT, 0); + tcp_syncache.zone = uma_zcreate("syncache", sizeof(struct syncache), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(tcp_syncache.zone, tcp_syncache.cache_limit); } static void @@ -858,7 +859,7 @@ syncache_add(inc, to, th, sop, m) return (1); } - sc = zalloc(tcp_syncache.zone); + sc = uma_zalloc(tcp_syncache.zone, M_NOWAIT); if (sc == NULL) { /* * The zone allocator couldn't provide more entries. @@ -875,7 +876,7 @@ syncache_add(inc, to, th, sop, m) syncache_drop(sc, NULL); splx(s); tcpstat.tcps_sc_zonefail++; - sc = zalloc(tcp_syncache.zone); + sc = uma_zalloc(tcp_syncache.zone, M_NOWAIT); if (sc == NULL) { if (ipopts) (void) m_free(ipopts); @@ -1313,7 +1314,7 @@ syncookie_lookup(inc, th, so) return (NULL); data = data >> SYNCOOKIE_WNDBITS; - sc = zalloc(tcp_syncache.zone); + sc = uma_zalloc(tcp_syncache.zone, M_NOWAIT); if (sc == NULL) return (NULL); /* diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index cec858c3226..fb71ac77789 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -55,7 +55,7 @@ #include #include -#include +#include #include #include @@ -212,8 +212,9 @@ tcp_init() tcbinfo.hashbase = hashinit(hashsize, M_PCB, &tcbinfo.hashmask); tcbinfo.porthashbase = hashinit(hashsize, M_PCB, &tcbinfo.porthashmask); - tcbinfo.ipi_zone = zinit("tcpcb", sizeof(struct inp_tp), maxsockets, - ZONE_INTERRUPT, 0); + tcbinfo.ipi_zone = uma_zcreate("tcpcb", sizeof(struct inp_tp), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(tcbinfo.ipi_zone, maxsockets); #ifdef INET6 #define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) #else /* INET6 */ diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index e4f7e0d73a7..4426aa9433e 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -51,7 +51,7 @@ #include #include -#include +#include #include #include @@ -144,8 +144,9 @@ udp_init() udbinfo.hashbase = hashinit(UDBHASHSIZE, M_PCB, &udbinfo.hashmask); udbinfo.porthashbase = hashinit(UDBHASHSIZE, M_PCB, &udbinfo.porthashmask); - udbinfo.ipi_zone = zinit("udpcb", sizeof(struct inpcb), maxsockets, - ZONE_INTERRUPT, 0); + udbinfo.ipi_zone = uma_zcreate("udpcb", sizeof(struct inpcb), NULL, + NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(udbinfo.ipi_zone, maxsockets); } void