每秒脉冲 - PPS
PPS 是最简单的同步形式。PPS 源每秒精确提供一个信号。交换机能够使用外部 PPS 信号来同步其 PHC(用于 PPS 输入),并且还可以生成 PPS 信号,供其他设备用于同步其时钟(用于 PPS 输出)。
- 在 PPS 输入模式下,交换机可以使用外部 PPS 信号来调整其 PHC 的相位。PPS 信号不提供 ToD,因此 Cumulus Linux 使用 PTP 来提供 ToD;您必须在交换机上为 PPS 输入配置 PTP 从端口。
- 在 PPS 输出模式下,交换机可以输出 PPS 信号。交换机可以使用此信号来检查其 PHC 频率的准确性,而其他设备可以使用此信号来同步其 PHC。
Cumulus Linux 仅支持 NVIDIA SN3750-SX 和 SN5400 交换机的 PPS。
启用 PPS 同步
要启用 PPS 同步
在启用 PPS 输入之前,请确保在交换机上配置 PTP 从端口。请参阅精确时间协议 - PTP。
cumulus@switch:~$ nv set platform pulse-per-second in state enabled
cumulus@switch:~$ nv config apply
- 如果您配置了 SyncE 或 PTP 噪声传输,则 Cumulus Linux 不支持 PPS 输入。
- 当您启用 PPS 输入时,PTP 日志报告偏移量为每两秒一次,而不是每秒一次。
cumulus@switch:~$ nv set platform pulse-per-second out state enabled
cumulus@switch:~$ nv config apply
编辑 `/etc/ptp4l.conf` 文件的 `Default interface options` 部分,以在交换机上配置 PTP 从端口。PPS 输入需要 PTP 从端口。有关 PTP 的信息,请参阅精确时间协议 - PTP。
cumulus@switch:~$ sudo nano /etc/linuxptp/pps_out.conf ... # Default interface options # time_stamping hardware [swp29] udp_ttl 1 masterOnly 0 delay_mechanism E2E network_transport RAWUDPv4
编辑 `/etc/linuxptp/ts2phc.conf` 文件以设置以下参数来启用 PPS 输入。
cumulus@switch:~$ sudo nano /etc/linuxptp/ts2phc.conf # Default configurations [global] use_syslog 0 verbose 1 logging_level 6 slave_event_monitor /var/run/ptp_sem.sock ts2phc.pulsewidth 500000000 ts2phc.tod_source ptp # # servo parameters # pi_proportional_const 0.000000 pi_integral_const 0.000000 pi_proportional_scale 0.700000 pi_proportional_exponent -0.300000 pi_proportional_norm_max 0.700000 pi_integral_scale 0.300000 pi_integral_exponent 0.400000 pi_integral_norm_max 0.300000 step_threshold 0.000000050 first_step_threshold 0.000000001 max_frequency 500000000 sanity_freq_limit 0 # [/dev/ptp1] ts2phc.pin_index 0 ts2phc.channel 0 ts2phc.extts_polarity rising ts2phc.extts_correction 0
启用并启动 `ptp4l` 和 `phc2sys` 服务
cumulus@switch:~$ sudo systemctl enable ptp4l.service phc2sys.service cumulus@switch:~$ sudo systemctl start ptp4l.service phc2sys.service
编辑 `/etc/linuxptp/pps_out.conf` 文件以设置以下参数。
cumulus@switch:~$ sudo nano /etc/linuxptp/pps_out.conf # Configuration file used for the pps_out.service # It is shell formatted and the file is source'd by the service # Set the PTP device to source our PPS from. # If not specified, the service will find the first device with a clock name "sx_ptp". PTP_DEV=/dev/ptp1 # Set the pin index on the PPS device to send on. # On the NVIDIA systems, only pin 1 (0-based) is supported OUT_PIN=1 # Set the file where to cache the last started values. # This is used primarily in the "stop" operation to know what to clean up. CACHE_FILE=/var/run/pps_out # Set the out pulse charateristics for frequency and width PULSE_FREQ=1000000000 PULSE_WIDTH=500000000 PULSE_PHASE=0
启用并启动 `pps_out` 服务
cumulus@switch:~$ sudo systemctl enable pps_out.service cumulus@switch:~$ sudo systemctl start pps_out.service
PPS 同步设置
您可以配置这些 PPS 设置
PPS 输入设置 | 描述 |
---|---|
channel-index | 设置 PPS 输入的通道索引。您可以设置值 1 或 0。默认值为 0。 |
logging-level | 设置 PPS 输入的日志记录级别。您可以指定 `emergency`、`alert`、`critical`、`error`、`warning`、`notice`、`info` 或 `debug`。默认日志记录级别为 `info`。 |
pin-index | 设置 PPS 输入的引脚索引。您可以设置值 1 或 0。默认值为 0。 |
signal-polarity | 设置 PPS 输入信号的极性。您可以指定 `rising-edge`、`falling-edge` 或 `both`。默认设置为 `rising-edge`。 |
signal-width | 设置 PPS 输入信号的脉冲宽度。您可以设置介于 1000000 和 999000000 之间的值。默认值为 500000000。 |
timestamp-correction | 设置要添加到每个 PPS 输入时间戳的值(以纳秒为单位)。您可以设置介于 -1000000000 和 1000000000 之间的值。默认值为 0。 |
PPS 输出设置 | 描述 |
---|---|
channel-index | 设置 PPS 输出的通道索引。您可以设置值 1 或 0。默认值为 0。 |
frequency-adjustment | 设置 PPS 输出信号的频率调整。您可以设置介于 1000000000 和 2147483647 之间的值。默认值为 1000000000。 |
pin-index | 设置 PPS 输出的引脚索引。Cumulus Linux 仅支持引脚 1。 |
signal-width | 设置 PPS 输出信号的脉冲宽度。您可以设置介于 1000000 和 999000000 之间的值。默认值为 500000000。 |
NVUE CLI 包括 PPS 输出的 phase adjustment
设置。Cumulus Linux 5.9 及更高版本不支持此设置。
以下示例配置 PPS 输入并设置
- 通道索引为 1。
- 引脚索引为 1。
- 信号宽度为 999000000。
- 时间戳校正为 1000000000。
- 日志记录级别为
warning
。 - PPS 输入信号的极性为 `falling-edge`。
cumulus@switch:~$ nv set platform pulse-per-second in channel-index 1
cumulus@switch:~$ nv set platform pulse-per-second in pin-index 1
cumulus@switch:~$ nv set platform pulse-per-second in signal-width 999000000
cumulus@switch:~$ nv set platform pulse-per-second in timestamp-correction 1000000000
cumulus@switch:~$ nv set platform pulse-per-second in logging-level warning
cumulus@switch:~$ nv set platform pulse-per-second in signal-polarity falling-edge
cumulus@switch:~$ nv config apply
以下示例配置 PPS 输出并设置
- 通道索引为 1。
- 信号宽度为 999000000。
- PPS 输出信号的频率调整为 2147483647。
cumulus@switch:~$ nv set platform pulse-per-second out channel-index 1
cumulus@switch:~$ nv set platform pulse-per-second out signal-width 999000000
cumulus@switch:~$ nv set platform pulse-per-second out frequency-adjustment 2147483647
cumulus@switch:~$ nv config apply
要配置 PPS 输入,请编辑 `/etc/linuxptp/ts2phc.conf` 文件,然后使用 `sudo systemctl restart ts2phc.service` 命令重启 PPS 输入服务。
以下示例配置 PPS 输入并设置
- 通道索引为 1
- 引脚索引为 1
- 信号宽度为 999000000。
- 时间戳校正为 1000000000。
- 日志记录级别为 4(警告)。
- PPS 输入信号的极性为下降沿 (`falling`)。
cumulus@switch:~$ sudo nano /etc/linuxptp/ts2phc.conf
# ts2phc is enabled
[global]
use_syslog 0
verbose 1
slave_event_monitor /var/run/ptp_sem.sock
logging_level 4
ts2phc.pulsewidth 999000000
ts2phc.tod_source ptp
domainNumber 0
...
[/dev/ptp1]
ts2phc.pin_index 1
ts2phc.channel 1
ts2phc.extts_polarity falling
ts2phc.extts_correction 0
要配置 PPS 输出,请编辑 `/etc/linuxptp/pps_out.conf.conf` 文件,然后使用 `sudo systemctl restart pps_out.service` 命令重启 PPS 输出服务。
以下示例配置 PPS 输出并设置
- 通道索引为 1。
- 信号宽度为 999000000。
- PPS 输出信号的频率调整为 2147483647。
cumulus@switch:~$ sudo nano /etc/linuxptp/pps_out.conf.conf
# Configuration file used for the pps_out.service
# It is shell formatted and the file is source'd by the service
#
# Set the PTP device to source our PPS from.
# If not specified, the service will find the first device with a clock name "sx_ptp".
PTP_DEV=/dev/ptp1
#
# Set the pin index on the PPS device to send on.
# On the NVIDIA systems, only pin 1 (0-based) is supported
OUT_PIN=1
#
OUT_CHANNEL=1
#
# Set the file where to cache the last started values.
# This is used primarily in the "stop" operation to know what to clean up.
CACHE_FILE=/var/run/pps_out
#
# Set the out pulse charateristics for frequency and width
PULSE_FREQ=2147483647
PULSE_WIDTH=999000000
PULSE_PHASE=1000000000
显示 PPS 配置设置
要显示 PPS 输入和 PPS 输出配置设置的摘要,请运行 `nv show platform pulse-per-second` 命令
cumulus@switch:~$ nv show platform pulse-per-second
applied
---------------------- -----------
in
state enabled
pin-index 0
channel-index 0
signal-width 500000000
signal-polarity rising-edge
timestamp-correction 0
logging-level info
out
state disabled
pin-index 1
channel-index 0
frequency-adjustment 1000000000
phase-adjustment 0
signal-width 500000000
要仅显示 PPS 输入配置设置,请运行 `nv show platform pulse-per-second in` 命令
cumulus@switch:~$ nv show platform pulse-per-second in
applied
-------------------- -----------
state enabled
pin-index 0
channel-index 0
signal-width 500000000
signal-polarity rising-edge
timestamp-correction 0
logging-level info
要仅显示 PPS 输出配置设置,请运行 `nv show platform pulse-per-second out` 命令
cumulus@switch:~$ nv show platform pulse-per-second out
applied
-------------------- ----------
state disabled
pin-index 1
channel-index 0
frequency-adjustment 1000000000
phase-adjustment 0
signal-width 500000000