Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e610420
First steps.
FelixMcFelix Apr 30, 2025
3c2750d
More primitives for Doing The Work.
FelixMcFelix May 1, 2025
9cefaeb
No LFTs yet, no expiry.
FelixMcFelix May 2, 2025
c73611f
Possibly actual LFTs, expiry.
FelixMcFelix May 29, 2025
923f9ee
Plumbed a demo method.
FelixMcFelix May 29, 2025
1336572
Why not name some rules?
FelixMcFelix May 2, 2025
d084d33
Style.
FelixMcFelix May 2, 2025
4b71596
Ioctl does not need engine.
FelixMcFelix May 2, 2025
23085ca
Merge branch 'master' into flowstats
FelixMcFelix Jun 12, 2025
6880f64
More fixups.
FelixMcFelix Jun 12, 2025
bd3353f
Break TreeStat -> Root & Intermediate
FelixMcFelix Jun 12, 2025
460c2d9
Goodbye to Dynamic Dispatch
FelixMcFelix Jun 12, 2025
4a9ff9b
Ah, XDE.
FelixMcFelix Jun 12, 2025
bd3b41b
Merge branch 'master' into flowstats
FelixMcFelix Jun 17, 2025
20e8432
Properly separate providers from the rest of port context.
FelixMcFelix Jun 17, 2025
a80fc6f
Aha
FelixMcFelix Jun 17, 2025
55ed983
Start cleanup, thinking about tests.
FelixMcFelix Jun 17, 2025
cfaa273
Testing, thinking through various invariants
FelixMcFelix Jun 18, 2025
a71a69a
Stats as observed from `Root`s
FelixMcFelix Jun 18, 2025
1ceb9b1
Tweaks
FelixMcFelix Jun 18, 2025
c0f9013
Add optional stat ID to fw rules/routes
FelixMcFelix Jun 20, 2025
9bd2b36
XXX thinking through actions being able to push RootStats
FelixMcFelix Jun 27, 2025
42c7f28
`InternalStat`s inclusive of action state.
FelixMcFelix Jun 30, 2025
d0bfb96
Merge branch 'master' into flowstats
FelixMcFelix Jun 30, 2025
034e268
...and `fmt`
FelixMcFelix Jun 30, 2025
48d9d64
Some clippy before I reshape the datapath, again.
FelixMcFelix Jun 30, 2025
7d62658
Pulling through some view stuff. Messy!
FelixMcFelix Jun 30, 2025
0d79c39
Cleanup leftover imports etc.
FelixMcFelix Jun 30, 2025
104c9ba
Merge branch 'master' into flowstats
FelixMcFelix Jun 30, 2025
fe81fbf
Some brokwn doclinks.
FelixMcFelix Jun 30, 2025
56a1265
Plumb through public `Packet` rather than private `meta`
FelixMcFelix Jul 1, 2025
1040b51
Some rearrangement (and docs).
FelixMcFelix Jul 1, 2025
48cf6d6
Start narrowing down `pub`.
FelixMcFelix Jul 2, 2025
643bd3a
fmt
FelixMcFelix Jul 2, 2025
f60f884
Flow stats are no longer the domain of TCP
FelixMcFelix Jul 2, 2025
014d6ed
Make layer in/out processing more consistent
FelixMcFelix Jul 3, 2025
0398b07
Errors as a decision (!)
FelixMcFelix Jul 3, 2025
333a9f0
Record packet delivery class as a tag/stat
FelixMcFelix Jul 3, 2025
7dac024
Ioctls, at last.
FelixMcFelix Jul 10, 2025
40f5198
TCP flow state is now a *bit* more precise.
FelixMcFelix Jul 10, 2025
355fc09
Omicron would like these to impl Eq.
FelixMcFelix Jul 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 14 additions & 7 deletions bench/src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use opte_test_utils::icmp::gen_icmp_echo;
use opte_test_utils::icmp::gen_icmpv6_echo;
use opte_test_utils::icmp::generate_ndisc;
use opte_test_utils::*;
use oxide_vpc::api::Route;

pub type TestCase = (MsgBlk, Direction);

