From owner-p4-projects@FreeBSD.ORG Thu Oct 18 23:49:56 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6C69616A419; Thu, 18 Oct 2007 23:49:56 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDF2516A417 for ; Thu, 18 Oct 2007 23:49:55 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C983013C4D1 for ; Thu, 18 Oct 2007 23:49:55 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l9INntOW025015 for ; Thu, 18 Oct 2007 23:49:55 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9INntsk025012 for perforce@freebsd.org; Thu, 18 Oct 2007 23:49:55 GMT (envelope-from zec@FreeBSD.org) Date: Thu, 18 Oct 2007 23:49:55 GMT Message-Id: <200710182349.l9INntsk025012@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 127733 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2007 23:49:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=127733 Change 127733 by zec@zec_tpx32 on 2007/10/18 23:49:36 We most probably don't need a separate UMA zone for raw ip pcbs per each vnet, though I see no straightforward answer to the question of shared vs private zones for each vnet. Introduce a hook for cleaning up raw ip state. Unbreak several references to a renamed field in struct inpcbinfo from previous change. Affected files ... .. //depot/projects/vimage/src/sys/netinet/in_proto.c#11 edit .. //depot/projects/vimage/src/sys/netinet/ip_var.h#8 edit .. //depot/projects/vimage/src/sys/netinet/raw_ip.c#14 edit .. //depot/projects/vimage/src/sys/netinet/tcp_hostcache.c#18 edit .. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#36 edit .. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#21 edit Differences ... ==== //depot/projects/vimage/src/sys/netinet/in_proto.c#11 (text+ko) ==== @@ -348,6 +348,9 @@ .pr_input = rip_input, .pr_ctloutput = rip_ctloutput, .pr_init = rip_init, +#ifdef VIMAGE + .pr_destroy = rip_destroy, +#endif .pr_usrreqs = &rip_usrreqs }, }; ==== //depot/projects/vimage/src/sys/netinet/ip_var.h#8 (text+ko) ==== @@ -220,6 +220,9 @@ int rip_ctloutput(struct socket *, struct sockopt *); void rip_ctlinput(int, struct sockaddr *, void *); void rip_init(void); +#ifdef VIMAGE +void rip_destroy(void); +#endif void rip_input(struct mbuf *, int); int rip_output(struct mbuf *, struct socket *, u_long); void ipip_input(struct mbuf *, int); ==== //depot/projects/vimage/src/sys/netinet/raw_ip.c#14 (text+ko) ==== @@ -81,6 +81,8 @@ #ifndef VIMAGE struct inpcbhead ripcb; struct inpcbinfo ripcbinfo; +#else +static struct uma_zone *ripcb_zone; #endif /* control hooks for ipfw and dummynet */ @@ -140,6 +142,17 @@ { INIT_VNET_INET(curvnet); +#ifdef VIMAGE + if (IS_DEFAULT_VNET(curvnet)) { +#endif + ripcb_zone = uma_zcreate("ripcb", sizeof(struct inpcb), + NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + uma_zone_set_max(V_ripcbinfo.ipi_zone, maxsockets); +#ifdef VIMAGE + } + V_ripcbinfo.ipi_vnet = curvnet; +#endif + INP_INFO_LOCK_INIT(&V_ripcbinfo, "rip"); LIST_INIT(&V_ripcb); V_ripcbinfo.ipi_listhead = &V_ripcb; @@ -152,15 +165,24 @@ hashinit(1, M_PCB, &V_ripcbinfo.ipi_hashmask); V_ripcbinfo.ipi_porthashbase = hashinit(1, M_PCB, &V_ripcbinfo.ipi_porthashmask); - /* XXX Marko we don't need a full zone for each stack - revisit! */ - V_ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb), - NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - V_ripcbinfo.vnet = curvnet; - uma_zone_set_max(V_ripcbinfo.ipi_zone, maxsockets); + V_ripcbinfo.ipi_zone = ripcb_zone; EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change, NULL, EVENTHANDLER_PRI_ANY); } +#ifdef VIMAGE +void +rip_destroy(void) +{ + INIT_VNET_INET(curvnet); + + hashdestroy(V_ripcbinfo.ipi_hashbase, M_PCB, + V_ripcbinfo.ipi_hashmask); + hashdestroy(V_ripcbinfo.ipi_porthashbase, M_PCB, + V_ripcbinfo.ipi_porthashmask); +} +#endif + static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; static int ==== //depot/projects/vimage/src/sys/netinet/tcp_hostcache.c#18 (text+ko) ==== ==== //depot/projects/vimage/src/sys/netinet/tcp_subr.c#36 (text+ko) ==== @@ -358,7 +358,7 @@ V_tcbinfo.ipi_porthashbase = hashinit(hashsize, M_PCB, &V_tcbinfo.ipi_porthashmask); V_tcbinfo.ipi_zone = tcp_ipi_zone; - V_tcbinfo.vnet = curvnet; + V_tcbinfo.ipi_vnet = curvnet; #ifdef INET6 #define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) #else /* INET6 */ ==== //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#21 (text+ko) ==== @@ -185,6 +185,7 @@ EVENTHANDLER_PRI_ANY); #ifdef VIMAGE } + V_udbinfo.ipi_vnet = curvnet; #endif INP_INFO_LOCK_INIT(&V_udbinfo, "udp"); @@ -195,7 +196,6 @@ V_udbinfo.ipi_porthashbase = hashinit(UDBHASHSIZE, M_PCB, &V_udbinfo.ipi_porthashmask); V_udbinfo.ipi_zone = udp_ipi_zone; - V_udbinfo.vnet = curvnet; } #ifdef VIMAGE