aboutgitcodebugslistschat
path: root/passt.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-26 23:19:40 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-27 01:28:02 +0200
commit2dbed699e78ed3393ac97a64b04581974070afed (patch)
tree509f88c1caf3ca359408656983201ea15eeafd37 /passt.h
parentcc8db1c5bcca6d84e7bd3ba7e0a5108b62937578 (diff)
downloadpasst-2dbed699e78ed3393ac97a64b04581974070afed.tar
passt-2dbed699e78ed3393ac97a64b04581974070afed.tar.gz
passt-2dbed699e78ed3393ac97a64b04581974070afed.tar.bz2
passt-2dbed699e78ed3393ac97a64b04581974070afed.tar.lz
passt-2dbed699e78ed3393ac97a64b04581974070afed.tar.xz
passt-2dbed699e78ed3393ac97a64b04581974070afed.tar.zst
passt-2dbed699e78ed3393ac97a64b04581974070afed.zip
passt: Align pkt_buf to PAGE_SIZE (start and size), try to fit in huge pages
If transparent huge pages are available, madvise() will do the trick. While at it, decrease EPOLL_EVENTS for the main loop from 10 to 8, for slightly better socket fairness. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.h')
-rw-r--r--passt.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/passt.h b/passt.h
index 649d4fc..bb41e90 100644
--- a/passt.h
+++ b/passt.h
@@ -45,7 +45,8 @@ union epoll_ref {
uint64_t u64;
};
-#define TAP_BUF_BYTES ((ETH_MAX_MTU + sizeof(uint32_t)) * 256)
+#define TAP_BUF_BYTES \
+ ROUND_DOWN(((ETH_MAX_MTU + sizeof(uint32_t)) * 256), PAGE_SIZE)
#define TAP_BUF_FILL (TAP_BUF_BYTES - ETH_MAX_MTU - sizeof(uint32_t))
#define TAP_MSGS \
DIV_ROUND_UP(TAP_BUF_BYTES, ETH_ZLEN - 2 * ETH_ALEN + sizeof(uint32_t))