summaryrefslogtreecommitdiffstats
path: root/sys/netatm
diff options
context:
space:
mode:
authorarr <arr@FreeBSD.org>2002-05-23 00:34:12 +0000
committerarr <arr@FreeBSD.org>2002-05-23 00:34:12 +0000
commit4fe0504ac98cad7ad7323ec4abdcaebff302914f (patch)
treef14d51e27572377253b16062ce1be02fe996d96f /sys/netatm
parent0da89370adfe17ba00f07ee8e04cf76817c813b2 (diff)
downloadFreeBSD-src-4fe0504ac98cad7ad7323ec4abdcaebff302914f.zip
FreeBSD-src-4fe0504ac98cad7ad7323ec4abdcaebff302914f.tar.gz
- Turn two more storage pools into UMA zones and make the related memory
allocations and frees use the UMA api.
Diffstat (limited to 'sys/netatm')
-rw-r--r--sys/netatm/ipatm/ipatm_if.c4
-rw-r--r--sys/netatm/ipatm/ipatm_load.c35
-rw-r--r--sys/netatm/ipatm/ipatm_var.h4
-rw-r--r--sys/netatm/ipatm/ipatm_vcm.c18
4 files changed, 31 insertions, 30 deletions
diff --git a/sys/netatm/ipatm/ipatm_if.c b/sys/netatm/ipatm/ipatm_if.c
index b811131..368655a 100644
--- a/sys/netatm/ipatm/ipatm_if.c
+++ b/sys/netatm/ipatm/ipatm_if.c
@@ -124,7 +124,7 @@ ipatm_nifstat(cmd, nip, arg)
/*
* Get a new interface block
*/
- inp = (struct ip_nif *)atm_allocate(&ipatm_nifpool);
+ inp = uma_zalloc(ipatm_nif_zone, M_WAITOK);
if (inp == NULL) {
err = ENOMEM;
break;
@@ -168,7 +168,7 @@ ipatm_nifstat(cmd, nip, arg)
* Clean up and free block
*/
UNLINK(inp, struct ip_nif, ipatm_nif_head, inf_next);
- atm_free((caddr_t)inp);
+ uma_zfree(ipatm_nif_zone, inp);
break;
case NCM_SETADDR:
diff --git a/sys/netatm/ipatm/ipatm_load.c b/sys/netatm/ipatm/ipatm_load.c
index 556e667..999d44d 100644
--- a/sys/netatm/ipatm/ipatm_load.c
+++ b/sys/netatm/ipatm/ipatm_load.c
@@ -65,6 +65,8 @@
#include <netatm/ipatm/ipatm.h>
#include <netatm/ipatm/ipatm_var.h>
+#include <vm/uma.h>
+
#ifndef lint
__RCSID("@(#) $FreeBSD$");
#endif
@@ -103,20 +105,8 @@ Atm_endpoint ipatm_endpt = {
NULL
};
-struct sp_info ipatm_vcpool = {
- "ipatm vcc pool", /* si_name */
- sizeof(struct ipvcc), /* si_blksiz */
- 10, /* si_blkcnt */
- 100 /* si_maxallow */
-};
-
-struct sp_info ipatm_nifpool = {
- "ipatm nif pool", /* si_name */
- sizeof(struct ip_nif), /* si_blksiz */
- 5, /* si_blkcnt */
- 52 /* si_maxallow */
-};
-
+uma_zone_t ipatm_vc_zone;
+uma_zone_t ipatm_nif_zone;
/*
* Local functions
@@ -415,6 +405,18 @@ ipatm_start()
return (EINVAL);
}
+ ipatm_vc_zone = uma_zcreate("ipatm vc", sizeof(struct ipvcc), NULL,
+ NULL, NULL, NULL, UMA_ALIGN_PTR, M_ZERO|M_WAITOK);
+ if (ipatm_vc_zone == NULL)
+ panic("ipatm_start: unable to create ipatm_vc_zone");
+ uma_zone_set_max(ipatm_vc_zone, 100);
+
+ ipatm_nif_zone = uma_zcreate("ipatm nif", sizeof(struct ip_nif), NULL,
+ NULL, NULL, NULL, UMA_ALIGN_PTR, M_ZERO|M_WAITOK);
+ if (ipatm_nif_zone == NULL)
+ panic("ipatm_start: unable to create ipatm_nif_zone");
+ uma_zone_set_max(ipatm_nif_zone, 52);
+
/*
* Register ourselves as a network convergence module
*/
@@ -602,9 +604,8 @@ ipatm_stop()
/*
* Free up our storage pools
*/
- atm_release_pool(&ipatm_vcpool);
- atm_release_pool(&ipatm_nifpool);
-
+ uma_zdestroy(ipatm_vc_zone);
+ uma_zdestroy(ipatm_nif_zone);
done:
(void) splx(s);
return (err);
diff --git a/sys/netatm/ipatm/ipatm_var.h b/sys/netatm/ipatm/ipatm_var.h
index 6e7e11b..d07fa06 100644
--- a/sys/netatm/ipatm/ipatm_var.h
+++ b/sys/netatm/ipatm/ipatm_var.h
@@ -200,8 +200,8 @@ extern int ipatm_print;
extern u_long last_map_ipdst;
extern struct ipvcc *last_map_ipvcc;
extern struct ip_nif *ipatm_nif_head;
-extern struct sp_info ipatm_vcpool;
-extern struct sp_info ipatm_nifpool;
+extern uma_zone_t ipatm_vc_zone;
+extern uma_zone_t ipatm_nif_zone;
extern struct ipatm_stat ipatm_stat;
extern struct atm_time ipatm_itimer;
extern Atm_endpoint ipatm_endpt;
diff --git a/sys/netatm/ipatm/ipatm_vcm.c b/sys/netatm/ipatm/ipatm_vcm.c
index 33605e1..d10e8e7 100644
--- a/sys/netatm/ipatm/ipatm_vcm.c
+++ b/sys/netatm/ipatm/ipatm_vcm.c
@@ -382,7 +382,7 @@ ipatm_openpvc(pvp, sivp)
/*
* Allocate IP VCC block
*/
- ivp = (struct ipvcc *)atm_allocate(&ipatm_vcpool);
+ ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK);
if (ivp == NULL) {
err = ENOMEM;
goto done;
@@ -423,7 +423,7 @@ ipatm_openpvc(pvp, sivp)
*/
err = atm_cm_connect(&ipatm_endpt, ivp, ap, &ivp->iv_conn);
if (err) {
- atm_free((caddr_t)ivp);
+ uma_zfree(ipatm_vc_zone, ivp);
goto done;
}
@@ -585,7 +585,7 @@ ipatm_createsvc(ifp, daf, dst, sivp)
/*
* Allocate IP VCC
*/
- ivp = (struct ipvcc *)atm_allocate(&ipatm_vcpool);
+ ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK);
if (ivp == NULL) {
err = ENOMEM;
goto done;
@@ -624,7 +624,7 @@ ipatm_createsvc(ifp, daf, dst, sivp)
err = ipatm_opensvc(ivp);
if (err) {
(*inp->inf_serv->is_arp_close)(ivp);
- atm_free((caddr_t)ivp);
+ uma_zfree(ipatm_vc_zone, ivp);
goto done;
}
break;
@@ -633,7 +633,7 @@ ipatm_createsvc(ifp, daf, dst, sivp)
/*
* So sorry...come again
*/
- atm_free((caddr_t)ivp);
+ uma_zfree(ipatm_vc_zone, ivp);
err = ENETDOWN;
goto done;
@@ -655,7 +655,7 @@ ipatm_createsvc(ifp, daf, dst, sivp)
ivp->iv_arpent = &map;
err = ipatm_opensvc(ivp);
if (err) {
- atm_free((caddr_t)ivp);
+ uma_zfree(ipatm_vc_zone, ivp);
goto done;
}
ivp->iv_arpent = NULL;
@@ -937,7 +937,7 @@ ipatm_incoming(tok, cop, ap, tokp)
/*
* Allocate IP VCC
*/
- ivp = (struct ipvcc *)atm_allocate(&ipatm_vcpool);
+ ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK);
if (ivp == NULL) {
err = ENOMEM;
cause = T_ATM_CAUSE_UNSPECIFIED_RESOURCE_UNAVAILABLE;
@@ -1015,7 +1015,7 @@ reject:
*/
if (ivp) {
(*inp->inf_serv->is_arp_close)(ivp);
- atm_free((caddr_t)ivp);
+ uma_zfree(ipatm_vc_zone, ivp);
}
ap->cause.tag = T_ATM_PRESENT;
ap->cause.v = ipatm_cause;
@@ -1128,7 +1128,7 @@ ipatm_closevc(ivp, code)
* If ARP module is done with VCC too, then free it
*/
if (ivp->iv_arpconn == NULL)
- atm_free((caddr_t)ivp);
+ uma_zfree(ipatm_vc_zone, ivp);
ipatm_vccnt--;
(void) splx(s);
OpenPOWER on IntegriCloud