-
Notifications
You must be signed in to change notification settings - Fork 189
netvsp: Add VLAN support #3417
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
Open
ben-zen
wants to merge
19
commits into
microsoft:main
Choose a base branch
from
ben-zen:netvsp-vlan
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
netvsp: Add VLAN support #3417
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c07d8e9
Initial steps
a7466f0
First steps
a8c0fa1
Formatted with single pass evaluation of header offset and flags.
2e2ae54
formatting
e8cefae
Added test coverage.
18f0c98
vmm_tests: add VLAN guest configuration integration test
8f2a824
net/gdma: replace test-only VLAN error flag with OOB-based detection
ea71b57
Added tracing to log usage of vlan.
08b73ab
Steps
b29ec04
cleaning up for the moment
8c4f22c
Cleaning up after ripping out some changes.
078b0bd
Format fixes
e0f35e0
Fixed the lack of Rx-side support for VLANs.
b43accc
Ensure GDMA/bnic side is functioning correctly, and include additiona…
8d02b15
Cleaning up loose ends
dc7f864
Yes, it's transport length.
d692c03
Updates from generated feedback, clippy fixes.
2d504c1
Missed a test break in tap
86502af
Minor edits.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -522,6 +522,7 @@ impl consomme::Client for Client<'_> { | |
| } else { | ||
| L4Protocol::Unknown | ||
| }, | ||
| vlan: None, | ||
| }, | ||
| data, | ||
| ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,7 @@ use net_backend::TxId; | |
| use net_backend::TxOffloadSupport; | ||
| use net_backend::TxSegment; | ||
| use net_backend::TxSegmentType; | ||
| use net_backend::VlanMetadata; | ||
| use pal_async::task::Spawn; | ||
| use safeatomic::AtomicSliceOps; | ||
| use std::collections::VecDeque; | ||
|
|
@@ -965,6 +966,11 @@ impl<T: DeviceBacking + Send> Queue for ManaQueue<T> { | |
| } else { | ||
| (L4Protocol::Unknown, RxChecksumState::Unknown) | ||
| }; | ||
| let vlantag = rx_oob.flags.rx_vlantag_present().then(|| VlanMetadata { | ||
| drop_eligible_indicator: false, | ||
| priority: 0, | ||
| vlan_id: rx_oob.flags.rx_vlan_id() as u16, | ||
| }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Increment the counter. Maybe here? |
||
| let len = rx_oob.ppi[0].pkt_len.into(); | ||
| pool.write_header( | ||
| rx.id, | ||
|
|
@@ -974,6 +980,7 @@ impl<T: DeviceBacking + Send> Queue for ManaQueue<T> { | |
| ip_checksum, | ||
| l4_checksum, | ||
| l4_protocol, | ||
| vlan: vlantag, | ||
| }, | ||
| ); | ||
| if rx.bounced_len_with_padding > 0 { | ||
|
|
@@ -1163,10 +1170,16 @@ impl<T: DeviceBacking> ManaQueue<T> { | |
| .set_comp_tcp_csum(meta.flags.offload_tcp_checksum()); | ||
| oob.s_oob | ||
| .set_comp_udp_csum(meta.flags.offload_udp_checksum()); | ||
| if meta.flags.offload_tcp_checksum() { | ||
| if meta.flags.offload_tcp_checksum() || meta.flags.offload_udp_checksum() { | ||
| oob.s_oob.set_trans_off(meta.l2_len as u16 + meta.l3_len); | ||
| } | ||
| let short_format = self.vp_offset <= 0xff; | ||
| if let Some(vlan) = &meta.vlan { | ||
| oob.l_oob.set_inject_vlan_pri_tag(true); | ||
| oob.l_oob.set_vlan_id(vlan.vlan_id); | ||
| oob.l_oob.set_pcp(vlan.priority); | ||
| oob.l_oob.set_dei(vlan.drop_eligible_indicator); | ||
| } | ||
| let short_format = self.vp_offset <= 0xff && meta.vlan.is_none(); | ||
| if short_format { | ||
| oob.s_oob.set_pkt_fmt(MANA_SHORT_PKT_FMT); | ||
| oob.s_oob.set_short_vp_offset(self.vp_offset as u8); | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oob.s_oob.trans_off()Just so that the test bnic is closely aligned with real behavior.