Coder Social home page Coder Social logo

synce4l's Introduction

Table of contents

  1. Introduction
  2. Compilation
  3. Installation
  4. Usage
  5. Config
  6. External API

1. Introduction

synce4l is a software implementation of Synchronous Ethernet (SyncE) according to ITU-T Recommendation G.8264. The design goal is to provide logic to supported hardware by processing Ethernet Synchronization Messaging Channel (ESMC) and control Ethernet Equipment Clock (EEC) on Network Card Interface (NIC).

Application can operate in two mutually exclusive input modes: line or external. Both modes are described in next paragraphs.

The best source selection is done according to ITU-T Recommendations G.781 and G.8264. Two network options are supported: option 1 and option 2.

Table showing priority of quality levels (QLs) in option 1 networks:

Quality Level Priority* SSM Extended SSM**
ePRTC 0 0x2 0x21
PRTC 1 0x2 0x20
PRC 2 0x2 0xFF
SSU-A 3 0x4 0xFF
SSU-B 4 0x8 0xFF
EEC1 5 0xB 0xFF

Table showing priority of quality levels (QLs) in option 2 networks:

Quality Level Priority* SSM Extended SSM**
ePRTC 0 0x1 0x21
PRTC 1 0x1 0x20
PRS 2 0x1 0xFF
STU 3 0x0 0xFF
ST2 4 0x7 0xFF
TNC 5 0x4 0xFF
ST3E 6 0xD 0xFF
EEC2 7 0xA 0xFF
PROV 8 0xE 0xFF

Remark: *Lower number means higher priority

Remark: **If extended SSM is not enabled, it's implicitly assumed as 0xFF

Incoming SyncE frames are processed and best clock source is extracted from the link having the best quality level. synce4l configures such "best quality" port as a source to recover clock for EEC. The recovered QL is broadcasted to all other interfaces then. synce4l can use external 1PPS source attached (GPS or other generator). which will participate in best source selection algorithm for EEC.


2. Compilation

Makefile rules are included in Makefile and compilation is done using the command:

make synce4l

External library dependencies

A compilation and further usage of synce4l requires following libraries:

  • glibc (which includes also required: libm, libpthread, librt)
  • libnl-3
  • libnl-genl-3

3. Installation

Use make install target to install synce4l in a system.


4. Usage

Use -h command line argument to print the help page:

$? ./synce4l -h
usage: synce4l [options]

 ...

 Other Options

 -f [file] read configuration from 'file'
           (config file takes precedence over command line arguments)
 -l [num]  set the logging level to 'num'
           (0: least detailed, 7: most detailed)
 -m        print messages to stdout
 -q        do not print messages to the syslog
 -v        print synce4l version and exit
 -h        print this message and exit

Remark: synce4l requires root privileges since it opens raw sockets.


5. Config

Configuration file contains three sections:

  • global,
  • device,
  • port.

Global section

This section starts with [global] keyword, consist of configuration items related to a running synce4l instance.

Parameter Default Valid values Description
logging_level 6 0-7 Minimum log level required to appear in a log.
message_tag None string Tag reported in a log.
poll_interval_msec 20 0-500 Sleep time between subsequent SyncE clock polls
smc_socket_path /tmp/synce4l_socket string Full path to socket file for external application communication
use_syslog 1 0, 1 Set to 1 if syslog should be used.
verbose 0 0, 1 Set to 1 to log extra information.

Device section

This section specifies the configuration of a one logical device e.g. 'synce1'. The name is defined by the user. The name has no impact for any functionality except traces. The name must be enclosed in extra angle bracket when defining new device section e.g. []. All ports defined by port sections after the device section will create one SyncE device (until next device section).

