integ/base/linuxptp/debian/patches/0056-Fixed-event-port-id-ma...

83 lines
2.9 KiB
Diff

From 0520c98e1f21c40079c2d0000133cccb62b160b6 Mon Sep 17 00:00:00 2001
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
Date: Mon, 15 Jan 2024 16:19:59 -0300
Subject: [PATCH 56/56] 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);
--
2.25.1