Skip to content

Commit

Permalink
net/hsr: Add support for the High-availability Seamless Redundancy pr…
Browse files Browse the repository at this point in the history
…otocol (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 <arvid.brodin@xdin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arvid Brodin authored and davem330 committed Nov 4, 2013
1 parent 74d332c commit f421436
Show file tree
Hide file tree
Showing 15 changed files with 2,403 additions and 0 deletions.
50 changes: 50 additions & 0 deletions include/uapi/linux/hsr_netlink.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2011-2013 Autronica Fire and Security AS
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* Author(s):
* 2011-2013 Arvid Brodin, arvid.brodin@xdin.com
*/

#ifndef __UAPI_HSR_NETLINK_H
#define __UAPI_HSR_NETLINK_H

/* Generic Netlink HSR family definition
*/

/* attributes */
enum {
HSR_A_UNSPEC,
HSR_A_NODE_ADDR,
HSR_A_IFINDEX,
HSR_A_IF1_AGE,
HSR_A_IF2_AGE,
HSR_A_NODE_ADDR_B,
HSR_A_IF1_SEQ,
HSR_A_IF2_SEQ,
HSR_A_IF1_IFINDEX,
HSR_A_IF2_IFINDEX,
HSR_A_ADDR_B_IFINDEX,
__HSR_A_MAX,
};
#define HSR_A_MAX (__HSR_A_MAX - 1)


/* commands */
enum {
HSR_C_UNSPEC,
HSR_C_RING_ERROR,
HSR_C_NODE_DOWN,
HSR_C_GET_NODE_STATUS,
HSR_C_SET_NODE_STATUS,
HSR_C_GET_NODE_LIST,
HSR_C_SET_NODE_LIST,
__HSR_C_MAX,
};
#define HSR_C_MAX (__HSR_C_MAX - 1)

#endif /* __UAPI_HSR_NETLINK_H */
1 change: 1 addition & 0 deletions include/uapi/linux/if_ether.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */
#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
#define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */
#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
#define ETH_P_TDLS 0x890D /* TDLS */
#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
Expand Down
13 changes: 13 additions & 0 deletions include/uapi/linux/if_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,17 @@ enum {

#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)


/* HSR section */

enum {
IFLA_HSR_UNSPEC,
IFLA_HSR_SLAVE1,
IFLA_HSR_SLAVE2,
IFLA_HSR_MULTICAST_SPEC,
__IFLA_HSR_MAX,
};

#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1)

#endif /* _UAPI_LINUX_IF_LINK_H */
1 change: 1 addition & 0 deletions net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ source "net/openvswitch/Kconfig"
source "net/vmw_vsock/Kconfig"
source "net/netlink/Kconfig"
source "net/mpls/Kconfig"
source "net/hsr/Kconfig"

config RPS
boolean
Expand Down
1 change: 1 addition & 0 deletions net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ obj-$(CONFIG_NFC) += nfc/
obj-$(CONFIG_OPENVSWITCH) += openvswitch/
obj-$(CONFIG_VSOCKETS) += vmw_vsock/
obj-$(CONFIG_NET_MPLS_GSO) += mpls/
obj-$(CONFIG_HSR) += hsr/
27 changes: 27 additions & 0 deletions net/hsr/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# IEC 62439-3 High-availability Seamless Redundancy
#

config HSR
tristate "High-availability Seamless Redundancy (HSR)"
---help---
If you say Y here, then your Linux box will be able to act as a
DANH ("Doubly attached node implementing HSR"). For this to work,
your Linux box needs (at least) two physical Ethernet interfaces,
and it must be connected as a node in a ring network together with
other HSR capable nodes.

All Ethernet frames sent over the hsr device will be sent in both
directions on the ring (over both slave ports), giving a redundant,
instant fail-over network. Each HSR node in the ring acts like a
bridge for HSR frames, but filters frames that have been forwarded
earlier.

This code is a "best effort" to comply with the HSR standard as
described in IEC 62439-3:2010 (HSRv0), but no compliancy tests have
been made.

You need to perform any and all necessary tests yourself before
relying on this code in a safety critical system!

If unsure, say N.
7 changes: 7 additions & 0 deletions net/hsr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Makefile for HSR
#

obj-$(CONFIG_HSR) += hsr.o

hsr-y := hsr_main.o hsr_framereg.o hsr_device.o hsr_netlink.o
Loading

0 comments on commit f421436

Please sign in to comment.