Parameter Default Valid values Description
extended_tlv 0 0, 1 Set to 1 to enable extended QL.
network_option 1 1, 2 Network option according to T-REC-G.8264. All devices in SyncE domain should have the same option configured.
recover_time 60 10-720 Seconds indicating the minimum time to recover from the QL-failed state on the port.
get_eec_state_cmd None string Shell command which will be executed by synce4l to acquire current state of a SyncE EEC on the device. The command shall output current state of EEC to stdout.
eec_holdover_value None string Value expected on stdout stream when EEC is in HOLDOVER state, after calling command defined in get_eec_state_cmd
eec_locked_ho_value None string Value expected on stdout stream when EEC is in LOCKED HOLDOVER state, after calling command defined in get_eec_state_cmd
eec_locked_value None string Value expected on stdout stream when EEC is in LOCKED state, after calling command defined in get_eec_state_cmd
eec_freerun_value None string Value expected on stdout stream when EEC is in FREERUN state, after calling command defined in get_eec_state_cmd
eec_invalid_value None string Value expected on stdout stream when EEC is in INVALID state, after calling command defined in get_eec_state_cmd
clock_id None 0-MAX(u64) Required when Linux dpll subsystem shall be used to control EEC, it refers to clock_id value of EEC type dpll in the system
module_name None string Required when Linux dpll subsystem shall be used to control EEC, it refers to name of kernel module that registered the dpll device in the system
dnu_prio 0xf 0-0xffff Required for Autmatic mode dpll device when Linux dpll subsystem is used. Value of priority which shall be set for input pins, when the source is marked as DNU

Port section

Any other section not starting with < (e.g. [eth0]) is the port section. Multiple port sections are allowed. Each port participates in SyncE communication.

Parameter Default Valid values Description
tx_heartbeat_msec 1000 100-3000 Interval between consecutive SyncE frame transmissions (1000ms is recommended).
rx_heartbeat_msec 50 10-500 Interval between consecutive SyncE socket polls (frame receive).
recover_clock_enable_cmd None string Shell command which enables PHY port pointed by this Port section as a source of frequency for the SyncE EEC on this device (required only in "internal_input" mode).
recover_clock_disable_cmd None string Shell command which disables PHY port pointed by this Port section as a source of frequency for the SyncE EEC on this device (required only in "internal_input" mode).
allowed_qls None string List of hex values containing allowed SSM QLs separated by comma (,), other received ones would be discarded - if parameter is not provided, all QLs will be accepted.
allowed_ext_qls None string List of hex values containing allowed extended SSM QLs separated by comma (,), other received ones would be discarded - if parameter is not provided, all QLs will be accepted.
internal_prio 128 0-255 An internal source priority, higher priority (lower value) is used to select a source as better quality in case two sources are considered equal quality

Remark: Please do not use backslashes in config file in 'string' fields - for example do not use it like this: "/sys/kernel/debug/ice/0000\:5e\:00\.0/cgu_state"

External source section

