diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2025-03-17 20:24:16 +1100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2025-03-20 20:33:09 +0100 |
| commit | a41d6d125eca5ac8c54bed8157098be141557b03 (patch) | |
| tree | 9ee7d475734d798733cb566823df67eaa305a8ce /contrib | |
| parent | e43e00719d7701301e4bc4fb179dc7adff175409 (diff) | |
| download | passt-a41d6d125eca5ac8c54bed8157098be141557b03.tar passt-a41d6d125eca5ac8c54bed8157098be141557b03.tar.gz passt-a41d6d125eca5ac8c54bed8157098be141557b03.tar.bz2 passt-a41d6d125eca5ac8c54bed8157098be141557b03.tar.lz passt-a41d6d125eca5ac8c54bed8157098be141557b03.tar.xz passt-a41d6d125eca5ac8c54bed8157098be141557b03.tar.zst passt-a41d6d125eca5ac8c54bed8157098be141557b03.zip | |
tap: Make size of pool_tap[46] purely a tuning parameter
Currently we attempt to size pool_tap[46] so they have room for the maximum
possible number of packets that could fit in pkt_buf (TAP_MSGS). However,
the calculation isn't quite correct: TAP_MSGS is based on ETH_ZLEN (60) as
the minimum possible L2 frame size. But ETH_ZLEN is based on physical
constraints of Ethernet, which don't apply to our virtual devices. It is
possible to generate a legitimate frame smaller than this, for example an
empty payload UDP/IPv4 frame on the 'pasta' backend is only 42 bytes long.
Further more, the same limit applies for vhost-user, which is not limited
by the size of pkt_buf like the other backends. In that case we don't even
have full control of the maximum buffer size, so we can't really calculate
how many packets could fit in there.
If we exceed do TAP_MSGS we'll drop packets, not just use more batches,
which is moderately bad. The fact that this needs to be sized just so for
correctness not merely for tuning is a fairly non-obvious coupling between
different parts of the code.
To make this more robust, alter the tap code so it doesn't rely on
everything fitting in a single batch of TAP_MSGS packets, instead breaking
into multiple batches as necessary. This leaves TAP_MSGS as purely a
tuning parameter, which we can freely adjust based on performance measures.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions
