Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(net): Apply only supported TAP offloading features #4680

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

bchalios
Copy link
Contributor

@bchalios bchalios commented Jul 15, 2024

Changes

Changes the Firecracker implementation of VirtIO device to only setup the TAP offload features that correspond to the ones that the guest driver acknowledged.

This is a clean-up and re-spin of #4386.

Closes: #4659

Reason

Currently, we assume that the guest virtio-net driver acknowledges all the offload features we offer to it and then subsequently set the corresponding TAP features.

This might be the case for the Linux guest kernel drivers we are currently using, but it is not necessarily the case. FreeBSD for example, might try to NACK some of them in some cases: #3905.

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.

Currently, we assume that the guest virtio-net driver acknowledges all
the offload features we offer to it and then subsequently set the
corresponding TAP features.

This might be the case for the Linux guest kernel drivers we are
currently using, but it is not necessarily the case. FreeBSD for
example, might try to NACK some of them in some cases:
firecracker-microvm#3905.

This commit, changes the Firecracker implementation of VirtIO device to
only setup the TAP offload features that correspond to the ones that the
guest driver acknowledged.

Signed-off-by: Nikita Zakirov <[email protected]>
Signed-off-by: Babis Chalios <[email protected]>
@bchalios bchalios force-pushed the fix_setting_tap_features branch from 10273ef to 49ed5ea Compare July 15, 2024 11:32
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.14%. Comparing base (cc78a1e) to head (99c2394).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4680      +/-   ##
==========================================
+ Coverage   82.12%   82.14%   +0.02%     
==========================================
  Files         255      255              
  Lines       31281    31321      +40     
==========================================
+ Hits        25689    25729      +40     
  Misses       5592     5592              
Flag Coverage Δ
4.14-c5n.metal 79.64% <100.00%> (+0.02%) ⬆️
4.14-m5n.metal 79.63% <100.00%> (+0.02%) ⬆️
4.14-m6a.metal 78.86% <100.00%> (+0.03%) ⬆️
4.14-m6g.metal 76.67% <100.00%> (+0.03%) ⬆️
4.14-m6i.metal 79.62% <100.00%> (+0.02%) ⬆️
4.14-m7g.metal 76.67% <100.00%> (+0.03%) ⬆️
5.10-c5n.metal 82.16% <100.00%> (+0.02%) ⬆️
5.10-m5n.metal 82.15% <100.00%> (+0.02%) ⬆️
5.10-m6a.metal 81.46% <100.00%> (+0.03%) ⬆️
5.10-m6g.metal 79.44% <100.00%> (+0.03%) ⬆️
5.10-m6i.metal 82.14% <100.00%> (+0.02%) ⬆️
5.10-m7g.metal 79.44% <100.00%> (+0.03%) ⬆️
6.1-c5n.metal 82.16% <100.00%> (+0.02%) ⬆️
6.1-m5n.metal 82.15% <100.00%> (+0.03%) ⬆️
6.1-m6a.metal 81.45% <100.00%> (+0.02%) ⬆️
6.1-m6g.metal 79.44% <100.00%> (+0.03%) ⬆️
6.1-m6i.metal 82.14% <100.00%> (+0.01%) ⬆️
6.1-m7g.metal 79.44% <100.00%> (+0.03%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

bchalios added 2 commits July 16, 2024 14:26
In the past, we were enabling IPv6 TSO in the TAP device but we were not
negotiating the flag with the guest driver. The previous commit cleaned
this up, by not setting gen::TUN_F_TSO6 when calling the TUNSETOFFLOAD
ioctl. This commit properly negotiates the feature and, if the guest
supports it, it enables it in the TAP device.

Signed-off-by: Babis Chalios <[email protected]>
Before, we were calling this ioctl() from the VMM thread when creating
the virtio network device. Moreover, this ioctl() was called before
setting up seccomp filters. Now, we call it during device activation,
which is handled by the vCPU threads. Change the seccomp filters to
allow these ioctl()s.

Signed-off-by: Babis Chalios <[email protected]>
@bchalios bchalios marked this pull request as ready for review July 16, 2024 14:54
@bchalios bchalios self-assigned this Jul 16, 2024
@bchalios bchalios added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Jul 16, 2024
@bchalios bchalios merged commit cb3b00e into firecracker-microvm:main Jul 17, 2024
7 checks passed
@bchalios bchalios deleted the fix_setting_tap_features branch July 17, 2024 08:49
bchalios added a commit to bchalios/firecracker that referenced this pull request Sep 2, 2024
Adds an entry in CHANGELOG.md about the fix
firecracker-microvm#4680. The fix
ensures that we set to the TAP device only features that were
successfully negotiated with the guest driver.

Signed-off-by: Babis Chalios <[email protected]>
bchalios added a commit to bchalios/firecracker that referenced this pull request Sep 2, 2024
Adds an entry in CHANGELOG.md about the fix
firecracker-microvm#4680. The fix
ensures that we set to the TAP device only features that were
successfully negotiated with the guest driver.

Signed-off-by: Babis Chalios <[email protected]>
bchalios added a commit that referenced this pull request Sep 2, 2024
Adds an entry in CHANGELOG.md about the fix
#4680. The fix
ensures that we set to the TAP device only features that were
successfully negotiated with the guest driver.

Signed-off-by: Babis Chalios <[email protected]>
bchalios added a commit to bchalios/firecracker that referenced this pull request Sep 2, 2024
Adds an entry in CHANGELOG.md about the fix
firecracker-microvm#4680. The fix
ensures that we set to the TAP device only features that were
successfully negotiated with the guest driver.

(cherry picked from commit 730e645)

Signed-off-by: Babis Chalios <[email protected]>
roypat pushed a commit that referenced this pull request Sep 2, 2024
Adds an entry in CHANGELOG.md about the fix
#4680. The fix
ensures that we set to the TAP device only features that were
successfully negotiated with the guest driver.

(cherry picked from commit 730e645)

Signed-off-by: Babis Chalios <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting review Indicates that a pull request is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set correctly the offload flags of TAP device based on feature negotiation with the guest
3 participants