hsr_main.h (9b031c86506cef9acae45e61339fcf9deaabb793) | hsr_main.h (8f4c0e01789c18674acdf17cae3822b3dc3db715) |
---|---|
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 | 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. |
|
6 */ 7 8#ifndef __HSR_PRIVATE_H 9#define __HSR_PRIVATE_H 10 11#include <linux/netdevice.h> 12#include <linux/list.h> 13 --- 43 unchanged lines hidden (view full) --- 57 * equivalently, the 4 most significant bits of HSR tag byte 14). 58 * 59 * This is unclear in the IEC specification; its definition of MAC addresses 60 * indicates the spec is written with the least significant bit first (to the 61 * left). This, however, would mean that the LSDU field would be split in two 62 * with the path field in-between, which seems strange. I'm guessing the MAC 63 * address definition is in error. 64 */ | 8 */ 9 10#ifndef __HSR_PRIVATE_H 11#define __HSR_PRIVATE_H 12 13#include <linux/netdevice.h> 14#include <linux/list.h> 15 --- 43 unchanged lines hidden (view full) --- 59 * equivalently, the 4 most significant bits of HSR tag byte 14). 60 * 61 * This is unclear in the IEC specification; its definition of MAC addresses 62 * indicates the spec is written with the least significant bit first (to the 63 * left). This, however, would mean that the LSDU field would be split in two 64 * with the path field in-between, which seems strange. I'm guessing the MAC 65 * address definition is in error. 66 */ |
65static inline u16 get_hsr_tag_path(struct hsr_tag *ht) 66{ 67 return ntohs(ht->path_and_LSDU_size) >> 12; 68} | |
69 | 67 |
70static inline u16 get_hsr_tag_LSDU_size(struct hsr_tag *ht) 71{ 72 return ntohs(ht->path_and_LSDU_size) & 0x0FFF; 73} 74 | |
75static inline void set_hsr_tag_path(struct hsr_tag *ht, u16 path) 76{ 77 ht->path_and_LSDU_size = 78 htons((ntohs(ht->path_and_LSDU_size) & 0x0FFF) | (path << 12)); 79} 80 81static inline void set_hsr_tag_LSDU_size(struct hsr_tag *ht, u16 LSDU_size) 82{ --- 15 unchanged lines hidden (view full) --- 98 __u8 HSR_TLV_type; 99 __u8 HSR_TLV_length; 100} __packed; 101 102struct hsr_sup_payload { 103 unsigned char macaddress_A[ETH_ALEN]; 104} __packed; 105 | 68static inline void set_hsr_tag_path(struct hsr_tag *ht, u16 path) 69{ 70 ht->path_and_LSDU_size = 71 htons((ntohs(ht->path_and_LSDU_size) & 0x0FFF) | (path << 12)); 72} 73 74static inline void set_hsr_tag_LSDU_size(struct hsr_tag *ht, u16 LSDU_size) 75{ --- 15 unchanged lines hidden (view full) --- 91 __u8 HSR_TLV_type; 92 __u8 HSR_TLV_length; 93} __packed; 94 95struct hsr_sup_payload { 96 unsigned char macaddress_A[ETH_ALEN]; 97} __packed; 98 |
106static inline u16 get_hsr_stag_path(struct hsr_sup_tag *hst) 107{ 108 return get_hsr_tag_path((struct hsr_tag *)hst); 109} 110 111static inline u16 get_hsr_stag_HSR_ver(struct hsr_sup_tag *hst) 112{ 113 return get_hsr_tag_LSDU_size((struct hsr_tag *)hst); 114} 115 | |
116static inline void set_hsr_stag_path(struct hsr_sup_tag *hst, u16 path) 117{ 118 set_hsr_tag_path((struct hsr_tag *)hst, path); 119} 120 121static inline void set_hsr_stag_HSR_ver(struct hsr_sup_tag *hst, u16 HSR_ver) 122{ 123 set_hsr_tag_LSDU_size((struct hsr_tag *)hst, HSR_ver); --- 21 unchanged lines hidden (view full) --- 145 146struct hsr_port { 147 struct list_head port_list; 148 struct net_device *dev; 149 struct hsr_priv *hsr; 150 enum hsr_port_type type; 151}; 152 | 99static inline void set_hsr_stag_path(struct hsr_sup_tag *hst, u16 path) 100{ 101 set_hsr_tag_path((struct hsr_tag *)hst, path); 102} 103 104static inline void set_hsr_stag_HSR_ver(struct hsr_sup_tag *hst, u16 HSR_ver) 105{ 106 set_hsr_tag_LSDU_size((struct hsr_tag *)hst, HSR_ver); --- 21 unchanged lines hidden (view full) --- 128 129struct hsr_port { 130 struct list_head port_list; 131 struct net_device *dev; 132 struct hsr_priv *hsr; 133 enum hsr_port_type type; 134}; 135 |
136/* used by driver internally to differentiate various protocols */ 137enum hsr_version { 138 HSR_V0 = 0, 139 HSR_V1, 140 PRP_V1, 141}; 142 |
|
153struct hsr_priv { 154 struct rcu_head rcu_head; 155 struct list_head ports; 156 struct list_head node_db; /* Known HSR nodes */ 157 struct list_head self_node_db; /* MACs of slaves */ 158 struct timer_list announce_timer; /* Supervision frame dispatch */ 159 struct timer_list prune_timer; 160 int announce_count; 161 u16 sequence_nr; 162 u16 sup_sequence_nr; /* For HSRv1 separate seq_nr for supervision */ | 143struct hsr_priv { 144 struct rcu_head rcu_head; 145 struct list_head ports; 146 struct list_head node_db; /* Known HSR nodes */ 147 struct list_head self_node_db; /* MACs of slaves */ 148 struct timer_list announce_timer; /* Supervision frame dispatch */ 149 struct timer_list prune_timer; 150 int announce_count; 151 u16 sequence_nr; 152 u16 sup_sequence_nr; /* For HSRv1 separate seq_nr for supervision */ |
163 u8 prot_version; /* Indicate if HSRv0 or HSRv1. */ | 153 enum hsr_version prot_version; /* Indicate if HSRv0, HSRv1 or PRPv1 */ |
164 spinlock_t seqnr_lock; /* locking for sequence_nr */ 165 spinlock_t list_lock; /* locking for node list */ 166 unsigned char sup_multicast_addr[ETH_ALEN]; 167#ifdef CONFIG_DEBUG_FS 168 struct dentry *node_tbl_root; 169#endif 170}; 171 --- 36 unchanged lines hidden --- | 154 spinlock_t seqnr_lock; /* locking for sequence_nr */ 155 spinlock_t list_lock; /* locking for node list */ 156 unsigned char sup_multicast_addr[ETH_ALEN]; 157#ifdef CONFIG_DEBUG_FS 158 struct dentry *node_tbl_root; 159#endif 160}; 161 --- 36 unchanged lines hidden --- |