Any other section not starting with { (e.g. {SMA1}) is the external source section. Multiple external source sections are allowed. Each external source participates in best source selection algorithm for EEC

Parameter Default Valid values Description
input_QL 0 0-15, 0x0-0xF Quality Level (QL) for "external input" mode.
input_ext_QL 0 0-255,0x0-0xFF Extended Quality Level for "external input" mode.
external_enable_cmd None string Shell command which enables external clock source pointed by this external source section as a source of frequency for the SyncE EEC on this device.
external_disable_cmd None string Shell command which disables external clock source pointed by this external source section as a source of frequency for the SyncE EEC on this device.
board_label None string Used for Linux dpll subsystem based configuration. A label of a pin associated with the external EEC input in Linux dpll subsytem.
panel_label None string Used for Linux dpll subsystem based configuration. A label of a pin associated with the external EEC input in Linux dpll subsytem.
package_label None string Used for Linux dpll subsystem based configuration. A label of a pin associated with the external EEC input in Linux dpll subsytem.
internal_prio 128 0-255 An internal source priority, higher priority (lower value) is used to select a source as better quality in case two sources are considered equal quality

Remark: When dpll subsystem is used, a value of board_label, panel_label or package_label shall be provided, depending on a type of label that given input has registered in Linux dpll subsystem.

Config example

Command based config

[global]
logging_level              7
use_syslog                 0
verbose                    1
message_tag                [synce4l]
smc_socket_path            /tmp/synce4l_socket

[<synce1>]
network_option             1
extended_tlv               1
recover_time               20
eec_get_state_cmd          cat /sys/class/net/eth0/device/dpll_0_state
eec_holdover_value         4
eec_locked_ho_value        3
eec_locked_value           2
eec_freerun_value          1
eec_invalid_value          0

[eth0]
tx_heartbeat_msec          1000
rx_heartbeat_msec          500
recover_clock_enable_cmd   echo 1 0 > /sys/class/net/eth0/device/phy/synce
recover_clock_disable_cmd  echo 0 0 > /sys/class/net/eth0/device/phy/synce
allowed_qls                0x2,0x4,0x8
allowed_ext_qls            0x20,0x21
internal_prio              1

[{SMA1}]
external_enable_cmd        echo 2 1 > /sys/class/net/enp1s0f0/device/ptp/ptp*/pins/SMA1
external_disable_cmd       echo 0 1 > /sys/class/net/enp1s0f0/device/ptp/ptp*/pins/SMA1
input_QL                   0x2
input_ext_QL               0x20
internal_prio              0

Linux dpll based config

[global]
logging_level              7
use_syslog                 0
verbose                    1
message_tag                [synce4l]
smc_socket_path            /tmp/synce4l_socket

[<synce1>]
network_option             1
extended_tlv               1
recover_time               20
clock_id                   0xaabbccffffccbbaa
module_name                ice

[eth0]
tx_heartbeat_msec          1000
rx_heartbeat_msec          500
allowed_qls                0x2,0x4,0x8
allowed_ext_qls            0x20,0x21
internal_prio              1

[{SMA1}]
board_label                SMA1
input_QL                   0x2
input_ext_QL               0x20
internal_prio              0


6. External API

The Synce4l API facilitates communication with the Synce4l running application using an AF_UNIX socket. Messages are exchanged as a list of TLV messages (Type-Length-Value) over the socket. The TLV structure is defined in synce_external_api.h as the following:

TLV Structure

Enum: synce_manager_type

Defines different message types for the Synce Manager.

  • MSG_DEV_NAME (1): Device name.
  • MSG_SRC_NAME (2): External clock source name.
  • MSG_ERR_MSG (3): Error messgae returned from synce4l.
  • MSG_GET_QL (4): Get QL of devide.
  • MSG_GET_EXT_QL (5): Get extended QL of device.
  • MSG_SET_QL (6): Set QL of external clock source.
  • MSG_SET_EXT_QL (7): Set extended QL of external clock source.
  • MSG_END_MARKER (8): End marker.

Struct: synce_manager_tlv

Represents a TLV (Type-Length-Value) message.

  • type (uint16_t): Enum value from synce_manager_type.
  • length (uint16_t): Length of the value field in bytes.
  • value (void*): Data of the given length.

Communication

Communication is achieved by packing the synce_manager_tlv structure and sending it as a byte stream to the AF_UNIX socket. Last TLV of any stream shall use the type MSG_END_MARKER. Returned byte stream from synce4l will use same TLV format, and will end by TLV with MSG_END_MARKER type.

Command and response example

Below is command example for getting the QL of device synce1. Command is constructed from 3 TLVs:

  1. Type MSG_DEV_NAME with length 6 and value synce1
  2. Type MSG_GET_QL with length 0 and null value
  3. Type MSG_END_MARKER with length 0 and null value

| TYPE | LEN | VALUE || TYPE | LEN || TYPE | LEN | |---------------------------------------------------------------------| | DEV | 6 | s y n c e 1 || GET | 0 || END | 0 | | 01 00 | 06 00 | 73 79 6E 63 65 31 || 04 00 | 00 00 || 08 00 | 00 00 |

Example response from synce4l. Device synce1 has QL = 2 Response is constructed from 3 TLVs:

  1. Type MSG_DEV_NAME with length 6 and value synce1
  2. Type MSG_GET_QL with length 1 and value 2
  3. Type MSG_END_MARKER with length 0 and null value

| TYPE | LEN | VALUE || TYPE | LEN | VALUE || TYPE | LEN | |-----------------------------------------------------------------------------| | DEV | 6 | s y n c e 1 || GET | 1 | 2 || END | 0 | | 01 00 | 06 00 | 73 79 6E 63 65 31 || 04 00 | 01 00 | 02 || 08 00 | 00 |


synce4l's People

Contributors

kubalewski avatar mlichvar avatar mmichaliintc avatar yhagvi avatar sshedi avatar przekorb avatar rdower avatar

Stargazers

Jason Rock avatar  avatar Ajs avatar Lars Munch avatar  avatar  avatar Jan Lübbe avatar  avatar yalli avatar  avatar Loren M. Lang avatar Adam Hoang Anh Bui avatar Bernard Nguyen avatar Łukasz Stolarczuk avatar Víctor Vázquez avatar Steven Zou avatar  avatar Ming Wen avatar Lars Munch avatar Wakka avatar Rigel Di Scala avatar

Watchers

James Cloos avatar Bernard Nguyen avatar  avatar yalli avatar  avatar  avatar

synce4l's Issues

memory corrupted after synce4l_cleanup(cfg)

Hi,

When verifying synce4l on my device, I enter ctrl^C to stop synce4l, I tried to put 2 lines of pr_info in the main function of synce4l.c

out:
	pr_info("%s:%d end", __func__, __LINE__);
	synce4l_cleanup(cfg);
	pr_info("%s:%d end", __func__, __LINE__);
        pr_info("%s:%d end", __func__, __LINE__);

and this is the results:

synce4l[169426.640]: [synce4l] QL=0x2 received on Ethernet8
^Csynce4l[169427.427]: [synce4l] synce_clock_destroy
synce4l[169427.427]: [synce4l] trying to detach EEC RCLK for Ethernet8
synce4l[169427.428]: [synce4l] using recover_clock_disable_cmd: echo 0 0 > /sys/class/net/Ethernet8/device/phy/synce on Ethernet8
synce4l[169427.428]: [synce4l] Reply-Str: (null)

synce4l[169427.429]: [synce4l] synce_port_ctrl_destroy on Ethernet8
synce4l[169427.612]: [synce4l] tx thread exit state 3=OK port Ethernet8
synce4l[169427.640]: [synce4l] rx thread exit state 3=OK port Ethernet8
synce4l[169427.700]: [synce4l] main:177 end
synce4l[169427.700]:  main:179 end
synce4l[169427.700]: 󒭪ªª main:180 end

The message_tag [synce4l] has gone at line 179 & 180, and seems the memory is corrupted with 󒭪ªª

support master-only interface to send ESMC with a QL#DNU

Hi,
Currently, synce4l just receives a valid QL (for example PRC, EEC, SSU-A, etc.) from another device and broadcast this QL to other running ports.
But, in order to integrate synce4l on a reliable frequency source , synce4l should support master-only role, it means synce4l can generate and send ESMC with a valid QL by itself first.

How about your idea?

input_QL not wanted in synce4l.cfg

Hello
I took the version 1.1.0
and put the configuration you give with part

 [{SMA1}]
 input_QL	0x2
 input_ext_QL	0xFF
 external_enable_cmd	echo 2 1 > /sys/class/net/enp1s0f0/device/ptp/ptp*/pins/SMA1
 external_disable_cmd	echo 0 1 > /sys/class/net/enp1s0f0/device/ptp/ptp*/pins/SMA1
 internal_prio	0

once I ran I got

synce4l -f /opt/ptpconf/synce4l_1_1_0.cfg 
unknown option input_QL at line 72 in {SMA1} section

SyncE input does not work

Hi, SyncE input does not work on my E810. Please give me some advice, thanks!

SyncE output is a commercial switch, I think it works well.

I use synce4l with tag 1.0.0

here is the config

[global]
logging_level              7
use_syslog                 0
verbose                    1
message_tag                [synce4l]

[<synce1>]
network_option             1
extended_tlv               1
recover_time               20
eec_get_state_cmd          cat /sys/class/net/ens3f0/device/dpll_0_state
eec_holdover_value         4
eec_locked_ho_value        3
eec_locked_value           2
eec_freerun_value          1
eec_invalid_value          0

[ens3f0]
tx_heartbeat_msec          1000
rx_heartbeat_msec          500
recover_clock_enable_cmd   echo 1 0 > /sys/class/net/ens3f0/device/phy/synce
recover_clock_disable_cmd  echo 0 0 > /sys/class/net/ens3f0/device/phy/synce

synce4l output

[root@fedora synce4l]# ./synce4l -f configs/synce4l_test.cfg -m
synce4l[8837.741]: [synce4l] created synce1
synce4l[8837.741]: [synce4l] device init synce1 addr 0x1b01780
synce4l[8837.741]: [synce4l] created num_devices: 1
synce4l[8837.741]: [synce4l] config item synce1.extended_tlv is 1 (0x1)
synce4l[8837.741]: [synce4l] config item synce1.network_option is 1 (0x1)
synce4l[8837.741]: [synce4l] config item synce1.recover_time is 20 (0x14)
synce4l[8837.741]: [synce4l] config item synce1.eec_get_state_cmd is 'cat /sys/class/net/ens3f0/device/dpll_0_state'
synce4l[8837.741]: [synce4l] config item synce1.eec_holdover_value is '4'
synce4l[8837.741]: [synce4l] config item synce1.eec_locked_ho_value is '3'
synce4l[8837.741]: [synce4l] config item synce1.eec_locked_value is '2'
synce4l[8837.741]: [synce4l] config item synce1.eec_freerun_value is '1'
synce4l[8837.741]: [synce4l] config item synce1.eec_invalid_value is '0'
synce4l[8837.741]: [synce4l] config item synce1.module_name is '(null)'
synce4l[8837.741]: [synce4l] config item synce1.clock_id is 0 (0x0)
synce4l[8837.741]: [synce4l] config item synce1.dnu_prio is 15 (0xf)
synce4l[8837.741]: [synce4l] synce_dev_ctrl_init: using legacy mode
synce4l[8837.741]: [synce4l] synce_dev_ctrl_init: using provided commands
synce4l[8837.749]: [synce4l] clock_source ens3f0 added on device synce1 addr 0x1b01c60
synce4l[8837.749]: [synce4l] config item ens3f0.recover_clock_enable_cmd is 'echo 1 0 > /sys/class/net/ens3f0/device/phy/synce'
synce4l[8837.749]: [synce4l] config item ens3f0.recover_clock_disable_cmd is 'echo 0 0 > /sys/class/net/ens3f0/device/phy/synce'
synce4l[8837.755]: [synce4l] config item ens3f0.tx_heartbeat_msec is 1000 (0x3e8)
synce4l[8837.756]: [synce4l] tx thread started on port ens3f0
synce4l[8837.756]: [synce4l] THREAD_STARTED
synce4l[8837.756]: [synce4l] config item ens3f0.rx_heartbeat_msec is 500 (0x1f4)
synce4l[8837.756]: [synce4l] config item ens3f0.allowed_qls is '(null)'
synce4l[8837.756]: [synce4l] No allowed QLs list found - filtering disabled
synce4l[8837.756]: [synce4l] config item ens3f0.allowed_ext_qls is '(null)'
synce4l[8837.756]: [synce4l] No allowed ext_QLs list found - filtering disabled
synce4l[8837.756]: [synce4l] rx thread started on port ens3f0
synce4l[8837.776]: [synce4l] THREAD_STARTED
synce4l[8837.776]: [synce4l] inited clock_source ens3f0 on device synce1
synce4l[8837.776]: [synce4l] act on EEC_HOLDOVER for ens3f0
synce4l[8837.776]: [synce4l] trying to detach EEC Source CLK for ens3f0
synce4l[8837.776]: [synce4l] using recover_clock_disable_cmd: echo 0 0 > /sys/class/net/ens3f0/device/phy/synce on ens3f0
synce4l[8837.784]: [synce4l] inited num_clock_sources 1 (1 ports) for synce1
synce4l[8837.784]: [synce4l] device inited synce1
synce4l[8837.784]: [synce4l] running num_devices 1 configured 1
synce4l[8837.788]: [synce4l] synce_port_ctrl_rx_ql_changed on ens3f0
synce4l[8837.788]: [synce4l] not valid source: ens3f0
synce4l[8837.788]: [synce4l] both left and right are invalid
synce4l[8837.788]: [synce4l] no valid source found
synce4l[8837.788]: [synce4l] best source not found on synce1
synce4l[8837.788]: [synce4l] trying to detach EEC Source CLK for ens3f0
synce4l[8837.788]: [synce4l] using recover_clock_disable_cmd: echo 0 0 > /sys/class/net/ens3f0/device/phy/synce on ens3f0
synce4l[8837.792]: [synce4l] act on EEC_HOLDOVER for ens3f0
synce4l[8838.756]: [synce4l] tx_rebuild_tlv: attached new TLV, QL=0xf on ens3f0
synce4l[8838.756]: [synce4l] tx_rebuild_tlv: attached new extended TLV, EXT_QL=0xff on ens3f0
synce4l[8838.756]: [synce4l] QL=0x2 found on ens3f0
synce4l[8839.756]: [synce4l] QL=0x2 found on ens3f0
synce4l[8840.757]: [synce4l] QL=0x2 found on ens3f0
synce4l[8841.757]: [synce4l] QL=0x2 found on ens3f0
synce4l[8842.757]: [synce4l] QL=0x2 found on ens3f0
synce4l[8843.757]: [synce4l] QL=0x2 found on ens3f0
synce4l[8844.758]: [synce4l] QL=0x2 found on ens3f0
synce4l[8845.758]: [synce4l] QL=0x2 found on ens3f0
synce4l[8846.758]: [synce4l] QL=0x2 found on ens3f0
synce4l[8847.759]: [synce4l] QL=0x2 found on ens3f0
synce4l[8848.759]: [synce4l] QL=0x2 found on ens3f0
synce4l[8849.759]: [synce4l] QL=0x2 found on ens3f0
synce4l[8850.759]: [synce4l] QL=0x2 found on ens3f0
synce4l[8851.760]: [synce4l] QL=0x2 found on ens3f0
synce4l[8852.760]: [synce4l] QL=0x2 found on ens3f0
synce4l[8853.760]: [synce4l] QL=0x2 found on ens3f0
synce4l[8854.761]: [synce4l] QL=0x2 found on ens3f0
synce4l[8855.761]: [synce4l] QL=0x2 found on ens3f0
synce4l[8856.761]: [synce4l] QL=0x2 found on ens3f0
synce4l[8857.761]: [synce4l] QL=0x2 found on ens3f0
synce4l[8858.762]: [synce4l] QL=0x2 found on ens3f0
synce4l[8858.762]: [synce4l] QL-failed recovered on ens3f0
synce4l[8858.783]: [synce4l] synce_port_ctrl_rx_ql_changed on ens3f0
synce4l[8858.783]: [synce4l] not valid source: ens3f0
synce4l[8858.783]: [synce4l] both left and right are invalid
synce4l[8858.783]: [synce4l] no valid source found
synce4l[8858.783]: [synce4l] best source not found on synce1
synce4l[8858.783]: [synce4l] trying to detach EEC Source CLK for ens3f0
synce4l[8858.783]: [synce4l] using recover_clock_disable_cmd: echo 0 0 > /sys/class/net/ens3f0/device/phy/synce on ens3f0
synce4l[8858.791]: [synce4l] act on EEC_HOLDOVER for ens3f0
synce4l[8859.759]: [synce4l] tx_rebuild_tlv: attached new TLV, QL=0xf on ens3f0
synce4l[8859.759]: [synce4l] tx_rebuild_tlv: attached new extended TLV, EXT_QL=0xff on ens3f0
synce4l[8859.762]: [synce4l] QL=0x2 found on ens3f0
synce4l[8859.762]: [synce4l] QL=0x2 received on ens3f0
synce4l[8861.262]: [synce4l] QL=0x2 found on ens3f0
synce4l[8861.262]: [synce4l] QL=0x2 received on ens3f0
synce4l[8862.263]: [synce4l] QL=0x2 found on ens3f0
synce4l[8862.263]: [synce4l] QL=0x2 received on ens3f0
synce4l[8863.263]: [synce4l] QL=0x2 found on ens3f0
synce4l[8863.263]: [synce4l] QL=0x2 received on ens3f0
synce4l[8864.263]: [synce4l] QL=0x2 found on ens3f0
synce4l[8864.263]: [synce4l] QL=0x2 received on ens3f0
synce4l[8865.264]: [synce4l] QL=0x2 found on ens3f0
synce4l[8865.264]: [synce4l] QL=0x2 received on ens3f0
synce4l[8866.264]: [synce4l] QL=0x2 found on ens3f0
synce4l[8866.264]: [synce4l] QL=0x2 received on ens3f0
synce4l[8867.264]: [synce4l] QL=0x2 found on ens3f0
synce4l[8867.264]: [synce4l] QL=0x2 received on ens3f0
synce4l[8868.265]: [synce4l] QL=0x2 found on ens3f0
synce4l[8868.265]: [synce4l] QL=0x2 received on ens3f0
synce4l[8869.265]: [synce4l] QL=0x2 found on ens3f0
synce4l[8869.265]: [synce4l] QL=0x2 received on ens3f0
synce4l[8870.265]: [synce4l] QL=0x2 found on ens3f0
synce4l[8870.265]: [synce4l] QL=0x2 received on ens3f0
synce4l[8871.266]: [synce4l] QL=0x2 found on ens3f0
synce4l[8871.266]: [synce4l] QL=0x2 received on ens3f0

dpll status

[root@fedora ~]# cat /sys/kernel/debug/ice/0000\:04\:00.0/cgu
Found ZL80032 CGU
DPLL Config ver: 1.3.0.1
DPLL FW ver: 6201

CGU Input status:
                   |            |      priority     |            |
      input (idx)  |    state   | EEC (0) | PPS (1) | ESync fail |
  ----------------------------------------------------------------
     CVL-SDP22 (0) |    invalid |     255 |       5 |     N/A    |
     CVL-SDP20 (1) |    invalid |     255 |       4 |     N/A    |
  C827_0-RCLKA (2) |    invalid |       8 |       8 |     N/A    |
  C827_0-RCLKB (3) |    invalid |       9 |       9 |     N/A    |
          SMA1 (4) |    invalid |       3 |       3 |     N/A    |
    SMA2/U.FL2 (5) |    invalid |       2 |       2 |     N/A    |
     GNSS-1PPS (6) |    invalid |       0 |       0 |     N/A    |

EEC DPLL:
        Current reference:      C827_0-RCLKA
        Status:                 holdover

PPS DPLL:
        Current reference:      C827_0-RCLKA
        Status:                 holdover
        Phase offset [ps]:                      158

Issues with multiple SyncE inputs

When synce4l is configured to use two ports of E810E, receiving the same QL or different QLs, I'm seeing some odd and nondeterministic behavior in the input priority setting and connections to RCLKA and RCLKB.

When I start synce4l the configuration printed by ynl --dump get-pins looks like this:

 {'board-label': 'C827_0-RCLKA',
                     'prio': 0,
                     'state': 'connected'},
                     'prio': 4,
                     'state': 'connected'}],
 {'board-label': 'C827_0-RCLKB',
                     'prio': 0,
                     'state': 'selectable'},
                     'prio': 5,
                     'state': 'selectable'}],
