blob: 0f0fa12b432937fdae50dc2f57953fffe238c20b [file] [log] [blame]
Murali Karicheri0e7623b2019-04-05 13:31:34 -04001/* SPDX-License-Identifier: GPL-2.0 */
Arvid Brodin70ebe4a2014-07-04 23:34:38 +02002/* Copyright 2011-2014 Autronica Fire and Security AS
Arvid Brodinf4214362013-10-30 21:10:47 +01003 *
Arvid Brodinf4214362013-10-30 21:10:47 +01004 * Author(s):
Arvid Brodin70ebe4a2014-07-04 23:34:38 +02005 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
Arvid Brodinf4214362013-10-30 21:10:47 +01006 */
7
Arvid Brodin70ebe4a2014-07-04 23:34:38 +02008#ifndef __HSR_FRAMEREG_H
9#define __HSR_FRAMEREG_H
Arvid Brodinf4214362013-10-30 21:10:47 +010010
11#include "hsr_main.h"
12
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020013struct hsr_node;
Arvid Brodinf4214362013-10-30 21:10:47 +010014
Taehee Yoo92a35672019-12-22 11:26:54 +000015void hsr_del_self_node(struct hsr_priv *hsr);
Cong Wangb9a1e622019-07-03 17:21:13 -070016void hsr_del_nodes(struct list_head *node_db);
Karicheri, Muralidharan675c8da2017-06-12 15:06:26 -040017struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
Arvid Brodinf266a682014-07-04 23:41:03 +020018 bool is_sup);
19void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
20 struct hsr_port *port);
21bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr);
Arvid Brodinf4214362013-10-30 21:10:47 +010022
Arvid Brodinf266a682014-07-04 23:41:03 +020023void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb);
24void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
Arvid Brodinc5a75912014-07-04 23:38:05 +020025 struct hsr_port *port);
Arvid Brodinf4214362013-10-30 21:10:47 +010026
Arvid Brodinf266a682014-07-04 23:41:03 +020027void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
28 u16 sequence_nr);
29int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
30 u16 sequence_nr);
Arvid Brodinf4214362013-10-30 21:10:47 +010031
Kees Cookdda436b2017-10-24 01:46:16 -070032void hsr_prune_nodes(struct timer_list *t);
Arvid Brodinf4214362013-10-30 21:10:47 +010033
Taehee Yoo92a35672019-12-22 11:26:54 +000034int hsr_create_self_node(struct hsr_priv *hsr,
Arvid Brodinf4214362013-10-30 21:10:47 +010035 unsigned char addr_a[ETH_ALEN],
36 unsigned char addr_b[ETH_ALEN]);
37
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020038void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
Arvid Brodinf4214362013-10-30 21:10:47 +010039 unsigned char addr[ETH_ALEN]);
40
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020041int hsr_get_node_data(struct hsr_priv *hsr,
Arvid Brodinf4214362013-10-30 21:10:47 +010042 const unsigned char *addr,
43 unsigned char addr_b[ETH_ALEN],
44 unsigned int *addr_b_ifindex,
45 int *if1_age,
46 u16 *if1_seq,
47 int *if2_age,
48 u16 *if2_seq);
49
Murali Karicherifc4ecae2019-04-05 13:31:35 -040050struct hsr_node {
51 struct list_head mac_list;
52 unsigned char macaddress_A[ETH_ALEN];
53 unsigned char macaddress_B[ETH_ALEN];
54 /* Local slave through which AddrB frames are received from this node */
55 enum hsr_port_type addr_B_port;
56 unsigned long time_in[HSR_PT_PORTS];
57 bool time_in_stale[HSR_PT_PORTS];
58 u16 seq_out[HSR_PT_PORTS];
59 struct rcu_head rcu_head;
60};
61
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020062#endif /* __HSR_FRAMEREG_H */