Always offer the VIRTIO_NET_F_GUEST_CSUM feature to the host, and not only if RXCSUM is enabled on vtnet. Instead of using RXCSUM to control whether this feature will be negotiated with the host, just use it to control whether the VIRTIO_NET_HDR_F_DATA_VALID flag on an incoming packet is processed (i.e., translated to the corresponding mbuf flag only if RXCSUM is enabled on the vtnet interface).
This has two benefits.
- Enabling/disabling RXCSUM on vtnet does not require feature renegotiation.
- The host is always allowed to send locally generated TCP or UDP packets to the guest without computing a full checksum (by setting the VIRTIO_NET_HDR_F_NEEDS_CSUM flag) and not only if the guest has enabled RXCSUM on vtnet. Since locally generated packets do not require a checksum, this saves otherwise unnecessarily wasted computing power.
If a user of a FreeBSD guest really does not want to negotiate the VIRTIO_NET_F_GUEST_CSUM feature with the host, it still can disable the loader tunable hw.vtnet.csum_disable.