xref: /linux/include/linux/if_hsr.h (revision 0be3ff0c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_IF_HSR_H_
3 #define _LINUX_IF_HSR_H_
4 
5 /* used to differentiate various protocols */
6 enum hsr_version {
7 	HSR_V0 = 0,
8 	HSR_V1,
9 	PRP_V1,
10 };
11 
12 /* HSR Tag.
13  * As defined in IEC-62439-3:2010, the HSR tag is really { ethertype = 0x88FB,
14  * path, LSDU_size, sequence Nr }. But we let eth_header() create { h_dest,
15  * h_source, h_proto = 0x88FB }, and add { path, LSDU_size, sequence Nr,
16  * encapsulated protocol } instead.
17  *
18  * Field names as defined in the IEC:2010 standard for HSR.
19  */
20 struct hsr_tag {
21 	__be16		path_and_LSDU_size;
22 	__be16		sequence_nr;
23 	__be16		encap_proto;
24 } __packed;
25 
26 #define HSR_HLEN	6
27 
28 #if IS_ENABLED(CONFIG_HSR)
29 extern bool is_hsr_master(struct net_device *dev);
30 extern int hsr_get_version(struct net_device *dev, enum hsr_version *ver);
31 #else
32 static inline bool is_hsr_master(struct net_device *dev)
33 {
34 	return false;
35 }
36 static inline int hsr_get_version(struct net_device *dev,
37 				  enum hsr_version *ver)
38 {
39 	return -EINVAL;
40 }
41 #endif /* CONFIG_HSR */
42 
43 #endif /*_LINUX_IF_HSR_H_*/
44