Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Nov 2013 14:44:59 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Luigi Rizzo <luigi@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r258464 - head/sys/netpfil/ipfw
Message-ID:  <20131122104459.GD7577@FreeBSD.org>
In-Reply-To: <201311220459.rAM4xHSJ019593@svn.freebsd.org>
References:  <201311220459.rAM4xHSJ019593@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131122104459.GD7577>