Skip to content

Ingest ereports from SPs #370

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 63 commits into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
1f16ef5
mgs_to_sp: add `EreportRequest` message
hawkw Mar 27, 2025
d943a9d
sp_to_mgs: ereport resposne headers
hawkw Mar 27, 2025
1145a13
ORDER MATTERS
hawkw Mar 27, 2025
8d8c478
make `SharedSocket` usable for other message types
hawkw Mar 31, 2025
882cb51
s/ReporterGeneration/Restart
hawkw Mar 31, 2025
521b6fc
allow ereport response packets to provide metadata
hawkw Mar 31, 2025
2e99593
make the ascii diagram either better or worse
hawkw Mar 31, 2025
a071df3
this one missed the big renaming
hawkw Mar 31, 2025
a80bab0
recv message plumbing
hawkw Apr 1, 2025
ac13a0d
reticulating SingleSp
hawkw Apr 1, 2025
f97653b
huge pile of parsing stuff
hawkw Apr 2, 2025
0f239c9
add `SingleSp::ereports`
hawkw Apr 3, 2025
3c412a6
quick test for ereport decoding, fix some bugs
hawkw Apr 3, 2025
e0708ea
slightly nicer decode errors
hawkw Apr 3, 2025
95c5c5f
fixup faux-mgs
hawkw Apr 3, 2025
94bbda7
reduce annoying generics
hawkw Apr 3, 2025
4e13ea6
need this part
hawkw Apr 4, 2025
52b642d
nicer error
hawkw Apr 4, 2025
d60a1a5
don't keep re-requesting old restart ID
hawkw Apr 4, 2025
f8847f3
make ereport errors a little nicer for MGS
hawkw Apr 4, 2025
aeb63ce
move all ereport messages into ereport module
hawkw Apr 5, 2025
7da4043
de-stutter names
hawkw Apr 5, 2025
8bdb482
ereport types naming tweaks
hawkw Apr 5, 2025
919888e
docs embetterment
hawkw Apr 5, 2025
99f4154
hex format enas like the control plane does
hawkw Apr 5, 2025
5a21963
factor out shared socket `RecvHandler` recv bits
hawkw Apr 6, 2025
8499374
reorganize and document shared socket recv bits
hawkw Apr 6, 2025
29ed9d4
docs improvement
hawkw Apr 7, 2025
f5f5773
add tests that enum serialized reprs don't change
hawkw Apr 7, 2025
0946a59
add module level docs
hawkw Apr 7, 2025
f570dd9
handle cbor bytes
hawkw Apr 7, 2025
eb12ab6
add limit field to requests
hawkw Apr 7, 2025
f47900d
force use of checked request methods
hawkw Apr 7, 2025
65d3fbb
make CBOR-to-JSON conversion do what the RFC says
hawkw Apr 9, 2025
5783a33
new response encoding
hawkw Apr 9, 2025
6ef478b
make ascii diagrams sort of goof
hawkw Apr 9, 2025
3b06317
more tests
hawkw Apr 9, 2025
d2e035e
review feedback from @jgallagher
hawkw Apr 10, 2025
599fd4a
delete duplicate old ereport types
hawkw Apr 10, 2025
aee719c
add request/response sequence numbers
hawkw Apr 10, 2025
dfed69f
add some more commentary
hawkw Apr 10, 2025
a6de2d6
fix MGS always returning the requested restart ID
hawkw Apr 10, 2025
b28689c
represent restart IDs as UUIDs except on the wire
hawkw Apr 11, 2025
02e4168
more logging embetterment
hawkw Apr 11, 2025
4312b8f
ereport bodies are now encoded as byte arrays
hawkw Apr 14, 2025
7f0f64d
somewhat messy partial decoding support
hawkw Apr 14, 2025
07b0513
simpler & nicer partial parse
hawkw Apr 14, 2025
365a654
clipppppyyyyyyy
hawkw Apr 14, 2025
e6c2fd4
log malformed ereports
hawkw Apr 15, 2025
82a2943
add test for parsing packets containing malformed ereports
hawkw Apr 15, 2025
fdc2e76
don't eagerly allocate task name indices
hawkw Apr 15, 2025
b7057be
add a test for index task names
hawkw Apr 15, 2025
f0ec780
don't allocate `Vec`s/s`String`s and immediately throw them away
hawkw Apr 15, 2025
b31eea6
tidy up task names
hawkw Apr 15, 2025
1c8c5d5
don't special-case invalid ereports
hawkw Apr 15, 2025
c23d3f0
tidiness/clippy
hawkw Apr 15, 2025
a2e67f5
add ereport protocol version
hawkw Apr 15, 2025
fbe5547
unsandwich ENAs
hawkw Apr 17, 2025
fb44445
move ereport msgs to their own crate, zerocopy
hawkw Apr 24, 2025
e05d39d
use zerocopy's unaligned integer types
hawkw Apr 28, 2025
f4a73ef
brevity
hawkw Apr 29, 2025
bb0f889
make use of `zerocopy` slightly more zero-copy
hawkw May 2, 2025
d6980f3
Merge branch 'main' into eliza/ereport-proto
hawkw May 5, 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
46 changes: 46 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[workspace]
members = [
"faux-mgs",
"gateway-ereport-messages",
"gateway-messages",
"gateway-sp-comms",
"xtask",
]

