hsr_main.h (c5a7591172100269e426cf630da0f2dc8138a206) hsr_main.h (f266a683a4804dc499efc6c2206ef68efed029d0)
1/* Copyright 2011-2014 Autronica Fire and Security AS
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation; either version 2 of the License, or (at your option)
6 * any later version.
7 *
8 * Author(s):

--- 15 unchanged lines hidden (view full) ---

24#define HSR_NODE_FORGET_TIME 60000 /* ms */
25#define HSR_ANNOUNCE_INTERVAL 100 /* ms */
26
27
28/* By how much may slave1 and slave2 timestamps of latest received frame from
29 * each node differ before we notify of communication problem?
30 */
31#define MAX_SLAVE_DIFF 3000 /* ms */
1/* Copyright 2011-2014 Autronica Fire and Security AS
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation; either version 2 of the License, or (at your option)
6 * any later version.
7 *
8 * Author(s):

--- 15 unchanged lines hidden (view full) ---

24#define HSR_NODE_FORGET_TIME 60000 /* ms */
25#define HSR_ANNOUNCE_INTERVAL 100 /* ms */
26
27
28/* By how much may slave1 and slave2 timestamps of latest received frame from
29 * each node differ before we notify of communication problem?
30 */
31#define MAX_SLAVE_DIFF 3000 /* ms */
32#define HSR_SEQNR_START (USHRT_MAX - 1024)
32
33
34/* How often shall we check for broken ring and remove node entries older than
35 * HSR_NODE_FORGET_TIME?
36 */
37#define PRUNE_PERIOD 3000 /* ms */
38
39

--- 108 unchanged lines hidden (view full) ---

148struct hsr_port {
149 struct list_head port_list;
150 struct net_device *dev;
151 struct hsr_priv *hsr;
152 enum hsr_port_type type;
153};
154
155struct hsr_priv {
33
34
35/* How often shall we check for broken ring and remove node entries older than
36 * HSR_NODE_FORGET_TIME?
37 */
38#define PRUNE_PERIOD 3000 /* ms */
39
40

--- 108 unchanged lines hidden (view full) ---

149struct hsr_port {
150 struct list_head port_list;
151 struct net_device *dev;
152 struct hsr_priv *hsr;
153 enum hsr_port_type type;
154};
155
156struct hsr_priv {
156 struct list_head hsr_list; /* List of hsr devices */
157 struct rcu_head rcu_head;
158 struct list_head ports;
157 struct rcu_head rcu_head;
158 struct list_head ports;
159 struct list_head node_db; /* Other HSR nodes */
159 struct list_head node_db; /* Known HSR nodes */
160 struct list_head self_node_db; /* MACs of slaves */
161 struct timer_list announce_timer; /* Supervision frame dispatch */
162 struct timer_list prune_timer;
163 int announce_count;
164 u16 sequence_nr;
165 spinlock_t seqnr_lock; /* locking for sequence_nr */
166 unsigned char sup_multicast_addr[ETH_ALEN];
167};
168
160 struct list_head self_node_db; /* MACs of slaves */
161 struct timer_list announce_timer; /* Supervision frame dispatch */
162 struct timer_list prune_timer;
163 int announce_count;
164 u16 sequence_nr;
165 spinlock_t seqnr_lock; /* locking for sequence_nr */
166 unsigned char sup_multicast_addr[ETH_ALEN];
167};
168
169#define hsr_for_each_port(hsr, port) \
170 list_for_each_entry_rcu((port), &(hsr)->ports, port_list)
171
169struct hsr_port *hsr_port_get_hsr(struct hsr_priv *hsr, enum hsr_port_type pt);
170
172struct hsr_port *hsr_port_get_hsr(struct hsr_priv *hsr, enum hsr_port_type pt);
173
174/* Caller must ensure skb is a valid HSR frame */
175static inline u16 hsr_get_skb_sequence_nr(struct sk_buff *skb)
176{
177 struct hsr_ethhdr *hsr_ethhdr;
178
179 hsr_ethhdr = (struct hsr_ethhdr *) skb_mac_header(skb);
180 return ntohs(hsr_ethhdr->hsr_tag.sequence_nr);
181}
182
171#endif /* __HSR_PRIVATE_H */
183#endif /* __HSR_PRIVATE_H */