1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2011-2014 Autronica Fire and Security AS
5 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
7 * include file for HSR and PRP.
10 #ifndef __HSR_FRAMEREG_H
11 #define __HSR_FRAMEREG_H
17 struct hsr_frame_info
{
18 struct sk_buff
*skb_std
;
19 struct sk_buff
*skb_hsr
;
20 struct sk_buff
*skb_prp
;
21 struct hsr_port
*port_rcv
;
22 struct hsr_node
*node_src
;
25 bool is_proxy_supervision
;
28 bool is_local_exclusive
;
32 void hsr_del_self_node(struct hsr_priv
*hsr
);
33 void hsr_del_nodes(struct list_head
*node_db
);
34 struct hsr_node
*hsr_get_node(struct hsr_port
*port
, struct list_head
*node_db
,
35 struct sk_buff
*skb
, bool is_sup
,
36 enum hsr_port_type rx_port
);
37 void hsr_handle_sup_frame(struct hsr_frame_info
*frame
);
38 bool hsr_addr_is_self(struct hsr_priv
*hsr
, unsigned char *addr
);
39 bool hsr_addr_is_redbox(struct hsr_priv
*hsr
, unsigned char *addr
);
41 void hsr_addr_subst_source(struct hsr_node
*node
, struct sk_buff
*skb
);
42 void hsr_addr_subst_dest(struct hsr_node
*node_src
, struct sk_buff
*skb
,
43 struct hsr_port
*port
);
45 void hsr_register_frame_in(struct hsr_node
*node
, struct hsr_port
*port
,
47 int hsr_register_frame_out(struct hsr_port
*port
, struct hsr_node
*node
,
50 void hsr_prune_nodes(struct timer_list
*t
);
51 void hsr_prune_proxy_nodes(struct timer_list
*t
);
53 int hsr_create_self_node(struct hsr_priv
*hsr
,
54 const unsigned char addr_a
[ETH_ALEN
],
55 const unsigned char addr_b
[ETH_ALEN
]);
57 void *hsr_get_next_node(struct hsr_priv
*hsr
, void *_pos
,
58 unsigned char addr
[ETH_ALEN
]);
60 int hsr_get_node_data(struct hsr_priv
*hsr
,
61 const unsigned char *addr
,
62 unsigned char addr_b
[ETH_ALEN
],
63 unsigned int *addr_b_ifindex
,
69 void prp_handle_san_frame(bool san
, enum hsr_port_type port
,
70 struct hsr_node
*node
);
71 void prp_update_san_info(struct hsr_node
*node
, bool is_sup
);
73 bool hsr_is_node_in_db(struct list_head
*node_db
,
74 const unsigned char addr
[ETH_ALEN
]);
77 struct list_head mac_list
;
78 /* Protect R/W access to seq_out */
79 spinlock_t seq_out_lock
;
80 unsigned char macaddress_A
[ETH_ALEN
];
81 unsigned char macaddress_B
[ETH_ALEN
];
82 /* Local slave through which AddrB frames are received from this node */
83 enum hsr_port_type addr_B_port
;
84 unsigned long time_in
[HSR_PT_PORTS
];
85 bool time_in_stale
[HSR_PT_PORTS
];
86 unsigned long time_out
[HSR_PT_PORTS
];
87 /* if the node is a SAN */
90 u16 seq_out
[HSR_PT_PORTS
];
92 struct rcu_head rcu_head
;
95 #endif /* __HSR_FRAMEREG_H */