diff options
author | arr <arr@FreeBSD.org> | 2002-05-24 00:39:58 +0000 |
---|---|---|
committer | arr <arr@FreeBSD.org> | 2002-05-24 00:39:58 +0000 |
commit | 0239286d2c509dd5fb5136bf070206cb641023f1 (patch) | |
tree | 04d4572458bd827a7bd3300d9f1628f4733762c9 | |
parent | d756e3ff88238ac6a0deb498bda602333d20ddb3 (diff) | |
download | FreeBSD-src-0239286d2c509dd5fb5136bf070206cb641023f1.zip FreeBSD-src-0239286d2c509dd5fb5136bf070206cb641023f1.tar.gz |
- Remove a few storage pools and replace them with UMA zones. The spans
code is now storage pool free, so I believe this only leaves the uni
base not cleaned.
-rw-r--r-- | sys/netatm/spans/spans_arp.c | 36 | ||||
-rw-r--r-- | sys/netatm/spans/spans_cls.c | 21 | ||||
-rw-r--r-- | sys/netatm/spans/spans_if.c | 34 | ||||
-rw-r--r-- | sys/netatm/spans/spans_msg.c | 59 | ||||
-rw-r--r-- | sys/netatm/spans/spans_proto.c | 7 | ||||
-rw-r--r-- | sys/netatm/spans/spans_subr.c | 4 | ||||
-rw-r--r-- | sys/netatm/spans/spans_var.h | 7 |
7 files changed, 90 insertions, 78 deletions
diff --git a/sys/netatm/spans/spans_arp.c b/sys/netatm/spans/spans_arp.c index 107bb19..e0c83f9 100644 --- a/sys/netatm/spans/spans_arp.c +++ b/sys/netatm/spans/spans_arp.c @@ -67,6 +67,8 @@ #include <netatm/spans/spans_var.h> #include <netatm/spans/spans_cls.h> +#include <vm/uma.h> + #ifndef lint __RCSID("@(#) $FreeBSD$"); #endif @@ -93,12 +95,7 @@ static struct atm_time spansarp_rtimer = {0, 0}; /* Retry timer */ static struct spansarp *spansarp_retry_head = NULL; /* Retry chain */ -static struct sp_info spansarp_pool = { - "spans arp pool", /* si_name */ - sizeof(struct spansarp), /* si_blksiz */ - 10, /* si_blkcnt */ - 100 /* si_maxallow */ -}; +static uma_zone_t spansarp_zone; /* @@ -175,7 +172,7 @@ spansarp_svcout(ivp, dst) /* * Now get the new arp entry */ - sap = (struct spansarp *)atm_allocate(&spansarp_pool); + sap = uma_zalloc(spansarp_zone, M_WAITOK); if (sap == NULL) { (void) splx(s); return (MAP_FAILED); @@ -362,10 +359,21 @@ spansarp_vcclose(ivp) * Free entry */ SPANSARP_DELETE(sap); - atm_free((caddr_t)sap); + uma_zfree(spansarp_zone, sap); (void) splx(s); } +/* + * Called when the spans module is loaded. + */ +void +spansarp_start() +{ + + spansarp_zone = uma_zcreate("spansarp", sizeof(struct spansarp), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + uma_zone_set_max(spansarp_zone, 100); +} /* * Process module unloading notification @@ -403,7 +411,7 @@ spansarp_stop() /* * Free our storage pools */ - atm_release_pool(&spansarp_pool); + uma_zdestroy(spansarp_zone); } @@ -484,7 +492,7 @@ spansarp_ipdact(clp) * Delete entry from arp table */ SPANSARP_DELETE(sap); - atm_free((caddr_t)sap); + uma_zfree(spansarp_zone, sap); } } @@ -712,7 +720,7 @@ spansarp_input(clp, m) /* * Source unknown and we're the target - add new entry */ - sap = (struct spansarp *)atm_allocate(&spansarp_pool); + sap = uma_zalloc(spansarp_zone, M_WAITOK); if (sap) { sap->sa_dstip.s_addr = in_src.s_addr; sap->sa_dstatm.address_format = T_ATM_SPANS_ADDR; @@ -837,7 +845,7 @@ spansarp_aging(tip) * Delete unused entry */ SPANSARP_DELETE(sap); - atm_free((caddr_t)sap); + uma_zfree(spansarp_zone, sap); } } } @@ -953,7 +961,7 @@ spansarp_ioctl(code, data, arg1) /* * No, get a new arp entry */ - sap = (struct spansarp *)atm_allocate(&spansarp_pool); + sap = uma_zalloc(spansarp_zone, M_WAITOK); if (sap == NULL) { err = ENOMEM; break; @@ -1063,7 +1071,7 @@ spansarp_ioctl(code, data, arg1) */ UNLINK(sap, struct spansarp, spansarp_retry_head, sa_rnext); SPANSARP_DELETE(sap); - atm_free((caddr_t)sap); + uma_zfree(spansarp_zone, sap); break; case AIOCS_INF_ARP: diff --git a/sys/netatm/spans/spans_cls.c b/sys/netatm/spans/spans_cls.c index 4544da5..5b93892 100644 --- a/sys/netatm/spans/spans_cls.c +++ b/sys/netatm/spans/spans_cls.c @@ -65,6 +65,8 @@ #include <netatm/spans/spans_var.h> #include <netatm/spans/spans_cls.h> +#include <vm/uma.h> + #ifndef lint __RCSID("@(#) $FreeBSD$"); #endif @@ -106,12 +108,7 @@ static void spanscls_pdu_print(struct spanscls *, KBuffer *, char *); /* * Local variables */ -static struct sp_info spanscls_pool = { - "spans cls pool", /* si_name */ - sizeof(struct spanscls), /* si_blksiz */ - 2, /* si_blkcnt */ - 100 /* si_maxallow */ -}; +static uma_zone_t spanscls_zone; static struct ip_serv spanscls_ipserv = { spanscls_ipact, @@ -258,6 +255,10 @@ spanscls_start() { int err; + spanscls_zone = uma_zcreate("spanscls", sizeof(struct spanscls), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + uma_zone_set_max(spanscls_zone, 100); + /* * Fill in union fields */ @@ -316,7 +317,7 @@ spanscls_stop() /* * Free our storage pools */ - atm_release_pool(&spanscls_pool); + uma_zdestroy(spanscls_zone); } @@ -347,7 +348,7 @@ spanscls_attach(spp) /* * Get a new cls control block */ - clp = (struct spanscls *)atm_allocate(&spanscls_pool); + clp = uma_zalloc(spanscls_zone, M_WAITOK); if (clp == NULL) return (ENOMEM); @@ -378,7 +379,7 @@ spanscls_attach(spp) err = atm_cm_connect(&spanscls_endpt, clp, &spanscls_attr, &clp->cls_conn); if (err) { - atm_free((caddr_t)clp); + uma_zfree(spanscls_zone, clp); return (err); } @@ -439,7 +440,7 @@ spanscls_detach(spp) spp->sp_cls = NULL; if (clp->cls_state == CLS_CLOSED) { UNLINK(clp, struct spanscls, spanscls_head, cls_next); - atm_free((caddr_t)clp); + uma_zfree(spanscls_zone, clp); } } diff --git a/sys/netatm/spans/spans_if.c b/sys/netatm/spans/spans_if.c index c9c8531..f4c1bf1 100644 --- a/sys/netatm/spans/spans_if.c +++ b/sys/netatm/spans/spans_if.c @@ -76,19 +76,8 @@ __RCSID("@(#) $FreeBSD$"); /* * Global variables */ -struct sp_info spans_vcpool = { - "spans vcc pool", /* si_name */ - sizeof(struct spans_vccb), /* si_blksiz */ - 10, /* si_blkcnt */ - 50 /* si_maxallow */ -}; - -struct sp_info spans_msgpool = { - "spans message pool", /* si_name */ - sizeof(spans_msg), /* si_blksiz */ - 10, /* si_blkcnt */ - 50 /* si_maxallow */ -}; +uma_zone_t spans_vc_zone; +uma_zone_t spans_msg_zone; /* * Local functions @@ -141,6 +130,14 @@ spans_start() return (EINVAL); } + spans_vc_zone = uma_zcreate("spans vc", sizeof(struct spans_vccb), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + uma_zone_set_max(spans_vc_zone, 50); + + spans_msg_zone = uma_zcreate("spans msg", sizeof(spans_msg), NULL, + NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + uma_zone_set_max(spans_msg_zone, 50); + /* * Allocate protocol definition structure */ @@ -171,6 +168,11 @@ spans_start() goto done; /* + * Start the arp service + */ + spansarp_start(); + + /* * Start up Connectionless Service */ err = spanscls_start(); @@ -237,8 +239,8 @@ spans_stop() /* * Free up our storage pools */ - atm_release_pool(&spans_vcpool); - atm_release_pool(&spans_msgpool); + uma_zdestroy(spans_vc_zone); + uma_zdestroy(spans_msg_zone); } else err = ENXIO; @@ -860,7 +862,7 @@ spans_free(vcp) */ vcp->vc_ustate = VCCU_NULL; vcp->vc_sstate = SPANS_VC_NULL; - atm_free((caddr_t)vcp); + uma_zfree(spans_vc_zone, vcp); /* * If we're detaching and this was the last VCC queued, diff --git a/sys/netatm/spans/spans_msg.c b/sys/netatm/spans/spans_msg.c index cc821d8..9ceabe5 100644 --- a/sys/netatm/spans/spans_msg.c +++ b/sys/netatm/spans/spans_msg.c @@ -233,7 +233,7 @@ spans_send_open_req(spp, svp) /* * Get memory for a request message */ - req = (spans_msg *)atm_allocate(&spans_msgpool); + req = uma_zalloc(spans_msg_zone, M_WAITOK); if (req == NULL) { err = ENOBUFS; goto done; @@ -256,8 +256,7 @@ spans_send_open_req(spp, svp) * Send the request */ err = spans_send_msg(spp, req); - atm_free(req); - + uma_zfree(spans_msg_zone, req); done: return(err); } @@ -292,7 +291,7 @@ spans_send_open_rsp(spp, svp, result) /* * Get memory for a response message */ - rsp = (spans_msg *)atm_allocate(&spans_msgpool); + rsp = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp == NULL) return(ENOBUFS); @@ -311,8 +310,7 @@ spans_send_open_rsp(spp, svp, result) * Send the response */ rc = spans_send_msg(spp, rsp); - atm_free(rsp); - + uma_zfree(spans_msg_zone, rsp); return(rc); } @@ -343,7 +341,7 @@ spans_send_close_req(spp, svp) /* * Get memory for a close request */ - req = (spans_msg *)atm_allocate(&spans_msgpool); + req = uma_zalloc(spans_msg_zone, M_WAITOK); if (req == NULL) { err = ENOBUFS; goto done; @@ -373,7 +371,7 @@ spans_send_close_req(spp, svp) done: if (req) - atm_free(req); + uma_zfree(spans_msg_zone, req); return(err); } @@ -471,7 +469,7 @@ spans_status_ind(spp, msg) * Respond to the status request or indication with a * status response */ - rsp_msg = (spans_msg *)atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; rsp_msg->sm_vers = SPANS_VERS_1_0; @@ -480,7 +478,7 @@ spans_status_ind(spp, msg) spans_addr_copy(spp->sp_addr.address, &rsp_msg->sm_stat_rsp.strsp_es_addr); spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -661,7 +659,7 @@ spans_open_req(spp, msg) /* * Get a new VCCB for the connection */ - svp = (struct spans_vccb *)atm_allocate(&spans_vcpool); + svp = uma_zalloc(spans_vc_zone, M_WAITOK); if (svp == NULL) { ATM_DEBUG0("spans_open_req: VCCB pool empty\n"); result = SPANS_NORSC; @@ -804,14 +802,14 @@ response: if (svp) { DEQUEUE(svp, struct spans_vccb, sv_sigelem, spp->sp_vccq); - atm_free(svp); + uma_zfree(spans_vc_zone, svp); } /* * Some problem was detected with the request. Send a SPANS * message rejecting the connection. */ - rsp_msg = (spans_msg *) atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -828,7 +826,7 @@ response: * Send the Open Response */ spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -1037,7 +1035,7 @@ response: /* * Respond to the SPANS_CLOSE_IND with a SPANS_CLOSE_RSP */ - rsp_msg = (spans_msg *)atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; rsp_msg->sm_vers = SPANS_VERS_1_0; @@ -1050,7 +1048,7 @@ response: rsp_msg->sm_close_rsp.clrsp_conn = msg->sm_close_req.clreq_conn; rsp_msg->sm_close_rsp.clrsp_result = result; spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -1172,7 +1170,7 @@ spans_multi_req(spp, msg) /* * Get memory for a SPANS_MULTI_RSP message. */ - rsp_msg = (spans_msg *) atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1190,7 +1188,7 @@ spans_multi_req(spp, msg) * Send the response and free the message. */ (void) spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -1218,7 +1216,7 @@ spans_add_req(spp, msg) /* * Get memory for a SPANS_ADD_RSP message. */ - rsp_msg = (spans_msg *) atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1237,7 +1235,7 @@ spans_add_req(spp, msg) * Send the response and free the message. */ (void) spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -1265,7 +1263,7 @@ spans_join_req(spp, msg) /* * Get memory for a SPANS_JOIN_CNF message. */ - rsp_msg = (spans_msg *) atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1282,7 +1280,7 @@ spans_join_req(spp, msg) * Send the response and free the message. */ (void) spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -1310,7 +1308,7 @@ spans_leave_req(spp, msg) /* * Get memory for a SPANS_LEAVE_CNF message. */ - rsp_msg = (spans_msg *) atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1327,7 +1325,7 @@ spans_leave_req(spp, msg) * Send the response and free the message. */ (void) spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -1404,7 +1402,7 @@ spans_query_req(spp, msg) /* * Get memory for a SPANS_QUERY_RSP message. */ - rsp_msg = (spans_msg *) atm_allocate(&spans_msgpool); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1447,7 +1445,7 @@ spans_query_req(spp, msg) /* * VCCB is for a PVC (shouldn't happen) */ - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); return; } } else { @@ -1461,7 +1459,7 @@ spans_query_req(spp, msg) * Send the response and free the message. */ (void) spans_send_msg(spp, rsp_msg); - atm_free(rsp_msg); + uma_zfree(spans_msg_zone, rsp_msg); } @@ -1492,10 +1490,9 @@ spans_rcv_msg(spp, m) /* * Get storage for the message */ - msg = (spans_msg *)atm_allocate(&spans_msgpool); - if (msg == NULL) { + msg = uma_zalloc(spans_msg_zone, M_WAITOK); + if (msg == NULL) return; - } /* * Convert the message from network order to internal format @@ -1648,7 +1645,7 @@ done: * necessary. */ if (msg) - atm_free(msg); + uma_zfree(spans_msg_zone, msg); if (m) KB_FREEALL(m); } diff --git a/sys/netatm/spans/spans_proto.c b/sys/netatm/spans/spans_proto.c index c287736..7562820 100644 --- a/sys/netatm/spans/spans_proto.c +++ b/sys/netatm/spans/spans_proto.c @@ -279,8 +279,9 @@ spans_timer(tip) /* * Send out SPANS_STAT_REQ message */ - msg = (spans_msg *)atm_allocate(&spans_msgpool); + msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (msg == NULL) { + /* XXX arr: This is bogus and will go away RSN */ /* Retry later if no memory */ SPANS_TIMER(spp, SPANS_PROBE_ERR_WAIT); break; @@ -291,10 +292,10 @@ spans_timer(tip) if (spans_send_msg(spp, msg)) { /* Retry later if send fails */ SPANS_TIMER(spp, SPANS_PROBE_ERR_WAIT); - atm_free(msg); + uma_zfree(spans_msg_zone, msg); break; } - atm_free(msg); + uma_zfree(spans_msg_zone, msg); spp->sp_probe_ct++; /* diff --git a/sys/netatm/spans/spans_subr.c b/sys/netatm/spans/spans_subr.c index 5dbee5e..93ea6d4 100644 --- a/sys/netatm/spans/spans_subr.c +++ b/sys/netatm/spans/spans_subr.c @@ -192,7 +192,7 @@ spans_open_vcc(spp, cvp) /* * Allocate control block for VCC */ - svp = (struct spans_vccb *)atm_allocate(&spans_vcpool); + svp = uma_zalloc(spans_vc_zone, M_WAITOK); if (svp == NULL) { return(ENOMEM); } @@ -251,7 +251,7 @@ spans_open_vcc(spp, cvp) DEQUEUE(svp, struct spans_vccb, sv_sigelem, spp->sp_vccq); cvp->cvc_vcc = (struct vccb *)0; - atm_free((caddr_t)svp); + uma_zfree(spans_vc_zone, svp); return(err); } else { /* diff --git a/sys/netatm/spans/spans_var.h b/sys/netatm/spans/spans_var.h index 113249b..191e0f2 100644 --- a/sys/netatm/spans/spans_var.h +++ b/sys/netatm/spans/spans_var.h @@ -39,6 +39,9 @@ #define _SPANS_SPANS_VAR_H #ifdef _KERNEL + +#include <vm/uma.h> /* XXX arr: will remove rsn */ + /* * Constants to indicate the state of the signalling interface */ @@ -244,8 +247,8 @@ void spans_dump_buffer(KBuffer *); * External variables */ extern struct spans_addr spans_bcastaddr; -extern struct sp_info spans_vcpool; -extern struct sp_info spans_msgpool; +extern uma_zone_t spans_vc_zone; +extern uma_zone_t spans_msg_zone; extern struct t_atm_cause spans_cause; #endif /* _KERNEL */ |