Compare commits
No commits in common. "c8" and "c10s" have entirely different histories.
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
SOURCES/synce4l-9564b5.tar.gz
|
/synce4l-1.1.0.tar.gz
|
||||||
|
@ -1 +0,0 @@
|
|||||||
0ac4868f7b3121b7f8cb58ef5560c4b807a36edd SOURCES/synce4l-9564b5.tar.gz
|
|
@ -1,27 +0,0 @@
|
|||||||
[global]
|
|
||||||
logging_level 6
|
|
||||||
use_syslog 1
|
|
||||||
verbose 0
|
|
||||||
message_tag [synce4l]
|
|
||||||
|
|
||||||
[<synce1>]
|
|
||||||
input_mode line
|
|
||||||
network_option 1
|
|
||||||
external_input_QL 11
|
|
||||||
external_input_ext_QL 33
|
|
||||||
extended_tlv 1
|
|
||||||
recover_time 20
|
|
||||||
eec_get_state_cmd cat /sys/class/net/eth0/device/cgu_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 3,4,7
|
|
||||||
allowed_ext_qls 20,21
|
|
@ -1,78 +0,0 @@
|
|||||||
%global gitver 9564b5589d72ed3571a1f2130204aea60683bd78
|
|
||||||
%global gitrel %(c=%{gitver}; echo ${c:0:6})
|
|
||||||
%global gitdate 20221122
|
|
||||||
|
|
||||||
Name: synce4l
|
|
||||||
Version: 0
|
|
||||||
Release: 4.%{gitdate}git%{gitrel}%{?dist}
|
|
||||||
Summary: SyncE implementation for Linux
|
|
||||||
|
|
||||||
License: GPL-2.0-or-later
|
|
||||||
URL: https://github.com/intel/synce4l
|
|
||||||
Source0: https://github.com/intel/synce4l/archive/%{gitrel}/synce4l-%{gitrel}.tar.gz
|
|
||||||
Source1: synce4l.service
|
|
||||||
Source2: synce4l.conf
|
|
||||||
|
|
||||||
BuildRequires: gcc make systemd
|
|
||||||
|
|
||||||
%{?systemd_requires}
|
|
||||||
|
|
||||||
%description
|
|
||||||
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).
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q -n synce4l-%{gitver}
|
|
||||||
|
|
||||||
%build
|
|
||||||
%{make_build} \
|
|
||||||
EXTRA_CFLAGS="$RPM_OPT_FLAGS" \
|
|
||||||
EXTRA_LDFLAGS="$RPM_LD_FLAGS"
|
|
||||||
|
|
||||||
%install
|
|
||||||
# make_install doesn't work here
|
|
||||||
%makeinstall
|
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir},%{_unitdir},%{_mandir}/man5}
|
|
||||||
install -m 644 -p %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}
|
|
||||||
install -m 644 -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}
|
|
||||||
|
|
||||||
echo '.so man8/synce4l.8' > $RPM_BUILD_ROOT%{_mandir}/man5/synce4l.conf.5
|
|
||||||
|
|
||||||
%check
|
|
||||||
./synce4l -h 2>&1 | grep 'usage:.*synce4l'
|
|
||||||
|
|
||||||
%post
|
|
||||||
%systemd_post synce4l.service
|
|
||||||
|
|
||||||
%preun
|
|
||||||
%systemd_preun synce4l.service
|
|
||||||
|
|
||||||
%postun
|
|
||||||
%systemd_postun_with_restart synce4l.service
|
|
||||||
|
|
||||||
%files
|
|
||||||
%license COPYING
|
|
||||||
%doc README.md
|
|
||||||
%config(noreplace) %{_sysconfdir}/synce4l.conf
|
|
||||||
%{_unitdir}/synce4l.service
|
|
||||||
%{_sbindir}/synce4l
|
|
||||||
%{_mandir}/man5/*.5*
|
|
||||||
%{_mandir}/man8/*.8*
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Tue Jan 03 2023 Miroslav Lichvar <mlichvar@redhat.com> 0-4.20221122git9564b5
|
|
||||||
- update to 20221122git9564b5 (#2019751)
|
|
||||||
|
|
||||||
* Wed Nov 16 2022 Miroslav Lichvar <mlichvar@redhat.com> 0-3.20221114gitca51d5
|
|
||||||
- update to 20221114gitca51d5 (#2141038)
|
|
||||||
|
|
||||||
* Thu Nov 10 2022 Miroslav Lichvar <mlichvar@redhat.com> 0-2.20221108git079577
|
|
||||||
- fix compiler warning (#2141038)
|
|
||||||
- add simple test (#2141038)
|
|
||||||
|
|
||||||
* Tue Nov 08 2022 Miroslav Lichvar <mlichvar@redhat.com> 0-1.20221108git079577
|
|
||||||
- make initial release
|
|
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
--- !Policy
|
||||||
|
product_versions:
|
||||||
|
- rhel-10
|
||||||
|
decision_context: osci_compose_gate
|
||||||
|
rules:
|
||||||
|
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
|||||||
|
SHA512 (synce4l-1.1.0.tar.gz) = d13418f9d229d3b335cf60f4f7a00bb21850d17c3d4f6486e0e13ce7ce6e2435f697b08e69a33980561d34d403148fb40e648eceb2c0b56a5841366d200fd650
|
90
synce4l-ccwarns.patch
Normal file
90
synce4l-ccwarns.patch
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
commit b8089eabc28d665cba462c29aabdb159f0f153a6
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Tue May 28 13:38:13 2024 +0200
|
||||||
|
|
||||||
|
Fix more compiler warnings
|
||||||
|
|
||||||
|
Fix the following warnings observed when -O2 and -D_FORTIFY_SOURCE=2 are
|
||||||
|
added to CFLAGS.
|
||||||
|
|
||||||
|
synce_dev.c: In function ‘rebuild_inputs_prio’:
|
||||||
|
synce_dev.c:610:28: warning: ‘best_c_idx’ may be used uninitialized [-Wmaybe-uninitialized]
|
||||||
|
610 | all[best_c_idx] = NULL;
|
||||||
|
| ^
|
||||||
|
synce_dev.c:582:39: note: ‘best_c_idx’ was declared here
|
||||||
|
582 | int i = 0, prio_count = 0, j, best_c_idx, ret;
|
||||||
|
| ^~~~~~~~~~
|
||||||
|
|
||||||
|
synce_manager.c: In function ‘synce_manager_server_thread’:
|
||||||
|
synce_manager.c:260:9: warning: ‘strncpy’ specified bound 108 equals destination size [-Wstringop-truncation]
|
||||||
|
260 | strncpy(server.sun_path, synce_clock_get_socket_path(clk),
|
||||||
|
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
261 | sizeof(server.sun_path));
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
synce_manager.c:343:20: warning: ‘ret’ may be used uninitialized [-Wmaybe-uninitialized]
|
||||||
|
343 | if (!ret)
|
||||||
|
| ^
|
||||||
|
synce_manager.c:241:26: note: ‘ret’ was declared here
|
||||||
|
241 | int tlv_num = 0, ret, i, resp_len, bytes_read;
|
||||||
|
| ^~~
|
||||||
|
|
||||||
|
synce_manager.c: In function ‘synce_manager_server_thread’:
|
||||||
|
synce_manager.c:346:25: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
|
||||||
|
346 | write(new_socket, response, resp_len);
|
||||||
|
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/synce_dev.c b/synce_dev.c
|
||||||
|
index fc784ed..5e2bbb9 100644
|
||||||
|
--- a/synce_dev.c
|
||||||
|
+++ b/synce_dev.c
|
||||||
|
@@ -579,7 +579,7 @@ static bool source_invalid(struct synce_clock_source *c)
|
||||||
|
int rebuild_inputs_prio(struct synce_dev *dev)
|
||||||
|
{
|
||||||
|
struct synce_clock_source *c, *best_c, **all, **prioritized;
|
||||||
|
- int i = 0, prio_count = 0, j, best_c_idx, ret;
|
||||||
|
+ int i = 0, prio_count = 0, j, best_c_idx = 0, ret;
|
||||||
|
uint32_t prio;
|
||||||
|
|
||||||
|
all = calloc(dev->num_clock_sources, sizeof(*all));
|
||||||
|
diff --git a/synce_manager.c b/synce_manager.c
|
||||||
|
index b9ba08d..598ef7e 100644
|
||||||
|
--- a/synce_manager.c
|
||||||
|
+++ b/synce_manager.c
|
||||||
|
@@ -257,8 +257,8 @@ static void *synce_manager_server_thread(void *arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
server.sun_family = AF_UNIX;
|
||||||
|
- strncpy(server.sun_path, synce_clock_get_socket_path(clk),
|
||||||
|
- sizeof(server.sun_path));
|
||||||
|
+ snprintf(server.sun_path, sizeof(server.sun_path), "%s",
|
||||||
|
+ synce_clock_get_socket_path(clk));
|
||||||
|
|
||||||
|
if (bind(server_fd, (struct sockaddr *)&server, sizeof(server)) < 0) {
|
||||||
|
pr_err("%s Bind failed", __func__);
|
||||||
|
@@ -289,10 +289,12 @@ static void *synce_manager_server_thread(void *arg)
|
||||||
|
bytes_read = recv(new_socket, command, MAX_COMMAND_SIZE, 0);
|
||||||
|
if (bytes_read <= 0) {
|
||||||
|
synce_manager_generate_err_tlv(&err_tlv, "NULL command");
|
||||||
|
+ ret = -1;
|
||||||
|
goto return_response;
|
||||||
|
} else if (bytes_read > MAX_COMMAND_SIZE) {
|
||||||
|
synce_manager_generate_err_tlv(&err_tlv,
|
||||||
|
"Command size exceeds MAX_COMMAND_SIZE");
|
||||||
|
+ ret = -1;
|
||||||
|
goto return_response;
|
||||||
|
}
|
||||||
|
ret = synce_manager_parse_input(command, bytes_read, &tlv_array,
|
||||||
|
@@ -340,8 +342,8 @@ return_response:
|
||||||
|
if (tlv_array)
|
||||||
|
free((void *)tlv_array);
|
||||||
|
|
||||||
|
- if (!ret)
|
||||||
|
- write(new_socket, response, resp_len);
|
||||||
|
+ if (!ret && write(new_socket, response, resp_len) != resp_len)
|
||||||
|
+ ret = -1;
|
||||||
|
close(new_socket);
|
||||||
|
}
|
||||||
|
|
24
synce4l-initpinid.patch
Normal file
24
synce4l-initpinid.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
commit b61dd54c1015692785a1766b15f7f5914f68df70
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Wed Aug 7 14:14:32 2024 +0200
|
||||||
|
|
||||||
|
Initialize pin ID to -1
|
||||||
|
|
||||||
|
When creating the pin structure, initialize the pin ID to -1 to avoid
|
||||||
|
matching an existing pin with ID 0 (e.g. CVL-SDP22 on E810) when a
|
||||||
|
nonexistent pin is specified in the config.
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/dpll_mon.c b/dpll_mon.c
|
||||||
|
index 39659fe..36aa559 100644
|
||||||
|
--- a/dpll_mon.c
|
||||||
|
+++ b/dpll_mon.c
|
||||||
|
@@ -240,6 +240,7 @@ static struct dpll_mon_pin *pin_create(void)
|
||||||
|
}
|
||||||
|
pr_debug("%s %p", __func__, pin);
|
||||||
|
pin->parent_used_by = PARENT_NOT_USED;
|
||||||
|
+ pin->id = -1;
|
||||||
|
STAILQ_INIT(&pin->parents);
|
||||||
|
|
||||||
|
return pin;
|
43
synce4l-noduppin.patch
Normal file
43
synce4l-noduppin.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
commit 11319e050cde0657395d2656e2be4a629b53fb3b
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Mon Aug 5 16:20:49 2024 +0200
|
||||||
|
|
||||||
|
Fix crash in dpll_rt_recv()
|
||||||
|
|
||||||
|
A crash was observed with E810 firmware 4.50 and kernel 6.11-rc1 in
|
||||||
|
dpll_rt_recv() trying to assign pin id to the pin which was removed by
|
||||||
|
remove_no_ifname_pin(). The pin is not a duplicate.
|
||||||
|
|
||||||
|
Add a third parameter to remove_no_ifname_pin() to avoid removing the
|
||||||
|
incorrect pin.
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/dpll_mon.c b/dpll_mon.c
|
||||||
|
index 06b4bce..39659fe 100644
|
||||||
|
--- a/dpll_mon.c
|
||||||
|
+++ b/dpll_mon.c
|
||||||
|
@@ -256,12 +256,12 @@ static void pin_destroy(struct dpll_mon_pin *pin)
|
||||||
|
free(pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
-void remove_no_ifname_pin(struct dpll_mon *dm, uint32_t pin_id)
|
||||||
|
+void remove_no_ifname_pin(struct dpll_mon *dm, uint32_t pin_id, struct dpll_mon_pin *except)
|
||||||
|
{
|
||||||
|
struct dpll_mon_pin *pin;
|
||||||
|
|
||||||
|
STAILQ_FOREACH(pin, &dm->pins, list)
|
||||||
|
- if (pin && pin_id == pin->id && pin->ifname == NULL) {
|
||||||
|
+ if (pin && pin != except && pin_id == pin->id && pin->ifname == NULL) {
|
||||||
|
pr_debug_pin("removed duplicated pin", pin);
|
||||||
|
STAILQ_REMOVE(&dm->pins, pin, dpll_mon_pin, list);
|
||||||
|
pin_destroy(pin);
|
||||||
|
@@ -589,7 +589,7 @@ static int dpll_rt_recv(struct nl_msg *msg, void *arg)
|
||||||
|
goto unlock;
|
||||||
|
pin_id = nla_get_u32(an[DPLL_A_PIN_ID]);
|
||||||
|
if (pin) {
|
||||||
|
- remove_no_ifname_pin(dm, pin_id);
|
||||||
|
+ remove_no_ifname_pin(dm, pin_id, pin);
|
||||||
|
pin->id = pin_id;
|
||||||
|
pr_debug_pin("pin assigned id", pin);
|
||||||
|
} else {
|
133
synce4l-smc.patch
Normal file
133
synce4l-smc.patch
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
commit 6edb7f5a974c8a80f68c7b82b1bde1c1b37b75bb
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Wed Jun 5 12:55:29 2024 +0200
|
||||||
|
|
||||||
|
Change default smc_socket_path to /run/synce4l_socket
|
||||||
|
|
||||||
|
System services should use /run for sockets and other runtime files.
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/README.md b/README.md
|
||||||
|
index 87623a9..c1c1d73 100644
|
||||||
|
--- a/README.md
|
||||||
|
+++ b/README.md
|
||||||
|
@@ -125,7 +125,7 @@ related to a running synce4l instance.
|
||||||
|
| `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 |
|
||||||
|
+| `smc_socket_path` | `/run/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. |
|
||||||
|
|
||||||
|
@@ -200,7 +200,7 @@ logging_level 7
|
||||||
|
use_syslog 0
|
||||||
|
verbose 1
|
||||||
|
message_tag [synce4l]
|
||||||
|
-smc_socket_path /tmp/synce4l_socket
|
||||||
|
+smc_socket_path /run/synce4l_socket
|
||||||
|
|
||||||
|
[<synce1>]
|
||||||
|
network_option 1
|
||||||
|
@@ -239,7 +239,7 @@ logging_level 7
|
||||||
|
use_syslog 0
|
||||||
|
verbose 1
|
||||||
|
message_tag [synce4l]
|
||||||
|
-smc_socket_path /tmp/synce4l_socket
|
||||||
|
+smc_socket_path /run/synce4l_socket
|
||||||
|
|
||||||
|
[<synce1>]
|
||||||
|
network_option 1
|
||||||
|
diff --git a/config.c b/config.c
|
||||||
|
index bb438a6..274c2d3 100644
|
||||||
|
--- a/config.c
|
||||||
|
+++ b/config.c
|
||||||
|
@@ -180,7 +180,7 @@ struct config_item config_tab_synce[] = {
|
||||||
|
GLOB_ITEM_STR("message_tag", NULL),
|
||||||
|
GLOB_ITEM_INT("poll_interval_msec", 20, CLOCK_POLL_INTERVAL_MIN,
|
||||||
|
CLOCK_POLL_INTERVAL_MAX),
|
||||||
|
- GLOB_ITEM_STR("smc_socket_path", "/tmp/synce4l_socket"),
|
||||||
|
+ GLOB_ITEM_STR("smc_socket_path", "/run/synce4l_socket"),
|
||||||
|
GLOB_ITEM_INT("use_syslog", 1, 0, 1),
|
||||||
|
GLOB_ITEM_STR("userDescription", ""),
|
||||||
|
GLOB_ITEM_INT("verbose", 0, 0, 1),
|
||||||
|
diff --git a/configs/synce4l.cfg b/configs/synce4l.cfg
|
||||||
|
index ca12e9f..de92bd1 100644
|
||||||
|
--- a/configs/synce4l.cfg
|
||||||
|
+++ b/configs/synce4l.cfg
|
||||||
|
@@ -7,7 +7,7 @@ logging_level 7
|
||||||
|
use_syslog 0
|
||||||
|
verbose 1
|
||||||
|
message_tag [synce4l]
|
||||||
|
-smc_socket_path /tmp/synce4l_socket
|
||||||
|
+smc_socket_path /run/synce4l_socket
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
diff --git a/configs/synce4l_dpll.cfg b/configs/synce4l_dpll.cfg
|
||||||
|
index b814266..db4bd88 100644
|
||||||
|
--- a/configs/synce4l_dpll.cfg
|
||||||
|
+++ b/configs/synce4l_dpll.cfg
|
||||||
|
@@ -7,7 +7,7 @@ logging_level 6
|
||||||
|
use_syslog 0
|
||||||
|
verbose 1
|
||||||
|
message_tag [synce4l]
|
||||||
|
-smc_socket_path /tmp/synce4l_socket
|
||||||
|
+smc_socket_path /run/synce4l_socket
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
commit 2f50c7a8b98d99220108abb0163696dcfed77635
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Wed Jun 5 13:05:18 2024 +0200
|
||||||
|
|
||||||
|
Check smc_socket_path length
|
||||||
|
|
||||||
|
Exit with an error message if the configured socket path is too long to
|
||||||
|
be bound as a Unix domain socket.
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/synce_manager.c b/synce_manager.c
|
||||||
|
index 598ef7e..a42b823 100644
|
||||||
|
--- a/synce_manager.c
|
||||||
|
+++ b/synce_manager.c
|
||||||
|
@@ -256,6 +256,10 @@ static void *synce_manager_server_thread(void *arg)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (strlen(synce_clock_get_socket_path(clk)) >= sizeof(server.sun_path)) {
|
||||||
|
+ pr_err("%s smc_socket_path is too long", __func__);
|
||||||
|
+ exit(EXIT_FAILURE);
|
||||||
|
+ }
|
||||||
|
server.sun_family = AF_UNIX;
|
||||||
|
snprintf(server.sun_path, sizeof(server.sun_path), "%s",
|
||||||
|
synce_clock_get_socket_path(clk));
|
||||||
|
|
||||||
|
commit b5a9ad4f0aa1fb98e4ac060c91a08d82fe66e7d2
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Wed Jun 5 13:07:04 2024 +0200
|
||||||
|
|
||||||
|
Unlink smc_socket_path before binding
|
||||||
|
|
||||||
|
Remove the Unix domain socket if it already exists (e.g. previous
|
||||||
|
synce4l instance didn't exit cleanly) to avoid failing in the bind()
|
||||||
|
call.
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/synce_manager.c b/synce_manager.c
|
||||||
|
index a42b823..6baf18c 100644
|
||||||
|
--- a/synce_manager.c
|
||||||
|
+++ b/synce_manager.c
|
||||||
|
@@ -264,6 +264,8 @@ static void *synce_manager_server_thread(void *arg)
|
||||||
|
snprintf(server.sun_path, sizeof(server.sun_path), "%s",
|
||||||
|
synce_clock_get_socket_path(clk));
|
||||||
|
|
||||||
|
+ unlink(server.sun_path);
|
||||||
|
+
|
||||||
|
if (bind(server_fd, (struct sockaddr *)&server, sizeof(server)) < 0) {
|
||||||
|
pr_err("%s Bind failed", __func__);
|
||||||
|
exit(EXIT_FAILURE);
|
26
synce4l-stacksize.patch
Normal file
26
synce4l-stacksize.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
commit f134a38219fc390405f488d5eaaa64e7957b29f3
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Tue Aug 13 12:19:24 2024 +0200
|
||||||
|
|
||||||
|
Fix requested thread stack size
|
||||||
|
|
||||||
|
The pthread_attr_setstacksize() call requesting size of 0xffff fails on
|
||||||
|
systems with 64k pages. Request the maximum of 0xffff and
|
||||||
|
PTHREAD_STACK_MIN instead.
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/synce_thread_common.h b/synce_thread_common.h
|
||||||
|
index cf607ac..8db11d7 100644
|
||||||
|
--- a/synce_thread_common.h
|
||||||
|
+++ b/synce_thread_common.h
|
||||||
|
@@ -13,7 +13,8 @@
|
||||||
|
#define MSEC_TO_USEC(X) (X * 1000)
|
||||||
|
#define THREAD_STOP_SLEEP_USEC MSEC_TO_USEC(50)
|
||||||
|
#define THREAD_START_SLEEP_USEC MSEC_TO_USEC(20)
|
||||||
|
-#define SYNCE_THREAD_STACK_SIZE 0xffff
|
||||||
|
+#define SYNCE_THREAD_STACK_SIZE (0xffff > PTHREAD_STACK_MIN ? \
|
||||||
|
+ 0xffff : PTHREAD_STACK_MIN)
|
||||||
|
#define TASK_COMM_LEN 16
|
||||||
|
|
||||||
|
#endif /* HAVE_SYNCE_THREAD_COMMON_H */
|
127
synce4l.spec
Normal file
127
synce4l.spec
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
Name: synce4l
|
||||||
|
Version: 1.1.0
|
||||||
|
Release: 5%{?dist}
|
||||||
|
Summary: SyncE implementation for Linux
|
||||||
|
|
||||||
|
License: GPL-2.0-or-later
|
||||||
|
URL: https://github.com/intel/synce4l
|
||||||
|
Source0: https://github.com/intel/synce4l/archive/%{version}/synce4l-%{version}.tar.gz
|
||||||
|
Source1: synce4l.service
|
||||||
|
|
||||||
|
# Fix compiler warnings to avoid build failures with -Werror
|
||||||
|
Patch1: synce4l-ccwarns.patch
|
||||||
|
# Change default smc socket path and remove existing socket on start
|
||||||
|
Patch2: synce4l-smc.patch
|
||||||
|
# Fix crash observed with newer E810 firmware
|
||||||
|
Patch3: synce4l-noduppin.patch
|
||||||
|
# Fix initial pin ID to not match an existing pin
|
||||||
|
Patch4: synce4l-initpinid.patch
|
||||||
|
# Fix requested thread stack size on aarch64
|
||||||
|
Patch5: synce4l-stacksize.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc make systemd
|
||||||
|
BuildRequires: libnl3-devel
|
||||||
|
|
||||||
|
%{?systemd_requires}
|
||||||
|
|
||||||
|
%description
|
||||||
|
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).
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1
|
||||||
|
|
||||||
|
sed \
|
||||||
|
-e 's|^\(logging_level *\)[0-7]|\16|' \
|
||||||
|
-e 's|^\(use_syslog *\)[01]|\11|' \
|
||||||
|
-e 's|^\(verbose *\)[01]|\10|' \
|
||||||
|
< configs/synce4l_dpll.cfg > synce4l.conf
|
||||||
|
touch -r configs/synce4l_dpll.cfg synce4l.conf
|
||||||
|
|
||||||
|
%build
|
||||||
|
%{make_build} \
|
||||||
|
EXTRA_CFLAGS="$RPM_OPT_FLAGS" \
|
||||||
|
EXTRA_LDFLAGS="$RPM_LD_FLAGS"
|
||||||
|
|
||||||
|
%install
|
||||||
|
# make_install doesn't work here
|
||||||
|
%makeinstall
|
||||||
|
|
||||||
|
mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir},%{_unitdir},%{_mandir}/man5}
|
||||||
|
install -m 644 -p %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}
|
||||||
|
install -m 644 -p synce4l.conf $RPM_BUILD_ROOT%{_sysconfdir}
|
||||||
|
|
||||||
|
echo '.so man8/synce4l.8' > $RPM_BUILD_ROOT%{_mandir}/man5/synce4l.conf.5
|
||||||
|
|
||||||
|
%check
|
||||||
|
./synce4l -h 2>&1 | grep 'usage:.*synce4l'
|
||||||
|
|
||||||
|
%post
|
||||||
|
%systemd_post synce4l.service
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%systemd_preun synce4l.service
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%systemd_postun_with_restart synce4l.service
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license COPYING
|
||||||
|
%doc README.md
|
||||||
|
%config(noreplace) %{_sysconfdir}/synce4l.conf
|
||||||
|
%{_unitdir}/synce4l.service
|
||||||
|
%{_sbindir}/synce4l
|
||||||
|
%{_mandir}/man5/*.5*
|
||||||
|
%{_mandir}/man8/*.8*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.1.0-5
|
||||||
|
- Bump release for October 2024 mass rebuild:
|
||||||
|
Resolves: RHEL-64018
|
||||||
|
|
||||||
|
* Tue Aug 20 2024 Miroslav Lichvar <mlichvar@redhat.com> 1.1.0-4
|
||||||
|
- remove existing smc socket on start (RHEL-40673)
|
||||||
|
- fix crash observed with newer E810 firmware (RHEL-55261)
|
||||||
|
- fix initial pin ID to not match an existing pin (RHEL-55261)
|
||||||
|
- fix requested thread stack size on aarch64 (RHEL-55260)
|
||||||
|
|
||||||
|
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.1.0-3
|
||||||
|
- Bump release for June 2024 mass rebuild
|
||||||
|
|
||||||
|
* Wed Jun 05 2024 Miroslav Lichvar <mlichvar@redhat.com> 1.1.0-2
|
||||||
|
- move smc_socket_path in default config to /run
|
||||||
|
|
||||||
|
* Tue Jun 04 2024 Miroslav Lichvar <mlichvar@redhat.com> 1.1.0-1
|
||||||
|
- update to 1.1.0 (RHEL-39976, RHEL-39467, RHEL-39465, RHEL-39463, RHEL-39454)
|
||||||
|
|
||||||
|
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Nov 06 2023 Miroslav Lichvar <mlichvar@redhat.com> 1.0.0-1
|
||||||
|
- update to 1.0.0
|
||||||
|
- switch default config to use kernel DPLL API
|
||||||
|
|
||||||
|
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.1-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jul 10 2023 Miroslav Lichvar <mlichvar@redhat.com> 0.9.1-1
|
||||||
|
- update to 0.9.1
|
||||||
|
|
||||||
|
* Mon Jun 19 2023 Miroslav Lichvar <mlichvar@redhat.com> 0.9.0-1
|
||||||
|
- update to 0.9.0
|
||||||
|
|
||||||
|
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0-4.20221114gitca51d5
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Nov 16 2022 Miroslav Lichvar <mlichvar@redhat.com> 0-3.20221114gitca51d5
|
||||||
|
- update to 20221114gitca51d5 (#2141038)
|
||||||
|
|
||||||
|
* Thu Nov 10 2022 Miroslav Lichvar <mlichvar@redhat.com> 0-2.20221108git079577
|
||||||
|
- fix compiler warning (#2141038)
|
||||||
|
- add simple test (#2141038)
|
||||||
|
|
||||||
|
* Tue Nov 08 2022 Miroslav Lichvar <mlichvar@redhat.com> 0-1.20221108git079577
|
||||||
|
- make initial release
|
33
tests/defconfig/runtest.sh
Executable file
33
tests/defconfig/runtest.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Test if synce4l can parse default configuration
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# Find a nonexistent network device
|
||||||
|
i=1
|
||||||
|
while ip link show eth$i &> /dev/null; do
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
eth=eth$i
|
||||||
|
|
||||||
|
tmpconf=$(mktemp)
|
||||||
|
|
||||||
|
sed \
|
||||||
|
-e "s/^\[ens.*\]/\[eth$i\]/" \
|
||||||
|
-e "s|/run/synce4l_socket|/doesnotexist/synce4l_socket|" \
|
||||||
|
< /etc/synce4l.conf > "$tmpconf"
|
||||||
|
|
||||||
|
out=$(timeout -s 9 5 synce4l -m -q -l 7 -f "$tmpconf" 2>&1 || :)
|
||||||
|
|
||||||
|
echo "$out" | grep -q "created num_devices:"
|
||||||
|
echo "$out" | grep -q "synce_manager_server_thread Bind failed"
|
||||||
|
|
||||||
|
echo "unknownoption 1" >> "$tmpconf"
|
||||||
|
|
||||||
|
out=$(timeout -s 9 5 synce4l -m -q -l 7 -f "$tmpconf" 2>&1 || :)
|
||||||
|
|
||||||
|
echo "$out" | grep -q "failed to parse configuration file"
|
||||||
|
|
||||||
|
rm "$tmpconf"
|
||||||
|
|
||||||
|
exit 0
|
9
tests/tests.yml
Normal file
9
tests/tests.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-basic
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
tests:
|
||||||
|
- defconfig
|
||||||
|
required_packages:
|
||||||
|
- iproute
|
Loading…
Reference in New Issue
Block a user