File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,3 +18,4 @@ oxnet.workspace = true
1818slog.workspace = true
1919tabwriter.workspace = true
2020tokio.workspace = true
21+ tofino.workspace = true
Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments