blob: c06447780d057540f3338afe43fe7717dbebc322 [file] [log] [blame]
Murali Karicheri0e7623b2019-04-05 13:31:34 -04001/* SPDX-License-Identifier: GPL-2.0 */
Arvid Brodin70ebe4a2014-07-04 23:34:38 +02002/* Copyright 2011-2014 Autronica Fire and Security AS
Arvid Brodinf4214362013-10-30 21:10:47 +01003 *
Arvid Brodinf4214362013-10-30 21:10:47 +01004 * Author(s):
Arvid Brodin70ebe4a2014-07-04 23:34:38 +02005 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
Murali Karicheri8f4c0e02020-07-22 10:40:16 -04006 *
7 * include file for HSR and PRP.
Arvid Brodinf4214362013-10-30 21:10:47 +01008 */
9
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020010#ifndef __HSR_FRAMEREG_H
11#define __HSR_FRAMEREG_H
Arvid Brodinf4214362013-10-30 21:10:47 +010012
13#include "hsr_main.h"
14
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020015struct hsr_node;
Arvid Brodinf4214362013-10-30 21:10:47 +010016
Taehee Yoo92a35672019-12-22 11:26:54 +000017void hsr_del_self_node(struct hsr_priv *hsr);
Cong Wangb9a1e622019-07-03 17:21:13 -070018void hsr_del_nodes(struct list_head *node_db);
Karicheri, Muralidharan675c8da2017-06-12 15:06:26 -040019struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
Arvid Brodinf266a682014-07-04 23:41:03 +020020 bool is_sup);
21void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
22 struct hsr_port *port);
23bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr);
Arvid Brodinf4214362013-10-30 21:10:47 +010024
Arvid Brodinf266a682014-07-04 23:41:03 +020025void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb);
26void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
Arvid Brodinc5a75912014-07-04 23:38:05 +020027 struct hsr_port *port);
Arvid Brodinf4214362013-10-30 21:10:47 +010028
Arvid Brodinf266a682014-07-04 23:41:03 +020029void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
30 u16 sequence_nr);
31int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
32 u16 sequence_nr);
Arvid Brodinf4214362013-10-30 21:10:47 +010033
Kees Cookdda436b2017-10-24 01:46:16 -070034void hsr_prune_nodes(struct timer_list *t);
Arvid Brodinf4214362013-10-30 21:10:47 +010035
Taehee Yoo92a35672019-12-22 11:26:54 +000036int hsr_create_self_node(struct hsr_priv *hsr,
Arvid Brodinf4214362013-10-30 21:10:47 +010037 unsigned char addr_a[ETH_ALEN],
38 unsigned char addr_b[ETH_ALEN]);
39
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020040void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
Arvid Brodinf4214362013-10-30 21:10:47 +010041 unsigned char addr[ETH_ALEN]);
42
Arvid Brodin70ebe4a2014-07-04 23:34:38 +020043int hsr_get_node_data(struct hsr_priv *hsr,
Arvid Brodinf4214362013-10-30 21:10:47 +010044 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 Karicherifc4ecae2019-04-05 13:31:35 -040052struct 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 Brodin70ebe4a2014-07-04 23:34:38 +020064#endif /* __HSR_FRAMEREG_H */