Skip to content

Commit f421436

Browse files
Arvid Brodindavem330
authored andcommitted
net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)
High-availability Seamless Redundancy ("HSR") provides instant failover redundancy for Ethernet networks. It requires a special network topology where all nodes are connected in a ring (each node having two physical network interfaces). It is suited for applications that demand high availability and very short reaction time. HSR acts on the Ethernet layer, using a registered Ethernet protocol type to send special HSR frames in both directions over the ring. The driver creates virtual network interfaces that can be used just like any ordinary Linux network interface, for IP/TCP/UDP traffic etc. All nodes in the network ring must be HSR capable. This code is a "best effort" to comply with the HSR standard as described in IEC 62439-3:2010 (HSRv0). Signed-off-by: Arvid Brodin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 74d332c commit f421436

File tree

15 files changed

+2403
-0
lines changed

15 files changed

+2403
-0
lines changed

include/uapi/linux/hsr_netlink.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2011-2013 Autronica Fire and Security AS
3+
*
4+
* This program is free software; you can redistribute it and/or modify it
5+
* under the terms of the GNU General Public License as published by the Free
6+
* Software Foundation; either version 2 of the License, or (at your option)
7+
* any later version.
8+
*
9+
* Author(s):
10+
* 2011-2013 Arvid Brodin, [email protected]
11+
*/
12+
13+
#ifndef __UAPI_HSR_NETLINK_H
14+
#define __UAPI_HSR_NETLINK_H
15+
16+
/* Generic Netlink HSR family definition
17+
*/
18+
19+
/* attributes */
20+
enum {
21+
HSR_A_UNSPEC,
22+
HSR_A_NODE_ADDR,
23+
HSR_A_IFINDEX,
24+
HSR_A_IF1_AGE,
25+
HSR_A_IF2_AGE,
26+
HSR_A_NODE_ADDR_B,
27+
HSR_A_IF1_SEQ,
28+
HSR_A_IF2_SEQ,
29+
HSR_A_IF1_IFINDEX,
30+
HSR_A_IF2_IFINDEX,
31+
HSR_A_ADDR_B_IFINDEX,
32+
__HSR_A_MAX,
33+
};
34+
#define HSR_A_MAX (__HSR_A_MAX - 1)
35+
36+
37+
/* commands */
38+
enum {
39+
HSR_C_UNSPEC,
40+
HSR_C_RING_ERROR,
41+
HSR_C_NODE_DOWN,
42+
HSR_C_GET_NODE_STATUS,
43+
HSR_C_SET_NODE_STATUS,
44+
HSR_C_GET_NODE_LIST,
45+
HSR_C_SET_NODE_LIST,
46+
__HSR_C_MAX,
47+
};
48+
#define HSR_C_MAX (__HSR_C_MAX - 1)
49+
50+
#endif /* __UAPI_HSR_NETLINK_H */

include/uapi/linux/if_ether.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
8686
#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */
8787
#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
88+
#define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */
8889
#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
8990
#define ETH_P_TDLS 0x890D /* TDLS */
9091
#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */

include/uapi/linux/if_link.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,4 +481,17 @@ enum {
481481

482482
#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
483483

484+
485+
/* HSR section */
486+
487+
enum {
488+
IFLA_HSR_UNSPEC,
489+
IFLA_HSR_SLAVE1,
490+
IFLA_HSR_SLAVE2,
491+
IFLA_HSR_MULTICAST_SPEC,
492+
__IFLA_HSR_MAX,
493+
};
494+
495+
#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1)
496+
484497
#endif /* _UAPI_LINUX_IF_LINK_H */

net/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ source "net/openvswitch/Kconfig"
220220
source "net/vmw_vsock/Kconfig"
221221
source "net/netlink/Kconfig"
222222
source "net/mpls/Kconfig"
223+
source "net/hsr/Kconfig"
223224

224225
config RPS
225226
boolean

net/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ obj-$(CONFIG_NFC) += nfc/
7171
obj-$(CONFIG_OPENVSWITCH) += openvswitch/
7272
obj-$(CONFIG_VSOCKETS) += vmw_vsock/
7373
obj-$(CONFIG_NET_MPLS_GSO) += mpls/
74+
obj-$(CONFIG_HSR) += hsr/

net/hsr/Kconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# IEC 62439-3 High-availability Seamless Redundancy
3+
#
4+
5+
config HSR
6+
tristate "High-availability Seamless Redundancy (HSR)"
7+
---help---
8+
If you say Y here, then your Linux box will be able to act as a
9+
DANH ("Doubly attached node implementing HSR"). For this to work,
10+
your Linux box needs (at least) two physical Ethernet interfaces,
11+
and it must be connected as a node in a ring network together with
12+
other HSR capable nodes.
13+
14+
All Ethernet frames sent over the hsr device will be sent in both
15+
directions on the ring (over both slave ports), giving a redundant,
16+
instant fail-over network. Each HSR node in the ring acts like a
17+
bridge for HSR frames, but filters frames that have been forwarded
18+
earlier.
19+
20+
This code is a "best effort" to comply with the HSR standard as
21+
described in IEC 62439-3:2010 (HSRv0), but no compliancy tests have
22+
been made.
23+
24+
You need to perform any and all necessary tests yourself before
25+
relying on this code in a safety critical system!
26+
27+
If unsure, say N.

net/hsr/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Makefile for HSR
3+
#
4+
5+
obj-$(CONFIG_HSR) += hsr.o
6+
7+
hsr-y := hsr_main.o hsr_framereg.o hsr_device.o hsr_netlink.o

0 commit comments

Comments
 (0)