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