xref: /openbmc/linux/net/hsr/hsr_framereg.h (revision 8622a0e5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2011-2014 Autronica Fire and Security AS
3  *
4  * Author(s):
5  *	2011-2014 Arvid Brodin, arvid.brodin@alten.se
6  */
7 
8 #ifndef __HSR_FRAMEREG_H
9 #define __HSR_FRAMEREG_H
10 
11 #include "hsr_main.h"
12 
13 struct hsr_node;
14 
15 void hsr_del_self_node(struct hsr_priv *hsr);
16 void hsr_del_nodes(struct list_head *node_db);
17 struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
18 			      bool is_sup);
19 void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
20 			  struct hsr_port *port);
21 bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr);
22 
23 void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb);
24 void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
25 			 struct hsr_port *port);
26 
27 void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
28 			   u16 sequence_nr);
29 int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
30 			   u16 sequence_nr);
31 
32 void hsr_prune_nodes(struct timer_list *t);
33 
34 int hsr_create_self_node(struct hsr_priv *hsr,
35 			 unsigned char addr_a[ETH_ALEN],
36 			 unsigned char addr_b[ETH_ALEN]);
37 
38 void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
39 			unsigned char addr[ETH_ALEN]);
40 
41 int hsr_get_node_data(struct hsr_priv *hsr,
42 		      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 
50 struct 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 
62 #endif /* __HSR_FRAMEREG_H */
63