@@ -349,6 +349,12 @@ pub enum Link {
349
349
filter : Option < String > ,
350
350
} ,
351
351
352
+ /// Enable a link.
353
+ Enable { link : LinkPath } ,
354
+
355
+ /// Disable a link.
356
+ Disable { link : LinkPath } ,
357
+
352
358
/// Set a property of a link.
353
359
SetProp {
354
360
/// The link to set the property on.
@@ -833,11 +839,11 @@ async fn link_rmon_counters(
833
839
#[ macro_export]
834
840
macro_rules! print_speedenc_fields {
835
841
( $label: expr, $all: ident, $( $field_path: ident) .+) => {
836
- print!( "{:10}" , $label) ;
842
+ print!( "{:10}" , $label) ;
837
843
for lane in & $all {
838
844
print!( " {:>6}" , lane. $( $field_path) .+. to_string( ) ) ;
839
- }
840
- println!( ) ;
845
+ }
846
+ println!( ) ;
841
847
}
842
848
}
843
849
@@ -865,11 +871,11 @@ async fn link_serdes_enc_speed(
865
871
#[ macro_export]
866
872
macro_rules! print_anlt_fields {
867
873
( $label: expr, $all: ident, $( $field_path: ident) .+) => {
868
- print!( "{:20}" , $label) ;
874
+ print!( "{:20}" , $label) ;
869
875
for lane in & $all {
870
876
print!( " {:>6}" , lane. $( $field_path) .+. to_string( ) ) ;
871
- }
872
- println!( ) ;
877
+ }
878
+ println!( ) ;
873
879
}
874
880
}
875
881
@@ -1005,11 +1011,11 @@ async fn link_serdes_eye(
1005
1011
#[ macro_export]
1006
1012
macro_rules! print_rx_adapt_fields {
1007
1013
( $label: expr, $all: ident, $( $field_path: ident) .+) => {
1008
- print!( "{:14}" , $label) ;
1014
+ print!( "{:14}" , $label) ;
1009
1015
for lane in & $all {
1010
1016
print!( " {:>6}" , lane. $( $field_path) .+. to_string( ) ) ;
1011
- }
1012
- println!( ) ;
1017
+ }
1018
+ println!( ) ;
1013
1019
}
1014
1020
}
1015
1021
@@ -1038,13 +1044,13 @@ async fn link_serdes_rx_adapt(
1038
1044
#[ macro_export]
1039
1045
macro_rules! print_txeq_fields {
1040
1046
( $label: expr, $all: ident, $( $field_path: ident) .+) => {
1041
- print!( "{:6}" , $label) ;
1047
+ print!( "{:6}" , $label) ;
1042
1048
for lane in & $all {
1043
1049
let sw = lane. sw. $( $field_path) .+. unwrap_or( 0 ) ;
1044
1050
let hw = lane. hw. $( $field_path) .+. unwrap_or( 0 ) ;
1045
- print!( " {:>3} ({:>3})" , sw. to_string( ) , hw. to_string( ) ) ;
1046
- }
1047
- println!( ) ;
1051
+ print!( " {:>3} ({:>3})" , sw. to_string( ) , hw. to_string( ) ) ;
1052
+ }
1053
+ println!( ) ;
1048
1054
}
1049
1055
}
1050
1056
@@ -1103,11 +1109,11 @@ async fn link_serdes_tx_eq_set(
1103
1109
#[ macro_export]
1104
1110
macro_rules! print_rx_sig_fields {
1105
1111
( $label: expr, $all: ident, $( $field_path: ident) .+) => {
1106
- print!( "{:12}" , $label) ;
1112
+ print!( "{:12}" , $label) ;
1107
1113
for lane in & $all {
1108
1114
print!( " {:>6}" , lane. $( $field_path) .+. to_string( ) ) ;
1109
- }
1110
- println!( ) ;
1115
+ }
1116
+ println!( ) ;
1111
1117
}
1112
1118
}
1113
1119
@@ -1798,6 +1804,18 @@ pub async fn link_cmd(client: &Client, link: Link) -> anyhow::Result<()> {
1798
1804
. context ( "failed to set KR mode" ) ?;
1799
1805
}
1800
1806
} ,
1807
+ Link :: Enable { link } => {
1808
+ client
1809
+ . link_enabled_set ( & link. port_id , & link. link_id , true )
1810
+ . await
1811
+ . with_context ( || "failed to enable link" ) ?;
1812
+ }
1813
+ Link :: Disable { link } => {
1814
+ client
1815
+ . link_enabled_set ( & link. port_id , & link. link_id , false )
1816
+ . await
1817
+ . with_context ( || "failed to disable link" ) ?;
1818
+ }
1801
1819
Link :: History {
1802
1820
link,
1803
1821
raw,
0 commit comments