Expand Down Expand Up @@ -294,18 +295,24 @@ impl BenchPacketInstance for UlpProcessInstance {

router::add_entry(
&g1.port,
IpCidr::Ip4("0.0.0.0/0".parse().unwrap()),
RouterTarget::InternetGateway(None),
RouterClass::System,
Route {
dest: IpCidr::Ip4("0.0.0.0/0".parse().unwrap()),
target: RouterTarget::InternetGateway(None),
class: RouterClass::System,
stat_id: None,
},
)
.unwrap();
incr!(g1, ["epoch", "router.rules.out"]);

router::add_entry(
&g1.port,
IpCidr::Ip6("::/0".parse().unwrap()),
RouterTarget::InternetGateway(None),
RouterClass::System,
Route {
dest: IpCidr::Ip6("::/0".parse().unwrap()),
target: RouterTarget::InternetGateway(None),
class: RouterClass::System,
stat_id: None,
},
)
.unwrap();
incr!(g1, ["epoch", "router.rules.out"]);
Expand All @@ -314,7 +321,7 @@ impl BenchPacketInstance for UlpProcessInstance {
let any_in = "dir=in action=allow priority=1000 protocol=any";
firewall::set_fw_rules(
&g1.port,
&SetFwRulesReq {
SetFwRulesReq {
port_name: g1.port.name().to_string(),
rules: vec![any_in.parse().unwrap()],
},
Expand Down
1 change: 1 addition & 0 deletions bin/opteadm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ postcard.workspace = true
serde.workspace = true
tabwriter.workspace = true
thiserror.workspace = true
uuid.workspace = true

[build-dependencies]
anyhow.workspace = true
78 changes: 74 additions & 4 deletions bin/opteadm/src/bin/opteadm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use clap::Parser;
use opte::api::API_VERSION;
use opte::api::Direction;
use opte::api::DomainName;
use opte::api::FlowPair;
use opte::api::IpAddr;
use opte::api::IpCidr;
use opte::api::Ipv4Addr;
Expand Down Expand Up @@ -45,6 +46,7 @@ use oxide_vpc::api::Ports;
use oxide_vpc::api::ProtoFilter;
use oxide_vpc::api::RemFwRuleReq;
use oxide_vpc::api::RemoveCidrResp;
use oxide_vpc::api::Route;
use oxide_vpc::api::RouterClass;
use oxide_vpc::api::RouterTarget;
use oxide_vpc::api::SNat4Cfg;
Expand Down Expand Up @@ -276,6 +278,42 @@ enum Command {
#[arg(long = "dir")]
direction: Option<Direction>,
},

/// Return the IDs of all registered stat objects.
ListRootStats {
/// The OPTE port to query.
#[arg(short)]
port: String,
},

/// Return the IDs of all current flows.
ListFlowStats {
/// The OPTE port to query.
#[arg(short)]
port: String,
},

/// Request the current state of root stats contained in a port.
DumpRootStats {
/// The OPTE port to query.
#[arg(short)]
port: String,
// /// A comma-separated list of stat UUIDs of interest. If omitted,
// /// request all available stats.
// #[arg(long)]
// ids: Uuid,
},

/// Return the IDs of all current flows.
DumpFlowStats {
/// The OPTE port to query.
#[arg(short)]
port: String,
// /// A comma-separated list of flowkeys of interest. If omitted,
// /// request all available stats.
// #[arg(long)]
// ids: Vec<InnerFlowId>,
},
}

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -632,6 +670,7 @@ fn main() -> anyhow::Result<()> {
filters: filters.into(),
action,
priority,
stat_id: None,
};
hdl.add_firewall_rule(&AddFwRuleReq { port_name: port, rule })?;
}
Expand Down Expand Up @@ -767,16 +806,16 @@ fn main() -> anyhow::Result<()> {
Command::AddRouterEntry {
route: RouterRule { port, dest, target, class },
} => {
let req =
AddRouterEntryReq { port_name: port, dest, target, class };
let route = Route { dest, target, class, stat_id: None };
let req = AddRouterEntryReq { port_name: port, route };
hdl.add_router_entry(&req)?;
}

Command::DelRouterEntry {
route: RouterRule { port, dest, target, class },
} => {
let req =
DelRouterEntryReq { port_name: port, dest, target, class };
let route = Route { dest, target, class, stat_id: None };
let req = DelRouterEntryReq { port_name: port, route };
if let DelRouterEntryResp::NotFound = hdl.del_router_entry(&req)? {
anyhow::bail!(
"could not delete entry -- no matching rule found"
Expand Down Expand Up @@ -859,6 +898,37 @@ fn main() -> anyhow::Result<()> {
})?;
}
}

Command::ListRootStats { port } => {
let vals = hdl.list_root_stats(&port)?;

for val in vals.root_ids {
println!("{val}");
}
}

Command::ListFlowStats { port } => {
let vals = hdl.list_flow_stats(&port)?;

println!("Inbound -> Outbound");
for FlowPair { inbound, outbound } in vals.flow_ids {
println!("{inbound} -> {outbound}");
}
}

Command::DumpRootStats { port } => {
let vals = hdl.dump_root_stats(&port, [])?;
for (id, stat) in vals.root_stats {
println!("{id}:\n\t{stat:?}");
}
}

Command::DumpFlowStats { port } => {
let vals = hdl.dump_flow_stats(&port, [])?;
for (id, stat) in vals.flow_stats {
println!("{id}:\n\t{stat:?}");
}
}
}

Ok(())
Expand Down
1 change: 1 addition & 0 deletions crates/opte-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ingot.workspace = true
ipnetwork = { workspace = true, optional = true }
postcard.workspace = true
serde.workspace = true
uuid.workspace = true

[dependencies.smoltcp]
workspace = true
Expand Down
Loading