...
  'parent-pin': [{'parent-id': 2, 'state': 'disconnected'},
                 {'parent-id': 3, 'state': 'connected'}],
  'parent-pin': [{'parent-id': 2, 'state': 'connected'},
                 {'parent-id': 3, 'state': 'disconnected'}],

The first port is connected to RCLKB and the second port to RCLKA, but the priority of RCLKA and RCLKB are the same even though the ports receive different QL.

When I bring the first port down by ip link set, I get:

 {'board-label': 'C827_0-RCLKA',
                     'prio': 0,
                     'state': 'connected'},
                     'prio': 4,
                     'state': 'connected'}],
 {'board-label': 'C827_0-RCLKB',
                     'prio': 0,
                     'state': 'selectable'},
                     'prio': 5,
                     'state': 'selectable'}],
...
  'parent-pin': [{'parent-id': 2, 'state': 'disconnected'},
                 {'parent-id': 3, 'state': 'disconnected'}],
  'parent-pin': [{'parent-id': 2, 'state': 'connected'},
                 {'parent-id': 3, 'state': 'connected'}],

Now the second port is connected to RCLKA and RCLKB, which have the same priority. That seems ok.

When I bring the first port up again, I get the some pin configuration:

 {'board-label': 'C827_0-RCLKA',
                     'prio': 0,
                     'state': 'connected'},
                     'prio': 4,
                     'state': 'connected'}],
 {'board-label': 'C827_0-RCLKB',
                     'prio': 0,
                     'state': 'selectable'},
                     'prio': 5,
                     'state': 'selectable'}],