default-members = [
"faux-mgs",
"gateway-ereport-messages",
"gateway-messages",
"gateway-sp-comms",
]
Expand All @@ -21,6 +23,7 @@ slog-error-chain = { git = "https://github.com/oxidecomputer/slog-error-chain.gi
anyhow = "1.0"
async-trait = "0.1"
backoff = { version = "0.4.0", features = ["tokio"] }
base64 = "0.22.1"
bitflags = "2.9.0"
camino = "1.1.9"
clap = { version = "4.5", features = ["derive", "env"] }
Expand All @@ -39,6 +42,8 @@ paste = "1.0.15"
rand = "0.8.5"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde-big-array = "0.5.1"
serde_bytes = "0.11.17"
serde_cbor = "0.11.2"
serde_json = "1.0.140"
serde_repr = { version = "0.1" }
sha2 = "0.10"
Expand All @@ -65,3 +70,4 @@ zip = { version = "0.6.6", default-features = false, features = ["deflate", "bzi

gateway-messages.path = "gateway-messages"
gateway-sp-comms.path = "gateway-sp-comms"
gateway-ereport-messages.path = "gateway-ereport-messages"
40 changes: 38 additions & 2 deletions faux-mgs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ use gateway_messages::UnlockResponse;
use gateway_messages::UpdateId;
use gateway_messages::UpdateStatus;
use gateway_messages::ROT_PAGE_SIZE;
use gateway_sp_comms::ereport;
use gateway_sp_comms::shared_socket;
use gateway_sp_comms::InMemoryHostPhase2Provider;
use gateway_sp_comms::SharedSocket;
use gateway_sp_comms::SingleSp;
Expand Down Expand Up @@ -91,6 +93,13 @@ struct Args {
#[clap(long)]
listen_port: Option<u16>,

/// Ereport port to bind to locally
// Note that, unlike `listen_port`, this always defaults to 0, because we
// don't need to act as a server with a known port for the ereport
// protocol.
#[clap(long, default_value_t = 0)]
ereport_port: u16,

/// Address to use to discover the SP. May be a specific SP's address to
/// bypass multicast discovery.
#[clap(long, default_value_t = gateway_sp_comms::default_discovery_addr())]
Expand Down Expand Up @@ -711,11 +720,20 @@ async fn main() -> Result<()> {

let shared_socket = SharedSocket::bind(
listen_port,
Arc::clone(&host_phase2_provider),
log.clone(),
shared_socket::ControlPlaneAgentHandler::new(&host_phase2_provider),
log.new(slog::o!("socket" => "control-plane-agent")),
)
.await
.context("SharedSocket:bind() failed")?;
let ereport_socket = {
SharedSocket::bind(
args.ereport_port,
ereport::EreportHandler::default(),
log.new(slog::o!("socket" => "ereport")),
)
.await
.context("SharedSocket::bind() for ereport socket failed")?
};

let mut sps = Vec::new();

Expand All @@ -730,21 +748,39 @@ async fn main() -> Result<()> {
let socket = UdpSocket::bind(bind_addr)
.await
.with_context(|| format!("failed to bind to {bind_addr}"))?;
let ereport_bind_addr: SocketAddrV6 =
SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, 0, 0, 0);
let ereport_socket =
UdpSocket::bind(ereport_bind_addr).await.with_context(|| {
format!("failed to bind to {ereport_bind_addr}")
})?;
sps.push(SingleSp::new_direct_socket_for_testing(
socket,
sp_sim_addr,
ereport_socket,
SocketAddrV6::new(
*sp_sim_addr.ip(),
gateway_sp_comms::ereport::SP_PORT,
0,
0,
),
retry_config,
log.clone(),
));
} else {
let interfaces = build_requested_interfaces(args.interface)?;

let mut ereport_addr = args.discovery_addr;
ereport_addr.set_port(gateway_sp_comms::ereport::SP_PORT);
for interface in interfaces {
info!(log, "creating SP handle on interface {interface}");
sps.push(
SingleSp::new(
&shared_socket,
&ereport_socket,
SwitchPortConfig {
discovery_addr: args.discovery_addr,
ereport_addr,
interface,
},
retry_config,
Expand Down
12 changes: 12 additions & 0 deletions gateway-ereport-messages/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "gateway-ereport-messages"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"

[dependencies]
bitflags.workspace = true
zerocopy = { workspace = true, features = ["derive"] }

[features]
debug-impls = []
Loading
Loading