summaryrefslogtreecommitdiffstats
path: root/sys/netatm
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-07-22 15:11:08 +0000
committerharti <harti@FreeBSD.org>2003-07-22 15:11:08 +0000
commit53a922e873a17320f442bff6cbea3dc9c5384255 (patch)
tree0b2e3638d6cd1f3e32637d3ca6c5458e155a9b8b /sys/netatm
parent35d5e319f1364dfee2aa34a19799430476ca39ea (diff)
downloadFreeBSD-src-53a922e873a17320f442bff6cbea3dc9c5384255.zip
FreeBSD-src-53a922e873a17320f442bff6cbea3dc9c5384255.tar.gz
Allocate network interfaces from malloc() instead of using a zone.
Usually one needs only a couple of them so using a zone is waste of memory (esp. on multi-cpu systems).
Diffstat (limited to 'sys/netatm')
-rw-r--r--sys/netatm/ipatm/ipatm_if.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/netatm/ipatm/ipatm_if.c b/sys/netatm/ipatm/ipatm_if.c
index 08517c5..7f85cde 100644
--- a/sys/netatm/ipatm/ipatm_if.c
+++ b/sys/netatm/ipatm/ipatm_if.c
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/syslog.h>
+#include <sys/malloc.h>
+#include <sys/kernel.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netatm/port.h>
@@ -58,6 +60,8 @@ __FBSDID("$FreeBSD$");
#include <netatm/ipatm/ipatm_var.h>
#include <netatm/ipatm/ipatm_serv.h>
+static MALLOC_DEFINE(M_IPATM_NIF, "ipatm nif", "IP/ATM network interfaces");
+
/*
* Local functions
*/
@@ -117,11 +121,7 @@ ipatm_nifstat(cmd, nip, arg)
/*
* Get a new interface block
*/
- inp = uma_zalloc(ipatm_nif_zone, M_WAITOK);
- if (inp == NULL) {
- err = ENOMEM;
- break;
- }
+ inp = malloc(sizeof(*inp), M_IPATM_NIF, M_WAITOK | M_ZERO);
inp->inf_nif = nip;
inp->inf_state = IPNIF_ADDR;
inp->inf_arpnotify = ipatm_arpnotify;
@@ -161,7 +161,7 @@ ipatm_nifstat(cmd, nip, arg)
* Clean up and free block
*/
UNLINK(inp, struct ip_nif, ipatm_nif_head, inf_next);
- uma_zfree(ipatm_nif_zone, inp);
+ free(inp, M_IPATM_NIF);
break;
case NCM_SETADDR:
OpenPOWER on IntegriCloud