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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to