Commit 8f4c0e01 authored by Murali Karicheri's avatar Murali Karicheri Committed by David S. Miller
Browse files

hsr: enhance netlink socket interface to support PRP



Parallel Redundancy Protocol (PRP) is another redundancy protocol
introduced by IEC 63439 standard. It is similar to HSR in many
aspects:-

 - Use a pair of Ethernet interfaces to created the PRP device
 - Use a 6 byte redundancy protocol part (RCT, Redundancy Check
   Trailer) similar to HSR Tag.
 - Has Link Redundancy Entity (LRE) that works with RCT to implement
   redundancy.

Key difference is that the protocol unit is a trailer instead of a
prefix as in HSR. That makes it inter-operable with tradition network
components such as bridges/switches which treat it as pad bytes,
whereas HSR nodes requires some kind of translators (Called redbox) to
talk to regular network devices. This features allows regular linux box
to be converted to a DAN-P box. DAN-P stands for Dual Attached Node - PRP
similar to DAN-H (Dual Attached Node - HSR).

Add a comment at the header/source code to explicitly state that the
driver files also handles PRP protocol as well.

Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1775da47
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
/* Generic Netlink HSR family definition
 */

/* attributes */
/* attributes for HSR or PRP node */
enum {
	HSR_A_UNSPEC,
	HSR_A_NODE_ADDR,
+11 −1
Original line number Diff line number Diff line
@@ -907,7 +907,14 @@ enum {
#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)


/* HSR section */
/* HSR/PRP section, both uses same interface */

/* Different redundancy protocols for hsr device */
enum {
	HSR_PROTOCOL_HSR,
	HSR_PROTOCOL_PRP,
	HSR_PROTOCOL_MAX,
};

enum {
	IFLA_HSR_UNSPEC,
@@ -917,6 +924,9 @@ enum {
	IFLA_HSR_SUPERVISION_ADDR,	/* Supervision frame multicast addr */
	IFLA_HSR_SEQ_NR,
	IFLA_HSR_VERSION,		/* HSR version */
	IFLA_HSR_PROTOCOL,		/* Indicate different protocol than
					 * HSR. For example PRP.
					 */
	__IFLA_HSR_MAX,
};

+23 −12
Original line number Diff line number Diff line
@@ -4,24 +4,35 @@
#

config HSR
	tristate "High-availability Seamless Redundancy (HSR)"
	tristate "High-availability Seamless Redundancy (HSR & PRP)"
	help
	  This enables IEC 62439 defined High-availability Seamless
	  Redundancy (HSR) and Parallel Redundancy Protocol (PRP).

	  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.
	  DANH ("Doubly attached node implementing HSR") or DANP ("Doubly
	  attached node implementing PRP"). For this to work, your Linux box
	  needs (at least) two physical Ethernet interfaces.

	  For DANH, 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.

	  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.
	  For DANP, it must be connected as a node connecting to two
	  separate networks over the two slave interfaces. Like HSR, Ethernet
	  frames sent over the PRP device will be sent to both networks giving
	  a redundant, instant fail-over network. Unlike HSR, PRP networks
	  can have Singly Attached Nodes (SAN) such as PC, printer, bridges
	  etc and will be able to communicate with DANP nodes.

	  This code is a "best effort" to comply with the HSR standard as
	  described in IEC 62439-3:2010 (HSRv0) and IEC 62439-3:2012 (HSRv1),
	  but no compliancy tests have been made. Use iproute2 to select
	  the version you desire.
	  and PRP standard described in IEC 62439-4:2012 (PRP), but no
	  compliancy tests have been made. Use iproute2 to select the protocol
	  you would like to use.

	  You need to perform any and all necessary tests yourself before
	  relying on this code in a safety critical system!
+1 −1
Original line number Diff line number Diff line
/*
 * hsr_debugfs code
 * debugfs code for HSR & PRP
 * Copyright (C) 2019 Texas Instruments Incorporated
 *
 * Author(s):
+5 −2
Original line number Diff line number Diff line
@@ -3,9 +3,8 @@
 *
 * Author(s):
 *	2011-2014 Arvid Brodin, arvid.brodin@alten.se
 *
 * This file contains device methods for creating, using and destroying
 * virtual HSR devices.
 * virtual HSR or PRP devices.
 */

#include <linux/netdevice.h>
@@ -427,6 +426,10 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],

	ether_addr_copy(hsr_dev->dev_addr, slave[0]->dev_addr);

	/* currently PRP is not supported */
	if (protocol_version == PRP_V1)
		return -EPROTONOSUPPORT;

	/* Make sure we recognize frames from ourselves in hsr_rcv() */
	res = hsr_create_self_node(hsr, hsr_dev->dev_addr,
				   slave[1]->dev_addr);
Loading