1
0
mirror of https://passt.top/passt synced 2024-07-01 23:42:41 +00:00

tap: Fix calculation of number of tap scatter-gather IO messages

Messages are typically smaller than ETH_MAX_MTU.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-09 15:08:31 +02:00
parent 089dec90ca
commit 5e23b1ef44

View File

@ -45,9 +45,10 @@ union epoll_ref {
uint64_t u64;
};
#define TAP_BUF_BYTES (ETH_MAX_MTU * 128)
#define TAP_BUF_BYTES ((ETH_MAX_MTU + sizeof(uint32_t)) * 128)
#define TAP_BUF_FILL (TAP_BUF_BYTES - ETH_MAX_MTU - sizeof(uint32_t))
#define TAP_MSGS (TAP_BUF_BYTES / sizeof(struct ethhdr) + 1)
#define TAP_MSGS \
DIV_ROUND_UP(TAP_BUF_BYTES, ETH_ZLEN - 2 * ETH_ALEN + sizeof(uint32_t))
#define PKT_BUF_BYTES MAX(TAP_BUF_BYTES, 0)
extern char pkt_buf [PKT_BUF_BYTES];