Questions about RX checksum offload on virtio and vhost
Quoted 34 lines
From: Morten Brørup
Sent: Tuesday, 15 September 2026 11.57Hi Maxime,
A Grout issue [1] regarding RX checksum offload with virtio and vhost triggered my curiosity...
AFAIU, in Linux, the
VIRTIO_NET_F_GUEST_CSUMflag on a virtio network device tells the host that it doesn't need to set the correct checksums in packets it writes to the device, because the guest will do it (when reading them).Now; if a guest application requests
RTE_ETH_RX_OFFLOAD_CHECKSUMoffload, the virtio PMD initializes the Linux device withVIRTIO_NET_F_GUEST_CSUM[2].
This behavior seems counterintuitive to me...
I would assume that if an application cares about packet checksums on ingress, it will setRTE_ETH_RX_OFFLOAD_CHECKSUM, so the NIC/PMD checks them, and the application can discard packets with invalid checksums on ingress.
But the virtio PMD usesRTE_ETH_RX_OFFLOAD_CHECKSUMto disable checksums, not enable them?Two questions:
1. What is the use case for a guest application receiving packets without correct packet checksums from the virtio ports, which motivated this driver behavior?
2. What is the performance gain in the Linux host by not setting the checksums (enablingVIRTIO_NET_F_GUEST_CSUM)? (If the guest application needs to calculate them instead, the performance cost in the guest might outweigh the performance gain in the host not doing it when creating the packet in the Linux kernel.)
Quoted 6 lines
NB: According to the Grout issue, the vhost PMD behaves similarly; but I haven't checked.
[1]: https://github.com/DPDK/grout/issues/724
[2]: https://github.com/DPDK/dpdk/blob/25.11/drivers/net/virtio/virtio_ethdev.c#L2282-L2284
I came across a patch [3], which writes into the packet's checksum field. It seems to be for the virtio PMD running on the host.
Is something similar missing for the virtio PMD running in a guest?
https://github.com/DPDK/dpdk/commit/8f1750f42e2d2dbf49af59eb058e8412f0e3afa4