OPNsense Forum

English Forums => 25.7 Series => Topic started by: s0x on September 23, 2025, 11:22:28 AM

Title: FreeBSD vtnet driver commit (vtnet: improve checksum offloading)
Post by: s0x on September 23, 2025, 11:22:28 AM
Hello everyone,

It seems that there's some improvement on the FreeBSD side regarding checksum offloading and vtnet driver.

Could this code be merged into OPNsense (or maybe you're already testing it)?

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.
@ 2025-09-04 11:16:46 +0000

https://cgit.freebsd.org/src/commit/?id=1c23d8f9f39870951c1d0dfbb112fc4e53237737

Thank you

Title: Re: FreeBSD vtnet driver commit (vtnet: improve checksum offloading)
Post by: meyergru on September 23, 2025, 11:30:29 AM
It does not work that way. That code probably has not even made it into official FreeBSD releases. Once it does, the next OpnSense release that will be based on the repective FreeBSD version will incorporate it.

If this were a security-relevant or essential fix, it might get handled differently, but this deficiency is long-standing and well known, see: https://forum.opnsense.org/index.php?topic=44159.0
Title: Re: FreeBSD vtnet driver commit (vtnet: improve checksum offloading)
Post by: s0x on September 23, 2025, 01:04:55 PM
Hey @meyergru

Oh I know, I've seen and read your guide multiple times now.

Thank you for the insight as to how and when it might come into OPNsense, didn't know it had to be that way.
Title: Re: FreeBSD vtnet driver commit (vtnet: improve checksum offloading)
Post by: franco on September 29, 2025, 12:57:04 PM
I've added this to my queue of backports since this also hit stable/14 now on the FreeBSD end. It may take up to 2 months to ship if we factor in a bit of real world testing on our end. I can also publish a test kernel, but not sooner than 25.7.5.


Cheers,
Franco
Title: Re: FreeBSD vtnet driver commit (vtnet: improve checksum offloading)
Post by: s0x on September 29, 2025, 05:17:46 PM
Hello @franco

That's great news! Thank you for checking this out, and for the work you and the team do on OPNsense.