Date: Thu, 19 Feb 2009 11:37:49 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 157930 for review Message-ID: <200902191137.n1JBbnO2040897@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=157930 Change 157930 by zec@zec_amdx2 on 2009/02/19 11:37:02 Make ipfw_dyn_rule_zone and tcp_reass_zone per-vnet. Affected files ... .. //depot/projects/vimage/src/sys/netinet/ip_fw.h#26 edit .. //depot/projects/vimage/src/sys/netinet/ip_fw2.c#68 edit .. //depot/projects/vimage/src/sys/netinet/tcp_reass.c#12 edit .. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#74 edit .. //depot/projects/vimage/src/sys/netinet/vinet.h#46 edit Differences ... ==== //depot/projects/vimage/src/sys/netinet/ip_fw.h#26 (text+ko) ==== @@ -718,6 +718,7 @@ int _fw_debug; int _autoinc_step; ipfw_dyn_rule **_ipfw_dyn_v; + uma_zone_t _ipfw_dyn_rule_zone; struct ip_fw_chain _layer3_chain; u_int32_t _dyn_buckets; u_int32_t _curr_dyn_buckets; @@ -762,6 +763,7 @@ #define V_fw_debug VNET_IPFW(fw_debug) #define V_autoinc_step VNET_IPFW(autoinc_step) #define V_ipfw_dyn_v VNET_IPFW(ipfw_dyn_v) +#define V_ipfw_dyn_rule_zone VNET_IPFW(ipfw_dyn_rule_zone) #define V_layer3_chain VNET_IPFW(layer3_chain) #define V_dyn_buckets VNET_IPFW(dyn_buckets) #define V_curr_dyn_buckets VNET_IPFW(curr_dyn_buckets) ==== //depot/projects/vimage/src/sys/netinet/ip_fw2.c#68 (text+ko) ==== @@ -129,14 +129,7 @@ static int fw_verbose; static struct callout ipfw_timeout; static int verbose_limit; -#endif - static uma_zone_t ipfw_dyn_rule_zone; - -/* - * list of rules for layer 3 - */ -#ifdef VIMAGE_GLOBALS struct ip_fw_chain layer3_chain; #endif @@ -1079,7 +1072,7 @@ else \ head = q = q->next; \ V_dyn_count--; \ - uma_zfree(ipfw_dyn_rule_zone, old_q); } + uma_zfree(V_ipfw_dyn_rule_zone, old_q); } #define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) @@ -1380,7 +1373,7 @@ } i = hash_packet(id); - r = uma_zalloc(ipfw_dyn_rule_zone, M_NOWAIT | M_ZERO); + r = uma_zalloc(V_ipfw_dyn_rule_zone, M_NOWAIT | M_ZERO); if (r == NULL) { printf ("ipfw: sorry cannot allocate state\n"); return NULL; @@ -4557,12 +4550,9 @@ V_layer3_chain.rules = NULL; IPFW_LOCK_INIT(&V_layer3_chain); -#if 0 /* XXX Marko fix this! */ - ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", + V_ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - IPFW_DYN_LOCK_INIT(); -#endif callout_init(&V_ipfw_timeout, CALLOUT_MPSAFE); bzero(&default_rule, sizeof default_rule); @@ -4583,13 +4573,13 @@ if (error != 0) { printf("ipfw2: error %u initializing default rule " "(support disabled)\n", error); - IPFW_DYN_LOCK_DESTROY(); + IPFW_DYN_LOCK_DESTROY(); /* XXX MARKO REVISIT */ IPFW_LOCK_DESTROY(&V_layer3_chain); - uma_zdestroy(ipfw_dyn_rule_zone); + uma_zdestroy(V_ipfw_dyn_rule_zone); return (error); } - ip_fw_default_rule = V_layer3_chain.rules; + ip_fw_default_rule = V_layer3_chain.rules; /* XXX V_ this ? MARKO */ #ifdef IPFIREWALL_VERBOSE V_fw_verbose = 1; @@ -4618,21 +4608,8 @@ int ipfw_init(void) { - ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", - sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, 0); IPFW_DYN_LOCK_INIT(); -#if 0 /* MARKO XXX */ - /* error = init_tables(&V_layer3_chain); moved to _iattach() */ - if (error) { - IPFW_DYN_LOCK_DESTROY(); - IPFW_LOCK_DESTROY(&V_layer3_chain); - uma_zdestroy(ipfw_dyn_rule_zone); - return (error); - } -#endif - #ifndef VIMAGE_GLOBALS vnet_mod_register(&vnet_ipfw_modinfo); #else @@ -4704,6 +4681,7 @@ if (V_ipfw_dyn_v != NULL) free(V_ipfw_dyn_v, M_IPFW); + uma_zdestroy(V_ipfw_dyn_rule_zone); return 0; } @@ -4723,7 +4701,6 @@ ipfw_nat_destroy(); #endif IPFW_DYN_LOCK_DESTROY(); - uma_zdestroy(ipfw_dyn_rule_zone); printf("IP firewall unloaded\n"); } ==== //depot/projects/vimage/src/sys/netinet/tcp_reass.c#12 (text+ko) ==== @@ -108,10 +108,12 @@ INIT_VNET_INET(curvnet); V_tcp_reass_maxseg = nmbclusters / 16; - uma_zone_set_max(tcp_reass_zone, V_tcp_reass_maxseg); + uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); } +#ifdef VIMAGE_GLOBALS uma_zone_t tcp_reass_zone; +#endif void tcp_reass_init(void) @@ -126,9 +128,9 @@ V_tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", &V_tcp_reass_maxseg); - tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(tcp_reass_zone, V_tcp_reass_maxseg); + uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } @@ -180,7 +182,7 @@ * Allocate a new queue entry. If we can't, or hit the zone limit * just drop the pkt. */ - te = uma_zalloc(tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); if (te == NULL) { V_tcpstat.tcps_rcvmemdrop++; m_freem(m); @@ -213,7 +215,7 @@ V_tcpstat.tcps_rcvduppack++; V_tcpstat.tcps_rcvdupbyte += *tlenp; m_freem(m); - uma_zfree(tcp_reass_zone, te); + uma_zfree(V_tcp_reass_zone, te); tp->t_segqlen--; V_tcp_reass_qsize--; /* @@ -250,7 +252,7 @@ nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(tcp_reass_zone, q); + uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; V_tcp_reass_qsize--; q = nq; @@ -287,7 +289,7 @@ m_freem(q->tqe_m); else sbappendstream_locked(&so->so_rcv, q->tqe_m); - uma_zfree(tcp_reass_zone, q); + uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; V_tcp_reass_qsize--; q = nq; ==== //depot/projects/vimage/src/sys/netinet/tcp_subr.c#74 (text+ko) ==== @@ -881,7 +881,7 @@ while ((q = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(tcp_reass_zone, q); + uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; V_tcp_reass_qsize--; } @@ -964,7 +964,7 @@ != NULL) { LIST_REMOVE(te, tqe_q); m_freem(te->tqe_m); - uma_zfree(tcp_reass_zone, te); + uma_zfree(V_tcp_reass_zone, te); tcpb->t_segqlen--; V_tcp_reass_qsize--; } ==== //depot/projects/vimage/src/sys/netinet/vinet.h#46 (text+ko) ==== @@ -87,6 +87,7 @@ struct callout _tcp_hc_callout; struct uma_zone *_tcp_ipi_zone; + struct uma_zone *_tcp_reass_zone; struct uma_zone *_tcpcb_zone; struct uma_zone *_tcptw_zone; struct uma_zone *_sack_hole_zone; @@ -332,6 +333,7 @@ #define V_tcp_reass_maxseg VNET_INET(tcp_reass_maxseg) #define V_tcp_reass_overflows VNET_INET(tcp_reass_overflows) #define V_tcp_reass_qsize VNET_INET(tcp_reass_qsize) +#define V_tcp_reass_zone VNET_INET(tcp_reass_zone) #define V_tcp_sack_globalholes VNET_INET(tcp_sack_globalholes) #define V_tcp_sack_globalmaxholes VNET_INET(tcp_sack_globalmaxholes) #define V_tcp_sack_maxholes VNET_INET(tcp_sack_maxholes)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902191137.n1JBbnO2040897>