Re: git: 1c23d8f9f398 - main - vtnet: improve checksum offloading

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sat, 06 Sep 2025 06:32:03 UTC
> On 5. Sep 2025, at 23:09, Bjoern A. Zeeb <bzeeb-lists@lists.zabbadoz.net> wrote:
> 
> On Thu, 4 Sep 2025, Michael Tuexen wrote:
> 
>> The branch main has been updated by tuexen:
>> 
>> URL: https://cgit.FreeBSD.org/src/commit/?id=1c23d8f9f39870951c1d0dfbb112fc4e53237737
>> 
>> commit 1c23d8f9f39870951c1d0dfbb112fc4e53237737
>> Author:     Michael Tuexen <tuexen@FreeBSD.org>
>> AuthorDate: 2025-09-04 11:16:46 +0000
>> Commit:     Michael Tuexen <tuexen@FreeBSD.org>
>> CommitDate: 2025-09-04 11:16:46 +0000
>> 
>>   vtnet: improve checksum offloading
>> 
>>   When transmitting a packet over the vtnet interface, map the
>>   csum flags CSUM_DATA_VALID | CSUM_PSEUDO_HDR to the virtio
>>   flag VIRTIO_NET_HDR_F_DATA_VALID.
>>   When receiving a packet over the virtio network channel, translate
>>   the virtio flag VIRTIO_NET_HDR_F_NEEDS_CSUM not to CSUM_DATA_VALID |
>>   CSUM_PSEUDO_HDR, but to CSUM_TCP, CSUM_TCP_IPV6, CSUM_UDP, or
>>   CSUM_UDP_IPV6.
>>   The second change fixes a series of issue related to checksum
>>   offloading for if_vtnet.
>>   While there, improve the stats counters to allow a detailed view
>>   on what is going on in relation to checksum offloading.
>> 
>>   PR:                     165059
>>   Reviewed by:            tuexen, manpages
>>   MFC after:              1 week
>>   Differential Revision:  https://reviews.freebsd.org/D51686
> 
> 
> This fails to build a LINT-NOIP now.  Makes me wonder what good vtnet is
> in first place w/o INET and w/o INET6?
Hi Bjoern,

let me double check this and fix it. Thanks for reporting!

Best regards
Michael
> 
> 33       | ^~~~~~~~~~~
> 34 1 warning generated.
> 35 /tank/users/bz/git/FreeBSD/freebsd-src/sys/dev/virtio/network/if_vtnet.c:1825:9: error: call to undeclared function 'in_cksum_skip'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
> 36  1825 |         csum = in_cksum_skip(m, m->m_pkthdr.len, hdr->csum_start);
> 37       |                ^
> 38 /tank/users/bz/git/FreeBSD/freebsd-src/sys/dev/virtio/network/if_vtnet.c:1849:6: error: variable 'hoff' set but not used [-Werror,-Wunused-but-set-variable]
> 39  1849 |         int hoff, protocol;
> 40       |             ^
> 41 2 errors generated.
> 42 --- if_vtnet.o ---
> 43 *** [if_vtnet.o] Error code 1
> 
> 
>> ---
>> share/man/man4/vtnet.4               |  28 +++--
>> sys/dev/virtio/network/if_vtnet.c    | 220 ++++++++++++++++++-----------------
>> sys/dev/virtio/network/if_vtnetvar.h |   2 +-
>> 3 files changed, 132 insertions(+), 118 deletions(-)
>> 
>> diff --git a/share/man/man4/vtnet.4 b/share/man/man4/vtnet.4