Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 May 2012 12:51:49 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r235606 - projects/pf/head/sys/contrib/pf/net
Message-ID:  <201205181251.q4ICpnpL053261@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri May 18 12:51:48 2012
New Revision: 235606
URL: http://svn.freebsd.org/changeset/base/235606

Log:
  Rename pf limits to "struct pf_limit", instead of "pf_pool_limit". The
  word "pool" comes here from OpenBSD pool(9) API, which is substituted
  by uma(9) in our tree.
  
  This rename is done to avoid confusion with pf address pools, described
  by "struct pf_pool", "struct pf_pooladdr". These address pools has nothing
  common with memory allocation limits.

Modified:
  projects/pf/head/sys/contrib/pf/net/if_pfsync.c
  projects/pf/head/sys/contrib/pf/net/pf.c
  projects/pf/head/sys/contrib/pf/net/pf_ioctl.c
  projects/pf/head/sys/contrib/pf/net/pf_norm.c
  projects/pf/head/sys/contrib/pf/net/pfvar.h

Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/if_pfsync.c	Fri May 18 12:39:20 2012	(r235605)
+++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c	Fri May 18 12:51:48 2012	(r235606)
@@ -1140,7 +1140,7 @@ pfsync_in_bus(struct pfsync_pkt *pkt, st
 	switch (bus->status) {
 	case PFSYNC_BUS_START:
 		callout_reset(&sc->sc_bulkfail_tmo, 4 * hz +
-		    V_pf_pool_limits[PF_LIMIT_STATES].limit /
+		    V_pf_limits[PF_LIMIT_STATES].limit /
 		    ((sc->sc_ifp->if_mtu - PFSYNC_MINPKT) /
 		    sizeof(struct pfsync_state)),
 		    pfsync_bulk_fail, sc);

Modified: projects/pf/head/sys/contrib/pf/net/pf.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pf.c	Fri May 18 12:39:20 2012	(r235605)
+++ projects/pf/head/sys/contrib/pf/net/pf.c	Fri May 18 12:51:48 2012	(r235606)
@@ -300,7 +300,7 @@ int in4_cksum(struct mbuf *m, u_int8_t n
 
 VNET_DECLARE(int, pf_end_threads);
 
-VNET_DEFINE(struct pf_pool_limit, pf_pool_limits[PF_LIMIT_MAX]);
+VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]);
 
 #define	PACKET_LOOPED(pd)	((pd)->pf_mtag->flags & PF_PACKET_LOOPED)
 
@@ -670,7 +670,7 @@ pf_initialize()
 	/* States and state keys storage. */
 	V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_state),
 	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
-	V_pf_pool_limits[PF_LIMIT_STATES].pp = V_pf_state_z;
+	V_pf_limits[PF_LIMIT_STATES].zone = V_pf_state_z;
         uma_zone_set_max(V_pf_state_z, PFSTATE_HIWAT);
 
 	V_pf_state_key_z = uma_zcreate("pf state keys",
@@ -691,7 +691,7 @@ pf_initialize()
 	V_pf_sources_z = uma_zcreate("pf source nodes",
 	    sizeof(struct pf_src_node), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
 	    0);
-	V_pf_pool_limits[PF_LIMIT_SRC_NODES].pp = V_pf_sources_z;
+	V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z;
 	uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT);
 	V_pf_srchash = malloc((PF_HASHSIZ / 4) * sizeof(struct pf_srchash),
 	  M_PFHASH, M_WAITOK|M_ZERO);
@@ -725,11 +725,11 @@ pf_initialize()
 	V_pfr_ktable_z = uma_zcreate("pf tables",
 	    sizeof(struct pfr_ktable), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
 	    0);
