Files
integ/base/linuxptp/debian/bullseye/patches/0056-Fixed-event-port-id-map.patch
Andre Mauricio Zelak 1fff0107f2 phc2sys: Downgrade log message about timeout reading pmc dds,
tpd and pds

Depending upon system load, the read pmc call can timeout. When
it happens the corresponding data set is reset, allowing the HA
algorithm to switch over the current source.

Although the read timeout is undesirable, the error message is
misleading because the failure is mitigated. Downgrade the error
message to notice to disable it in the default log level.

Test Plan:
PASS: Deploy T-BC with single PTP4L instance
 - Load system (stress -c 64 -m 5 -t 60)
   check user.log, phc2sys not showing the error message
   phc2sys: notice [1200995.017] phc-inst2 pmc agent index 0, timeout reading pmc tpd

PASS: Deploy T-BC with single PTP4L instance
 - Adjust the log to debug level
 system ptp-instance-parameter-add phc-inst2 logging_level=7
 - Load system (stress -c 64 -m 5 -t 60)
   check user.log, phc2sys eventually shows the error message
   phc2sys: notice [1215208.628] phc-inst2 pmc agent index 0, timeout reading pmc tpd

PASS: Build linuxptp package

Closes-Bug: 2132273

Change-Id: I3e05de4006c0e35b725178d9e56eaf8c72d52747
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
2025-11-25 17:07:25 -03:00

79 lines
2.8 KiB
Diff

From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 15 Jan 2024 16:19:59 -0300
Subject: [PATCH 56/67] Fixed event port id map
Fixed the port id map in the Port Data Set event handling. The port id
is composed by port number and node index after the HA implementation.
Code tidying. As definition, the port id and the port number are
different. An existing port number variable was rennamed to
prevent missinterpretation.
Code tidying. The HA node state change processing was disabled
when HA feature is not enabled.
Test plan:
PASS: Verify the phc2sys executable recognizes the port in the port
state change event, when -a configuration option is used
PASS: Verify the events in the HA scenario are being recognized
Story: 2010723
Task: 49405
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
---
phc2sys.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/phc2sys.c b/phc2sys.c
index 1f6b6c2..d89fb23 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1638,7 +1638,7 @@ static int do_loop(struct phc2sys_private *priv, struct config *cfg, int subscri
continue;
}
- if (node->new_dds || node->new_tpds || node->new_pds) {
+ if (ha_enabled && (node->new_dds || node->new_tpds || node->new_pds)) {
pr_debug("pmc agent index %d clock state changed by %s%s%s",
node->index, node->new_dds ? "new dds " : "",
node->new_tpds ? "new tpds " : "",
@@ -1789,6 +1789,7 @@ static int phc2sys_recv_subscribed(struct pmc_agent *node, void *context, struct
struct portDS *pds;
struct port *port;
struct clock *clock;
+ unsigned int port_id;
mgt_id = management_tlv_id(msg);
if (mgt_id == excluded)
@@ -1796,7 +1797,8 @@ static int phc2sys_recv_subscribed(struct pmc_agent *node, void *context, struct
switch (mgt_id) {
case MID_PORT_DATA_SET:
pds = (struct portDS *)management_tlv_data(msg);
- port = port_get(priv, pds->portIdentity.portNumber);
+ port_id = PORT_INDEX_TO_PORT_ID(pds->portIdentity.portNumber, node->index);
+ port = port_get(priv, port_id);
if (!port) {
pr_info("received data for unknown port %s",
pid2str(&pds->portIdentity));
@@ -1827,7 +1829,7 @@ static int auto_init_ports(struct phc2sys_private *priv, int add_rt)
struct port *port;
unsigned int i;
struct pmc_agent *node = NULL;
- unsigned int retries, port_number;
+ unsigned int retries, port_id;
LIST_FOREACH(node, &priv->pmc_agents, list) {
retries = 0;
@@ -1875,8 +1877,8 @@ static int auto_init_ports(struct phc2sys_private *priv, int add_rt)
/* ignore ports with software time stamping */
continue;
}
- port_number = PORT_INDEX_TO_PORT_ID(i, node->index);
- port = port_add(priv, port_number, iface);
+ port_id = PORT_INDEX_TO_PORT_ID(i, node->index);
+ port = port_add(priv, port_id, iface);
if (!port)
return -1;
port->state = normalize_state(state);