Skip to content

[fmt] match Omicron rust formatting for consistency + edition 2024#183

Merged
zeeshanlakhani merged 5 commits intomainfrom
zl/match-omicron-fmt-edition
Jan 20, 2026
Merged

[fmt] match Omicron rust formatting for consistency + edition 2024#183
zeeshanlakhani merged 5 commits intomainfrom
zl/match-omicron-fmt-edition

Conversation

@zeeshanlakhani
Copy link
Copy Markdown
Contributor

My editor complains when using 2024 edition enhancements, even though the min version here is Rust 1.90.

This PR aligns us with Omicron's formatting style (and edition).

Copy link
Copy Markdown
Contributor

@FelixMcFelix FelixMcFelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to generally condense things overall. I'm happy with it since it matches the decisions we've made in other repos.

I did attempt to verify the change on my Macbook to some extent:

kyle@Mac dendrite % git diff
kyle@Mac dendrite % git diff origin/zl/match-omicron-fmt-edition --stat
 asic/src/chaos/mod.rs              | 10 ++++++++--
 asic/src/chaos/table.rs            |  5 ++++-
 asic/src/lib.rs                    |  5 ++++-
 asic/src/softnpu/mgmt.rs           |  7 +++++--
 asic/src/softnpu/mod.rs            | 30 ++++++++++++++++++++++--------
 asic/src/softnpu/table.rs          |  6 +++++-
 asic/src/tofino_asic/bf_wrapper.rs | 23 ++++++++++++++++++-----
 asic/src/tofino_asic/link_fsm.rs   |  6 +++++-
 asic/src/tofino_asic/mcast.rs      | 16 +++++++++++++---
 asic/src/tofino_asic/mod.rs        | 18 +++++++++++++++---
 asic/src/tofino_asic/ports.rs      | 41 ++++++++++++++++++++++++++++++++---------
 asic/src/tofino_asic/qsfp.rs       | 30 +++++++++++++++++++++++++-----
 asic/src/tofino_asic/serdes.rs     | 27 +++++++++++++++++++++------
 asic/src/tofino_asic/table.rs      | 43 ++++++++++++++++++++++++++++++++-----------
 asic/src/tofino_common/mod.rs      |  7 ++++++-
 asic/src/tofino_stub/mcast.rs      |  4 +++-
 asic/src/tofino_stub/mod.rs        |  5 ++++-
 asic/src/tofino_stub/ports.rs      | 22 ++++++++++++++++++----
 pcap/src/lib.rs                    | 10 +++++++---
 19 files changed, 247 insertions(+), 68 deletions(-)
kyle@Mac dendrite % cargo fmt --check
Error writing files: failed to resolve mod `genpd`: /Users/kyle/gits/dendrite/asic/src/tofino_asic/genpd.rs does not exist
Error writing files: failed to resolve mod `ffi`: /Users/kyle/gits/dendrite/pcap/src/ffi.rs does not exist
kyle@Mac dendrite %

So I have some divergence, but that lines up with some of the modules just not playing well on this platform. The diff itself does just look like, as reported, cargo fmt has bailed on those modules for me.

@zeeshanlakhani
Copy link
Copy Markdown
Contributor Author

zeeshanlakhani commented Jan 15, 2026

@FelixMcFelix I can't ignore those generated files, and it seems to be OSX only, as they can't build.

@FelixMcFelix
Copy link
Copy Markdown
Contributor

@FelixMcFelix I can't ignore those generated files, and it seems to be OSX only, as they can't build.

I don't think this has to be fixed here; it will have always been the case, I'd think? So long as there's an issue tracking then I think this PR does what it set out to.

@zeeshanlakhani
Copy link
Copy Markdown
Contributor Author

@FelixMcFelix I can't ignore those generated files, and it seems to be OSX only, as they can't build.

I don't think this has to be fixed here; it will have always been the case, I'd think? So long as there's an issue tracking then I think this PR does what it set out to.

Yeah, its' essentially wait for some nightly features to come around for fmt.

@zeeshanlakhani zeeshanlakhani merged commit 0fa03e2 into main Jan 20, 2026
5 checks passed
@zeeshanlakhani zeeshanlakhani deleted the zl/match-omicron-fmt-edition branch January 20, 2026 04:36
zeeshanlakhani added a commit that referenced this pull request Mar 30, 2026
This wires up the softnpu ASIC backend to support multicast end-to-end by
translating DPD's sidecar.p4 table operations into sidecar-lite.p4's
simplified P4 pipeline.

## AsicMulticastOps

We replace the stubbed AsicMulticastOps implementation (which returned
"OperationUnsupported" for group creation and port addition with in-memory group
tracking via McGroupData, following the tofino_stub pattern.

Group membership is used by the table translation layer to build port
bitmaps for sidecar-lite's Replicate extern. Ports >= 128 are
rejected at add time to match sidecar-lite's 128-bit bitmap width.

## Table translation (asic/src/softnpu/table.rs)

We map sidecar.p4 table names to sidecar-lite equivalents and translate
action parameters where the designs differ for emulation.

All multicast action arms are gated with #[cfg(feature = "multicast")].

## References

- [softnpu #183](oxidecomputer/softnpu#183)
- [propolis #1093](oxidecomputer/propolis#1093)
- [p4rs #240](oxidecomputer/p4#240)
- [sidecar-lite #152](oxidecomputer/sidecar-lite#152)
- tokio: 1.50 (due to softnpu)
- oxide-tokio-rt: 0.1.3 (following-up from tokio's move to 1.50)
zeeshanlakhani added a commit that referenced this pull request Apr 1, 2026
This wires up the softnpu ASIC backend to support multicast end-to-end by
translating DPD's sidecar.p4 table operations into sidecar-lite.p4's
simplified P4 pipeline.

## AsicMulticastOps

We replace the stubbed AsicMulticastOps implementation (which returned
"OperationUnsupported" for group creation and port addition with in-memory group
tracking via McGroupData, following the tofino_stub pattern.

Group membership is used by the table translation layer to build port
bitmaps for sidecar-lite's Replicate extern. Ports >= 128 are
rejected at add time to match sidecar-lite's 128-bit bitmap width.

## Table translation (asic/src/softnpu/table.rs)

We map sidecar.p4 table names to sidecar-lite equivalents and translate
action parameters where the designs differ for emulation.

All multicast action arms are gated with #[cfg(feature = "multicast")].

## References

- [softnpu #183](oxidecomputer/softnpu#183)
- [propolis #1093](oxidecomputer/propolis#1093)
- [p4rs #240](oxidecomputer/p4#240)
- [sidecar-lite #152](oxidecomputer/sidecar-lite#152)
- tokio: 1.50 (due to softnpu)
- oxide-tokio-rt: 0.1.3 (following-up from tokio's move to 1.50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants