Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_IF_HSR_H_
0003 #define _LINUX_IF_HSR_H_
0004 
0005 #include <linux/types.h>
0006 
0007 struct net_device;
0008 
0009 /* used to differentiate various protocols */
0010 enum hsr_version {
0011     HSR_V0 = 0,
0012     HSR_V1,
0013     PRP_V1,
0014 };
0015 
0016 /* HSR Tag.
0017  * As defined in IEC-62439-3:2010, the HSR tag is really { ethertype = 0x88FB,
0018  * path, LSDU_size, sequence Nr }. But we let eth_header() create { h_dest,
0019  * h_source, h_proto = 0x88FB }, and add { path, LSDU_size, sequence Nr,
0020  * encapsulated protocol } instead.
0021  *
0022  * Field names as defined in the IEC:2010 standard for HSR.
0023  */
0024 struct hsr_tag {
0025     __be16      path_and_LSDU_size;
0026     __be16      sequence_nr;
0027     __be16      encap_proto;
0028 } __packed;
0029 
0030 #define HSR_HLEN    6
0031 
0032 #if IS_ENABLED(CONFIG_HSR)
0033 extern bool is_hsr_master(struct net_device *dev);
0034 extern int hsr_get_version(struct net_device *dev, enum hsr_version *ver);
0035 #else
0036 static inline bool is_hsr_master(struct net_device *dev)
0037 {
0038     return false;
0039 }
0040 static inline int hsr_get_version(struct net_device *dev,
0041                   enum hsr_version *ver)
0042 {
0043     return -EINVAL;
0044 }
0045 #endif /* CONFIG_HSR */
0046 
0047 #endif /*_LINUX_IF_HSR_H_*/