summaryrefslogtreecommitdiffstats
path: root/sys/netatm
diff options
context:
space:
mode:
authorarr <arr@FreeBSD.org>2002-05-07 20:13:55 +0000
committerarr <arr@FreeBSD.org>2002-05-07 20:13:55 +0000
commita4e47caebb6166080dbe6aea51f0995cbf51bc25 (patch)
tree0373fed3aab9fd018e409b788a739976963db63a /sys/netatm
parentc73ea9d79bebb0683c8470070d5c1136585b9762 (diff)
downloadFreeBSD-src-a4e47caebb6166080dbe6aea51f0995cbf51bc25.zip
FreeBSD-src-a4e47caebb6166080dbe6aea51f0995cbf51bc25.tar.gz
- Add atm_sock_init()
- Move the Atm_pcb storage pool (atm_pcb_pool) to be an UMA zone.
Diffstat (limited to 'sys/netatm')
-rw-r--r--sys/netatm/atm_socket.c21
-rw-r--r--sys/netatm/atm_subr.c3
-rw-r--r--sys/netatm/atm_var.h1
3 files changed, 16 insertions, 9 deletions
diff --git a/sys/netatm/atm_socket.c b/sys/netatm/atm_socket.c
index 9577e19..6ff6abc 100644
--- a/sys/netatm/atm_socket.c
+++ b/sys/netatm/atm_socket.c
@@ -67,12 +67,7 @@ __RCSID("@(#) $FreeBSD$");
/*
* Local variables
*/
-static struct sp_info atm_pcb_pool = {
- "atm pcb pool", /* si_name */
- sizeof(Atm_pcb), /* si_blksiz */
- 10, /* si_blkcnt */
- 100 /* si_maxallow */
-};
+static uma_zone_t atm_pcb_zone;
static struct t_atm_cause atm_sock_cause = {
T_ATM_ITU_CODING,
@@ -81,6 +76,16 @@ static struct t_atm_cause atm_sock_cause = {
{0, 0, 0, 0}
};
+void
+atm_sock_init(void)
+{
+
+ atm_pcb_zone = uma_zcreate("atm pcb", sizeof(Atm_pcb), NULL, NULL,
+ NULL, NULL, UMA_ALIGN_PTR, 0);
+ if (atm_pcb_zone == NULL)
+ panic("atm_sock_init: unable to initialize atm_pcb_zone");
+ uma_zone_set_max(atm_pcb_zone, 100);
+}
/*
* Allocate resources for a new ATM socket
@@ -130,7 +135,7 @@ atm_sock_attach(so, send, recv)
/*
* Allocate and initialize our control block
*/
- atp = (Atm_pcb *)atm_allocate(&atm_pcb_pool);
+ atp = uma_zalloc(atm_pcb_zone, M_ZERO | M_NOWAIT);
if (atp == NULL)
return (ENOMEM);
@@ -178,7 +183,7 @@ atm_sock_detach(so)
so->so_pcb = NULL;
sotryfree(so);
- atm_free((caddr_t)atp);
+ uma_zfree(atm_pcb_zone, atp);
return (0);
}
diff --git a/sys/netatm/atm_subr.c b/sys/netatm/atm_subr.c
index 84a74d0..43d651d 100644
--- a/sys/netatm/atm_subr.c
+++ b/sys/netatm/atm_subr.c
@@ -141,7 +141,8 @@ atm_initialize()
/*
* Initialize subsystems
*/
- atm_cm_init(NULL);
+ atm_sock_init();
+ atm_cm_init();
atm_aal5_init();
/*
diff --git a/sys/netatm/atm_var.h b/sys/netatm/atm_var.h
index b681950..85bdc68 100644
--- a/sys/netatm/atm_var.h
+++ b/sys/netatm/atm_var.h
@@ -147,6 +147,7 @@ int atm_create_stack(Atm_connvc *, struct stack_list *,
void (*)(int, void *, int, int) );
/* atm_socket.c */
+void atm_sock_init(void);
int atm_sock_attach(struct socket *, u_long, u_long);
int atm_sock_detach(struct socket *);
int atm_sock_bind(struct socket *, struct sockaddr *);
OpenPOWER on IntegriCloud