summaryrefslogtreecommitdiffstats
path: root/sys/netatm/uni
diff options
context:
space:
mode:
authorarr <arr@FreeBSD.org>2002-06-13 14:32:51 +0000
committerarr <arr@FreeBSD.org>2002-06-13 14:32:51 +0000
commit14714108891719cd4af97afba8c20ed7b9f5a0f4 (patch)
treed4d37a64db8643744bf8333ce20f45640c1bcaef /sys/netatm/uni
parent2f568aeb91d6d5f3b370b9b641b5a64a3466d1bd (diff)
downloadFreeBSD-src-14714108891719cd4af97afba8c20ed7b9f5a0f4.zip
FreeBSD-src-14714108891719cd4af97afba8c20ed7b9f5a0f4.tar.gz
- Finish the uni part of the storage pool cleanup. There should now only
be a few bits left to clean from the HARP code in terms of what is using the storage pools; once that's done, the memory management code can be removed entirely. This commit effectively changes the use of dynamic memory routines from atm_allocate, atm_free, atm_release_pool to uma_zcreate, uma_zalloc, uma_zfree, uma_zdestroy.
Diffstat (limited to 'sys/netatm/uni')
-rw-r--r--sys/netatm/uni/sscf_uni.c36
-rw-r--r--sys/netatm/uni/sscf_uni_lower.c5
-rw-r--r--sys/netatm/uni/sscop.c40
-rw-r--r--sys/netatm/uni/sscop_lower.c2
-rw-r--r--sys/netatm/uni/sscop_var.h5
-rw-r--r--sys/netatm/uni/uniarp.c32
-rw-r--r--sys/netatm/uni/uniarp_cache.c4
-rw-r--r--sys/netatm/uni/uniarp_timer.c2
-rw-r--r--sys/netatm/uni/uniarp_vcm.c17
-rw-r--r--sys/netatm/uni/uniip.c28
-rw-r--r--sys/netatm/uni/uniip_var.h2
-rw-r--r--sys/netatm/uni/unisig_decode.c14
-rw-r--r--sys/netatm/uni/unisig_if.c58
-rw-r--r--sys/netatm/uni/unisig_msg.c40
-rw-r--r--sys/netatm/uni/unisig_subr.c52
-rw-r--r--sys/netatm/uni/unisig_util.c5
-rw-r--r--sys/netatm/uni/unisig_var.h11
-rw-r--r--sys/netatm/uni/unisig_vc_state.c42
18 files changed, 195 insertions, 200 deletions
diff --git a/sys/netatm/uni/sscf_uni.c b/sys/netatm/uni/sscf_uni.c
index 028a4dc..b5ff7d0 100644
--- a/sys/netatm/uni/sscf_uni.c
+++ b/sys/netatm/uni/sscf_uni.c
@@ -59,6 +59,8 @@
#include <netatm/uni/uni.h>
#include <netatm/uni/sscf_uni_var.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
@@ -77,12 +79,8 @@ static int sscf_uni_inst(struct stack_defn **, Atm_connvc *);
/*
* Local variables
*/
-static struct sp_info sscf_uni_pool = {
- "sscf uni pool", /* si_name */
- sizeof(struct univcc), /* si_blksiz */
- 5, /* si_blkcnt */
- 100 /* si_maxallow */
-};
+
+static uma_zone_t sscf_uni_zone;
static struct stack_defn sscf_uni_service = {
NULL,
@@ -121,13 +119,17 @@ sscf_uni_start()
{
int err = 0;
+ sscf_uni_zone = uma_zcreate("sscf uni", sizeof(struct univcc), NULL,
+ NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (sscf_uni_zone == NULL)
+ panic("sscf_uni_start: uma_zcreate");
+
+ uma_zone_set_max(sscf_uni_zone, 100);
+
/*
* Register stack service
*/
- if ((err = atm_stack_register(&sscf_uni_service)) != 0)
- goto done;
-
-done:
+ err = atm_stack_register(&sscf_uni_service);
return (err);
}
@@ -166,13 +168,8 @@ sscf_uni_stop()
/*
* Deregister the stack service
*/
- (void) atm_stack_deregister(&sscf_uni_service);
-
- /*
- * Free our storage pools
- */
- atm_release_pool(&sscf_uni_pool);
-
+ (void)atm_stack_deregister(&sscf_uni_service);
+ uma_zdestroy(sscf_uni_zone);
return (0);
}
@@ -216,10 +213,9 @@ sscf_uni_inst(ssp, cvp)
/*
* Allocate our control block
*/
- uvp = (struct univcc *)atm_allocate(&sscf_uni_pool);
+ uvp = uma_zalloc(sscf_uni_zone, M_WAITOK);
if (uvp == NULL)
return (ENOMEM);
-
uvp->uv_ustate = UVU_INST;
uvp->uv_lstate = UVL_INST;
uvp->uv_connvc = cvp;
@@ -246,7 +242,7 @@ sscf_uni_inst(ssp, cvp)
/*
* Lower layer instantiation failed, free our resources
*/
- atm_free((caddr_t)uvp);
+ uma_zfree(sscf_uni_zone, uvp);
sscf_uni_vccnt--;
return (err);
}
diff --git a/sys/netatm/uni/sscf_uni_lower.c b/sys/netatm/uni/sscf_uni_lower.c
index d8c3677..d87cd0e 100644
--- a/sys/netatm/uni/sscf_uni_lower.c
+++ b/sys/netatm/uni/sscf_uni_lower.c
@@ -59,10 +59,13 @@
#include <netatm/uni/sscf_uni.h>
#include <netatm/uni/sscf_uni_var.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
+extern uma_zone_t unisig_vc_zone;
/*
* Local variables
@@ -173,7 +176,7 @@ sscf_uni_lower(cmd, tok, arg1, arg2)
sscf_uni_abort(uvp, "sscf_uni: TERM failure\n");
return;
}
- atm_free((caddr_t)uvp);
+ uma_zfree(unisig_vc_zone, uvp);
sscf_uni_vccnt--;
break;
diff --git a/sys/netatm/uni/sscop.c b/sys/netatm/uni/sscop.c
index b11e690..6374f30 100644
--- a/sys/netatm/uni/sscop.c
+++ b/sys/netatm/uni/sscop.c
@@ -61,6 +61,8 @@
#include <netatm/uni/sscop_pdu.h>
#include <netatm/uni/sscop_var.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
@@ -77,13 +79,7 @@ struct sscop_stat sscop_stat = {0};
struct atm_time sscop_timer = {0, 0};
-struct sp_info sscop_pool = {
- "sscop pool", /* si_name */
- sizeof(struct sscop), /* si_blksiz */
- 5, /* si_blkcnt */
- 100 /* si_maxallow */
-};
-
+uma_zone_t sscop_zone;
/*
* Local functions
@@ -159,6 +155,12 @@ sscop_start()
{
int err = 0;
+ sscop_zone = uma_zcreate("sscop", sizeof(struct sscop), NULL, NULL,
+ NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (sscop_zone == NULL)
+ panic("sscop_start: uma_zcreate");
+ uma_zone_set_max(sscop_zone, 100);
+
/*
* Register stack service
*/
@@ -198,31 +200,21 @@ sscop_stop()
int err = 0;
/*
- * Any connections still exist??
+ * Any connections still exist?? If so, we can't bail just yet.
*/
- if (sscop_vccnt) {
-
- /*
- * Yes, can't stop yet
- */
+ if (sscop_vccnt)
return (EBUSY);
- }
/*
* Stop our timer
*/
- (void) atm_untimeout(&sscop_timer);
+ (void)atm_untimeout(&sscop_timer);
/*
* Deregister the stack service
*/
- (void) atm_stack_deregister(&sscop_service);
-
- /*
- * Free our storage pools
- */
- atm_release_pool(&sscop_pool);
-
+ (void)atm_stack_deregister(&sscop_service);
+ uma_zdestroy(sscop_zone);
return (err);
}
@@ -266,7 +258,7 @@ sscop_inst(ssp, cvp)
/*
* Allocate our control block
*/
- sop = (struct sscop *)atm_allocate(&sscop_pool);
+ sop = uma_zalloc(sscop_zone, M_WAITOK);
if (sop == NULL)
return (ENOMEM);
@@ -294,7 +286,7 @@ sscop_inst(ssp, cvp)
/*
* Lower layer instantiation failed, free our resources
*/
- atm_free((caddr_t)sop);
+ uma_zfree(sscop_zone, sop);
return (err);
}
diff --git a/sys/netatm/uni/sscop_lower.c b/sys/netatm/uni/sscop_lower.c
index 615e5f1..6f25d57 100644
--- a/sys/netatm/uni/sscop_lower.c
+++ b/sys/netatm/uni/sscop_lower.c
@@ -357,7 +357,7 @@ sscop_term_all(sop, arg1, arg2)
* Unlink and free the connection block
*/
UNLINK(sop, struct sscop, sscop_head, so_next);
- atm_free((caddr_t)sop);
+ uma_zfree(sscop_zone, sop);
sscop_vccnt--;
return;
}
diff --git a/sys/netatm/uni/sscop_var.h b/sys/netatm/uni/sscop_var.h
index 807b70a..dca9d27 100644
--- a/sys/netatm/uni/sscop_var.h
+++ b/sys/netatm/uni/sscop_var.h
@@ -135,6 +135,9 @@ struct sscop_stat {
};
#ifdef _KERNEL
+
+#include <vm/uma.h>
+
/*
* Global function declarations
*/
@@ -264,7 +267,7 @@ void qsaal1_clear_connection(struct sscop *);
/*
* External variables
*/
-extern struct sp_info sscop_pool;
+extern uma_zone_t sscop_zone;
extern int sscop_vccnt;
extern struct sscop *sscop_head;
extern struct sscop_stat sscop_stat;
diff --git a/sys/netatm/uni/uniarp.c b/sys/netatm/uni/uniarp.c
index 4590aa5..0de56b8 100644
--- a/sys/netatm/uni/uniarp.c
+++ b/sys/netatm/uni/uniarp.c
@@ -66,6 +66,8 @@
#include <netatm/uni/unisig_var.h>
#include <netatm/uni/uniip_var.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
@@ -99,12 +101,7 @@ Atm_endpoint uniarp_endpt = {
NULL
};
-struct sp_info uniarp_pool = {
- "uni arp pool", /* si_name */
- sizeof(struct uniarp), /* si_blksiz */
- 10, /* si_blkcnt */
- 200 /* si_maxallow */
-};
+uma_zone_t uniarp_zone;
/*
@@ -132,11 +129,16 @@ uniarp_start()
{
int err;
+ uniarp_zone = uma_zcreate("uni arp", sizeof(struct uniarp), NULL, NULL,
+ NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (uniarp_zone == NULL)
+ panic("uniarp_start: uma_zcreate");
+ uma_zone_set_max(uniarp_zone, 200);
+
/*
* Register our endpoint
*/
err = atm_endpoint_register(&uniarp_endpt);
-
return (err);
}
@@ -181,7 +183,7 @@ uniarp_stop()
/*
* Free our storage pools
*/
- atm_release_pool(&uniarp_pool);
+ uma_zdestroy(uniarp_zone);
}
@@ -279,7 +281,7 @@ uniarp_ipdact(uip)
* Delete entry from arp table and free entry
*/
UNIARP_DELETE(uap);
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
}
}
@@ -307,7 +309,7 @@ uniarp_ipdact(uip)
* Delete entry from 'no map' table and free entry
*/
UNLINK(uap, struct uniarp, uniarp_nomaptab, ua_next);
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
}
/*
@@ -497,7 +499,7 @@ uniarp_server_mode(uip)
if (uap->ua_ivp == NULL) {
UNIARP_CANCEL(uap);
UNIARP_DELETE(uap);
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
continue;
}
@@ -631,7 +633,7 @@ uniarp_client_mode(uip, aap)
if (uap->ua_ivp == NULL) {
UNIARP_CANCEL(uap);
UNIARP_DELETE(uap);
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
continue;
}
@@ -711,7 +713,7 @@ uniarp_client_mode(uip, aap)
* Now, get an arp entry for the server connection
*/
uip->uip_arpstate = UIAS_CLIENT_POPEN;
- uap = (struct uniarp *)atm_allocate(&uniarp_pool);
+ uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO);
if (uap == NULL) {
UNIIP_ARP_TIMER(uip, 1 * ATM_HZ);
return;
@@ -722,7 +724,7 @@ uniarp_client_mode(uip, aap)
*/
if ((*inp->inf_createsvc)(&inp->inf_nif->nif_if, AF_ATM,
(caddr_t)&uip->uip_arpsvratm, &ivp)) {
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
UNIIP_ARP_TIMER(uip, 1 * ATM_HZ);
return;
}
@@ -928,7 +930,7 @@ uniarp_ioctl(code, data, arg1)
*/
UNIARP_CANCEL(uap);
UNIARP_DELETE(uap);
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
break;
case AIOCS_SET_ASV:
diff --git a/sys/netatm/uni/uniarp_cache.c b/sys/netatm/uni/uniarp_cache.c
index 69bd329..dbfe402 100644
--- a/sys/netatm/uni/uniarp_cache.c
+++ b/sys/netatm/uni/uniarp_cache.c
@@ -126,7 +126,7 @@ uniarp_cache_svc(uip, ip, atm, atmsub, origin)
* If there aren't any entries yet, create one
*/
if ((ipuap == NULL) && (nouap == NULL)) {
- ipuap = (struct uniarp *)atm_allocate(&uniarp_pool);
+ ipuap = uma_zalloc(uniarp_zone, M_WAITOK);
if (ipuap == NULL)
return (ENOMEM);
ipuap->ua_dstip.s_addr = ip->s_addr;
@@ -271,7 +271,7 @@ dataok:
*/
UNLINK(nouap, struct uniarp, uniarp_nomaptab, ua_next);
UNIARP_CANCEL(nouap);
- atm_free((caddr_t)nouap);
+ uma_zfree(uniarp_zone, nouap);
}
/*
diff --git a/sys/netatm/uni/uniarp_timer.c b/sys/netatm/uni/uniarp_timer.c
index 0138b5d..8309615 100644
--- a/sys/netatm/uni/uniarp_timer.c
+++ b/sys/netatm/uni/uniarp_timer.c
@@ -187,7 +187,7 @@ uniarp_svc_oldage(uap)
if (uap->ua_ivp == NULL) {
UNIARP_CANCEL(uap);
UNIARP_DELETE(uap);
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
return;
}
}
diff --git a/sys/netatm/uni/uniarp_vcm.c b/sys/netatm/uni/uniarp_vcm.c
index 5903e04..ac1c167 100644
--- a/sys/netatm/uni/uniarp_vcm.c
+++ b/sys/netatm/uni/uniarp_vcm.c
@@ -60,10 +60,13 @@
#include <netatm/ipatm/ipatm_serv.h>
#include <netatm/uni/uniip_var.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
+extern uma_zone_t unisig_vc_zone;
/*
* Local variables
@@ -130,7 +133,7 @@ uniarp_pvcopen(ivp)
/*
* Get an arp map entry
*/
- uap = (struct uniarp *)atm_allocate(&uniarp_pool);
+ uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO);
if (uap == NULL)
return (MAP_FAILED);
@@ -147,7 +150,7 @@ uniarp_pvcopen(ivp)
(void) atm_cm_release(ivp->iv_arpconn, &uniarp_cause);
ivp->iv_arpconn = NULL;
}
- atm_free((caddr_t)uap);
+ uma_zfree(uniarp_zone, uap);
return (MAP_FAILED);
}
@@ -276,7 +279,7 @@ uniarp_svcout(ivp, dst)
/*
* We're a client with an open VCC to the server, get a new arp entry
*/
- uap = (struct uniarp *)atm_allocate(&uniarp_pool);
+ uap = uma_zalloc(uniarp_zone, M_WAITOK);
if (uap == NULL) {
(void) splx(s);
return (MAP_FAILED);
@@ -437,7 +440,7 @@ uniarp_svcin(ivp, dst, dstsub)
/*
* No info in the cache - get a new arp entry
*/
- uap = (struct uniarp *)atm_allocate(&uniarp_pool);
+ uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO);
if (uap == NULL) {
(void) splx(s);
return (MAP_FAILED);
@@ -659,8 +662,7 @@ uniarp_vcclose(ivp)
/*
* Finally, free the entry
*/
- atm_free((caddr_t)uap);
-
+ uma_zfree(uniarp_zone, uap);
(void) splx(s);
return;
}
@@ -719,8 +721,7 @@ uniarp_cleared(toku, cause)
* If IP is finished with VCC, then we'll free it
*/
if (ivp->iv_state == IPVCC_FREE)
- atm_free((caddr_t)ivp);
-
+ uma_zfree(unisig_vc_zone, ivp);
(void) splx(s);
}
diff --git a/sys/netatm/uni/uniip.c b/sys/netatm/uni/uniip.c
index 6054166..802571f 100644
--- a/sys/netatm/uni/uniip.c
+++ b/sys/netatm/uni/uniip.c
@@ -59,6 +59,8 @@
#include <netatm/ipatm/ipatm_serv.h>
#include <netatm/uni/uniip_var.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
@@ -93,13 +95,7 @@ struct ip_serv uniip_ipserv = {
/*
* Local variables
*/
-static struct sp_info uniip_pool = {
- "uni ip pool", /* si_name */
- sizeof(struct uniip), /* si_blksiz */
- 2, /* si_blkcnt */
- 100 /* si_maxallow */
-};
-
+static uma_zone_t uniip_zone;
/*
* Process module loading notification
@@ -119,11 +115,16 @@ uniip_start()
{
int err;
+ uniip_zone = uma_zcreate("uni ip", sizeof(struct uniip), NULL, NULL,
+ NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (uniip_zone == NULL)
+ panic("uniip_start: uma_zcreate");
+ uma_zone_set_max(uniip_zone, 100);
+
/*
* Tell arp to initialize stuff
*/
err = uniarp_start();
-
return (err);
}
@@ -157,12 +158,7 @@ uniip_stop()
* Tell arp to stop
*/
uniarp_stop();
-
- /*
- * Free our storage pools
- */
- atm_release_pool(&uniip_pool);
-
+ uma_zdestroy(uniip_zone);
return (0);
}
@@ -199,7 +195,7 @@ uniip_ipact(inp)
/*
* Get a new interface control block
*/
- uip = (struct uniip *)atm_allocate(&uniip_pool);
+ uip = uma_zalloc(uniip_zone, M_WAITOK | M_ZERO);
if (uip == NULL)
return (ENOMEM);
@@ -262,7 +258,7 @@ uniip_ipdact(inp)
UNLINK(uip, struct uniip, uniip_head, uip_next);
if (uip->uip_prefix != NULL)
free(uip->uip_prefix, M_DEVBUF);
- atm_free((caddr_t)uip);
+ uma_zfree(uniip_zone, uip);
return (0);
}
diff --git a/sys/netatm/uni/uniip_var.h b/sys/netatm/uni/uniip_var.h
index 22ba48d..768790a 100644
--- a/sys/netatm/uni/uniip_var.h
+++ b/sys/netatm/uni/uniip_var.h
@@ -252,7 +252,7 @@ extern struct ip_serv uniip_ipserv;
extern struct uniarp *uniarp_arptab[];
extern struct uniarp *uniarp_nomaptab;
extern struct uniarp *uniarp_pvctab;
-extern struct sp_info uniarp_pool;
+extern uma_zone_t uniarp_zone;
extern struct atm_time uniarp_timer;
extern int uniarp_print;
extern Atm_endpoint uniarp_endpt;
diff --git a/sys/netatm/uni/unisig_decode.c b/sys/netatm/uni/unisig_decode.c
index ad484f5..7e58249 100644
--- a/sys/netatm/uni/unisig_decode.c
+++ b/sys/netatm/uni/unisig_decode.c
@@ -66,11 +66,11 @@
__RCSID("@(#) $FreeBSD$");
#endif
-#define ALLOC_IE(ie) \
- (ie) = (struct ie_generic *) atm_allocate(&unisig_iepool); \
- if (!ie) \
- return(ENOMEM);
-
+#define ALLOC_IE(ie) do { \
+ (ie) = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO); \
+ if ((ie) == NULL) \
+ return (ENOMEM); \
+} while (0)
/*
* Local functions
@@ -845,7 +845,7 @@ usf_dec_msg(usf, msg)
ALLOC_IE(ie);
rc = usf_dec_ie(usf, msg, ie);
if (rc) {
- atm_free(ie);
+ uma_zfree(unisig_ie_zone, ie);
return(rc);
}
len -= (ie->ie_length + UNI_IE_HDR_LEN);
@@ -945,7 +945,7 @@ usf_dec_ie(usf, msg, ie)
* Ignore the IE if it is of zero length.
*/
if (!ie->ie_length) {
- atm_free(ie);
+ uma_zfree(unisig_ie_zone, ie);
return(0);
}
diff --git a/sys/netatm/uni/unisig_if.c b/sys/netatm/uni/unisig_if.c
index bacd10e..f914cb6 100644
--- a/sys/netatm/uni/unisig_if.c
+++ b/sys/netatm/uni/unisig_if.c
@@ -68,6 +68,8 @@
#include <netatm/uni/unisig_var.h>
#include <netatm/uni/unisig_msg.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
@@ -76,27 +78,9 @@ __RCSID("@(#) $FreeBSD$");
/*
* Global variables
*/
-struct sp_info unisig_vcpool = {
- "unisig vcc pool", /* si_name */
- sizeof(struct unisig_vccb), /* si_blksiz */
- 10, /* si_blkcnt */
- 50 /* si_maxallow */
-};
-
-struct sp_info unisig_msgpool = {
- "unisig message pool", /* si_name */
- sizeof(struct unisig_msg), /* si_blksiz */
- 10, /* si_blkcnt */
- 50 /* si_maxallow */
-};
-
-struct sp_info unisig_iepool = {
- "unisig ie pool", /* si_name */
- sizeof(struct ie_generic), /* si_blksiz */
- 10, /* si_blkcnt */
- 50 /* si_maxallow */
-};
-
+uma_zone_t unisig_vc_zone;
+uma_zone_t unisig_msg_zone;
+uma_zone_t unisig_ie_zone;
/*
* Local functions
@@ -176,6 +160,27 @@ unisig_start()
}
/*
+ * Atleast ensure the versioning prior to creating our
+ * UMA zone.
+ */
+ unisig_vc_zone = uma_zcreate("unisig vcc", sizeof(struct unisig_vccb),
+ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (unisig_vc_zone == NULL)
+ panic("unisig_start: uma_zcreate failed to create vcc zone");
+ unisig_msg_zone = uma_zcreate("unisig msg", sizeof(struct unisig_msg),
+ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (unisig_msg_zone == NULL)
+ panic("unisig_start: uma_zcreate failed to create msg zone");
+ unisig_ie_zone = uma_zcreate("unisig ie", sizeof(struct ie_generic),
+ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (unisig_ie_zone == NULL)
+ panic("unisig_start: uma_zcreate failed to create ie zone");
+
+ uma_zone_set_max(unisig_vc_zone, 50);
+ uma_zone_set_max(unisig_msg_zone, 50);
+ uma_zone_set_max(unisig_ie_zone, 50);
+
+ /*
* Register ourselves with system
*/
err = atm_sigmgr_register(&unisig_mgr30);
@@ -231,12 +236,11 @@ unisig_stop()
/*
* Free up our storage pools
*/
- atm_release_pool(&unisig_vcpool);
- atm_release_pool(&unisig_msgpool);
- atm_release_pool(&unisig_iepool);
-
+ uma_zdestroy(unisig_vc_zone);
+ uma_zdestroy(unisig_msg_zone);
+ uma_zdestroy(unisig_ie_zone);
done:
- (void) splx(s);
+ (void)splx(s);
return (err);
}
@@ -775,7 +779,7 @@ unisig_free(vcp)
*/
vcp->vc_ustate = VCCU_NULL;
vcp->vc_sstate = UNI_NULL;
- atm_free((caddr_t)vcp);
+ uma_zfree(unisig_vc_zone, vcp);
/*
* If we're detaching and this was the last VCC queued,
diff --git a/sys/netatm/uni/unisig_msg.c b/sys/netatm/uni/unisig_msg.c
index 28347c9..a002426 100644
--- a/sys/netatm/uni/unisig_msg.c
+++ b/sys/netatm/uni/unisig_msg.c
@@ -61,6 +61,8 @@
#include <netatm/uni/unisig_mbuf.h>
#include <netatm/uni/unisig_print.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
@@ -292,7 +294,7 @@ unisig_send_setup(usp, uvp)
/*
* Get memory for a SETUP message
*/
- setup = (struct unisig_msg *)atm_allocate(&unisig_msgpool);
+ setup = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (setup == NULL) {
err = ENOMEM;
goto done;
@@ -318,8 +320,7 @@ unisig_send_setup(usp, uvp)
* specify one in the attribute block
*/
if (ap->calling.tag != T_ATM_PRESENT) {
- setup->msg_ie_cgad = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ setup->msg_ie_cgad = uma_zalloc(unisig_ie_zone, M_WAITOK);
if (setup->msg_ie_cgad == NULL) {
err = ENOMEM;
goto done;
@@ -378,13 +379,13 @@ unisig_send_release(usp, uvp, msg, cause)
/*
* Get memory for a RELEASE message
*/
- rls_msg = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ rls_msg = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (rls_msg == NULL) {
return(ENOMEM);
}
- cause_ie = (struct ie_generic *) atm_allocate(&unisig_iepool);
+ cause_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO);
if (cause_ie == NULL) {
- atm_free(rls_msg);
+ uma_zfree(unisig_msg_zone, rls_msg);
return(ENOMEM);
}
@@ -454,13 +455,13 @@ unisig_send_release_complete(usp, uvp, msg, cause)
/*
* Get memory for a RELEASE COMPLETE message
*/
- rls_cmp = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ rls_cmp = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (rls_cmp == NULL) {
return(ENOMEM);
}
- cause_ie = (struct ie_generic *) atm_allocate(&unisig_iepool);
+ cause_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO);
if (cause_ie == NULL) {
- atm_free(rls_cmp);
+ uma_zfree(unisig_msg_zone, rls_cmp);
return(ENOMEM);
}
@@ -533,19 +534,19 @@ unisig_send_status(usp, uvp, msg, cause)
/*
* Get memory for a STATUS message
*/
- stat_msg = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ stat_msg = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (stat_msg == NULL) {
return(ENOMEM);
}
- cause_ie = (struct ie_generic *) atm_allocate(&unisig_iepool);
+ cause_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO);
if (cause_ie == NULL) {
- atm_free(stat_msg);
+ uma_zfree(unisig_msg_zone, stat_msg);
return(ENOMEM);
}
- clst_ie = (struct ie_generic *) atm_allocate(&unisig_iepool);
+ clst_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO);
if (clst_ie == NULL) {
- atm_free(stat_msg);
- atm_free(cause_ie);
+ uma_zfree(unisig_msg_zone, stat_msg);
+ uma_zfree(unisig_ie_zone, cause_ie);
return(ENOMEM);
}
@@ -678,7 +679,7 @@ unisig_rcv_restart(usp, msg)
/*
* Get memory for a RESTART ACKNOWLEDGE message
*/
- rsta_msg = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ rsta_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
if (rsta_msg == NULL) {
return;
}
@@ -771,7 +772,7 @@ unisig_rcv_setup(usp, msg)
/*
* Get a new VCCB for the connection
*/
- uvp = (struct unisig_vccb *)atm_allocate(&unisig_vcpool);
+ uvp = uma_zalloc(unisig_vc_zone, M_WAITOK | M_ZERO);
if (uvp == NULL) {
return;
}
@@ -799,9 +800,8 @@ unisig_rcv_setup(usp, msg)
if (uvp->uv_sstate == UNI_NULL) {
DEQUEUE(uvp, struct unisig_vccb, uv_sigelem,
usp->us_vccq);
- atm_free(uvp);
+ uma_zfree(unisig_vc_zone, uvp);
}
-
return;
}
@@ -842,7 +842,7 @@ unisig_rcv_msg(usp, m)
/*
* Get storage for the message
*/
- msg = (struct unisig_msg *)atm_allocate(&unisig_msgpool);
+ msg = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (msg == NULL) {
err = ENOMEM;
goto done;
diff --git a/sys/netatm/uni/unisig_subr.c b/sys/netatm/uni/unisig_subr.c
index f371cc3..31cd1a4 100644
--- a/sys/netatm/uni/unisig_subr.c
+++ b/sys/netatm/uni/unisig_subr.c
@@ -275,7 +275,7 @@ unisig_open_vcc(usp, cvp)
/*
* Allocate control block for VCC
*/
- uvp = (struct unisig_vccb *)atm_allocate(&unisig_vcpool);
+ uvp = uma_zalloc(unisig_vc_zone, M_WAITOK | M_ZERO);
if (uvp == NULL) {
return(ENOMEM);
}
@@ -318,7 +318,7 @@ unisig_open_vcc(usp, cvp)
*/
DEQUEUE(uvp, struct unisig_vccb, uv_sigelem,
usp->us_vccq);
- atm_free((caddr_t)uvp);
+ uma_zfree(unisig_vc_zone, uvp);
return(err);
}
}
@@ -896,8 +896,8 @@ unisig_set_attrs(usp, msg, ap)
*/
if (ap->aal.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_aalp) {
- msg->msg_ie_aalp = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_aalp = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_aalp == NULL) {
err = ENOMEM;
goto done;
@@ -954,8 +954,8 @@ unisig_set_attrs(usp, msg, ap)
*/
if (ap->traffic.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_clrt) {
- msg->msg_ie_clrt = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_clrt = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_clrt == NULL) {
err = ENOMEM;
goto done;
@@ -1011,8 +1011,8 @@ unisig_set_attrs(usp, msg, ap)
*/
if (ap->bearer.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_bbcp) {
- msg->msg_ie_bbcp = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_bbcp = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_bbcp == NULL) {
err = ENOMEM;
goto done;
@@ -1039,8 +1039,8 @@ unisig_set_attrs(usp, msg, ap)
*/
if (ap->bhli.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_bhli) {
- msg->msg_ie_bhli = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_bhli = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_bhli == NULL) {
err = ENOMEM;
goto done;
@@ -1079,8 +1079,8 @@ unisig_set_attrs(usp, msg, ap)
if (ap->blli.tag_l2 == T_ATM_PRESENT ||
ap->blli.tag_l3 == T_ATM_PRESENT) {
if (!msg->msg_ie_blli) {
- msg->msg_ie_blli = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_blli = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_blli == NULL) {
err = ENOMEM;
goto done;
@@ -1164,8 +1164,8 @@ unisig_set_attrs(usp, msg, ap)
*/
if (ap->called.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_cdad) {
- msg->msg_ie_cdad = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_cdad = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_cdad == NULL) {
err = ENOMEM;
goto done;
@@ -1180,8 +1180,8 @@ unisig_set_attrs(usp, msg, ap)
if (ap->called.subaddr.address_format != T_ATM_ABSENT) {
if (!msg->msg_ie_cdsa) {
- msg->msg_ie_cdsa = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_cdsa = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_cdsa == NULL) {
err = ENOMEM;
goto done;
@@ -1202,8 +1202,8 @@ unisig_set_attrs(usp, msg, ap)
if (ap->calling.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_cgad) {
- msg->msg_ie_cgad = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_cgad = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_cgad == NULL) {
err = ENOMEM;
goto done;
@@ -1219,8 +1219,8 @@ unisig_set_attrs(usp, msg, ap)
if (ap->calling.subaddr.address_format !=
T_ATM_ABSENT) {
if (!msg->msg_ie_cgsa) {
- msg->msg_ie_cgsa = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_cgsa = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_cgsa == NULL) {
err = ENOMEM;
goto done;
@@ -1240,8 +1240,8 @@ unisig_set_attrs(usp, msg, ap)
*/
if (ap->qos.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_qosp) {
- msg->msg_ie_qosp = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_qosp = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_qosp == NULL) {
err = ENOMEM;
goto done;
@@ -1272,8 +1272,8 @@ unisig_set_attrs(usp, msg, ap)
if (ap->transit.tag == T_ATM_PRESENT &&
ap->transit.v.length != 0) {
if (!msg->msg_ie_trnt) {
- msg->msg_ie_trnt = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_trnt = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_trnt == NULL) {
err = ENOMEM;
goto done;
@@ -1297,8 +1297,8 @@ unisig_set_attrs(usp, msg, ap)
*/
if (ap->cause.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_caus) {
- msg->msg_ie_caus = (struct ie_generic *)
- atm_allocate(&unisig_iepool);
+ msg->msg_ie_caus = uma_zalloc(unisig_ie_zone,
+ M_WAITOK | M_ZERO);
if (msg->msg_ie_caus == NULL) {
err = ENOMEM;
goto done;
diff --git a/sys/netatm/uni/unisig_util.c b/sys/netatm/uni/unisig_util.c
index f1858bd..41109a5 100644
--- a/sys/netatm/uni/unisig_util.c
+++ b/sys/netatm/uni/unisig_util.c
@@ -92,7 +92,7 @@ unisig_free_msg(msg)
ie = msg->msg_ie_vec[i];
while (ie) {
ienxt = ie->ie_next;
- atm_free(ie);
+ uma_zfree(unisig_ie_zone, ie);
ie = ienxt;
}
}
@@ -100,10 +100,9 @@ unisig_free_msg(msg)
/*
* Finally, free the message structure itself
*/
- atm_free(msg);
+ uma_zfree(unisig_msg_zone, msg);
}
-
/*
* Verify a VCCB
*
diff --git a/sys/netatm/uni/unisig_var.h b/sys/netatm/uni/unisig_var.h
index 2105b21..2dcab17 100644
--- a/sys/netatm/uni/unisig_var.h
+++ b/sys/netatm/uni/unisig_var.h
@@ -44,6 +44,9 @@
#endif
#ifdef _KERNEL
+
+#include <vm/uma.h>
+
/*
* Structure containing state information for each UNI protocol
* instance. There will be one instance for each ATM device interface
@@ -314,10 +317,8 @@ int unisig_vc_state(struct unisig *,
/*
* External variables
*/
-extern struct sp_info unisig_vcpool;
-extern struct sp_info unisig_msgpool;
-extern struct sp_info unisig_iepool;
-
+extern uma_zone_t unisig_vc_zone;
+extern uma_zone_t unisig_msg_zone;
+extern uma_zone_t unisig_ie_zone;
#endif /* _KERNEL */
-
#endif /* _UNISIG_VAR_H */
diff --git a/sys/netatm/uni/unisig_vc_state.c b/sys/netatm/uni/unisig_vc_state.c
index fa9c3dd..3c88cba 100644
--- a/sys/netatm/uni/unisig_vc_state.c
+++ b/sys/netatm/uni/unisig_vc_state.c
@@ -456,9 +456,9 @@ unisig_vc_act04(usp, uvp, msg)
vpi = msg->msg_ie_cnid->ie_cnid_vpci;
vci = msg->msg_ie_cnid->ie_cnid_vci;
} else {
- iep = (struct ie_generic *)atm_allocate(&unisig_iepool);
- if (!iep)
- return(ENOMEM);
+ iep = uma_zalloc(unisig_ie_zone, M_WAITOK);
+ if (iep == NULL)
+ return (ENOMEM);
iep->ie_ident = UNI_IE_CNID;
iep->ie_err_cause = UNI_IE_CAUS_MISSING;
MSG_IE_ADD(msg, iep, UNI_MSG_IE_ERR);
@@ -548,12 +548,12 @@ unisig_vc_act05(usp, uvp, msg)
/*
* Send a RELEASE message
*/
- rls_msg = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ rls_msg = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (rls_msg == NULL)
return(ENOMEM);
- cause_ie = (struct ie_generic *) atm_allocate(&unisig_iepool);
+ cause_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO);
if (cause_ie == NULL) {
- atm_free(rls_msg);
+ uma_zfree(unisig_msg_zone, rls_msg);
return(ENOMEM);
}
@@ -668,9 +668,8 @@ unisig_vc_act06(usp, uvp, msg)
* No--VCI must have been specified earlier
*/
if (!uvp->uv_vci) {
- iep = (struct ie_generic *)atm_allocate(
- &unisig_iepool);
- if (!iep)
+ iep = uma_zalloc(unisig_ie_zone, M_WAITOK);
+ if (iep == NULL)
return(ENOMEM);
iep->ie_ident = UNI_IE_CNID;
iep->ie_err_cause = UNI_IE_CAUS_MISSING;
@@ -743,7 +742,7 @@ unisig_vc_act06(usp, uvp, msg)
/*
* Get memory for a CONNECT ACK message
*/
- cack_msg = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ cack_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
if (cack_msg == NULL)
return(ENOMEM);
@@ -1059,7 +1058,7 @@ unisig_vc_act09(usp, uvp, msg)
int rc;
struct unisig_msg *conn_msg;
- conn_msg = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ conn_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
if (conn_msg == NULL)
return(ENOMEM);
@@ -1390,9 +1389,8 @@ unisig_vc_act15(usp, uvp, msg)
}
}
if (cause == UNI_IE_CAUS_MISSING) {
- iep = (struct ie_generic *)atm_allocate(
- &unisig_iepool);
- if (!iep)
+ iep = uma_zalloc(unisig_ie_zone, M_WAITOK);
+ if (iep == NULL)
return(ENOMEM);
iep->ie_ident = UNI_IE_CNID;
iep->ie_err_cause = UNI_IE_CAUS_MISSING;
@@ -1613,7 +1611,7 @@ unisig_vc_act20(usp, uvp, msg)
/*
* Get memory for a STATUS ENQUIRY message
*/
- stat_msg = (struct unisig_msg *)atm_allocate(&unisig_msgpool);
+ stat_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
if (stat_msg == NULL)
return(ENOMEM);
@@ -1759,18 +1757,18 @@ unisig_vc_act22(usp, uvp, msg)
/*
* Get memory for a STATUS message
*/
- status = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ status = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (status == NULL)
return(ENOMEM);
- callst_ie = (struct ie_generic *) atm_allocate(&unisig_iepool);
+ callst_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO);
if (callst_ie == NULL) {
- atm_free(status);
+ uma_zfree(unisig_msg_zone, status);
return(ENOMEM);
}
- cause_ie = (struct ie_generic *) atm_allocate(&unisig_iepool);
+ cause_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO);
if (cause_ie == NULL) {
- atm_free(status);
- atm_free(callst_ie);
+ uma_zfree(unisig_msg_zone, status);
+ uma_zfree(unisig_ie_zone, callst_ie);
return(ENOMEM);
}
@@ -1861,7 +1859,7 @@ unisig_vc_act23(usp, uvp, msg)
/*
* Get memory for the ADD PARTY REJECT message
*/
- apr_msg = (struct unisig_msg *) atm_allocate(&unisig_msgpool);
+ apr_msg = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO);
if (apr_msg == NULL)
return(ENOMEM);
OpenPOWER on IntegriCloud