Commit f1764114 authored by Marco Wenzel's avatar Marco Wenzel Committed by Jakub Kicinski

net: hsr: add support for EntryForgetTime

In IEC 62439-3 EntryForgetTime is defined with a value of 400 ms. When a
node does not send any frame within this time, the sequence number check
for can be ignored. This solves communication issues with Cisco IE 2000
in Redbox mode.

Fixes: f421436a ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
Signed-off-by: default avatarMarco Wenzel <marco.wenzel@a-eberle.de>
Reviewed-by: default avatarGeorge McCollister <george.mccollister@gmail.com>
Tested-by: default avatarGeorge McCollister <george.mccollister@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20210224094653.1440-1-marco.wenzel@a-eberle.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fcd4ba3b
...@@ -164,8 +164,10 @@ static struct hsr_node *hsr_add_node(struct hsr_priv *hsr, ...@@ -164,8 +164,10 @@ static struct hsr_node *hsr_add_node(struct hsr_priv *hsr,
* as initialization. (0 could trigger an spurious ring error warning). * as initialization. (0 could trigger an spurious ring error warning).
*/ */
now = jiffies; now = jiffies;
for (i = 0; i < HSR_PT_PORTS; i++) for (i = 0; i < HSR_PT_PORTS; i++) {
new_node->time_in[i] = now; new_node->time_in[i] = now;
new_node->time_out[i] = now;
}
for (i = 0; i < HSR_PT_PORTS; i++) for (i = 0; i < HSR_PT_PORTS; i++)
new_node->seq_out[i] = seq_out; new_node->seq_out[i] = seq_out;
...@@ -413,9 +415,12 @@ void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port, ...@@ -413,9 +415,12 @@ void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node, int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
u16 sequence_nr) u16 sequence_nr)
{ {
if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type])) if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type]) &&
time_is_after_jiffies(node->time_out[port->type] +
msecs_to_jiffies(HSR_ENTRY_FORGET_TIME)))
return 1; return 1;
node->time_out[port->type] = jiffies;
node->seq_out[port->type] = sequence_nr; node->seq_out[port->type] = sequence_nr;
return 0; return 0;
} }
......
...@@ -75,6 +75,7 @@ struct hsr_node { ...@@ -75,6 +75,7 @@ struct hsr_node {
enum hsr_port_type addr_B_port; enum hsr_port_type addr_B_port;
unsigned long time_in[HSR_PT_PORTS]; unsigned long time_in[HSR_PT_PORTS];
bool time_in_stale[HSR_PT_PORTS]; bool time_in_stale[HSR_PT_PORTS];
unsigned long time_out[HSR_PT_PORTS];
/* if the node is a SAN */ /* if the node is a SAN */
bool san_a; bool san_a;
bool san_b; bool san_b;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define HSR_LIFE_CHECK_INTERVAL 2000 /* ms */ #define HSR_LIFE_CHECK_INTERVAL 2000 /* ms */
#define HSR_NODE_FORGET_TIME 60000 /* ms */ #define HSR_NODE_FORGET_TIME 60000 /* ms */
#define HSR_ANNOUNCE_INTERVAL 100 /* ms */ #define HSR_ANNOUNCE_INTERVAL 100 /* ms */
#define HSR_ENTRY_FORGET_TIME 400 /* ms */
/* By how much may slave1 and slave2 timestamps of latest received frame from /* By how much may slave1 and slave2 timestamps of latest received frame from
* each node differ before we notify of communication problem? * each node differ before we notify of communication problem?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment