External source never selected in legacy mode (no dpll subsystem)
- Dominant language
- C
- Stars
- 29
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
### Introduction
I am working on a server equipped with an Intel E810 NIC with a GNSS module connected.
The goal is to configure the system so that this NIC acts as a synchronization source, distributing both PTP and SyncE to other connected devices.
In practice, the server should operate as a Telecom Grandmaster (T-GM) and provide timing and frequency synchronization to downstream network elements.
### Description
When running synce4l in legacy mode (using `eec_get_state_cmd` without `clock_id`, i.e. `dpll_mon = NULL`), an external source (e.g. GNSS via SMA1) is never selected as best source.
All ports remain stuck transmitting `DNU (QL=0xF)` even though the EEC reports `EEC_LOCKED_HO_ACQ`.
### Analisys
In `synce_dev_init()`, `rebuild_prio` is initialized to `0` and never set to `1` before the first `synce_dev_step()` call.
The only runtime path that sets `rebuild_prio = 1` is in `update_dev_state()`:
```
if (dev->dpll_mon != NULL) {
dev->rebuild_prio = 1;
}
```
This condition requires `dev->dpll_mon != NULL`, so it never triggers in legacy mode.
As a result, in `dev_step_line_input()`, the branch that triggers `choose_best_source()` is never entered:
```
if (dev->rebuild_prio) {
choose_best_source(dev);
}
```
Since external sources do not generate `rx_ql_changed` events (they are not ports), `choose_best_source()` is never called and the external source is never selected.
### How I get it working:
Add `dev->rebuild_prio = 1;` at the end of `synce_dev_init()`, after `force_all_eecs_detach()`:
```
void synce_dev_init(...) {
...
dev->rebuild_prio = 1;
...
}
```
(added on line 847 https://github.com/intel/synce4l/blob/main/synce_dev.c#L847)
##Configuration to reproduce:
```
[]
network_option 1
extended_tlv 0
recover_time 20
module_name ice
eec_get_state_cmd cat /sys/class/net/ens17f0np0/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
[ens17f0np0]
tx_heartbeat_msec 1000
rx_heartbeat_msec 500
[{SMA1}]
board_label SMA1
input_QL 0x2
input_ext_QL 0x20
internal_prio 1
external_enable_cmd /bin/true
external_disable_cmd /bin/true
```
[not-working.log](https://github.com/user-attachments/files/28223244/not-working.log)
[working.log](https://github.com/user-attachments/files/28223245/working.log)
I am relatively new to synce4l and SyncE configuration in general, so I would also like to ask whether I might be missing something in my setup that could explain this behavior.
From my understanding, the external GNSS source should be selected as the best source in this scenario, but I might be overlooking some configuration detail or expected behavior in legacy mode.
Any feedback or guidance would be greatly appreciated.
Contributor guide
Assessment
This issue has not been assessed yet.