If using the virtio network channel, transferring packets between a host and a VM requires translating the packet's meta information between the fields in the virtio network header and, in the case of FreeBSD, the fields in the mbuf. On the VM side, this is done by the vtnet interface driver. The vtnet driver does the translation in two ways less than good:
- When sending a packet over the virtio network channel, it does not translate the CSUM_DATA_VALID | CSUM_PSEUDO_HDR mbuf flags in VIRTIO_NET_HDR_F_DATA_VALID.
- When receiving a packet over the virtio network channel, it translates VIRTIO_NET_HDR_F_NEEDS_CSUM in the CSUM_DATA_VALID | CSUM_PSEUDO_HDR mbuf flags.
This patch adds for the vtnet driver the translation 1. and changes the translation 2. of VIRTIO_NET_HDR_F_NEEDS_CSUM in the mbuf transmission checksum offload flag (CSUM_TCP, CSUM_TCP_IPV6, CSUM_UDP, or CSUM_UDP_IPV6).
Note that D51475 added the handling of an incoming packet with a transmission checksum offload flag set.