...
  'parent-pin': [{'parent-id': 2, 'state': 'disconnected'},
                 {'parent-id': 3, 'state': 'disconnected'}],
  'parent-pin': [{'parent-id': 2, 'state': 'connected'},
                 {'parent-id': 3, 'state': 'connected'}],

I think it should reconnect the first port as it has a higher-priority QL.

It's not clear to me how this should actually work. Is there any advantage of connecting different ports to different clocks, so the DPLL can have multiple inputs and maybe reduce the time needed to switch between the RCLK inputs when one of them is disconnected, or is it better to connect only one port and leave the other port disconnected? I assume connecting one port to both clocks doesn't have any advantages.

support interface priority when running Clock Selection Algorithm (CSA) with same recv QL

Hi,

When synce4l receives the same QL from 2 interfaces, it should choose the better one as the best-selected port, it maybe come from the priority of interfaces.

As Cisco describes: https://www.cisco.com/c/en/us/td/docs/iosxr/ncs5000/sysman/62x/b-system-management-cg-ncs5000-62x/b-system-management-cg-ncs5000-62x_chapter_01100.html

Configure priority of the frequency source on a controller or an interface by specifying a value in the range 1 (highest priority) to 254 (lowest priority). The default value is 100. The priority value set is used by the clock-selection algorithm to choose between two sources that have the same quality level (QL) and lower priority values are usually preferred.


