- Add atm_sock_init()

- Move the Atm_pcb storage pool (atm_pcb_pool) to be an UMA zone.
This commit is contained in:
arr 2002-05-07 20:13:55 +00:00
parent c73ea9d79b
commit a4e47caebb
3 changed files with 16 additions and 9 deletions

View File

@ -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);
}

View File

@ -141,7 +141,8 @@ atm_initialize()
/*
* Initialize subsystems
*/
atm_cm_init(NULL);
atm_sock_init();
atm_cm_init();
atm_aal5_init();
/*

View File

@ -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 *);