diff options
author | Vincenzo Maffione <vmaffione@FreeBSD.org> | 2021-04-18 13:36:05 +0000 |
---|---|---|
committer | Vincenzo Maffione <vmaffione@FreeBSD.org> | 2021-04-18 13:39:15 +0000 |
commit | f4a54f4333c5c0f61d8ddddbb75e9c18af8c1aaa (patch) | |
tree | 1ecb97af4a8511c287cf2538cb46c5dfac126a91 /usr.bin | |
parent | 16e0391f8e2124eb85af984204548cf841648db5 (diff) | |
download | src-f4a54f4333c5c0f61d8ddddbb75e9c18af8c1aaa.tar.gz src-f4a54f4333c5c0f61d8ddddbb75e9c18af8c1aaa.zip |
netmap: use safer defaults for hwbuf_len
We must make sure that incoming packets will never overflow the netmap
buffers, even when the user is using the offset feature. In the typical
scenario, the netmap buffer is 2KiB and, with an MTU of 1500, there are
~500 bytes available for user offsets.
Unfortunately, some NICs accept incoming packets even when they are
larger then the MTU. This means that the only way to stop DMA from
overflowing the netmap buffers, when offsets are allowed, is to choose
a hardware buffer length which is smaller than the netmap buffer
length. For most NICs and for 2KiB netmap buffers, this means 1024
bytes, which is unconveniently small.
The current code will select the small hardware buf size even when
offsets are not in use. The main purpose of this change is to
fix this bug by returning to the normal behavior for the no-offsets
case.
At the same time, the patch pushes the handling of the offset case
to the lower level driver code, so that it can be made NIC-specific
(in future patches).
Diffstat (limited to 'usr.bin')
0 files changed, 0 insertions, 0 deletions