Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jun 2012 09:55:47 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r236553 - projects/pf/head/sys/contrib/pf/net
Message-ID:  <201206040955.q549tlpm018811@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Jun  4 09:55:47 2012
New Revision: 236553
URL: http://svn.freebsd.org/changeset/base/236553

Log:
  struct pf_altq doesn't need a separate uma(9) zone, they are
  allocated only at configuration stage.

Modified:
  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/pfvar.h

Modified: projects/pf/head/sys/contrib/pf/net/pf.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pf.c	Mon Jun  4 09:47:19 2012	(r236552)
+++ projects/pf/head/sys/contrib/pf/net/pf.c	Mon Jun  4 09:55:47 2012	(r236553)
@@ -195,7 +195,6 @@ VNET_DEFINE(uma_zone_t,	 pf_rule_z);
 VNET_DEFINE(uma_zone_t,	 pf_pooladdr_z);
 VNET_DEFINE(uma_zone_t,	 pf_state_z);
 VNET_DEFINE(uma_zone_t,	 pf_state_key_z);
-VNET_DEFINE(uma_zone_t,	 pf_altq_z);
 
 #define	V_pf_sources_z	VNET(pf_sources_z)
 
@@ -704,8 +703,6 @@ pf_initialize()
 		mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF);
 
 	/* ALTQ */
-	V_pf_altq_z = uma_zcreate("pf altq", sizeof(struct pf_altq),
-	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
 	TAILQ_INIT(&V_pf_altqs[0]);
 	TAILQ_INIT(&V_pf_altqs[1]);
 	TAILQ_INIT(&V_pf_pabuf);
@@ -776,7 +773,6 @@ pf_cleanup()
 	uma_zdestroy(V_pf_rule_z);
 	uma_zdestroy(V_pf_state_z);
 	uma_zdestroy(V_pf_state_key_z);
-	uma_zdestroy(V_pf_altq_z);
 	uma_zdestroy(V_pf_pooladdr_z);
 	uma_zdestroy(V_pfr_ktable_z);
 	uma_zdestroy(V_pfr_kentry_z);

Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c	Mon Jun  4 09:47:19 2012	(r236552)
+++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c	Mon Jun  4 09:55:47 2012	(r236553)
@@ -158,6 +158,7 @@ VNET_DEFINE(struct pf_tags, pf_tags);
 #define	V_pf_qids		VNET(pf_qids)
 VNET_DEFINE(struct pf_tags, pf_qids);
 MALLOC_DEFINE(M_PFTAG, "pf tags", "pf tags");
+MALLOC_DEFINE(M_PFALTQ, "pf(4) altq", "pf(4) altq configuration db");
 
 #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE)
 #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE
@@ -538,7 +539,7 @@ pf_begin_altq(u_int32_t *ticket)
 			error = altq_remove(altq);
 		} else
 			pf_qid_unref(altq->qid);
-		uma_zfree(V_pf_altq_z, altq);
+		free(altq, M_PFALTQ);
 	}
 	if (error)
 		return (error);
@@ -566,7 +567,7 @@ pf_rollback_altq(u_int32_t ticket)
 			error = altq_remove(altq);
 		} else
 			pf_qid_unref(altq->qid);
-		uma_zfree(V_pf_altq_z, altq);
+		free(altq, M_PFALTQ);
 	}
 	V_altqs_inactive_open = 0;
 	return (error);
@@ -619,7 +620,7 @@ pf_commit_altq(u_int32_t ticket)
 				error = err;
 		} else
 			pf_qid_unref(altq->qid);
-		uma_zfree(V_pf_altq_z, altq);
+		free(altq, M_PFALTQ);
 	}
 
 	V_altqs_inactive_open = 0;
@@ -695,7 +696,7 @@ pf_altq_ifnet_event(struct ifnet *ifp, i
 
 	/* Copy the current active set */
 	TAILQ_FOREACH(a1, V_pf_altqs_active, entries) {
-		a2 = uma_zalloc(V_pf_altq_z, M_NOWAIT);
+		a2 = malloc(sizeof(*a2), M_PFALTQ, M_NOWAIT);
 		if (a2 == NULL) {
 			error = ENOMEM;
 			break;
@@ -705,7 +706,7 @@ pf_altq_ifnet_event(struct ifnet *ifp, i
 		if (a2->qname[0] != 0) {
 			if ((a2->qid = pf_qname2qid(a2->qname)) == 0) {
 				error = EBUSY;
-				uma_zfree(V_pf_altq_z, a2);
+				free(a2, M_PFALTQ);
 				break;
 			}
 			a2->altq_disc = NULL;
@@ -729,7 +730,7 @@ pf_altq_ifnet_event(struct ifnet *ifp, i
 				error = EBUSY;
 
 			if (error) {
-				uma_zfree(V_pf_altq_z, a2);
+				free(a2, M_PFALTQ);
 				break;
 			}
 		}
@@ -2039,14 +2040,14 @@ DIOCGETSTATES_full:
 		struct pf_altq		*altq, *a;
 		struct ifnet		*ifp;
 
-		altq = uma_zalloc(V_pf_altq_z, M_WAITOK);
+		altq = malloc(sizeof(*altq), M_PFALTQ, M_WAITOK);
 		bcopy(&pa->altq, altq, sizeof(struct pf_altq));
 		altq->local_flags = 0;
 
 		PF_RULES_WLOCK();
 		if (pa->ticket != V_ticket_altqs_inactive) {
 			PF_RULES_WUNLOCK();
-			uma_zfree(V_pf_altq_z, altq);
+			free(altq, M_PFALTQ);
 			error = EBUSY;
 			break;
 		}
@@ -2059,7 +2060,7 @@ DIOCGETSTATES_full:
 			if ((altq->qid = pf_qname2qid(altq->qname)) == 0) {
 				PF_RULES_WUNLOCK();
 				error = EBUSY;
-				uma_zfree(V_pf_altq_z, altq);
+				free(altq, M_PFALTQ);
 				break;
 			}
 			altq->altq_disc = NULL;
@@ -2079,7 +2080,7 @@ DIOCGETSTATES_full:
 
 		if (error) {
 			PF_RULES_WUNLOCK();
-			uma_zfree(V_pf_altq_z, altq);
+			free(altq, M_PFALTQ);
 			break;
 		}
 

Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h
==============================================================================
--- projects/pf/head/sys/contrib/pf/net/pfvar.h	Mon Jun  4 09:47:19 2012	(r236552)
+++ projects/pf/head/sys/contrib/pf/net/pfvar.h	Mon Jun  4 09:55:47 2012	(r236553)
@@ -1734,8 +1734,6 @@ VNET_DECLARE(uma_zone_t,	 pf_state_z);
 #define	V_pf_state_z		 VNET(pf_state_z)
 VNET_DECLARE(uma_zone_t,	 pf_state_key_z);
 #define	V_pf_state_key_z	 VNET(pf_state_key_z)
-VNET_DECLARE(uma_zone_t,	 pf_altq_z);
-#define	V_pf_altq_z		 VNET(pf_altq_z)
 VNET_DECLARE(uma_zone_t,	 pf_pooladdr_z);
 #define	V_pf_pooladdr_z		 VNET(pf_pooladdr_z)
 VNET_DECLARE(uma_zone_t,	 pfr_ktable_z);



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