]> git.ipfire.org Git - people/ms/linux.git/blame - net/hsr/hsr_framereg.h
Merge tag 'tegra-for-5.20-arm64-defconfig' of git://git.kernel.org/pub/scm/linux...
[people/ms/linux.git] / net / hsr / hsr_framereg.h
CommitLineData
0e7623bd 1/* SPDX-License-Identifier: GPL-2.0 */
70ebe4a4 2/* Copyright 2011-2014 Autronica Fire and Security AS
f421436a
AB
3 *
4 * Author(s):
70ebe4a4 5 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
8f4c0e01
MK
6 *
7 * include file for HSR and PRP.
f421436a
AB
8 */
9
70ebe4a4
AB
10#ifndef __HSR_FRAMEREG_H
11#define __HSR_FRAMEREG_H
f421436a
AB
12
13#include "hsr_main.h"
14
70ebe4a4 15struct hsr_node;
f421436a 16
451d8123
MK
17struct 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;
23 u16 sequence_nr;
24 bool is_supervision;
25 bool is_vlan;
26 bool is_local_dest;
27 bool is_local_exclusive;
28 bool is_from_san;
29};
30
a0b92e05
JK
31#ifdef CONFIG_LOCKDEP
32int lockdep_hsr_is_held(spinlock_t *lock);
33#else
34#define lockdep_hsr_is_held(lock) 1
35#endif
36
4acc45db 37u32 hsr_mac_hash(struct hsr_priv *hsr, const unsigned char *addr);
a0b92e05 38struct hsr_node *hsr_node_get_first(struct hlist_head *head, spinlock_t *lock);
92a35678 39void hsr_del_self_node(struct hsr_priv *hsr);
4acc45db
JK
40void hsr_del_nodes(struct hlist_head *node_db);
41struct hsr_node *hsr_get_node(struct hsr_port *port, struct hlist_head *node_db,
451d8123
MK
42 struct sk_buff *skb, bool is_sup,
43 enum hsr_port_type rx_port);
44void hsr_handle_sup_frame(struct hsr_frame_info *frame);
f266a683
AB
45bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr);
46
47void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb);
48void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
c5a75911 49 struct hsr_port *port);
f421436a 50
f266a683
AB
51void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
52 u16 sequence_nr);
53int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
54 u16 sequence_nr);
f421436a 55
dda436b7 56void hsr_prune_nodes(struct timer_list *t);
f421436a 57
92a35678 58int hsr_create_self_node(struct hsr_priv *hsr,
39c19fb9
JK
59 const unsigned char addr_a[ETH_ALEN],
60 const unsigned char addr_b[ETH_ALEN]);
f421436a 61
70ebe4a4 62void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
f421436a
AB
63 unsigned char addr[ETH_ALEN]);
64
70ebe4a4 65int hsr_get_node_data(struct hsr_priv *hsr,
f421436a
AB
66 const unsigned char *addr,
67 unsigned char addr_b[ETH_ALEN],
68 unsigned int *addr_b_ifindex,
69 int *if1_age,
70 u16 *if1_seq,
71 int *if2_age,
72 u16 *if2_seq);
73
451d8123
MK
74void prp_handle_san_frame(bool san, enum hsr_port_type port,
75 struct hsr_node *node);
76void prp_update_san_info(struct hsr_node *node, bool is_sup);
77
fc4ecaee 78struct hsr_node {
4acc45db 79 struct hlist_node mac_list;
fc4ecaee
MK
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];
f1764114 86 unsigned long time_out[HSR_PT_PORTS];
451d8123
MK
87 /* if the node is a SAN */
88 bool san_a;
89 bool san_b;
fc4ecaee
MK
90 u16 seq_out[HSR_PT_PORTS];
91 struct rcu_head rcu_head;
92};
93
70ebe4a4 94#endif /* __HSR_FRAMEREG_H */