firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

Add VIRTIO_NET_F_MRG_RXBUF to virtio-net

Open ShadowCurse opened this issue 2 months ago • 1 comments

Changes

Add VIRTIO_NET_F_MRG_RXBUF to virtio-net.

Now virtio-net device can split incoming packets across multiple descriptor chains if VIRTIO_NET_F_MRG_RXBUF is enabled by the guest. The amount of descriptor chains (also known as heads) is written into the virtio_net_hdr_v1 structure which is located at the very begging of the packet. Virtio spec states that the number of heads used should always be correct:

  • 1 - if VIRTIO_NET_F_MRG_RXBUF is not negotiated
  • N - if VIRTIO_NET_F_MRG_RXBUF is negotiated Prior to this commit Firecracker never set the number of used heads to 1, but Linux was fine with it. Now we always set correct number of heads. Because of this some changes were introduced into the unit test code that was generating testing frames.

Fixes: #1314

Reason

Better performance and guest memory utilization.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check CONTRIBUTING.md.

PR Checklist

  • [ ] If a specific issue led to this PR, this PR closes the issue.
  • [ ] The description of changes is clear and encompassing.
  • [ ] Any required documentation changes (code and docs) are included in this PR.
  • [ ] API changes follow the Runbook for Firecracker API changes.
  • [ ] User-facing changes are mentioned in CHANGELOG.md.
  • [ ] All added/changed functionality is tested.
  • [ ] New TODOs link to an issue.
  • [ ] Commits meet contribution quality standards.

  • [ ] This functionality cannot be added in rust-vmm.

ShadowCurse avatar Jun 28 '24 17:06 ShadowCurse