Skip to content

Commit 63dc371

Browse files
committed
Add the slave-only instance configuration option to statime-linux
1 parent daf0117 commit 63dc371

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
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.toml.5

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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")]
@@ -190,6 +192,10 @@ fn default_sdo_id() -> u16 {
190192
0x000
191193
}
192194

195+
fn default_slave_only() -> bool {
196+
false
197+
}
198+
193199
fn default_announce_interval() -> i8 {
194200
1
195201
}
@@ -281,6 +287,7 @@ interface = "enp0s31f6"
281287
loglevel: LogLevel::Info,
282288
sdo_id: 0x000,
283289
domain: 0,
290+
slave_only: false,
284291
identity: None,
285292
priority1: 128,
286293
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)