Skip to content

Commit 4e12eb4

Browse files
committed
Add the slave-only instance configuration option to statime-linux
1 parent cf40195 commit 4e12eb4

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

docs/man/statime.toml.5.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ will be indicated by each configuration setting shown.
3232
`sdo-id` = *u12* (**0**)
3333
: The "source domain identity" of this PTP instance. Together with the `domain` it identifies a domain.
3434

35+
`slave-only` = *bool* (**false**)
36+
: Forbids this instance to ever become a master on any port.
37+
3538
`priority1` = *priority* (**128**)
3639
: A tie breaker for the best master clock algorithm in the range `0..256`. `0` being the highest priority and `255` the lowest.
3740

docs/precompiled/man/statime.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 3.5
1+
.\" Automatically generated by Pandoc 3.4
22
.\"
33
.TH "STATIME" "8" "" "statime 0.2.2" "statime"
44
.SH NAME

docs/precompiled/man/statime.toml.5

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 3.5
1+
.\" Automatically generated by Pandoc 3.4
22
.\"
33
.TH "STATIME.TOML" "5" "" "statime 0.2.2" "statime"
44
.SH NAME
@@ -33,6 +33,9 @@ domain.
3333
The \[lq]source domain identity\[rq] of this PTP instance.
3434
Together with the \f[CR]domain\f[R] it identifies a domain.
3535
.TP
36+
\f[CR]slave\-only\f[R] = \f[I]bool\f[R] (\f[B]false\f[R])
37+
Forbids this instance to ever become a master on any port.
38+
.TP
3639
\f[CR]priority1\f[R] = \f[I]priority\f[R] (\f[B]128\f[R])
3740
A tie breaker for the best master clock algorithm in the range
3841
\f[CR]0..256\f[R].

statime-linux/src/config/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub struct Config {
2424
pub sdo_id: u16,
2525
#[serde(default = "default_domain")]
2626
pub domain: u8,
27+
#[serde(default = "default_slave_only")]
28+
pub slave_only: bool,
2729
#[serde(default, deserialize_with = "deserialize_clock_identity")]
2830
pub identity: Option<ClockIdentity>,
2931
#[serde(default = "default_priority1")]
@@ -205,6 +207,10 @@ fn default_sdo_id() -> u16 {
205207
0x000
206208
}
207209

210+
fn default_slave_only() -> bool {
211+
false
212+
}
213+
208214
fn default_announce_interval() -> i8 {
209215
1
210216
}
@@ -302,6 +308,7 @@ interface = "enp0s31f6"
302308
loglevel: LogLevel::Info,
303309
sdo_id: 0x000,
304310
domain: 0,
311+
slave_only: false,
305312
identity: None,
306313
priority1: 128,
307314
priority2: 128,

statime-linux/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ async fn actual_main() {
268268
priority_1: config.priority1,
269269
priority_2: config.priority2,
270270
domain_number: config.domain,
271-
slave_only: false,
271+
slave_only: config.slave_only,
272272
sdo_id: SdoId::try_from(config.sdo_id).expect("sdo-id should be between 0 and 4095"),
273273
path_trace: config.path_trace,
274274
};

0 commit comments

Comments
 (0)