xref: /openbmc/linux/net/hsr/hsr_framereg.h (revision b830f94f)
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 list_head *self_node_db);
16 void hsr_del_nodes(struct list_head *node_db);
17 struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[],
18 			      u16 seq_out);
19 struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
20 			      bool is_sup);
21 void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
22 			  struct hsr_port *port);
23 bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr);
24 
25 void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb);
26 void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
27 			 struct hsr_port *port);
28 
29 void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
30 			   u16 sequence_nr);
31 int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
32 			   u16 sequence_nr);
33 
34 void hsr_prune_nodes(struct timer_list *t);
35 
36 int hsr_create_self_node(struct list_head *self_node_db,
37 			 unsigned char addr_a[ETH_ALEN],
38 			 unsigned char addr_b[ETH_ALEN]);
39 
40 void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
41 			unsigned char addr[ETH_ALEN]);
42 
43 int hsr_get_node_data(struct hsr_priv *hsr,
44 		      const unsigned char *addr,
45 		      unsigned char addr_b[ETH_ALEN],
46 		      unsigned int *addr_b_ifindex,
47 		      int *if1_age,
48 		      u16 *if1_seq,
49 		      int *if2_age,
50 		      u16 *if2_seq);
51 
52 struct hsr_node {
53 	struct list_head	mac_list;
54 	unsigned char		macaddress_A[ETH_ALEN];
55 	unsigned char		macaddress_B[ETH_ALEN];
56 	/* Local slave through which AddrB frames are received from this node */
57 	enum hsr_port_type	addr_B_port;
58 	unsigned long		time_in[HSR_PT_PORTS];
59 	bool			time_in_stale[HSR_PT_PORTS];
60 	u16			seq_out[HSR_PT_PORTS];
61 	struct rcu_head		rcu_head;
62 };
63 
64 #endif /* __HSR_FRAMEREG_H */
65