* Questions about RX checksum offload on virtio and vhost
@ 2026-09-15 9:57 Morten Brørup
0 siblings, 0 replies; 2+ messages in thread
From: Morten Brørup @ 2026-09-15 9:57 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: David Marchand, Harrison Caldicott, dev
Hi Maxime,
A Grout issue [1] regarding RX checksum offload with virtio and vhost triggered my curiosity...
AFAIU, in Linux, the VIRTIO_NET_F_GUEST_CSUM flag 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_CHECKSUM offload, the virtio PMD initializes the Linux device with VIRTIO_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 set RTE_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 uses RTE_ETH_RX_OFFLOAD_CHECKSUM to 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 (enabling VIRTIO_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.)
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
Venlig hilsen / Kind regards,
-Morten Brørup
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: Questions about RX checksum offload on virtio and vhost
@ 2026-09-15 12:02 Morten Brørup
0 siblings, 0 replies; 2+ messages in thread
From: Morten Brørup @ 2026-09-15 12:02 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: David Marchand, Harrison Caldicott, dev
> From: Morten Brørup
> Sent: Tuesday, 15 September 2026 11.57
>
> Hi Maxime,
>
> A Grout issue [1] regarding RX checksum offload with virtio and vhost
> triggered my curiosity...
>
> AFAIU, in Linux, the VIRTIO_NET_F_GUEST_CSUM flag 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_CHECKSUM
> offload, the virtio PMD initializes the Linux device with
> VIRTIO_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 set RTE_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 uses RTE_ETH_RX_OFFLOAD_CHECKSUM to 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 (enabling VIRTIO_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.)
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-15 12:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15 12:02 Questions about RX checksum offload on virtio and vhost Morten Brørup
-- strict thread matches above, loose matches on Subject: below --
2026-09-15 9:57 Morten Brørup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox