diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-09-09 15:08:31 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-09-09 15:40:04 +0200 |
commit | 5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f (patch) | |
tree | fd6f6362238315734263930019073b8e299efee3 /passt.h | |
parent | 089dec90ca99efdb09f56153d11cfae6c5b9b8f1 (diff) | |
download | passt-5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f.tar passt-5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f.tar.gz passt-5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f.tar.bz2 passt-5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f.tar.lz passt-5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f.tar.xz passt-5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f.tar.zst passt-5e23b1ef449bc191b7d0c6f0f7bdcfe28060596f.zip |
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>
Diffstat (limited to 'passt.h')
-rw-r--r-- | passt.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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]; |