Skip to content

Commit ed1651c

Browse files
committed
lot fishing
1 parent c01bc55 commit ed1651c

9 files changed

Lines changed: 38 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aal/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub trait SidecarIdentifiers {
4343
fn asic_backend(&self) -> &str;
4444
fn fab(&self) -> Option<char>;
4545
fn lot(&self) -> Option<char>;
46+
fn lotnum(&self) -> Option<[char; 4]>;
4647
fn wafer(&self) -> Option<u8>;
4748
fn wafer_loc(&self) -> Option<(i16, i16)>;
4849
}

asic/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub struct Identifiers {
3636
fab: Option<char>,
3737
/// Lot identifier.
3838
lot: Option<char>,
39+
/// Lot number
40+
lotnum: Option<[char; 4]>,
3941
/// Wafer number within the lot.
4042
wafer: Option<u8>,
4143
/// The wafer location as (x, y) coordinates on the wafer, represented as
@@ -49,6 +51,7 @@ impl Default for Identifiers {
4951
id: Uuid::new_v4(),
5052
asic_backend: "chaos".to_string(),
5153
fab: None,
54+
lotnum: None,
5255
lot: None,
5356
wafer: None,
5457
wafer_loc: None,
@@ -73,6 +76,10 @@ impl aal::SidecarIdentifiers for Identifiers {
7376
self.lot
7477
}
7578

79+
fn lotnum(&self) -> Option<[char; 4]> {
80+
self.lotnum
81+
}
82+
7683
fn wafer(&self) -> Option<u8> {
7784
self.wafer
7885
}

asic/src/tofino_asic/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ impl AsicOps for Handle {
224224
asic_backend: "tofino_asic".to_string(),
225225
fab: Some(chip_id.fab),
226226
lot: Some(chip_id.lot),
227+
lotnum: Some([
228+
chip_id.lotnum0,
229+
chip_id.lotnum1,
230+
chip_id.lotnum2,
231+
chip_id.lotnum3,
232+
]),
227233
wafer: Some(chip_id.wafer),
228234
wafer_loc: Some(wafer_loc_from_coords(
229235
chip_id.xsign,

dpd-types/src/switch_identifiers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pub struct SwitchIdentifiers {
1919
pub fab: Option<char>,
2020
/// Lot identifier.
2121
pub lot: Option<char>,
22+
/// Lot number
23+
pub lotnum: Option<[char; 4]>,
2224
/// Wafer number within the lot.
2325
pub wafer: Option<u8>,
2426
/// The wafer location as (x, y) coordinates on the wafer, represented as

dpd/src/oxstats.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ async fn wait_for_switch_identifiers(
593593
asic_backend: switch_identifiers.asic_backend.clone(),
594594
fab: switch_identifiers.fab,
595595
lot: switch_identifiers.lot,
596+
lotnum: switch_identifiers.lotnum,
596597
wafer: switch_identifiers.wafer,
597598
wafer_loc: switch_identifiers.wafer_loc,
598599
model: switch_identifiers.model.clone(),

dpd/src/switch_identifiers.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ pub(crate) async fn fetch_switch_identifiers_loop(
8484
asic_backend: sidecar_idents.asic_backend().to_string(),
8585
fab: sidecar_idents.fab(),
8686
lot: sidecar_idents.lot(),
87+
lotnum: sidecar_idents.lotnum(),
8788
wafer: sidecar_idents.wafer(),
8889
wafer_loc: sidecar_idents.wafer_loc().map(|(x, y)| [x, y]),
8990
model: sp.model,
@@ -107,10 +108,12 @@ pub(crate) async fn fetch_switch_identifiers_loop(
107108
)
108109
.await
109110
.expect("infinite retry loop fetching switch identifiers");
111+
let chip_id = sidecar_id.as_u128() as u64;
110112
info!(
111113
log,
112114
"fetched switch identifiers from MGS";
113115
"identifiers" => ?idents,
116+
"chip_id" => format!("{chip_id:x}"),
114117
);
115118

116119
Ok(idents)

swadm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ oxnet.workspace = true
1818
slog.workspace = true
1919
tabwriter.workspace = true
2020
tokio.workspace = true
21+
tofino.workspace = true

swadm/src/main.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ enum Commands {
9191
#[command(subcommand)]
9292
cmd: compliance::Compliance,
9393
},
94+
Identifiers,
9495
}
9596

9697
// A LinkPath or "loopback", used when either is appropriate.
@@ -231,5 +232,20 @@ async fn main_impl() -> anyhow::Result<()> {
231232
Commands::Compliance { cmd: compliance } => {
232233
compliance::compliance_cmd(&client, compliance).await
233234
}
235+
Commands::Identifiers => identifiers(),
234236
}
235237
}
238+
239+
fn identifiers() -> anyhow::Result<()> {
240+
/*
241+
let t = tofino::get_tofino().unwrap().unwrap();
242+
let pci = t.open_pci().unwrap();
243+
*/
244+
let pci =
245+
tofino::pci::Pci::new("/dev/tofino/1", tofino::REGISTER_SIZE).unwrap();
246+
let fuse = tofino::fuse::Fuse::read(&pci).unwrap();
247+
let chip_id: tofino::fuse::ChipId = fuse.chip_id.into();
248+
println!("chip id: {:016x}", fuse.chip_id);
249+
println!("{}", chip_id);
250+
Ok(())
251+
}

0 commit comments

Comments
 (0)