Murali Karicheri | 0e7623b | 2019-04-05 13:31:34 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 2 | /* Copyright 2011-2014 Autronica Fire and Security AS |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 3 | * |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 4 | * Author(s): |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 5 | * 2011-2014 Arvid Brodin, arvid.brodin@alten.se |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame^] | 6 | * |
| 7 | * include file for HSR and PRP. |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 8 | */ |
| 9 | |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 10 | #ifndef __HSR_FRAMEREG_H |
| 11 | #define __HSR_FRAMEREG_H |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 12 | |
| 13 | #include "hsr_main.h" |
| 14 | |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 15 | struct hsr_node; |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 16 | |
Taehee Yoo | 92a3567 | 2019-12-22 11:26:54 +0000 | [diff] [blame] | 17 | void hsr_del_self_node(struct hsr_priv *hsr); |
Cong Wang | b9a1e62 | 2019-07-03 17:21:13 -0700 | [diff] [blame] | 18 | void hsr_del_nodes(struct list_head *node_db); |
Karicheri, Muralidharan | 675c8da | 2017-06-12 15:06:26 -0400 | [diff] [blame] | 19 | struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, |
Arvid Brodin | f266a68 | 2014-07-04 23:41:03 +0200 | [diff] [blame] | 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); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 24 | |
Arvid Brodin | f266a68 | 2014-07-04 23:41:03 +0200 | [diff] [blame] | 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, |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 27 | struct hsr_port *port); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 28 | |
Arvid Brodin | f266a68 | 2014-07-04 23:41:03 +0200 | [diff] [blame] | 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); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 33 | |
Kees Cook | dda436b | 2017-10-24 01:46:16 -0700 | [diff] [blame] | 34 | void hsr_prune_nodes(struct timer_list *t); |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 35 | |
Taehee Yoo | 92a3567 | 2019-12-22 11:26:54 +0000 | [diff] [blame] | 36 | int hsr_create_self_node(struct hsr_priv *hsr, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 37 | unsigned char addr_a[ETH_ALEN], |
| 38 | unsigned char addr_b[ETH_ALEN]); |
| 39 | |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 40 | void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 41 | unsigned char addr[ETH_ALEN]); |
| 42 | |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 43 | int hsr_get_node_data(struct hsr_priv *hsr, |
Arvid Brodin | f421436 | 2013-10-30 21:10:47 +0100 | [diff] [blame] | 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 | |
Murali Karicheri | fc4ecae | 2019-04-05 13:31:35 -0400 | [diff] [blame] | 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 | |
Arvid Brodin | 70ebe4a | 2014-07-04 23:34:38 +0200 | [diff] [blame] | 64 | #endif /* __HSR_FRAMEREG_H */ |