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 1 year 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

Codecov Report

Attention: Patch coverage is 98.06094% with 7 lines in your changes missing coverage. Please review.

Project coverage is 84.50%. Comparing base (a364da8) to head (70bce30). Report is 161 commits behind head on main.

:exclamation: Current head 70bce30 differs from pull request most recent head b61f394

Please upload reports for the commit b61f394 to get more accurate results.

Files with missing lines Patch % Lines
src/vmm/src/devices/virtio/net/device.rs 96.00% 7 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4658      +/-   ##
==========================================
+ Coverage   84.37%   84.50%   +0.12%     
==========================================
  Files         249      250       +1     
  Lines       27433    27678     +245     
==========================================
+ Hits        23147    23388     +241     
- Misses       4286     4290       +4     
Flag Coverage Δ
5.10-c5n.metal 84.73% <98.06%> (+0.13%) :arrow_up:
5.10-m5n.metal 84.72% <98.06%> (+0.13%) :arrow_up:
5.10-m6a.metal 84.02% <98.06%> (+0.13%) :arrow_up:
5.10-m6g.metal 81.09% <98.06%> (+0.17%) :arrow_up:
5.10-m6i.metal 84.72% <98.06%> (+0.13%) :arrow_up:
5.10-m7g.metal 81.09% <98.06%> (+0.17%) :arrow_up:
6.1-c5n.metal 84.73% <98.06%> (+0.13%) :arrow_up:
6.1-m5n.metal 84.72% <98.06%> (+0.13%) :arrow_up:
6.1-m6a.metal 84.02% <98.06%> (+0.13%) :arrow_up:
6.1-m6g.metal 81.08% <98.06%> (+0.17%) :arrow_up:
6.1-m6i.metal 84.72% <98.06%> (+0.14%) :arrow_up:
6.1-m7g.metal 81.09% <98.06%> (+0.17%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 18 '24 11:07 codecov[bot]

Closing in favor of #4834

ShadowCurse avatar Oct 04 '24 14:10 ShadowCurse