File Index
Files and directories
Sign in
FILE

hsr_framereg.h

File preview with syntax highlighting.

linux-6.19.14/net/hsr/hsr_framereg.h C
 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 * include file for HSR and PRP.
 8 */
 9
10#ifndef __HSR_FRAMEREG_H
11#define __HSR_FRAMEREG_H
12
13#include "hsr_main.h"
14
15struct hsr_node;
16
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_proxy_supervision;
26	bool is_vlan;
27	bool is_local_dest;
28	bool is_local_exclusive;
29	bool is_from_san;
30};
31
32void hsr_del_self_node(struct hsr_priv *hsr);
33void hsr_del_nodes(struct list_head *node_db);
34struct 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);
37void hsr_handle_sup_frame(struct hsr_frame_info *frame);
38bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr);
39bool hsr_addr_is_redbox(struct hsr_priv *hsr, unsigned char *addr);
40
41void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb);
42void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
43			 struct hsr_port *port);
44
45void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
46			   u16 sequence_nr);
47int hsr_register_frame_out(struct hsr_port *port, struct hsr_frame_info *frame);
48
49void hsr_prune_nodes(struct timer_list *t);
50void hsr_prune_proxy_nodes(struct timer_list *t);
51
52int hsr_create_self_node(struct hsr_priv *hsr,
53			 const unsigned char addr_a[ETH_ALEN],
54			 const unsigned char addr_b[ETH_ALEN]);
55
56void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
57			unsigned char addr[ETH_ALEN]);
58
59int hsr_get_node_data(struct hsr_priv *hsr,
60		      const unsigned char *addr,
61		      unsigned char addr_b[ETH_ALEN],
62		      unsigned int *addr_b_ifindex,
63		      int *if1_age,
64		      u16 *if1_seq,
65		      int *if2_age,
66		      u16 *if2_seq);
67
68void prp_handle_san_frame(bool san, enum hsr_port_type port,
69			  struct hsr_node *node);
70void prp_update_san_info(struct hsr_node *node, bool is_sup);
71
72bool hsr_is_node_in_db(struct list_head *node_db,
73		       const unsigned char addr[ETH_ALEN]);
74
75int prp_register_frame_out(struct hsr_port *port, struct hsr_frame_info *frame);
76
77struct hsr_node {
78	struct list_head	mac_list;
79	/* Protect R/W access to seq_out */
80	spinlock_t		seq_out_lock;
81	unsigned char		macaddress_A[ETH_ALEN];
82	unsigned char		macaddress_B[ETH_ALEN];
83	/* Local slave through which AddrB frames are received from this node */
84	enum hsr_port_type	addr_B_port;
85	unsigned long		time_in[HSR_PT_PORTS];
86	bool			time_in_stale[HSR_PT_PORTS];
87	unsigned long		time_out[HSR_PT_PORTS];
88	/* if the node is a SAN */
89	bool			san_a;
90	bool			san_b;
91	u16			seq_out[HSR_PT_PORTS];
92	bool			removed;
93	/* PRP specific duplicate handling */
94	u16			seq_expected[HSR_PT_PORTS];
95	u16			seq_start[HSR_PT_PORTS];
96	struct rcu_head		rcu_head;
97};
98
99#endif /* __HSR_FRAMEREG_H */
~/ Read-only file preview.