-
Notifications
You must be signed in to change notification settings - Fork 10
Use a repr(C) flow ID to reduce repeated per-packet conversion costs
#475
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d5d2479
Perf: rework InnerFlowId with a C ABI repr
FelixMcFelix cc1dd8b
Merge branch 'master' into cheaper-flowid
FelixMcFelix 48b831d
Fix compile of bad USDT.
FelixMcFelix cbbe568
Temporarily disable miscompile-y probes
FelixMcFelix d84fba7
...Oops.
FelixMcFelix 4de9c4a
DTrace script fixes, trying to understand odd behaviour.
FelixMcFelix cb20ed2
Correctly type all InnerFlowId SDT args
FelixMcFelix 60e0b84
I suppose that's technically an API change.
FelixMcFelix 1c37083
A hopefully temporary workaround for opte#476.
FelixMcFelix baed8d0
Unformat (most of) the Ok cases for packet probes
FelixMcFelix 4e2ad7e
Fixup dtrace scripts, nicer format on drop
FelixMcFelix 74bed98
Minor nit caught on self-review.
FelixMcFelix a2cab3b
Review feedback: Matt (hidden tail-call prevention)
FelixMcFelix 0eca6c9
Merge branch 'master' into cheaper-flowid
FelixMcFelix 1e7506e
Re-bump API version.
FelixMcFelix fffbaba
Review Feedback: Luqman pt.1
FelixMcFelix 0bf91e6
InnerFlowId needs 4B alignment itself.
FelixMcFelix ddc1b98
Review Feedback: Luqman pt.2
FelixMcFelix 0edd7e6
Friendlier names -- `LabelBlock`, `::from_nested`
FelixMcFelix 8237f42
Remove `NopDrop` and its uses
FelixMcFelix 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
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 |
|---|---|---|
|
|
@@ -19,17 +19,12 @@ use alloc::string::String; | |
| use alloc::vec::Vec; | ||
| use core::fmt; | ||
| use core::num::NonZeroU32; | ||
| #[cfg(all(not(feature = "std"), not(test)))] | ||
| use illumos_sys_hdrs::uintptr_t; | ||
| use opte_api::OpteError; | ||
| use serde::de::DeserializeOwned; | ||
| use serde::Serialize; | ||
|
|
||
| cfg_if! { | ||
| if #[cfg(all(not(feature = "std"), not(test)))] { | ||
| use illumos_sys_hdrs::uintptr_t; | ||
| use super::rule::flow_id_sdt_arg; | ||
| } | ||
| } | ||
|
|
||
| // XXX This really shouldn't be pub but for now we are leaking this | ||
| // info for the purpose of testing until the Port API has support for | ||
| // setting/getting TTL on a per Flow Table basis. | ||
|
|
@@ -229,16 +224,15 @@ fn flow_expired_probe( | |
| last_hit: Option<Moment>, | ||
| now: Option<Moment>, | ||
| ) { | ||
| let a = crate::NopDrop; | ||
|
Collaborator
Author
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. All |
||
| last_hit.unwrap_or_default(); | ||
| cfg_if! { | ||
| if #[cfg(all(not(feature = "std"), not(test)))] { | ||
| let arg = flow_id_sdt_arg::from(flowid); | ||
|
|
||
| unsafe { | ||
| __dtrace_probe_flow__expired( | ||
| port.as_ptr() as uintptr_t, | ||
| name.as_ptr() as uintptr_t, | ||
| &arg as *const flow_id_sdt_arg as uintptr_t, | ||
| flowid, | ||
| last_hit.and_then(|m| m.raw_millis()).unwrap_or_default() as usize, | ||
| now.and_then(|m| m.raw_millis()).unwrap_or_default() as usize, | ||
| ); | ||
|
|
@@ -254,6 +248,7 @@ fn flow_expired_probe( | |
| let (_, _, _) = (port, name, flowid); | ||
| } | ||
| } | ||
| drop(a); | ||
| } | ||
|
|
||
| /// A type that can be "dumped" for the purposes of presenting an | ||
|
|
@@ -332,7 +327,7 @@ extern "C" { | |
| pub fn __dtrace_probe_flow__expired( | ||
| port: uintptr_t, | ||
| layer: uintptr_t, | ||
| flowid: uintptr_t, | ||
| flowid: *const InnerFlowId, | ||
| last_hit: uintptr_t, | ||
| now: uintptr_t, | ||
| ); | ||
|
|
@@ -341,7 +336,7 @@ extern "C" { | |
| dir: uintptr_t, | ||
| port: uintptr_t, | ||
| layer: uintptr_t, | ||
| ifid: uintptr_t, | ||
| ifid: *const InnerFlowId, | ||
| epoch: uintptr_t, | ||
| ); | ||
| } | ||
|
|
@@ -355,8 +350,8 @@ impl Dump for () { | |
| #[cfg(test)] | ||
| mod test { | ||
| use super::*; | ||
| use crate::engine::headers::IpAddr; | ||
| use crate::engine::ip4::Protocol; | ||
| use crate::engine::packet::AddrPair; | ||
| use crate::engine::packet::FLOW_ID_DEFAULT; | ||
| use core::time::Duration; | ||
|
|
||
|
|
@@ -365,10 +360,12 @@ mod test { | |
| #[test] | ||
| fn flow_expired() { | ||
| let flowid = InnerFlowId { | ||
| proto: Protocol::TCP, | ||
| src_ip: IpAddr::Ip4("192.168.2.10".parse().unwrap()), | ||
| proto: Protocol::TCP.into(), | ||
| addrs: AddrPair::V4 { | ||
| src: "192.168.2.10".parse().unwrap(), | ||
| dst: "76.76.21.21".parse().unwrap(), | ||
| }, | ||
| src_port: 37890, | ||
| dst_ip: IpAddr::Ip4("76.76.21.21".parse().unwrap()), | ||
| dst_port: 443, | ||
| }; | ||
|
|
||
|
|
@@ -389,10 +386,12 @@ mod test { | |
| #[test] | ||
| fn flow_clear() { | ||
| let flowid = InnerFlowId { | ||
| proto: Protocol::TCP, | ||
| src_ip: IpAddr::Ip4("192.168.2.10".parse().unwrap()), | ||
| proto: Protocol::TCP.into(), | ||
| addrs: AddrPair::V4 { | ||
| src: "192.168.2.10".parse().unwrap(), | ||
| dst: "76.76.21.21".parse().unwrap(), | ||
| }, | ||
| src_port: 37890, | ||
| dst_ip: IpAddr::Ip4("76.76.21.21".parse().unwrap()), | ||
| dst_port: 443, | ||
| }; | ||
|
|
||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.