diff options
author | Andrew R. Reiter <arr@FreeBSD.org> | 2002-05-07 20:13:55 +0000 |
---|---|---|
committer | Andrew R. Reiter <arr@FreeBSD.org> | 2002-05-07 20:13:55 +0000 |
commit | bfb57eef8a3d508910a92619b68c59e7319bbe5f (patch) | |
tree | 0373fed3aab9fd018e409b788a739976963db63a /sys/netatm/atm_socket.c | |
parent | a3d5f221b45c158f813b370294a35fe2f9913b07 (diff) | |
download | src-bfb57eef8a3d508910a92619b68c59e7319bbe5f.tar.gz src-bfb57eef8a3d508910a92619b68c59e7319bbe5f.zip |
- Add atm_sock_init()
- Move the Atm_pcb storage pool (atm_pcb_pool) to be an UMA zone.
Notes
Notes:
svn path=/head/; revision=96177
Diffstat (limited to 'sys/netatm/atm_socket.c')
-rw-r--r-- | sys/netatm/atm_socket.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/netatm/atm_socket.c b/sys/netatm/atm_socket.c index 9577e19d6c63..6ff6abcc4018 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); } |