RP/0/RP0/CPU0:router(config-if-freqsync)# priority 101

Can we support this feature?

SyncE input priority not reset on exit

When synce4l starts, it sets the synce priority (C827_0-RCLKA with E810) to 15. Later, if valid QL is received, it sets the priority to 0. But when synce4l is terminated, that priority stays there and the input stays connected even when nothing is checking the QL.

get_eec_state_from_cmd() called every 20 ms, causing unacceptable CPU load

For each interface, synce_clock_poll() looks for clock state updates every 20 ms. In the end every call results in a popen() and pclose(), which can be really resource heavy in embedded systems. I think some sort of of alternative to this approach for updating the state should be added, perhaps giving a filename and using inotify on it or similar, or having the poll time parameterized. Happy to supply a PR if this sounds like a good idea.

sync4l.cfg not up to date

Hello
the file synce4l.cfg is not up-to-date with last driver, indeed

eec_get_state_cmd cat /sys/class/net/enp1s0f0/device/cgu_state
shall be replaced by
eec_get_state_cmd cat /sys/class/net/enp1s0f0/device/dpll_0_state
thank you

BR
Kar

Building from synce4l-0.9.0 tarball fails

The Makefile uses a git command to get a version string to be printed by the -v option. This command fails when building from the released tarball if not unpacked in a subdirectory of a git repository (in which case the version string is wrong).

Maybe the command could be expanded to check for the .git directory and fall back to a hardcoded version string, which could be update before each release?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.