From 0290a0c2f7684d3b3159f5cd92c0fb2e08aba725 Mon Sep 17 00:00:00 2001 From: luigi Date: Wed, 8 Feb 2012 11:43:29 +0000 Subject: - change the buffer size from a constant to a TUNABLE variable (hw.netmap.buf_size) so we can experiment with values different from 2048 which may give better cache performance. - rearrange the memory allocation code so it will be easier to replace it with a different implementation. The current code relies on a single large contiguous chunk of memory obtained through contigmalloc. The new implementation (not committed yet) uses multiple smaller chunks which are easier to fit in a fragmented address space. --- sys/net/netmap.h | 6 ------ sys/net/netmap_user.h | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) (limited to 'sys/net') diff --git a/sys/net/netmap.h b/sys/net/netmap.h index 4dec1fd..0ba1537 100644 --- a/sys/net/netmap.h +++ b/sys/net/netmap.h @@ -258,12 +258,6 @@ struct nmreq { #define NETMAP_RING_MASK 0xfff /* the ring number */ }; -/* - * default buf size is 2048, but it may make sense to have - * it shorter for better cache usage. - */ - -#define NETMAP_BUF_SIZE (2048) #define NIOCGINFO _IOWR('i', 145, struct nmreq) /* return IF info */ #define NIOCREGIF _IOWR('i', 146, struct nmreq) /* interface register */ #define NIOCUNREGIF _IO('i', 147) /* interface unregister */ diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h index c9443b8..6449045 100644 --- a/sys/net/netmap_user.h +++ b/sys/net/netmap_user.h @@ -73,14 +73,8 @@ ((struct netmap_ring *)((char *)(nifp) + \ (nifp)->ring_ofs[index + (nifp)->ni_num_queues+1] ) ) -#if NETMAP_BUF_SIZE != 2048 -#error cannot handle odd size #define NETMAP_BUF(ring, index) \ - ((char *)(ring) + (ring)->buf_ofs + ((index)*NETMAP_BUF_SIZE)) -#else -#define NETMAP_BUF(ring, index) \ - ((char *)(ring) + (ring)->buf_ofs + ((index)<<11)) -#endif + ((char *)(ring) + (ring)->buf_ofs + ((index)*(ring)->nr_buf_size)) #define NETMAP_RING_NEXT(r, i) \ ((i)+1 == (r)->num_slots ? 0 : (i) + 1 ) -- cgit v1.1