diff options
author | Luigi Rizzo <luigi@FreeBSD.org> | 2012-02-08 11:43:29 +0000 |
---|---|---|
committer | Luigi Rizzo <luigi@FreeBSD.org> | 2012-02-08 11:43:29 +0000 |
commit | 5819da83cec5fdb1d77956b2e7726525bf1245ea (patch) | |
tree | dc9a4f4f3227fea430bc6d74c565a7291e95bc05 /sys/net | |
parent | 78674822c7c824d55219c5817522dc81b09c8cd1 (diff) | |
download | src-5819da83cec5fdb1d77956b2e7726525bf1245ea.tar.gz src-5819da83cec5fdb1d77956b2e7726525bf1245ea.zip |
- 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.
Notes
Notes:
svn path=/head/; revision=231198
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/netmap.h | 6 | ||||
-rw-r--r-- | sys/net/netmap_user.h | 8 |
2 files changed, 1 insertions, 13 deletions
diff --git a/sys/net/netmap.h b/sys/net/netmap.h index 4dec1fddbb3c..0ba1537b4e1a 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 c9443b89e43f..64490452fe0c 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 ) |