Sled-agent: detect switch backend (tofino, softnpu, et al) at runtime - #11237
Sled-agent: detect switch backend (tofino, softnpu, et al) at runtime#11237sion42x wants to merge 6 commits into
Conversation
Replace the switch-asic, switch-stub, and switch-softnpu cargo features with startup detection. The propolis SoftNPU backend is selected by a virtio 9p device answering 9P2000.P4; without one the existing Tofino path is used. Optional switch_backend config added for the stub and SoftNPU zone backends. pumpkind is gated on Oxide hardware.
issues deserve to be fatal.
|
Note for reviewers: I realized |
| devinfo: &mut DevInfo, | ||
| ) -> Result<Option<String>, SwitchDetectError> { | ||
| let mut walker = devinfo.walk_node(); | ||
| while let Some(node) = |
There was a problem hiding this comment.
This loop kinda-sorta feels like a hand-rolled version of Iterator::find:
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.find
? NodeWalk implements Iterator, so it may be useful to pull the bulk of logic here out into a predicate function. Dunno.
There was a problem hiding this comment.
Hmm... I can pull out the per-node logic and into a probe_node predicate. The catch with find itself is that each step is fallible and needs ? to propagate. try_find would make a good fit but I believe it's not stable. So I could do something like:
devinfo
.walk_node()
.map(|node| probe_node(log, &node.map_err(SwitchDetectError::DevInfo)?))
.find_map(Result::transpose)
.transpose()
but that feels harder to read than a loop. Not to mention doing a double transpose just to make it work which feels icky. Let me know which you think is clearer.
|
Tests post On voxel: Working as expected on all scrimlet/non-scrimlet + rack/voxel combinations. |
Replace the
switch-asic,switch-stub, andswitch-softnpucargo features with startup detection. A Tofino node in the device tree selects the Tofino ASIC; otherwise a virtio 9p device answering9P2000.P4selects the propolis SoftNPU backend, and with neither the existing auto Tofino path is used. Optionalswitch_backendconfig added for the stub and SoftNPU zone backends.pumpkindis gated on Oxide hardware.This PR is a proposed solution to #11202 based on feedback from the control plane team. Prior proposed/attempted solutions:
sled-agentwith CI as a downloadable artifact: Publish the omicron-sled-agent package as a separate artifact for dev labs #11133 (half measure and doesn't solve the real issue)vio9pdevice based on a new subsystem ID (breaks driver loading due to illumos device binding andscadmhardcoding, likewiseMode::Modernrequires newer stlouis changes and would be the first modern-only device)Options 2-4 would have also required additional tooling in omicron to detect these things, making it a pretty sizeable cross-repo change. However, @rcgoodfellow proposed a detection method
scadmalready uses:p9fsdevices usingdevinfop9server if it is9P2000.P4So rather than changing propolis, this PR uses that method to detect softnpu devices. A test on a racklette vs on a voxel lab showed:
Lastly, follow ups:
sled_mode,sidecar_revision, andswitch_backendoverlap, and legal combinations are enforced by runtime checks. It would probably be good to get the latter two into oneswitchenum so illegal configs aren't representable.