summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2012-02-08 11:43:29 +0000
committerluigi <luigi@FreeBSD.org>2012-02-08 11:43:29 +0000
commit0290a0c2f7684d3b3159f5cd92c0fb2e08aba725 (patch)
treedc9a4f4f3227fea430bc6d74c565a7291e95bc05 /sys/net
parent507691dbd9aa5a7e9229bb26aa781572f120595c (diff)
downloadFreeBSD-src-0290a0c2f7684d3b3159f5cd92c0fb2e08aba725.zip
FreeBSD-src-0290a0c2f7684d3b3159f5cd92c0fb2e08aba725.tar.gz
- 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.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/netmap.h6
-rw-r--r--sys/net/netmap_user.h8
2 files changed, 1 insertions, 13 deletions
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 )
OpenPOWER on IntegriCloud