hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/net/hsr/hsr_framereg.c
....@@ -1,9 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /* 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.
73 *
84 * Author(s):
95 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
....@@ -12,6 +8,7 @@
128 * interface. A frame is identified by its source MAC address and its HSR
139 * sequence number. This code keeps track of senders and their sequence numbers
1410 * to allow filtering of duplicate frames, and to detect HSR ring errors.
11
+ * Same code handles filtering of duplicates for PRP as well.
1512 */
1613
1714 #include <linux/if_ether.h>
....@@ -22,22 +19,7 @@
2219 #include "hsr_framereg.h"
2320 #include "hsr_netlink.h"
2421
25
-
26
-struct hsr_node {
27
- struct list_head mac_list;
28
- unsigned char MacAddressA[ETH_ALEN];
29
- unsigned char MacAddressB[ETH_ALEN];
30
- /* Local slave through which AddrB frames are received from this node */
31
- enum hsr_port_type AddrB_port;
32
- unsigned long time_in[HSR_PT_PORTS];
33
- bool time_in_stale[HSR_PT_PORTS];
34
- u16 seq_out[HSR_PT_PORTS];
35
- struct rcu_head rcu_head;
36
-};
37
-
38
-
3922 /* TODO: use hash lists for mac addresses (linux/jhash.h)? */
40
-
4123
4224 /* seq_nr_after(a, b) - return true if a is after (higher in sequence than) b,
4325 * false otherwise.
....@@ -47,15 +29,14 @@
4729 /* Remove inconsistency where
4830 * seq_nr_after(a, b) == seq_nr_before(a, b)
4931 */
50
- if ((int) b - a == 32768)
32
+ if ((int)b - a == 32768)
5133 return false;
5234
53
- return (((s16) (b - a)) < 0);
35
+ return (((s16)(b - a)) < 0);
5436 }
55
-#define seq_nr_before(a, b) seq_nr_after((b), (a))
56
-#define seq_nr_after_or_eq(a, b) (!seq_nr_before((a), (b)))
57
-#define seq_nr_before_or_eq(a, b) (!seq_nr_after((a), (b)))
5837
38
+#define seq_nr_before(a, b) seq_nr_after((b), (a))
39
+#define seq_nr_before_or_eq(a, b) (!seq_nr_after((a), (b)))
5940
6041 bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr)
6142 {
....@@ -68,9 +49,9 @@
6849 return false;
6950 }
7051
71
- if (ether_addr_equal(addr, node->MacAddressA))
52
+ if (ether_addr_equal(addr, node->macaddress_A))
7253 return true;
73
- if (ether_addr_equal(addr, node->MacAddressB))
54
+ if (ether_addr_equal(addr, node->macaddress_B))
7455 return true;
7556
7657 return false;
....@@ -78,152 +59,231 @@
7859
7960 /* Search for mac entry. Caller must hold rcu read lock.
8061 */
81
-static struct hsr_node *find_node_by_AddrA(struct list_head *node_db,
82
- const unsigned char addr[ETH_ALEN])
62
+static struct hsr_node *find_node_by_addr_A(struct list_head *node_db,
63
+ const unsigned char addr[ETH_ALEN])
8364 {
8465 struct hsr_node *node;
8566
8667 list_for_each_entry_rcu(node, node_db, mac_list) {
87
- if (ether_addr_equal(node->MacAddressA, addr))
68
+ if (ether_addr_equal(node->macaddress_A, addr))
8869 return node;
8970 }
9071
9172 return NULL;
9273 }
9374
94
-
9575 /* Helper for device init; the self_node_db is used in hsr_rcv() to recognize
9676 * frames from self that's been looped over the HSR ring.
9777 */
98
-int hsr_create_self_node(struct list_head *self_node_db,
78
+int hsr_create_self_node(struct hsr_priv *hsr,
9979 unsigned char addr_a[ETH_ALEN],
10080 unsigned char addr_b[ETH_ALEN])
10181 {
82
+ struct list_head *self_node_db = &hsr->self_node_db;
10283 struct hsr_node *node, *oldnode;
10384
10485 node = kmalloc(sizeof(*node), GFP_KERNEL);
10586 if (!node)
10687 return -ENOMEM;
10788
108
- ether_addr_copy(node->MacAddressA, addr_a);
109
- ether_addr_copy(node->MacAddressB, addr_b);
89
+ ether_addr_copy(node->macaddress_A, addr_a);
90
+ ether_addr_copy(node->macaddress_B, addr_b);
11091
111
- rcu_read_lock();
92
+ spin_lock_bh(&hsr->list_lock);
11293 oldnode = list_first_or_null_rcu(self_node_db,
113
- struct hsr_node, mac_list);
94
+ struct hsr_node, mac_list);
11495 if (oldnode) {
11596 list_replace_rcu(&oldnode->mac_list, &node->mac_list);
116
- rcu_read_unlock();
117
- synchronize_rcu();
118
- kfree(oldnode);
97
+ spin_unlock_bh(&hsr->list_lock);
98
+ kfree_rcu(oldnode, rcu_head);
11999 } else {
120
- rcu_read_unlock();
121100 list_add_tail_rcu(&node->mac_list, self_node_db);
101
+ spin_unlock_bh(&hsr->list_lock);
122102 }
123103
124104 return 0;
125105 }
126106
127
-void hsr_del_node(struct list_head *self_node_db)
107
+void hsr_del_self_node(struct hsr_priv *hsr)
128108 {
109
+ struct list_head *self_node_db = &hsr->self_node_db;
129110 struct hsr_node *node;
130111
131
- rcu_read_lock();
112
+ spin_lock_bh(&hsr->list_lock);
132113 node = list_first_or_null_rcu(self_node_db, struct hsr_node, mac_list);
133
- rcu_read_unlock();
134114 if (node) {
135115 list_del_rcu(&node->mac_list);
136
- kfree(node);
116
+ kfree_rcu(node, rcu_head);
137117 }
118
+ spin_unlock_bh(&hsr->list_lock);
138119 }
139120
140
-/* Allocate an hsr_node and add it to node_db. 'addr' is the node's AddressA;
121
+void hsr_del_nodes(struct list_head *node_db)
122
+{
123
+ struct hsr_node *node;
124
+ struct hsr_node *tmp;
125
+
126
+ list_for_each_entry_safe(node, tmp, node_db, mac_list)
127
+ kfree(node);
128
+}
129
+
130
+void prp_handle_san_frame(bool san, enum hsr_port_type port,
131
+ struct hsr_node *node)
132
+{
133
+ /* Mark if the SAN node is over LAN_A or LAN_B */
134
+ if (port == HSR_PT_SLAVE_A) {
135
+ node->san_a = true;
136
+ return;
137
+ }
138
+
139
+ if (port == HSR_PT_SLAVE_B)
140
+ node->san_b = true;
141
+}
142
+
143
+/* Allocate an hsr_node and add it to node_db. 'addr' is the node's address_A;
141144 * seq_out is used to initialize filtering of outgoing duplicate frames
142145 * originating from the newly added node.
143146 */
144
-struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[],
145
- u16 seq_out)
147
+static struct hsr_node *hsr_add_node(struct hsr_priv *hsr,
148
+ struct list_head *node_db,
149
+ unsigned char addr[],
150
+ u16 seq_out, bool san,
151
+ enum hsr_port_type rx_port)
146152 {
147
- struct hsr_node *node;
153
+ struct hsr_node *new_node, *node;
148154 unsigned long now;
149155 int i;
150156
151
- node = kzalloc(sizeof(*node), GFP_ATOMIC);
152
- if (!node)
157
+ new_node = kzalloc(sizeof(*new_node), GFP_ATOMIC);
158
+ if (!new_node)
153159 return NULL;
154160
155
- ether_addr_copy(node->MacAddressA, addr);
161
+ ether_addr_copy(new_node->macaddress_A, addr);
162
+ spin_lock_init(&new_node->seq_out_lock);
156163
157164 /* We are only interested in time diffs here, so use current jiffies
158165 * as initialization. (0 could trigger an spurious ring error warning).
159166 */
160167 now = jiffies;
168
+ for (i = 0; i < HSR_PT_PORTS; i++) {
169
+ new_node->time_in[i] = now;
170
+ new_node->time_out[i] = now;
171
+ }
161172 for (i = 0; i < HSR_PT_PORTS; i++)
162
- node->time_in[i] = now;
163
- for (i = 0; i < HSR_PT_PORTS; i++)
164
- node->seq_out[i] = seq_out;
173
+ new_node->seq_out[i] = seq_out;
165174
166
- list_add_tail_rcu(&node->mac_list, node_db);
175
+ if (san && hsr->proto_ops->handle_san_frame)
176
+ hsr->proto_ops->handle_san_frame(san, rx_port, new_node);
167177
178
+ spin_lock_bh(&hsr->list_lock);
179
+ list_for_each_entry_rcu(node, node_db, mac_list,
180
+ lockdep_is_held(&hsr->list_lock)) {
181
+ if (ether_addr_equal(node->macaddress_A, addr))
182
+ goto out;
183
+ if (ether_addr_equal(node->macaddress_B, addr))
184
+ goto out;
185
+ }
186
+ list_add_tail_rcu(&new_node->mac_list, node_db);
187
+ spin_unlock_bh(&hsr->list_lock);
188
+ return new_node;
189
+out:
190
+ spin_unlock_bh(&hsr->list_lock);
191
+ kfree(new_node);
168192 return node;
193
+}
194
+
195
+void prp_update_san_info(struct hsr_node *node, bool is_sup)
196
+{
197
+ if (!is_sup)
198
+ return;
199
+
200
+ node->san_a = false;
201
+ node->san_b = false;
169202 }
170203
171204 /* Get the hsr_node from which 'skb' was sent.
172205 */
173
-struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
174
- bool is_sup)
206
+struct hsr_node *hsr_get_node(struct hsr_port *port, struct list_head *node_db,
207
+ struct sk_buff *skb, bool is_sup,
208
+ enum hsr_port_type rx_port)
175209 {
176
- struct list_head *node_db = &port->hsr->node_db;
210
+ struct hsr_priv *hsr = port->hsr;
177211 struct hsr_node *node;
178212 struct ethhdr *ethhdr;
213
+ struct prp_rct *rct;
214
+ bool san = false;
179215 u16 seq_out;
180216
181217 if (!skb_mac_header_was_set(skb))
182218 return NULL;
183219
184
- ethhdr = (struct ethhdr *) skb_mac_header(skb);
220
+ ethhdr = (struct ethhdr *)skb_mac_header(skb);
185221
186222 list_for_each_entry_rcu(node, node_db, mac_list) {
187
- if (ether_addr_equal(node->MacAddressA, ethhdr->h_source))
223
+ if (ether_addr_equal(node->macaddress_A, ethhdr->h_source)) {
224
+ if (hsr->proto_ops->update_san_info)
225
+ hsr->proto_ops->update_san_info(node, is_sup);
188226 return node;
189
- if (ether_addr_equal(node->MacAddressB, ethhdr->h_source))
227
+ }
228
+ if (ether_addr_equal(node->macaddress_B, ethhdr->h_source)) {
229
+ if (hsr->proto_ops->update_san_info)
230
+ hsr->proto_ops->update_san_info(node, is_sup);
190231 return node;
232
+ }
191233 }
192234
193
- /* Everyone may create a node entry, connected node to a HSR device. */
194
-
195
- if (ethhdr->h_proto == htons(ETH_P_PRP)
196
- || ethhdr->h_proto == htons(ETH_P_HSR)) {
235
+ /* Everyone may create a node entry, connected node to a HSR/PRP
236
+ * device.
237
+ */
238
+ if (ethhdr->h_proto == htons(ETH_P_PRP) ||
239
+ ethhdr->h_proto == htons(ETH_P_HSR)) {
197240 /* Use the existing sequence_nr from the tag as starting point
198241 * for filtering duplicate frames.
199242 */
200243 seq_out = hsr_get_skb_sequence_nr(skb) - 1;
201244 } else {
202
- /* this is called also for frames from master port and
203
- * so warn only for non master ports
204
- */
205
- if (port->type != HSR_PT_MASTER)
206
- WARN_ONCE(1, "%s: Non-HSR frame\n", __func__);
207
- seq_out = HSR_SEQNR_START;
245
+ rct = skb_get_PRP_rct(skb);
246
+ if (rct && prp_check_lsdu_size(skb, rct, is_sup)) {
247
+ seq_out = prp_get_skb_sequence_nr(rct);
248
+ } else {
249
+ if (rx_port != HSR_PT_MASTER)
250
+ san = true;
251
+ seq_out = HSR_SEQNR_START;
252
+ }
208253 }
209254
210
- return hsr_add_node(node_db, ethhdr->h_source, seq_out);
255
+ return hsr_add_node(hsr, node_db, ethhdr->h_source, seq_out,
256
+ san, rx_port);
211257 }
212258
213
-/* Use the Supervision frame's info about an eventual MacAddressB for merging
214
- * nodes that has previously had their MacAddressB registered as a separate
259
+/* Use the Supervision frame's info about an eventual macaddress_B for merging
260
+ * nodes that has previously had their macaddress_B registered as a separate
215261 * node.
216262 */
217
-void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
218
- struct hsr_port *port_rcv)
263
+void hsr_handle_sup_frame(struct hsr_frame_info *frame)
219264 {
220
- struct ethhdr *ethhdr;
221
- struct hsr_node *node_real;
265
+ struct hsr_node *node_curr = frame->node_src;
266
+ struct hsr_port *port_rcv = frame->port_rcv;
267
+ struct hsr_priv *hsr = port_rcv->hsr;
222268 struct hsr_sup_payload *hsr_sp;
269
+ struct hsr_node *node_real;
270
+ struct sk_buff *skb = NULL;
223271 struct list_head *node_db;
272
+ struct ethhdr *ethhdr;
224273 int i;
225274
226
- ethhdr = (struct ethhdr *) skb_mac_header(skb);
275
+ /* Here either frame->skb_hsr or frame->skb_prp should be
276
+ * valid as supervision frame always will have protocol
277
+ * header info.
278
+ */
279
+ if (frame->skb_hsr)
280
+ skb = frame->skb_hsr;
281
+ else if (frame->skb_prp)
282
+ skb = frame->skb_prp;
283
+ if (!skb)
284
+ return;
285
+
286
+ ethhdr = (struct ethhdr *)skb_mac_header(skb);
227287
228288 /* Leave the ethernet header. */
229289 skb_pull(skb, sizeof(struct ethhdr));
....@@ -235,45 +295,54 @@
235295 /* And leave the HSR sup tag. */
236296 skb_pull(skb, sizeof(struct hsr_sup_tag));
237297
238
- hsr_sp = (struct hsr_sup_payload *) skb->data;
298
+ hsr_sp = (struct hsr_sup_payload *)skb->data;
239299
240
- /* Merge node_curr (registered on MacAddressB) into node_real */
300
+ /* Merge node_curr (registered on macaddress_B) into node_real */
241301 node_db = &port_rcv->hsr->node_db;
242
- node_real = find_node_by_AddrA(node_db, hsr_sp->MacAddressA);
302
+ node_real = find_node_by_addr_A(node_db, hsr_sp->macaddress_A);
243303 if (!node_real)
244304 /* No frame received from AddrA of this node yet */
245
- node_real = hsr_add_node(node_db, hsr_sp->MacAddressA,
246
- HSR_SEQNR_START - 1);
305
+ node_real = hsr_add_node(hsr, node_db, hsr_sp->macaddress_A,
306
+ HSR_SEQNR_START - 1, true,
307
+ port_rcv->type);
247308 if (!node_real)
248309 goto done; /* No mem */
249310 if (node_real == node_curr)
250311 /* Node has already been merged */
251312 goto done;
252313
253
- ether_addr_copy(node_real->MacAddressB, ethhdr->h_source);
314
+ ether_addr_copy(node_real->macaddress_B, ethhdr->h_source);
315
+ spin_lock_bh(&node_real->seq_out_lock);
254316 for (i = 0; i < HSR_PT_PORTS; i++) {
255317 if (!node_curr->time_in_stale[i] &&
256318 time_after(node_curr->time_in[i], node_real->time_in[i])) {
257319 node_real->time_in[i] = node_curr->time_in[i];
258
- node_real->time_in_stale[i] = node_curr->time_in_stale[i];
320
+ node_real->time_in_stale[i] =
321
+ node_curr->time_in_stale[i];
259322 }
260323 if (seq_nr_after(node_curr->seq_out[i], node_real->seq_out[i]))
261324 node_real->seq_out[i] = node_curr->seq_out[i];
262325 }
263
- node_real->AddrB_port = port_rcv->type;
326
+ spin_unlock_bh(&node_real->seq_out_lock);
327
+ node_real->addr_B_port = port_rcv->type;
264328
329
+ spin_lock_bh(&hsr->list_lock);
265330 list_del_rcu(&node_curr->mac_list);
331
+ spin_unlock_bh(&hsr->list_lock);
266332 kfree_rcu(node_curr, rcu_head);
267333
268334 done:
269
- skb_push(skb, sizeof(struct hsrv1_ethhdr_sp));
335
+ /* PRP uses v0 header */
336
+ if (ethhdr->h_proto == htons(ETH_P_HSR))
337
+ skb_push(skb, sizeof(struct hsrv1_ethhdr_sp));
338
+ else
339
+ skb_push(skb, sizeof(struct hsrv0_ethhdr_sp));
270340 }
271
-
272341
273342 /* 'skb' is a frame meant for this host, that is to be passed to upper layers.
274343 *
275344 * If the frame was sent by a node's B interface, replace the source
276
- * address with that node's "official" address (MacAddressA) so that upper
345
+ * address with that node's "official" address (macaddress_A) so that upper
277346 * layers recognize where it came from.
278347 */
279348 void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb)
....@@ -283,7 +352,7 @@
283352 return;
284353 }
285354
286
- memcpy(&eth_hdr(skb)->h_source, node->MacAddressA, ETH_ALEN);
355
+ memcpy(&eth_hdr(skb)->h_source, node->macaddress_A, ETH_ALEN);
287356 }
288357
289358 /* 'skb' is a frame meant for another host.
....@@ -308,18 +377,19 @@
308377 if (!is_unicast_ether_addr(eth_hdr(skb)->h_dest))
309378 return;
310379
311
- node_dst = find_node_by_AddrA(&port->hsr->node_db, eth_hdr(skb)->h_dest);
380
+ node_dst = find_node_by_addr_A(&port->hsr->node_db,
381
+ eth_hdr(skb)->h_dest);
312382 if (!node_dst) {
313
- if (net_ratelimit())
383
+ if (port->hsr->prot_version != PRP_V1 && net_ratelimit())
314384 netdev_err(skb->dev, "%s: Unknown node\n", __func__);
315385 return;
316386 }
317
- if (port->type != node_dst->AddrB_port)
387
+ if (port->type != node_dst->addr_B_port)
318388 return;
319389
320
- ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->MacAddressB);
390
+ if (is_valid_ether_addr(node_dst->macaddress_B))
391
+ ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B);
321392 }
322
-
323393
324394 void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
325395 u16 sequence_nr)
....@@ -346,13 +416,19 @@
346416 int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
347417 u16 sequence_nr)
348418 {
349
- if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type]))
419
+ spin_lock_bh(&node->seq_out_lock);
420
+ if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type]) &&
421
+ time_is_after_jiffies(node->time_out[port->type] +
422
+ msecs_to_jiffies(HSR_ENTRY_FORGET_TIME))) {
423
+ spin_unlock_bh(&node->seq_out_lock);
350424 return 1;
425
+ }
351426
427
+ node->time_out[port->type] = jiffies;
352428 node->seq_out[port->type] = sequence_nr;
429
+ spin_unlock_bh(&node->seq_out_lock);
353430 return 0;
354431 }
355
-
356432
357433 static struct hsr_port *get_late_port(struct hsr_priv *hsr,
358434 struct hsr_node *node)
....@@ -374,7 +450,6 @@
374450 return NULL;
375451 }
376452
377
-
378453 /* Remove stale sequence_nr records. Called by timer every
379454 * HSR_LIFE_CHECK_INTERVAL (two seconds or so).
380455 */
....@@ -382,20 +457,29 @@
382457 {
383458 struct hsr_priv *hsr = from_timer(hsr, t, prune_timer);
384459 struct hsr_node *node;
460
+ struct hsr_node *tmp;
385461 struct hsr_port *port;
386462 unsigned long timestamp;
387463 unsigned long time_a, time_b;
388464
389
- rcu_read_lock();
390
- list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
465
+ spin_lock_bh(&hsr->list_lock);
466
+ list_for_each_entry_safe(node, tmp, &hsr->node_db, mac_list) {
467
+ /* Don't prune own node. Neither time_in[HSR_PT_SLAVE_A]
468
+ * nor time_in[HSR_PT_SLAVE_B], will ever be updated for
469
+ * the master port. Thus the master node will be repeatedly
470
+ * pruned leading to packet loss.
471
+ */
472
+ if (hsr_addr_is_self(hsr, node->macaddress_A))
473
+ continue;
474
+
391475 /* Shorthand */
392476 time_a = node->time_in[HSR_PT_SLAVE_A];
393477 time_b = node->time_in[HSR_PT_SLAVE_B];
394478
395479 /* Check for timestamps old enough to risk wrap-around */
396
- if (time_after(jiffies, time_a + MAX_JIFFY_OFFSET/2))
480
+ if (time_after(jiffies, time_a + MAX_JIFFY_OFFSET / 2))
397481 node->time_in_stale[HSR_PT_SLAVE_A] = true;
398
- if (time_after(jiffies, time_b + MAX_JIFFY_OFFSET/2))
482
+ if (time_after(jiffies, time_b + MAX_JIFFY_OFFSET / 2))
399483 node->time_in_stale[HSR_PT_SLAVE_B] = true;
400484
401485 /* Get age of newest frame from node.
....@@ -410,26 +494,29 @@
410494
411495 /* Warn of ring error only as long as we get frames at all */
412496 if (time_is_after_jiffies(timestamp +
413
- msecs_to_jiffies(1.5*MAX_SLAVE_DIFF))) {
497
+ msecs_to_jiffies(1.5 * MAX_SLAVE_DIFF))) {
414498 rcu_read_lock();
415499 port = get_late_port(hsr, node);
416
- if (port != NULL)
417
- hsr_nl_ringerror(hsr, node->MacAddressA, port);
500
+ if (port)
501
+ hsr_nl_ringerror(hsr, node->macaddress_A, port);
418502 rcu_read_unlock();
419503 }
420504
421505 /* Prune old entries */
422506 if (time_is_before_jiffies(timestamp +
423
- msecs_to_jiffies(HSR_NODE_FORGET_TIME))) {
424
- hsr_nl_nodedown(hsr, node->MacAddressA);
507
+ msecs_to_jiffies(HSR_NODE_FORGET_TIME))) {
508
+ hsr_nl_nodedown(hsr, node->macaddress_A);
425509 list_del_rcu(&node->mac_list);
426510 /* Note that we need to free this entry later: */
427511 kfree_rcu(node, rcu_head);
428512 }
429513 }
430
- rcu_read_unlock();
431
-}
514
+ spin_unlock_bh(&hsr->list_lock);
432515
516
+ /* Restart timer */
517
+ mod_timer(&hsr->prune_timer,
518
+ jiffies + msecs_to_jiffies(PRUNE_PERIOD));
519
+}
433520
434521 void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
435522 unsigned char addr[ETH_ALEN])
....@@ -440,19 +527,18 @@
440527 node = list_first_or_null_rcu(&hsr->node_db,
441528 struct hsr_node, mac_list);
442529 if (node)
443
- ether_addr_copy(addr, node->MacAddressA);
530
+ ether_addr_copy(addr, node->macaddress_A);
444531 return node;
445532 }
446533
447534 node = _pos;
448535 list_for_each_entry_continue_rcu(node, &hsr->node_db, mac_list) {
449
- ether_addr_copy(addr, node->MacAddressA);
536
+ ether_addr_copy(addr, node->macaddress_A);
450537 return node;
451538 }
452539
453540 return NULL;
454541 }
455
-
456542
457543 int hsr_get_node_data(struct hsr_priv *hsr,
458544 const unsigned char *addr,
....@@ -467,11 +553,11 @@
467553 struct hsr_port *port;
468554 unsigned long tdiff;
469555
470
- node = find_node_by_AddrA(&hsr->node_db, addr);
556
+ node = find_node_by_addr_A(&hsr->node_db, addr);
471557 if (!node)
472558 return -ENOENT;
473559
474
- ether_addr_copy(addr_b, node->MacAddressB);
560
+ ether_addr_copy(addr_b, node->macaddress_B);
475561
476562 tdiff = jiffies - node->time_in[HSR_PT_SLAVE_A];
477563 if (node->time_in_stale[HSR_PT_SLAVE_A])
....@@ -497,8 +583,8 @@
497583 *if1_seq = node->seq_out[HSR_PT_SLAVE_B];
498584 *if2_seq = node->seq_out[HSR_PT_SLAVE_A];
499585
500
- if (node->AddrB_port != HSR_PT_NONE) {
501
- port = hsr_port_get_hsr(hsr, node->AddrB_port);
586
+ if (node->addr_B_port != HSR_PT_NONE) {
587
+ port = hsr_port_get_hsr(hsr, node->addr_B_port);
502588 *addr_b_ifindex = port->dev->ifindex;
503589 } else {
504590 *addr_b_ifindex = -1;