forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
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,230 @@
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);
156162
157163 /* We are only interested in time diffs here, so use current jiffies
158164 * as initialization. (0 could trigger an spurious ring error warning).
159165 */
160166 now = jiffies;
167
+ for (i = 0; i < HSR_PT_PORTS; i++) {
168
+ new_node->time_in[i] = now;
169
+ new_node->time_out[i] = now;
170
+ }
161171 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;
172
+ new_node->seq_out[i] = seq_out;
165173
166
- list_add_tail_rcu(&node->mac_list, node_db);
174
+ if (san && hsr->proto_ops->handle_san_frame)
175
+ hsr->proto_ops->handle_san_frame(san, rx_port, new_node);
167176
177
+ spin_lock_bh(&hsr->list_lock);
178
+ list_for_each_entry_rcu(node, node_db, mac_list,
179
+ lockdep_is_held(&hsr->list_lock)) {
180
+ if (ether_addr_equal(node->macaddress_A, addr))
181
+ goto out;
182
+ if (ether_addr_equal(node->macaddress_B, addr))
183
+ goto out;
184
+ }
185
+ list_add_tail_rcu(&new_node->mac_list, node_db);
186
+ spin_unlock_bh(&hsr->list_lock);
187
+ return new_node;
188
+out:
189
+ spin_unlock_bh(&hsr->list_lock);
190
+ kfree(new_node);
168191 return node;
192
+}
193
+
194
+void prp_update_san_info(struct hsr_node *node, bool is_sup)
195
+{
196
+ if (!is_sup)
197
+ return;
198
+
199
+ node->san_a = false;
200
+ node->san_b = false;
169201 }
170202
171203 /* Get the hsr_node from which 'skb' was sent.
172204 */
173
-struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
174
- bool is_sup)
205
+struct hsr_node *hsr_get_node(struct hsr_port *port, struct list_head *node_db,
206
+ struct sk_buff *skb, bool is_sup,
207
+ enum hsr_port_type rx_port)
175208 {
176
- struct list_head *node_db = &port->hsr->node_db;
209
+ struct hsr_priv *hsr = port->hsr;
177210 struct hsr_node *node;
178211 struct ethhdr *ethhdr;
212
+ struct prp_rct *rct;
213
+ bool san = false;
179214 u16 seq_out;
180215
181216 if (!skb_mac_header_was_set(skb))
182217 return NULL;
183218
184
- ethhdr = (struct ethhdr *) skb_mac_header(skb);
219
+ ethhdr = (struct ethhdr *)skb_mac_header(skb);
185220
186221 list_for_each_entry_rcu(node, node_db, mac_list) {
187
- if (ether_addr_equal(node->MacAddressA, ethhdr->h_source))
222
+ if (ether_addr_equal(node->macaddress_A, ethhdr->h_source)) {
223
+ if (hsr->proto_ops->update_san_info)
224
+ hsr->proto_ops->update_san_info(node, is_sup);
188225 return node;
189
- if (ether_addr_equal(node->MacAddressB, ethhdr->h_source))
226
+ }
227
+ if (ether_addr_equal(node->macaddress_B, ethhdr->h_source)) {
228
+ if (hsr->proto_ops->update_san_info)
229
+ hsr->proto_ops->update_san_info(node, is_sup);
190230 return node;
231
+ }
191232 }
192233
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)) {
234
+ /* Everyone may create a node entry, connected node to a HSR/PRP
235
+ * device.
236
+ */
237
+ if (ethhdr->h_proto == htons(ETH_P_PRP) ||
238
+ ethhdr->h_proto == htons(ETH_P_HSR)) {
197239 /* Use the existing sequence_nr from the tag as starting point
198240 * for filtering duplicate frames.
199241 */
200242 seq_out = hsr_get_skb_sequence_nr(skb) - 1;
201243 } 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;
244
+ rct = skb_get_PRP_rct(skb);
245
+ if (rct && prp_check_lsdu_size(skb, rct, is_sup)) {
246
+ seq_out = prp_get_skb_sequence_nr(rct);
247
+ } else {
248
+ if (rx_port != HSR_PT_MASTER)
249
+ san = true;
250
+ seq_out = HSR_SEQNR_START;
251
+ }
208252 }
209253
210
- return hsr_add_node(node_db, ethhdr->h_source, seq_out);
254
+ return hsr_add_node(hsr, node_db, ethhdr->h_source, seq_out,
255
+ san, rx_port);
211256 }
212257
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
258
+/* Use the Supervision frame's info about an eventual macaddress_B for merging
259
+ * nodes that has previously had their macaddress_B registered as a separate
215260 * node.
216261 */
217
-void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
218
- struct hsr_port *port_rcv)
262
+void hsr_handle_sup_frame(struct hsr_frame_info *frame)
219263 {
220
- struct ethhdr *ethhdr;
221
- struct hsr_node *node_real;
264
+ struct hsr_node *node_curr = frame->node_src;
265
+ struct hsr_port *port_rcv = frame->port_rcv;
266
+ struct hsr_priv *hsr = port_rcv->hsr;
222267 struct hsr_sup_payload *hsr_sp;
268
+ struct hsr_node *node_real;
269
+ struct sk_buff *skb = NULL;
223270 struct list_head *node_db;
271
+ struct ethhdr *ethhdr;
224272 int i;
225273
226
- ethhdr = (struct ethhdr *) skb_mac_header(skb);
274
+ /* Here either frame->skb_hsr or frame->skb_prp should be
275
+ * valid as supervision frame always will have protocol
276
+ * header info.
277
+ */
278
+ if (frame->skb_hsr)
279
+ skb = frame->skb_hsr;
280
+ else if (frame->skb_prp)
281
+ skb = frame->skb_prp;
282
+ if (!skb)
283
+ return;
284
+
285
+ ethhdr = (struct ethhdr *)skb_mac_header(skb);
227286
228287 /* Leave the ethernet header. */
229288 skb_pull(skb, sizeof(struct ethhdr));
....@@ -235,45 +294,52 @@
235294 /* And leave the HSR sup tag. */
236295 skb_pull(skb, sizeof(struct hsr_sup_tag));
237296
238
- hsr_sp = (struct hsr_sup_payload *) skb->data;
297
+ hsr_sp = (struct hsr_sup_payload *)skb->data;
239298
240
- /* Merge node_curr (registered on MacAddressB) into node_real */
299
+ /* Merge node_curr (registered on macaddress_B) into node_real */
241300 node_db = &port_rcv->hsr->node_db;
242
- node_real = find_node_by_AddrA(node_db, hsr_sp->MacAddressA);
301
+ node_real = find_node_by_addr_A(node_db, hsr_sp->macaddress_A);
243302 if (!node_real)
244303 /* 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);
304
+ node_real = hsr_add_node(hsr, node_db, hsr_sp->macaddress_A,
305
+ HSR_SEQNR_START - 1, true,
306
+ port_rcv->type);
247307 if (!node_real)
248308 goto done; /* No mem */
249309 if (node_real == node_curr)
250310 /* Node has already been merged */
251311 goto done;
252312
253
- ether_addr_copy(node_real->MacAddressB, ethhdr->h_source);
313
+ ether_addr_copy(node_real->macaddress_B, ethhdr->h_source);
254314 for (i = 0; i < HSR_PT_PORTS; i++) {
255315 if (!node_curr->time_in_stale[i] &&
256316 time_after(node_curr->time_in[i], node_real->time_in[i])) {
257317 node_real->time_in[i] = node_curr->time_in[i];
258
- node_real->time_in_stale[i] = node_curr->time_in_stale[i];
318
+ node_real->time_in_stale[i] =
319
+ node_curr->time_in_stale[i];
259320 }
260321 if (seq_nr_after(node_curr->seq_out[i], node_real->seq_out[i]))
261322 node_real->seq_out[i] = node_curr->seq_out[i];
262323 }
263
- node_real->AddrB_port = port_rcv->type;
324
+ node_real->addr_B_port = port_rcv->type;
264325
326
+ spin_lock_bh(&hsr->list_lock);
265327 list_del_rcu(&node_curr->mac_list);
328
+ spin_unlock_bh(&hsr->list_lock);
266329 kfree_rcu(node_curr, rcu_head);
267330
268331 done:
269
- skb_push(skb, sizeof(struct hsrv1_ethhdr_sp));
332
+ /* PRP uses v0 header */
333
+ if (ethhdr->h_proto == htons(ETH_P_HSR))
334
+ skb_push(skb, sizeof(struct hsrv1_ethhdr_sp));
335
+ else
336
+ skb_push(skb, sizeof(struct hsrv0_ethhdr_sp));
270337 }
271
-
272338
273339 /* 'skb' is a frame meant for this host, that is to be passed to upper layers.
274340 *
275341 * 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
342
+ * address with that node's "official" address (macaddress_A) so that upper
277343 * layers recognize where it came from.
278344 */
279345 void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb)
....@@ -283,7 +349,7 @@
283349 return;
284350 }
285351
286
- memcpy(&eth_hdr(skb)->h_source, node->MacAddressA, ETH_ALEN);
352
+ memcpy(&eth_hdr(skb)->h_source, node->macaddress_A, ETH_ALEN);
287353 }
288354
289355 /* 'skb' is a frame meant for another host.
....@@ -308,18 +374,19 @@
308374 if (!is_unicast_ether_addr(eth_hdr(skb)->h_dest))
309375 return;
310376
311
- node_dst = find_node_by_AddrA(&port->hsr->node_db, eth_hdr(skb)->h_dest);
377
+ node_dst = find_node_by_addr_A(&port->hsr->node_db,
378
+ eth_hdr(skb)->h_dest);
312379 if (!node_dst) {
313380 if (net_ratelimit())
314381 netdev_err(skb->dev, "%s: Unknown node\n", __func__);
315382 return;
316383 }
317
- if (port->type != node_dst->AddrB_port)
384
+ if (port->type != node_dst->addr_B_port)
318385 return;
319386
320
- ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->MacAddressB);
387
+ if (is_valid_ether_addr(node_dst->macaddress_B))
388
+ ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B);
321389 }
322
-
323390
324391 void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
325392 u16 sequence_nr)
....@@ -346,13 +413,15 @@
346413 int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
347414 u16 sequence_nr)
348415 {
349
- if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type]))
416
+ if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type]) &&
417
+ time_is_after_jiffies(node->time_out[port->type] +
418
+ msecs_to_jiffies(HSR_ENTRY_FORGET_TIME)))
350419 return 1;
351420
421
+ node->time_out[port->type] = jiffies;
352422 node->seq_out[port->type] = sequence_nr;
353423 return 0;
354424 }
355
-
356425
357426 static struct hsr_port *get_late_port(struct hsr_priv *hsr,
358427 struct hsr_node *node)
....@@ -374,7 +443,6 @@
374443 return NULL;
375444 }
376445
377
-
378446 /* Remove stale sequence_nr records. Called by timer every
379447 * HSR_LIFE_CHECK_INTERVAL (two seconds or so).
380448 */
....@@ -382,20 +450,29 @@
382450 {
383451 struct hsr_priv *hsr = from_timer(hsr, t, prune_timer);
384452 struct hsr_node *node;
453
+ struct hsr_node *tmp;
385454 struct hsr_port *port;
386455 unsigned long timestamp;
387456 unsigned long time_a, time_b;
388457
389
- rcu_read_lock();
390
- list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
458
+ spin_lock_bh(&hsr->list_lock);
459
+ list_for_each_entry_safe(node, tmp, &hsr->node_db, mac_list) {
460
+ /* Don't prune own node. Neither time_in[HSR_PT_SLAVE_A]
461
+ * nor time_in[HSR_PT_SLAVE_B], will ever be updated for
462
+ * the master port. Thus the master node will be repeatedly
463
+ * pruned leading to packet loss.
464
+ */
465
+ if (hsr_addr_is_self(hsr, node->macaddress_A))
466
+ continue;
467
+
391468 /* Shorthand */
392469 time_a = node->time_in[HSR_PT_SLAVE_A];
393470 time_b = node->time_in[HSR_PT_SLAVE_B];
394471
395472 /* Check for timestamps old enough to risk wrap-around */
396
- if (time_after(jiffies, time_a + MAX_JIFFY_OFFSET/2))
473
+ if (time_after(jiffies, time_a + MAX_JIFFY_OFFSET / 2))
397474 node->time_in_stale[HSR_PT_SLAVE_A] = true;
398
- if (time_after(jiffies, time_b + MAX_JIFFY_OFFSET/2))
475
+ if (time_after(jiffies, time_b + MAX_JIFFY_OFFSET / 2))
399476 node->time_in_stale[HSR_PT_SLAVE_B] = true;
400477
401478 /* Get age of newest frame from node.
....@@ -410,26 +487,29 @@
410487
411488 /* Warn of ring error only as long as we get frames at all */
412489 if (time_is_after_jiffies(timestamp +
413
- msecs_to_jiffies(1.5*MAX_SLAVE_DIFF))) {
490
+ msecs_to_jiffies(1.5 * MAX_SLAVE_DIFF))) {
414491 rcu_read_lock();
415492 port = get_late_port(hsr, node);
416
- if (port != NULL)
417
- hsr_nl_ringerror(hsr, node->MacAddressA, port);
493
+ if (port)
494
+ hsr_nl_ringerror(hsr, node->macaddress_A, port);
418495 rcu_read_unlock();
419496 }
420497
421498 /* Prune old entries */
422499 if (time_is_before_jiffies(timestamp +
423
- msecs_to_jiffies(HSR_NODE_FORGET_TIME))) {
424
- hsr_nl_nodedown(hsr, node->MacAddressA);
500
+ msecs_to_jiffies(HSR_NODE_FORGET_TIME))) {
501
+ hsr_nl_nodedown(hsr, node->macaddress_A);
425502 list_del_rcu(&node->mac_list);
426503 /* Note that we need to free this entry later: */
427504 kfree_rcu(node, rcu_head);
428505 }
429506 }
430
- rcu_read_unlock();
431
-}
507
+ spin_unlock_bh(&hsr->list_lock);
432508
509
+ /* Restart timer */
510
+ mod_timer(&hsr->prune_timer,
511
+ jiffies + msecs_to_jiffies(PRUNE_PERIOD));
512
+}
433513
434514 void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
435515 unsigned char addr[ETH_ALEN])
....@@ -440,19 +520,18 @@
440520 node = list_first_or_null_rcu(&hsr->node_db,
441521 struct hsr_node, mac_list);
442522 if (node)
443
- ether_addr_copy(addr, node->MacAddressA);
523
+ ether_addr_copy(addr, node->macaddress_A);
444524 return node;
445525 }
446526
447527 node = _pos;
448528 list_for_each_entry_continue_rcu(node, &hsr->node_db, mac_list) {
449
- ether_addr_copy(addr, node->MacAddressA);
529
+ ether_addr_copy(addr, node->macaddress_A);
450530 return node;
451531 }
452532
453533 return NULL;
454534 }
455
-
456535
457536 int hsr_get_node_data(struct hsr_priv *hsr,
458537 const unsigned char *addr,
....@@ -467,11 +546,11 @@
467546 struct hsr_port *port;
468547 unsigned long tdiff;
469548
470
- node = find_node_by_AddrA(&hsr->node_db, addr);
549
+ node = find_node_by_addr_A(&hsr->node_db, addr);
471550 if (!node)
472551 return -ENOENT;
473552
474
- ether_addr_copy(addr_b, node->MacAddressB);
553
+ ether_addr_copy(addr_b, node->macaddress_B);
475554
476555 tdiff = jiffies - node->time_in[HSR_PT_SLAVE_A];
477556 if (node->time_in_stale[HSR_PT_SLAVE_A])
....@@ -497,8 +576,8 @@
497576 *if1_seq = node->seq_out[HSR_PT_SLAVE_B];
498577 *if2_seq = node->seq_out[HSR_PT_SLAVE_A];
499578
500
- if (node->AddrB_port != HSR_PT_NONE) {
501
- port = hsr_port_get_hsr(hsr, node->AddrB_port);
579
+ if (node->addr_B_port != HSR_PT_NONE) {
580
+ port = hsr_port_get_hsr(hsr, node->addr_B_port);
502581 *addr_b_ifindex = port->dev->ifindex;
503582 } else {
504583 *addr_b_ifindex = -1;