import CS synce4l-1.1.0-2.el9_4

This commit is contained in:
eabdullin 2024-09-03 08:40:30 +00:00
parent fda4c6377f
commit d8387fe501
11 changed files with 337 additions and 395 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/synce4l-1.0.0.tar.gz SOURCES/synce4l-1.1.0.tar.gz

View File

@ -1 +1 @@
657eba71a2d740660aa32a03c8d1a160ea70d8e8 SOURCES/synce4l-1.0.0.tar.gz b140fb69715e4d8d20fbd7ae763510b2a3986eec SOURCES/synce4l-1.1.0.tar.gz

View File

@ -1,50 +0,0 @@
commit 11cc3508d4b7594e2a429000d162b3582d242c20
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon Nov 6 14:10:42 2023 +0100
Fix printf formats for 32-bit archs
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/config.c b/config.c
index 56fcbbd..723ff84 100644
--- a/config.c
+++ b/config.c
@@ -21,6 +21,7 @@
*/
#include <ctype.h>
#include <float.h>
+#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -767,7 +768,7 @@ config_get_u64(struct config *cfg, const char *section, const char *option)
pr_err("bug: config option %s type mismatch!", option);
exit(-1);
}
- pr_debug("config item %s.%s is %lu (0x%lx)", section, option,
+ pr_debug("config item %s.%s is %"PRIu64" (0x%"PRIx64")", section, option,
ci->val.u64, ci->val.u64);
return ci->val.u64;
}
diff --git a/nl_dpll.c b/nl_dpll.c
index f343de6..4dee01b 100644
--- a/nl_dpll.c
+++ b/nl_dpll.c
@@ -8,6 +8,7 @@
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <linux/rtnetlink.h>
+#include <inttypes.h>
#include <errno.h>
#include "nl_dpll.h"
#include "print.h"
@@ -118,7 +119,7 @@ int nl_dpll_device_id_get(struct nl_sock *sk, struct sk_arg *arg,
pr_err("%s: failed to send request", __func__);
goto msg_free;
}
- pr_debug("DEVICE_ID_GET request sent dpll id: %lu %s, ret:%d",
+ pr_debug("DEVICE_ID_GET request sent dpll id: %"PRIu64" %s, ret:%d",
clock_id, module_name, ret);
arg->err = 0;

View 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);
}

View 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;