-	V_pf_pool_limits[PF_LIMIT_TABLES].pp = V_pfr_ktable_z;
+	V_pf_limits[PF_LIMIT_TABLES].zone = V_pfr_ktable_z;
 	V_pfr_kentry_z = uma_zcreate("pf table entries",
 	    sizeof(struct pfr_kentry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
 	    0);
-	V_pf_pool_limits[PF_LIMIT_TABLE_ENTRIES].pp = V_pfr_kentry_z;
+	V_pf_limits[PF_LIMIT_TABLE_ENTRIES].zone = V_pfr_kentry_z;
 	V_pfi_addr_z = uma_zcreate("pf pfi_dynaddr", sizeof(struct pfi_dynaddr),
 	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
 }

Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c	Fri May 18 12:39:20 2012	(r235605)
+++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c	Fri May 18 12:51:48 2012	(r235606)
@@ -254,11 +254,11 @@ pfattach(void)
 	pf_osfp_initialize();
 	pf_normalize_init();
 
-	V_pf_pool_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT;
-	V_pf_pool_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT;
-	V_pf_pool_limits[PF_LIMIT_TABLES].limit = PFR_KTABLE_HIWAT;
-	V_pf_pool_limits[PF_LIMIT_TABLE_ENTRIES].pp = V_pfr_kentry_z;
-	V_pf_pool_limits[PF_LIMIT_TABLE_ENTRIES].limit = PFR_KENTRY_HIWAT;
+	V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT;
+	V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT;
+	V_pf_limits[PF_LIMIT_TABLES].limit = PFR_KTABLE_HIWAT;
+	V_pf_limits[PF_LIMIT_TABLE_ENTRIES].zone = V_pfr_kentry_z;
+	V_pf_limits[PF_LIMIT_TABLE_ENTRIES].limit = PFR_KENTRY_HIWAT;
 
 	RB_INIT(&V_pf_anchors);
 	pf_init_ruleset(&pf_main_ruleset);
@@ -1934,7 +1934,7 @@ DIOCGETSTATES_full:
 			error = EINVAL;
 			break;
 		}
-		pl->limit = V_pf_pool_limits[pl->index].limit;
+		pl->limit = V_pf_limits[pl->index].limit;
 		break;
 	}
 
@@ -1944,14 +1944,14 @@ DIOCGETSTATES_full:
 
 		PF_LOCK();
 		if (pl->index < 0 || pl->index >= PF_LIMIT_MAX ||
-		    V_pf_pool_limits[pl->index].pp == NULL) {
+		    V_pf_limits[pl->index].zone == NULL) {
 			PF_UNLOCK();
 			error = EINVAL;
 			break;
 		}
-		uma_zone_set_max(V_pf_pool_limits[pl->index].pp, pl->limit);
-		old_limit = V_pf_pool_limits[pl->index].limit;
-		V_pf_pool_limits[pl->index].limit = pl->limit;
+		uma_zone_set_max(V_pf_limits[pl->index].zone, pl->limit);
+		old_limit = V_pf_limits[pl->index].limit;
+		V_pf_limits[pl->index].limit = pl->limit;
 		pl->limit = old_limit;
 		PF_UNLOCK();
 		break;

Modified: projects/pf/head/sys/contrib/pf/net/pf_norm.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pf_norm.c	Fri May 18 12:39:20 2012	(r235605)
+++ projects/pf/head/sys/contrib/pf/net/pf_norm.c	Fri May 18 12:51:48 2012	(r235606)
@@ -188,8 +188,8 @@ pf_normalize_init(void)
 	uma_zone_set_max(V_pf_cache_z, PFFRAG_FRCACHE_HIWAT);
 	uma_zone_set_max(V_pf_cent_z, PFFRAG_FRCENT_HIWAT);
 
-	V_pf_pool_limits[PF_LIMIT_FRAGS].pp = V_pf_frent_z;
-	V_pf_pool_limits[PF_LIMIT_FRAGS].limit = PFFRAG_FRENT_HIWAT;
+	V_pf_limits[PF_LIMIT_FRAGS].zone = V_pf_frent_z;
+	V_pf_limits[PF_LIMIT_FRAGS].limit = PFFRAG_FRENT_HIWAT;
 
 	mtx_init(&pf_frag_mtx, "pf fragments", NULL, MTX_DEF);
 

Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pfvar.h	Fri May 18 12:39:20 2012	(r235605)
+++ projects/pf/head/sys/contrib/pf/net/pfvar.h	Fri May 18 12:51:48 2012	(r235606)
@@ -1951,12 +1951,12 @@ void		 pf_qid2qname(u_int32_t, char *);
 VNET_DECLARE(struct pf_status,		 pf_status);
 #define	V_pf_status			 VNET(pf_status)
 
-struct pf_pool_limit {
-	void		*pp;
-	unsigned	 limit;
+struct pf_limit {
+	uma_zone_t	zone;
+	u_int		limit;
 };
-VNET_DECLARE(struct pf_pool_limit,		 pf_pool_limits[PF_LIMIT_MAX]);
-#define	V_pf_pool_limits			 VNET(pf_pool_limits)
+VNET_DECLARE(struct pf_limit, pf_limits[PF_LIMIT_MAX]);
+#define	V_pf_limits VNET(pf_limits)
 
 #endif /* _KERNEL */
 



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