virtio_net_hdr recommendations

Hey there! I’ve got some exciting news about Apple’s virtio_net_hdr implementation on macOS 15.4. It’s making communication a lot smoother, with a noticeable improvement!

Now, I’d love to hear your thoughts on a couple of things. First, how do you think we can validate the populated values? And secondly, should we consider reusing populated values for the other endpoint, like the ‘flags’ field?

Your insights would be invaluable!

Answered by DTS Engineer in 836050022

I’m still not entirely sure I understand where you’re going with this, but let’s start with some basic info.

First, this header is defined by the virtio spec:

https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html

Next, my general advice is:

  • On the transmit path (packets from the VM), the virtio header can be used to indicate whether checksum offload is requested or not, and also whether they are transmitting a TCP large segment (TSO).

  • On the receive path (packets going to the VM), the virtio header communicates whether the checksum has already been validated and doesn’t need to be checked. It can also indicate a large receive offload packet and the number of segments that were aggregated.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I’m not sure I understand your questions. Can you explain more about what you hope to achieve by “validat[ing] the populated values”?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@DTS Engineer

Hey Quinn! How's it going? Hope you’re smashing it today—whatever “it” happens to be!

Bit of a mix-up earlier. English isn’t my first language, and sometimes my grammar takes a tea break right when I need it. Cheers for bearing with me!

  • I'm trying to make sure that the first 12 bytes are always valid virtio_net_hdr. I am just asking because when the interface is up, it takes a little while before the values show up.

  • In a write routine, which feature flags should be set to ensure optimal networking performance, corresponding values seen earlier from a read routine?

Thanks a bunch!

Accepted Answer

I’m still not entirely sure I understand where you’re going with this, but let’s start with some basic info.

First, this header is defined by the virtio spec:

https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html

Next, my general advice is:

  • On the transmit path (packets from the VM), the virtio header can be used to indicate whether checksum offload is requested or not, and also whether they are transmitting a TCP large segment (TSO).

  • On the receive path (packets going to the VM), the virtio header communicates whether the checksum has already been validated and doesn’t need to be checked. It can also indicate a large receive offload packet and the number of segments that were aggregated.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

virtio_net_hdr recommendations
 
 
Q