View 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 {

View File

@ -1,297 +0,0 @@
commit a59358afe10326096c0e4330d705457a65176bb8
Author: Yochai Hagvi <yochai.hagvi@intel.com>
Date: Thu Nov 30 13:06:01 2023 +0200
synce4l: fix flows moving from best port to SMA
When synce4l best source is changed from port and SMA, due to SMA QL
update, some flows found broken.
on choose_best_source, when best source is changed, ibest_source should
be NULL since dev_update_ql uses the best_port for configuring
on dev_step_line_input, when rebuild_prio is set, this case should be
hit
(ML: backported to 1.0.0)
Signed-off-by: Yochai Hagvi <yochai.hagvi@intel.com>
diff --git a/synce_dev.c b/synce_dev.c
index cd5c787..70936a6 100644
--- a/synce_dev.c
+++ b/synce_dev.c
@@ -525,6 +525,7 @@ static void choose_best_source(struct synce_dev *dev)
dev->name);
} else {
dev->ext_src_is_best = ext_src_is_best;
+ dev->best_source = NULL;
/* if input source is changing
* current input is invalid, send DNU and wait
* for EEC being locked in further dev_step
@@ -555,14 +556,17 @@ static int dev_step_line_input(struct synce_dev *dev)
if (rx_ql_changed(dev)) {
choose_best_source(dev);
- } else if (dev->best_source && dev->best_source->type == PORT) {
- if (synce_port_rx_ql_failed(dev->best_source->port)) {
- synce_port_invalidate_rx_ql(dev->best_source->port);
- force_all_eecs_detach(dev);
- dev_update_ql(dev);
- dev->best_source = NULL;
- choose_best_source(dev);
- }
+ } else if (dev->best_source && dev->best_source->type == PORT &&
+ synce_port_rx_ql_failed(dev->best_source->port)) {
+ synce_port_invalidate_rx_ql(dev->best_source->port);
+ force_all_eecs_detach(dev);
+ dev_update_ql(dev);
+ dev->best_source = NULL;
+ choose_best_source(dev);
+ } else if (dev->rebuild_prio) {
+ choose_best_source(dev);
+ dev_update_ql(dev);
+ dev->rebuild_prio = 0;
}
return ret;
@@ -697,6 +701,7 @@ int synce_dev_init(struct synce_dev *dev, struct config *cfg)
dev->recover_time = config_get_int(cfg, dev->name, "recover_time");
dev->best_source = NULL;
dev->ext_src_is_best = false;
+ dev->rebuild_prio = 0;
eec_get_state_cmd = config_get_string(cfg, dev->name, "eec_get_state_cmd");
ess.holdover = config_get_string(cfg, dev->name, "eec_holdover_value");
ess.locked_ho = config_get_string(cfg, dev->name, "eec_locked_ho_value");
commit 08914289b154ef4467929a84f1b2bf72591e8857
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon Jan 8 16:56:38 2024 +0100
Update port TX QL when external source locks
With multiple external sources, the transmitted QL was wrong if the best
source was not selected. When an external source locks, update the
forced QL of all ports to transmit the correct QL.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/synce_dev.c b/synce_dev.c
index 70936a6..b8bfd0f 100644
--- a/synce_dev.c
+++ b/synce_dev.c
@@ -664,6 +664,10 @@ static int dev_step_dpll(struct synce_dev *dev)
dev->best_source = active;
pr_info("EEC_LOCKED/EEC_LOCKED_HO_ACQ on %s of %s",
dev->best_source->ext_src->name, dev->name);
+ LIST_FOREACH(c, &dev->clock_sources, list) {
+ if (c->type == PORT)
+ set_port_ql_from_ext_src(dev, c->port, active->ext_src);
+ }
dev_update_ql(dev);
} else if (active->type == PORT) {
dev->ext_src_is_best = 0;
commit 0d6452efc885ec30547124b4c5570f4e6039ad69
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed Jan 17 14:15:16 2024 +0100
Add functions for clearing priority of individual pins
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/dpll_mon.c b/dpll_mon.c
index 0f0648c..14e5354 100644
--- a/dpll_mon.c
+++ b/dpll_mon.c
@@ -972,7 +972,7 @@ int set_prio(struct dpll_mon *dm, uint32_t pin_id, uint32_t prio)
dm->dpll_id, prio);
}
-static int dpll_mon_pin_prio_clear(struct dpll_mon *dm, struct dpll_mon_pin *pin)
+int dpll_mon_pin_prio_clear(struct dpll_mon *dm, struct dpll_mon_pin *pin)
{
struct dpll_mon_pin *parent;
struct parent_pin *pp;
diff --git a/dpll_mon.h b/dpll_mon.h
index ec6e8b4..481b5e3 100644
--- a/dpll_mon.h
+++ b/dpll_mon.h
@@ -119,6 +119,15 @@ int dpll_mon_pin_is_active(struct dpll_mon *dm, struct dpll_mon_pin *pin);
int dpll_mon_pin_prio_set(struct dpll_mon *dm, struct dpll_mon_pin *pin,
uint32_t prio);
+/**
+ * Request to reset the priority of a pin to dnu_prio.
+ *
+ * @param dm Instance of dpll mon which owns the pin.
+ * @param pin Valid pointer to a pin.
+ * @return 0 - success, negative - failed to send request
+ */
+int dpll_mon_pin_prio_clear(struct dpll_mon *dm, struct dpll_mon_pin *pin);
+
/**
* Request to set Do Not Use priority on all valid pins for all the pins
* controlled by the dpll_mon's dpll.
diff --git a/synce_clock_source.c b/synce_clock_source.c
index 16ba091..50b21b8 100644
--- a/synce_clock_source.c
+++ b/synce_clock_source.c
@@ -220,3 +220,18 @@ int synce_clock_source_prio_set(struct dpll_mon *dpll_mon,
prio);
return synce_ext_src_prio_set(dpll_mon, clk_src->ext_src, prio);
}
+
+int synce_clock_source_prio_clear(struct dpll_mon *dpll_mon,
+ struct synce_clock_source *clk_src)
+{
+ if (!clk_src) {
+ pr_err("%s clock_source is NULL", __func__);
+ return -ENODEV;
+ }
+ pr_debug("%s: clear prio on %s", __func__,
+ clk_src->type == PORT ? clk_src->port->name :
+ clk_src->ext_src->name);
+ if (clk_src->type == PORT)
+ return synce_port_prio_clear(dpll_mon, clk_src->port);
+ return synce_ext_src_prio_clear(dpll_mon, clk_src->ext_src);
+}
diff --git a/synce_clock_source.h b/synce_clock_source.h
index 80c1327..96e6d26 100644
--- a/synce_clock_source.h
+++ b/synce_clock_source.h
@@ -132,4 +132,14 @@ int synce_clock_source_prio_set(struct dpll_mon *dpll_mon,
struct synce_clock_source *clk_src,
uint32_t prio);
+/**
+ * request to set priority of a clock source pin on a dpll to dnu_prio
+ *
+ * @param dpll_mon Pointer to dpll_mon class
+ * @param clk_src Configured instance
+ * @return 0 - success, error code - failure
+ */
+int synce_clock_source_prio_clear(struct dpll_mon *dpll_mon,
+ struct synce_clock_source *clk_src);
+
#endif /* HAVE_SYNCE_CLOCK_SOURCE_H */
diff --git a/synce_ext_src.c b/synce_ext_src.c
index 7d0debd..d5c94f5 100644
--- a/synce_ext_src.c
+++ b/synce_ext_src.c
@@ -204,3 +204,9 @@ int synce_ext_src_prio_set(struct dpll_mon *dpll_mon,
{
return dpll_mon_pin_prio_set(dpll_mon, ext_src->pin, prio);
}
+
+int synce_ext_src_prio_clear(struct dpll_mon *dpll_mon,
+ struct synce_ext_src *ext_src)
+{
+ return dpll_mon_pin_prio_clear(dpll_mon, ext_src->pin);
+}
diff --git a/synce_ext_src.h b/synce_ext_src.h
index 79e6773..972c254 100644
--- a/synce_ext_src.h
+++ b/synce_ext_src.h
@@ -128,4 +128,14 @@ int synce_ext_src_is_active(struct dpll_mon *dpll_mon,
int synce_ext_src_prio_set(struct dpll_mon *dpll_mon,
struct synce_ext_src *ext_src, uint32_t prio);
+/**
+ * request to set priority of a external source associated pin to dnu_prio
+ *
+ * @param dpll_mon Pointer to dpll_mon class
+ * @param ext_src Configured instance
+ * @return 0 - success, error code - failure
+ */
+int synce_ext_src_prio_clear(struct dpll_mon *dpll_mon,
+ struct synce_ext_src *ext_src);
+
#endif /* HAVE_SYNCE_EXT_SRC_H */
diff --git a/synce_port.c b/synce_port.c
index 93bcee0..93a9f9f 100644
--- a/synce_port.c
+++ b/synce_port.c
@@ -473,3 +473,8 @@ int synce_port_prio_set(struct dpll_mon *dpll_mon, struct synce_port *port,
{
return dpll_mon_pin_prio_set(dpll_mon, port->pin, prio);
}
+
+int synce_port_prio_clear(struct dpll_mon *dpll_mon, struct synce_port *port)
+{
+ return dpll_mon_pin_prio_clear(dpll_mon, port->pin);
+}
diff --git a/synce_port.h b/synce_port.h
index 6f08976..ce07101 100644
--- a/synce_port.h
+++ b/synce_port.h
@@ -192,4 +192,13 @@ int synce_port_is_active(struct dpll_mon *dpll_mon, struct synce_port *port);
int synce_port_prio_set(struct dpll_mon *dpll_mon, struct synce_port *port,
uint32_t prio);
+/**
+ * request to set priority of a port pin on a dpll to dnu_prio
+ *
+ * @param dpll_mon Pointer to dpll_mon class
+ * @param port Configured instance
+ * @return 0 - success, error code - failure
+ */
+int synce_port_prio_clear(struct dpll_mon *dpll_mon, struct synce_port *port);
+
#endif /* HAVE_SYNCE_PORT_H */
commit 977f85ac74720996733c9ecce3cd2cd545a357de
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed Jan 17 14:16:07 2024 +0100
Avoid disconnecting input when rebuilding priority
When rebuilding the input priority (e.g. after a change in the received
QL), avoid temporarily clearing the priority (setting to DNU) of inputs
that will still be usable for synchronization.
This avoids an unnecessary disconnect of the currently locked input
causing a change in the transmitted QL and possibly an infinite loop in
the selection of inputs if the downstream SyncE clock is selecting this
clock as its input.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/synce_dev.c b/synce_dev.c
index b8bfd0f..7800508 100644
--- a/synce_dev.c
+++ b/synce_dev.c
@@ -577,13 +577,14 @@ int rebuild_inputs_prio(struct synce_dev *dev)
struct synce_clock_source *tmp, *tmp_best, **arr, *best, *prev_tmp = NULL;
int i = 0, prio_count;
- if (dpll_mon_pins_prio_dnu_set(dev->dpll_mon)) {
- pr_err("failed to set DNU priorities on %s", dev->name);
- return -EIO;
- }
best = find_dev_best_clock_source(dev);
- if (!best)
+ if (!best) {
+ if (dpll_mon_pins_prio_dnu_set(dev->dpll_mon)) {
+ pr_err("failed to set DNU priorities on %s", dev->name);
+ return -EIO;
+ }
return 0;
+ }
arr = calloc(dev->num_clock_sources, sizeof(*arr));
if (!arr)
return -ENOMEM;
@@ -620,6 +621,13 @@ int rebuild_inputs_prio(struct synce_dev *dev)
}
prio_count = i;
pr_debug("considered valid clock sources num: %d on %s", i, dev->name);
+ LIST_FOREACH(tmp, &dev->clock_sources, list) {
+ for (i = 0; i < prio_count; i++)
+ if (tmp == arr[i])
+ break;
+ if (i == prio_count)
+ synce_clock_source_prio_clear(dev->dpll_mon, tmp);
+ }
for (i = 0; i < prio_count; i++)
synce_clock_source_prio_set(dev->dpll_mon, arr[i], i);
free(arr);

133
SOURCES/synce4l-smc.patch Normal file
View 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);

View 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 */

View File

@ -1,37 +0,0 @@
commit 2ae971b87f05c03bd07d0ce41db59cc522625482
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed Nov 8 15:15:28 2023 +0100
Avoid -Wmaybe-uninitialized warning
This fixes false positives reported by an older gcc:
In file included from dpll_mon.c:17:
dpll_mon.c: In function 'dpll_mon_pin_update':
print.h:54:17: error: 'pin_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]
54 | print(l, x); \
| ^~~~~
dpll_mon.c:334:33: note: 'pin_state' was declared here
334 | uint32_t parent_pin_id, pin_state;
| ^~~~~~~~~
print.h:54:17: error: 'parent_pin_id' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
54 | print(l, x); \
| ^~~~~
dpll_mon.c:334:18: note: 'parent_pin_id' was declared here
334 | uint32_t parent_pin_id, pin_state;
| ^~~~~~~~~~~~~
diff --git a/dpll_mon.c b/dpll_mon.c
index 3cc26cc..0f0648c 100644
--- a/dpll_mon.c
+++ b/dpll_mon.c
@@ -331,7 +331,7 @@ static void update_muxed_pin(struct dpll_mon *dm, uint32_t pin_id,
struct nlattr *a, int exist, int notify)
{
int parent_pin_id_valid = 0, pin_state_valid = 0, rem;
- uint32_t parent_pin_id, pin_state;
+ uint32_t parent_pin_id = 0, pin_state = 0;
struct dpll_mon_pin *pin, *parent;
struct nlattr *an;

View File

@ -1,6 +1,6 @@
Name: synce4l Name: synce4l
Version: 1.0.0 Version: 1.1.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: SyncE implementation for Linux Summary: SyncE implementation for Linux
License: GPL-2.0-or-later License: GPL-2.0-or-later
@ -8,12 +8,16 @@ URL: https://github.com/intel/synce4l
Source0: https://github.com/intel/synce4l/archive/%{version}/synce4l-%{version}.tar.gz Source0: https://github.com/intel/synce4l/archive/%{version}/synce4l-%{version}.tar.gz
Source1: synce4l.service Source1: synce4l.service
# Fix building on 32-bit archs # Fix compiler warnings to avoid build failures with -Werror
Patch1: synce4l-32bit.patch Patch1: synce4l-ccwarns.patch
# Fix false compiler warning # Change default smc socket path and remove existing socket on start
Patch2: synce4l-uninit-warning.patch Patch2: synce4l-smc.patch
# Fix various issues in handling of changes in received/transmitted QL # Fix crash observed with newer E810 firmware
Patch3: synce4l-ql.patch 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: gcc make systemd
BuildRequires: libnl3-devel BuildRequires: libnl3-devel
@ -28,7 +32,7 @@ supported hardware by processing Ethernet Synchronization Messaging Channel
(NIC). (NIC).
%prep %prep
%autosetup %autosetup -p1
sed \ sed \
-e 's|^\(logging_level *\)[0-7]|\16|' \ -e 's|^\(logging_level *\)[0-7]|\16|' \
@ -74,6 +78,12 @@ echo '.so man8/synce4l.8' > $RPM_BUILD_ROOT%{_mandir}/man5/synce4l.conf.5
%{_mandir}/man8/*.8* %{_mandir}/man8/*.8*
%changelog %changelog
* Tue Aug 13 2024 Miroslav Lichvar <mlichvar@redhat.com> 1.1.0-2
- fix requested thread stack size on aarch64 (RHEL-54121)
* Wed Aug 07 2024 Miroslav Lichvar <mlichvar@redhat.com> 1.1.0-1
- update to 1.1.0 (RHEL-52089 RHEL-52090 RHEL-52091 RHEL-52197)
* Mon Feb 19 2024 Miroslav Lichvar <mlichvar@redhat.com> 1.0.0-1 * Mon Feb 19 2024 Miroslav Lichvar <mlichvar@redhat.com> 1.0.0-1
- update to 1.0.0 (RHEL-10089 RHEL-1645 RHEL-17948 RHEL-17949) - update to 1.0.0 (RHEL-10089 RHEL-1645 RHEL-17948 RHEL-17949)