From owner-svn-src-all@FreeBSD.ORG Fri Nov 22 10:45:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B760FD2; Fri, 22 Nov 2013 10:45:02 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8009B293E; Fri, 22 Nov 2013 10:45:00 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id rAMAixYG087710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 22 Nov 2013 14:44:59 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id rAMAix9H087709; Fri, 22 Nov 2013 14:44:59 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 22 Nov 2013 14:44:59 +0400 From: Gleb Smirnoff To: Luigi Rizzo Subject: Re: svn commit: r258464 - head/sys/netpfil/ipfw Message-ID: <20131122104459.GD7577@FreeBSD.org> References: <201311220459.rAM4xHSJ019593@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201311220459.rAM4xHSJ019593@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2013 10:45:02 -0000 Luigi, On Fri, Nov 22, 2013 at 04:59:17AM +0000, Luigi Rizzo wrote: L> Author: luigi L> Date: Fri Nov 22 04:59:17 2013 L> New Revision: 258464 L> URL: http://svnweb.freebsd.org/changeset/base/258464 L> L> Log: L> more support for userspace compiling of this code: L> emulate the uma_zone for dynamic rules. Why isn't the ipfw_dyn_count variable entirely under USERSPACE? We are working in direction of removing global counters in networking stack, and this change is a step back. L> Modified: L> head/sys/netpfil/ipfw/ip_fw_dynamic.c L> L> Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c L> ============================================================================== L> --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Nov 22 04:57:50 2013 (r258463) L> +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Nov 22 04:59:17 2013 (r258464) L> @@ -181,6 +181,13 @@ static VNET_DEFINE(u_int32_t, dyn_max); L> #define DYN_COUNT uma_zone_get_cur(V_ipfw_dyn_rule_zone) L> #define V_dyn_max VNET(dyn_max) L> L> +/* for userspace, we emulate the uma_zone_counter with ipfw_dyn_count */ L> +static int ipfw_dyn_count; /* number of objects */ L> + L> +#ifdef USERSPACE /* emulation of UMA object counters for userspace */ L> +#define uma_zone_get_cur(x) ipfw_dyn_count L> +#endif /* USERSPACE */ L> + L> static int last_log; /* Log ratelimiting */ L> L> static void ipfw_dyn_tick(void *vnetx); L> @@ -579,6 +586,7 @@ add_dyn_rule(struct ipfw_flow_id *id, in L> } L> return NULL; L> } L> + ipfw_dyn_count++; L> L> /* L> * refcount on parent is already incremented, so L> @@ -1253,11 +1261,13 @@ check_dyn_rules(struct ip_fw_chain *chai L> for (q = exp_head; q != NULL; q = q_next) { L> q_next = q->next; L> uma_zfree(V_ipfw_dyn_rule_zone, q); L> + ipfw_dyn_count--; L> } L> L> for (q = exp_lhead; q != NULL; q = q_next) { L> q_next = q->next; L> uma_zfree(V_ipfw_dyn_rule_zone, q); L> + ipfw_dyn_count--; L> } L> L> /* -- Totus tuus, Glebius.