diff --git a/source/common/Industrial_Protocols/HSR_PRP/_Firmware.rst b/source/common/Industrial_Protocols/HSR_PRP/_Firmware.rst deleted file mode 100644 index 2d2cad05a..000000000 --- a/source/common/Industrial_Protocols/HSR_PRP/_Firmware.rst +++ /dev/null @@ -1,452 +0,0 @@ -.. http://processors.wiki.ti.com/index.php/Processor_SDK_HSR_PRP - - -Duplicate algorithm and table ------------------------------ -Handling duplicate frames is one of the main tasks in HSR and PRP. The -LRE must not provide the duplicate of a frame to its upper layer in -order to offload the processor. The algorithm for discarding duplicates -is not specified in IEC 62439-3. However, the standard mandates that the -algorithm must be designed such that it never rejects a legitimate -frame, while occasional acceptance of a duplicate can be tolerated. - -In HSR, additionally to discarding duplicates destined to the host, a -discard operation should also be used to prevent frames from looping in -the network. A looping frame is a frame that is never discarded in any -node of the network and therefore it keeps looping indefinitely. -Normally, such a frame should be dropped by its source node. The -function handles the case when a defective HSR device does not filter -correctly according to source/destination address. This operation is -less critical than the host duplicate discard. It is also specified that -any duplicate discard method shall be able to forget an entry identified -by the source MAC address and the sequence number after a time -EntryForgetTime (default 400ms). - -A table holds entries representing frames that have been registered in -the LRE, each entry is represented bya frame signature. The signature -consists of the source MAC address and the 16 bit sequence number. The -sequence number value is incremented by 1 when a frame and its duplicate -are sent by a source in an HSR network. This signature allows -identifying a frame uniquely. When a frame is received, the list is -searched by comparing the frame signature with all entries in the table. -If such an entry is found, the frame is a duplicate and shall be -discarded. If no entry exists, the frame is the first one received and -needs to be forwarded to the application and/or – in case of HSR - to -the other port. With a successful forwarding process (frame received -with no error), a new entry with the signature of that frame is created -in the table. - -A linear lookup process is too time consuming; thus Hash algorithms are -used to decrease the search time. - -Port to Host Duplicate Table ----------------------------- - -It is used to prevent sending duplicate frames to the upper layers. This -table is common for both PRUs. Resource sharing implies that collision -(two PRUs accessing the same data) must be handled. Since the table is -common to both PRUs, the host duplicate rejection must be done after the -EOF is detected in order to avoid rejecting legitimate frames. - -Port to Port Duplicate Table ----------------------------- - -A PRU forwards the frames received from one HSR port to the other HSR -port, unless the frame was sent already. Each PRU has its own port -duplicate table. A search operation can start before the EOF is detected -since the table is not shared between the PRU and is not subject to any -modification during the reception of a frame. In order to minimize the -load of the PRU after EOF reception, the search operation in the port -duplicate table is executed during frame reception. Moreover, this -allows to quickly detecting if the frame should be discarded early in -the reception process. An insertion in the table is still made only -after the EOF is detected, but the operation is much faster since the -result of the search operation can used. - -Node Table ------------ - -The node table is a central element of the HSR/PRP mechanism although -the standard declares node tables optional. This firmware implements -node tables for HSR and PRP. Node table handling is implemented in the -PRU and comprises of registering incoming supervision and -non-supervision-frames as well as ageing and deleting of old entries. -The standard requires updating the node table when a supervision frame -is received. Accessing the node table is thus not critical since -supervision frames are sent only every 2 seconds. For HSR, to maintain -statistics for each source node of the network and to facilitate -debugging, the implementation updates the node table for each frame -received by the host from a source that has previously sent a -supervision frame. A further advantage of this approach is having a -similar implementation for HSR and PRP. Indeed, the PRP Standard -requires updating the node table, if implemented, for all the incoming -frames in order to keep track of the traffic contented to each redundant -LAN. The node table is accessible by the host for management purposes. -Update- and register operations in the table should be done when the -frame is completely received in order to avoid registering erroneous -frames. - -The node table search/update operation is very critical since it is -resource/time consuming (maximum NODE\_TABLE\_SIZE is 256 entries). In -the worst case scenario (node table full), a linear lookup operation in -the receiving task could load the PRU too much and in consequence could -cause Rx overflow or TX underflow. Moreover the node table is common to -both PRUs and since it is accessed often, the resource-sharing -management has additional impact on the latency. Optimized linear tables -were considered, but the timing remained too critical in the worst case -scenario. Hash tables are not considered because it is not allowed to -lose entries due to collisions. The implemented solution is a sorted -table with a two layer table structure. This allows to significantly -optimize the lookup time especially when the table has lots of valid -entries. - -It is important to notice that in a normal HSR case scenario there are - -in average - significantly more successful lookup operations (MAC -address found in the table) than insertion and deletion operations. -Indeed, insertion operations are only made with a supervision frame. -This assumption cannot be made for PRP since all frames can create an -entry in the node table. The design is therefore optimized according to -this assumption. - -Frame duplication from the host -------------------------------- - -Frames sent by the host must be duplicated and should be sent to both -ports nearly at the same time for HSR and PRP. In a simple approach, the -host stores the frame in the queue of one PRU, the PRU then waits until -both ports are available and finally sends the frame at the same time -via both ports. However, this solution is not resource efficient and it -increases the latency of one PRU when waiting for the PORT to be ready. -Therefore, a solution that off-loads the PRU from the duplication task -is implemented: the host driver duplicates the frames and puts a copy to -each PRU queue. - -The implementation is however not straightforward: - -Since the frames are not “linked” to each other, there is no guarantee -that the frames are sent by both PRUs within a short interval. The host -could control the queue status and only push the frames in the highest -priority queue of both PRU when the queues are free. This would force -each PRU to send the frame and its duplicate next. Nevertheless, for HSR -this solution removes the prioritization of the frame circulating in the -HSR ring as a PRU could buffer a high priority frame from the ring due -to a lower priority frame sent by the host. Frames circulating in the -ring are to be treated with higher priority than frames sent by the -host. There is a compromise to be found. - -The solution is the following: The host driver duplicates the frame and -puts the duplicates in the queues of each PRU. The queue is selected -based on the priority of the frame. Each PRU handles the frame -independently and we only have the assurance that each frame will be -sent out within an unknown interval. The drawback of this solution is -the lack of control on when each frame will be sent out. The interval -can be bigger than one maximum sized Ethernet frame in this case. - -Supervision Frame ------------------- - -Incoming supervision frames are received and processed by the PRU. On -reception of a frame, the PRU updates the node table and the statistic -counters. For HSR, if the received supervision frame originates from the -receiver (i.e. it traversed the whole ring) it is discarded. Otherwise -it is sent to the next node in store and forward mode. The reason for -using store and forward mode is the following: A supervision frame might -trigger the creation of an entry in the node table and this task is time -consuming. By sending the frame in store and forward mode, more time is -available for this operation while receiving the frame. Each device in -an HSR/PRP network sends supervision frames at a constant time interval. -Outgoing supervision frames are composed and sent by the host CPU. - -Cut-Through for HSR --------------------- - -Cut through happens when switch firmware bypasses the transmit queues -and directly copies data from Rx FIFO to Tx FIFO. The concept is -explained here - -The concept of forwarding frames from HSR port to HSR port when -operating in cut-through mode deserves more explanation since the -following boundary conditions require a carefully balanced -implementation: •Cut-through of a frame shall start as early as possible -in order to minimize the propagation delay in each node. The ICSS switch -supports starting the cut-through operation after a configurable amount -of bytes received. Theoretically, for HSR the minimum number of bytes -required is 22 (12 bytes Source-/Destination MAC, 4 bytes VLAN Tag, 6 -bytes HSR Tag) in order to have all the necessary data to take the -routing decision. The receiving process is optimized to allow cut -through as soon as possible depending on the type of the frame ( see -start receiving process in 3.2.2 Micro Scheduler). •Duplicates shall not -be cut through (i.e. the detection of a duplicate shall be finished -before the next node in the ring starts processing the frame) •Detection -of duplicates (computing the hash index and scanning a bin in the hash -table) is time consuming - -Waiting for the duplicate detection before taking the cut through -decision would delay the frame too much. Starting to cut-through a frame -without port duplicate rejection minimizes the delay and allows starting -the receiving process after 14 bytes. Once the cut through of a frame -has started, the port duplication rejection process starts. If the frame -is identified as duplicate or corrupted, the transmission of the frame -is aborted by asserting the TX\_RESET which will reset the transmit FIFO -and clear all its contents and therefore corrupt the frame being -cut-though. - -.. _HSR_PRP_Firmware_Memory_Map_label: - -HSR/PRP Memory Map ------------------- - -.. rubric:: Shared RAM Memory Map - :name: shared-ram-memory-map - -+--------------------+--------------------+--------------------+--------------------+ -| Name of Offset | Description | Offset in Shared | Size (in bytes) | -| | Refer to | RAM | | -| | *hsr\_prp\_firmwar | | | -| | e.h* | | | -+====================+====================+====================+====================+ -| INDEX\_ARRAY | Index entry for | *0x1E0* | 144 | -| | Node Table | | | -+--------------------+--------------------+--------------------+--------------------+ -| NODE\_TABLE | Node Table for the | *0x1FCO* | *4132* | -| | DANH/DANP | | | -+--------------------+--------------------+--------------------+--------------------+ - -Table: **Shared RAM Memory Map** - -+--------------------------+--------------------------+--------------------------+ -| Name of Offset | Description | Offset in Shared RAM | -| | Refer to | (base : 0x140) | -| | *hsr\_prp\_firmware.h* | | -+==========================+==========================+==========================+ -| LRE\_CNT\_TX\_A | Number of frames | *4* | -| | successfully sent over | | -| | port A that are HSR/PRP | | -| | tagged | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_TX\_B | Same for Port B | *8* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_TX\_C | Number of frames | *12* | -| | successfully sent to | | -| | Host that are HSR/PRP | | -| | tagged | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_ERRWRONGLAN\_A | number of frames with | *16* | -| | the wrong LAN | | -| | identifier received on | | -| | LRE port A | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_ERRWRONGLAN\_B | Same for Port B | *20* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_ERRWRONGLAN\_C | Same for Host | *24* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_RX\_A | number of frames | *28* | -| | received successfully | | -| | with HSR or PRP TAG on a | | -| | LRE port A | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_RX\_B | Same for Port B | *32* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_RX\_C | Same for Host | *36* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_ERRORS\_A | number of frames with | *40* | -| | errors | | -| | received on this LRE | | -| | port A | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_ERRORS\_B | Same for Port B | *44* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_ERRORS\_C | Same for Host | *48* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_NODES | Number of active nodes | *52* | -| | in the node table | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_PROXY\_NODES | Number of active proxy | *56* | -| | nodes in the node table | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_UNIQUE\_RX\_A | Number of entries in the | *60* | -| | duplicate detection | | -| | mechanism | | -| | on port A for which no | | -| | duplicate was received | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_UNIQUE\_RX\_B | Same for Port B | *64* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_UNIQUE\_RX\_C | Same for Host | *68* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_DUPLICATE\_RX\ | Number of entries in the | *72* | -| _A | duplicate detection | | -| | mechanism on port A for | | -| | which one single | | -| | duplicate was received | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_DUPLICATE\_RX\ | Same for Port B | *76* | -| _B | | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_DUPLICATE\_RX\ | Same for Host | *80* | -| _C | | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_MULTIPLE\_RX\_ | Number of entries in the | *84* | -| A | duplicate detection | | -| | mechanism on port A for | | -| | which more than one | | -| | duplicate was received | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_MULTIPLE\_RX\_ | Same for Port B | *88* | -| B | | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_MULTIPLE\_RX\_ | Same for Port C | *92* | -| C | | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_OWN\_RX\_A | Number of entries on | *96* | -| | port A received from | | -| | device itself | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_CNT\_OWN\_RX\_B | Same for Port B | *100* | -+--------------------------+--------------------------+--------------------------+ -| LRE\_DUPLICATE\_DISCARD | Number of frame retreive | *104* | -| | by the host | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_TRANSPARENT\_RECEPT | Number of frame received | *108* | -| ION | without PRP RCT | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_NODE\_TABLE\_LOOKUP | Number of instances | *112* | -| \_ERROR\_A | where node table look up | | -| | failed for Port A | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_NODE\_TABLE\_LOOKUP | Same for Port B | *116* | -| \_ERROR\_B | | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_NODE\_TABLE\_FULL | If Node Table is full, | *120* | -| | this value is | | -| | incremented | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_MULTICAST\_DROPPED | If the Multicast frame is| *124* | -| | dropped because of no | | -| | hash value configured in | | -| | the filter table, this | | -| | value is incremented | | -+--------------------------+--------------------------+--------------------------+ -| LRE\_VLAN\_DROPPED | If the frame is dropped | *128* | -| | because of no entry for | | -| | the VID of the frame in | | -| | the VLAN filter table, | | -| | this value is incremented| | -+--------------------------+--------------------------+--------------------------+ - -Table: **LRE Interface Stats** - -+--------------------+--------------------+--------------------+--------------------+ -| Name of Offset | Description | Offset in PRU0 | Size (in bytes) | -| | Refer to | DRAM | | -| | *hsr\_prp\_firmwar | | | -| | e.h* | | | -+====================+====================+====================+====================+ -| DUPLICATE\_HOST\_T | Duplicate | *0x200* | *6136* | -| ABLE | detection table | | | -| | for Host | | | -+--------------------+--------------------+--------------------+--------------------+ -| NEXT\_FREE\_ADDRES | Offset of the | *0x1B00* | *132* | -| S\_NT\_QUEUE | queue of the free | | | -| | address | | | -| | for the node table | | | -+--------------------+--------------------+--------------------+--------------------+ -| POINTERS\_FREE\_AD | Offset of the read | *0x1B84* | *4* | -| DR\_NODETABLE | and write pointer | | | -| | of the | | | -| | free address of | | | -| | the node | | | -| | table(read.w0,writ | | | -| | e.w2) | | | -+--------------------+--------------------+--------------------+--------------------+ - -Table: **PRU0 RAM Memory Map** - -+--------------------+--------------------+--------------------+--------------------+ -| Name of Offset | Description | Offset in PRU1 | Size (in bytes) | -| | Refer to | DRAM | | -| | *hsr\_prp\_firmwar | | | -| | e.h* | | | -+====================+====================+====================+====================+ -| DUPLICATE\_PORT\_T | Offset of port | *0x200* | *3064* | -| ABLE\_PRU0 | duplicate table | | | -| | for PRU0 (HSR | | | -| | Only) | | | -+--------------------+--------------------+--------------------+--------------------+ -| DUPLICATE\_PORT\_T | Offset of port | *0xE00* | *3064* | -| ABLE\_PRU1 | duplicate table | | | -| | for PRU1 (HSR | | | -| | Only) | | | -+--------------------+--------------------+--------------------+--------------------+ -| NODE\_TABLE\_SIZE | Size of the node | *0x1C00* | *4* | -| | table [0..128] | | | -+--------------------+--------------------+--------------------+--------------------+ -| NODE\_TABLE\_ARBIT | Busy slave flag | *0x1C04* | *4* | -| RATION | and busy master | | | -| | flag | | | -| | for 3 lock used to | | | -| | protect the node | | | -| | table | | | -+--------------------+--------------------+--------------------+--------------------+ -| DUPLICATE\_HOST\_T | Size and setup (N | *0x1C08* | *4* | -| ABLE\_SIZE | and M) of | | | -| | duplicate host | | | -| | table | | | -+--------------------+--------------------+--------------------+--------------------+ -| DUPLICATE\_PORT\_T | Size and setup (N | *0x1C1C* | *4* | -| ABLE\_SIZE | and M) of | | | -| | duplicate port | | | -| | table | | | -+--------------------+--------------------+--------------------+--------------------+ -| NODE\_FORGET\_TIME | Time after which a | *0x1C20* | *4* | -| | node entry is | | | -| | cleared (10ms | | | -| | resolution) | | | -+--------------------+--------------------+--------------------+--------------------+ -| DUPLI\_FORGET\_TIM | Time after which | *0x1C24* | *4* | -| E | an entry is | | | -| | removed from the | | | -| | duplicate table | | | -| | (10ms resolution) | | | -+--------------------+--------------------+--------------------+--------------------+ -| PATH\_BROKEN\_NB\_ | Supervision frame | *0x1C28* | *4* | -| FRAM\_DIFF | Counter minimum | | | -| | difference to | | | -| | detect a broken | | | -| | path | | | -+--------------------+--------------------+--------------------+--------------------+ -| DUPLI\_PORT\_CHECK | Time interval to | *0x1C2C* | *4* | -| \_RESO | check the port | | | -| | duplicate table | | | -+--------------------+--------------------+--------------------+--------------------+ -| DUPLI\_HOST\_CHECK | Time interval to | *0x1C30* | *4* | -| \_RESO | check the host | | | -| | duplicate table | | | -+--------------------+--------------------+--------------------+--------------------+ -| NODETABLE\_CHECK\_ | Time interval to | *0x1C34* | *4* | -| RESO | check the node | | | -| | duplicate table | | | -+--------------------+--------------------+--------------------+--------------------+ -| HOST\_TIMER\_CHECK | Host \| Port | *0x1C38* | *4* | -| \_FLAGS | | | | -+--------------------+--------------------+--------------------+--------------------+ -| HOST\_DUPLICATE\_A | Arbitration flag | *0x1C3C* | *4* | -| RBITRATION | for the host | | | -| | duplicate task | | | -+--------------------+--------------------+--------------------+--------------------+ -| ICSS\_FIRMWARE\_RE | Time counter to | *0x1C40* | *4* | -| LEASE | trigger the host | | | -| | duplicate table | | | -| | check task | | | -+--------------------+--------------------+--------------------+--------------------+ -| RED\_FIRMWARE\_REL | Time counter to | *0x1C44* | *4* | -| EASE | trigger the Node | | | -| | Table check task | | | -| | in firmware | | | -+--------------------+--------------------+--------------------+--------------------+ -| SUP\_ADDR | Supervision | *0x1C48* | *4* | -| | address in HSR | | | -+--------------------+--------------------+--------------------+--------------------+ - -Table: **PRU1 RAM Memory Map** - diff --git a/source/common/Industrial_Protocols/HSR_PRP/_Firmware_Features.rst b/source/common/Industrial_Protocols/HSR_PRP/_Firmware_Features.rst deleted file mode 100644 index 5f06530d9..000000000 --- a/source/common/Industrial_Protocols/HSR_PRP/_Firmware_Features.rst +++ /dev/null @@ -1,69 +0,0 @@ -.. http://processors.wiki.ti.com/index.php/PRU_ICSS_HSR_PRP_Release_Notes - -A common firmware is used across TI RTOS and Linux implementations of -HSR/PRP. This section describes the firmware details. - -Firmware Features Supported ----------------------------- - -- **HSR/PRP** - - - The implementation is as per IEC 62439-3 Ed 2.0 - - Operates as a DAN (Dual Attached Node) - -- **HSR** - - - Operates as a DANH - - As per clause 5 of the standard - - Support for modes – H, T, U and N as per standard - - Modes can be changed at run time - -- **PRP** - - - Operates as a DANP - - As per clause 6 of the standard - - Two ports as per standard, Port A and Port B - -- **Support for Node Table** - - - Total 128 entries on AMICx, AM335x, AM437x - - Total 256 entries on AM57xx & K2G - - Hash Table for faster lookup - - O(1) complexity - - Node Table statistics - -- **Support for Multicast Filtering** - - - Supported on all SoCs - - Hash Table for faster lookup - - O(1) complexity - -- **Duplicate Discard Table** - - - Duplicate discard on Port to Host path (HSR and PRP) - - Duplicate discard table on Port to Port path (HSR) - - Data integrity (CRC) check during port to port forwarding, except cut through (HSR) - -- **QoS scheme** : 3-bit VLAN PCP - - - No of levels supported : 8 - - Number of host queues : 2 \| 4 QoS levels per host queue - - Number of port queues : 4 \| 2 QoS levels per port queue - - Number of host queues are configurable - -- **Statistics** - - - Supports all MIB statistics as per standard - - Node Table statistics for debugging - -- **PTP/1588** - - - PTP Slave and Master mode - - Supports P2P clock. - - PTP over 802.3 (Annex F) - - Transparent Clock supported - - Ordinary Clock supported - - Single and Two step clock supported - - Peer delay Response is always sent as two-step - -- **Storm Prevention** : Yes. Configurable per port diff --git a/source/common/Industrial_Protocols/HSR_PRP/_Protocol_Overview.rst b/source/common/Industrial_Protocols/HSR_PRP/_Protocol_Overview.rst deleted file mode 100644 index 9d921312d..000000000 --- a/source/common/Industrial_Protocols/HSR_PRP/_Protocol_Overview.rst +++ /dev/null @@ -1,25 +0,0 @@ - -HSR (High-availability Seamless Redundancy) and PRP (Parellel Redundancy -Protocol) are protocols supporting redundant network connections defined by -IEC 62439-3. Both operate by using two ethernet ports together, and duplicating -every frame to be sent over both ports, so if one connection fails, the -transmission succeeds. Frames are tagged with a sequence number, so the -receiving node can identify and discard duplicates. HSR/PRP provides an -advantage over other protocols that handle link failure (e.g. STP/RSTP) -because there is no downtime or packet loss on link failure. This is -required in some industrial networking situations. - -The major difference between HSR and PRP is that HSR networks are configured -as a ring, then frames are sent both directions around the ring by all nodes. -PRP networks can take any configuration, and all connections are simply -physically duplicated. Additionally, PRP nodes can interoperate with standard -ethernet networks, while HSR cannot. (See more details below and full -details in IEC 62439-3) - -The HSR/PRP protocols can be run by the Linux kernel, and function over -standard ethernet ports, but the advantage of using the PRU-ICSS supported -industrial ethernet ports is that the PRU-ICSS HSR/PRP firmware offloads much -of the protocol functionality to firmware, allowing more processing bandwidth -for an application, and in the case of HSR, providing faster cut-through -switching as frames pass through ring nodes. - diff --git a/source/images/Hsr-network-setup-v2.jpg b/source/images/Hsr-network-setup-v2.jpg deleted file mode 100644 index 8f2017b6f..000000000 Binary files a/source/images/Hsr-network-setup-v2.jpg and /dev/null differ diff --git a/source/images/Hsr-prp-offload.png b/source/images/Hsr-prp-offload.png deleted file mode 100644 index 3a5ebbce9..000000000 Binary files a/source/images/Hsr-prp-offload.png and /dev/null differ diff --git a/source/images/Linux-hsr-architecture.png b/source/images/Linux-hsr-architecture.png deleted file mode 100644 index 34cfb06d9..000000000 Binary files a/source/images/Linux-hsr-architecture.png and /dev/null differ diff --git a/source/images/Prp-network-setup.jpg b/source/images/Prp-network-setup.jpg deleted file mode 100644 index c687a2c90..000000000 Binary files a/source/images/Prp-network-setup.jpg and /dev/null differ diff --git a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst index 60251a75b..dd806847c 100644 --- a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst +++ b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload.rst @@ -1,3 +1,5 @@ +.. _hsr-offload: + =================== HSR Offload =================== diff --git a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst index cf3337c24..3ef7c5684 100644 --- a/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst +++ b/source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload.rst @@ -1,3 +1,5 @@ +.. _prp-offload: + =================== PRP Offload =================== diff --git a/source/linux/Industrial_Protocols/HSR_PRP/_HSR_PRP_for_Linux.rst b/source/linux/Industrial_Protocols/HSR_PRP/_HSR_PRP_for_Linux.rst deleted file mode 100644 index 1995c9b8c..000000000 --- a/source/linux/Industrial_Protocols/HSR_PRP/_HSR_PRP_for_Linux.rst +++ /dev/null @@ -1,2177 +0,0 @@ -Overview ---------- - -In both HSR and PRP protocols, the DAN (Dual Attached Node) sends an -identical frame to both the interfaces and uses a sequence number in the -tag to allow drop duplicates at the Rx node to achieve redundancy. This -section describes the different software components of a Linux based -HSR/PRP solution to support redundancy. - -Features supported ------------------- - -- **HSR/PRP** - - - 100 Mbits/s Full Duplex Ethernet Interface - - The implementation is as per IEC 62439-3 Ed 2.0 - - Operates as a DAN (Dual Attached Node) - -- **HSR** - - - Operates as a DANH - - As per clause 5 of the standard - - Support for modes – H, T, U and N as per standard - - Modes can be changed at run time - - Cut-through switching - -- **PRP** - - - Operates as a DANP - - As per clause 6 of the standard - - Two ports as per standard, Port A and Port B - -- **Support for Node Table** - - - Total 128 entries on AMICx, AM335x, AM437x - - Total 256 entries on AM57xx - - Hash Table for faster lookup - - Node Table statistics - -- **Support for Multicast Filtering** - - - Supported on all SoCs - - Hash Table of 256 entries for faster lookup - - O(1) complexity - - User configurable mask to select bits for hashing - -- **Support for VLAN over HSR/PRP interface** - -- **Support for VLAN Filtering** - - - VLAN filter table of 4096 entries for perfect match - - O(1) complexity - -- **Duplicate Discard Table** - - - Duplicate discard on Port to Host path (HSR and PRP) - - Duplicate discard table on Port to Port path (HSR) - - Data integrity (CRC) check during port to port forwarding, except cut through (HSR) - -- **QoS scheme** : 3-bit VLAN PCP - - - No of levels supported : 2 - - Number of host queues : 2 \| 2 QoS levels per host queue - - Number of port queues : 2 \| 2 QoS levels per port queue - -- **Statistics** - - - Supports all MIB statistics as per standard - - Node Table statistics for debugging - -- **Storm Prevention** : Yes. Configurable per port - -- **Dual instance of HSR/PRP using two PRU-ICSS on AM571x** - -- **VLAN tag support in Supervision frames** - -- **Run time change of Protocol at PRU-ICSS without reboot** - -Software Architecture ----------------------- - -The diagram below highlights the software components that are modified -or developed specifically for HSR/PRP. These along with other standard -Linux OS components are used to implement the Linux HSR/PRP DAN (Dual -Attached Node). - -- Linux Kernel drivers - - - HSR/PRP driver - - Ethernet driver - -- User space - - - Net-SNMP - - iproute2 - -.. Image:: /images/Linux-hsr-architecture.png - -HSR/PRP Driver source code and Kconfig option -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The driver source code is located under net/hsr-prp folder of the Linux -source tree. To build kernel with this driver, set Kconfig option -CONFIG\_HSR=y in the dotconfig or enable it from the menu. - -.. _hsr-prp-overview-and-setup: - -Linux HSR/PRP Driver -^^^^^^^^^^^^^^^^^^^^^^^^ - -The Linux networking subsystem in upstream kernel has added support for -HSR driver starting in v3.12 (HSRv0 - IEC 62439-3:2010) and enhanced the -same to support HSRv1 (IEC 62439-3:2012) in v4.6. This driver allows -user to create an HSR network device with a pair of slave network -interfaces (A and B) that are standard Ethernet interfaces. For example -on TI's AM572x IDK EVM, there are two Ethernet interfaces (10/100) per -each PRU ICSS. The PRU Emac driver available for ICSS PRU Ethernet h/w -supports two Ethernet ports. Using ip link command, user will be able to -setup a HSR interface on this EVM that pair the two PRU Ethernet -interfaces to create a HSR node or **DAN-H**. - -TI has enhanced the Linux HSR driver and ip link command in iproute2 -package to support PRP defined in IEC 62439-3 clause 4. With this -change, user will be able to create a Doubly Attached Node with PRP -(**DAN-P**) using standard Ethernet interfaces. As in the case of HSR, -using ip link command, user will be able to setup a prp interface using -two Ethernet interfaces such as the one provided by PRU Dual EMAC driver. - -Linux HSR/PRP driver provides a standard Ethernet interface to -application layer and hide the details of the redundancy protocol under -the driver layer. Linux HSR/PRP driver implements the Link Redundancy -Entity (LRE) that is central to implementing redundancy using respective -protocol. - -HSR LRE functions and L2 routing can be offloaded to the firmware -running on the PRU cores of ICSS. The diagram below shows the -architecture of an Offloaded HSR/PRP driver. The upper layer driver is -existing Linux HSR/PRP driver described in the previous section. The PRU -Ethernet driver exports HSR/PRP capabilities in the NetDev feature -flags. The green blocks in the Redundancy layer shows the software -blocks that gets offloaded to PRUs in ICSS which is shown green as well. -The upper layer HSR/PRP driver uses the feature flags exported by the -PRU Ethernet driver to disable corresponding functions in its layer. The -firmware is a re-use from the TI RTOS implementation that is discussed -above. Re-use means the data structures and API should be re-used across -both TI RTOS and Linux driver implementations. A common PRU Ethernet -driver is developed to support existing Dual EMAC device as well HSR/PRP - -.. Image:: /images/Hsr-prp-offload.png - -.. _SITARA_HSR_PRP_id_if_number_mapping: - -PRU-ICSS Subsystem Driver -^^^^^^^^^^^^^^^^^^^^^^^^^ - -PRU-ICSS Subsystem Driver provide a set of functions to client driver -such as PRU Ethernet (described in next section) to load and run firmware -on a specific core, such as PRU on a PRU-ICSS. On a SoC, there can be 1 or -2 instance of the PRU-ICSS and client driver might want to know which -instance it is referring to. PRU-ICSS sysfs files are specific to an instance -and user might have to know what instance the file refers to. Following -mapping is used for the ID based on the SoC and the PRU-ICSS instance. - -+---------------------------+------+-----------+--------------------+ -| SoC | ID | if number | ICSS TRM reference | -+===========================+======+===========+====================+ -| AM3 | 0 | eth0/1 | PRU-ICSS | -+---------------------------+------+-----------+--------------------+ -| AM4 | 0 | eth1/2 | PRU-ICSS0 | -+---------------------------+------+-----------+--------------------+ -| AM571 | 1 | eth2/3 | PRU-ICSS1 | -+---------------------------+------+-----------+--------------------+ -| AM571 | 2 | eth4/5 | PRU-ICSS2 | -+---------------------------+------+-----------+--------------------+ -| AM572/4 | 2 | eth2/3 | PRU-ICSS2 | -+---------------------------+------+-----------+--------------------+ - -In the following section, the PRU-ICSS ID is used in the sysfs file path -and the same can be obtained from the table above to know which PRU-ICSS -the file refers to. - -You can also check which PRU-ICSS an ethernet interface belongs to via command -line, e.g. eth2 on different platforms: - -AM571x: - -:: - - root@am57xx-evm:~# ls -l /sys/class/net/eth2 | grep device - lrwxrwxrwx 1 root root 0 Jun 10 11:29 device -> ../../../pruss1_eth - -AM572x: - -:: - - root@am57xx-evm:~# ls -l /sys/class/net/eth2 | grep device - lrwxrwxrwx 1 root root 0 Jun 10 11:29 device -> ../../../pruss2_eth - -PRU Ethernet Driver (Dual EMAC/HSR/PRP) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -As of Processor SDK 7.x, the PRU Ethernet driver supports HSR/PRP/SWITCH -firmware offload. The PRU Ethernet driver initially probe in Dual EMAC mode and -loads Dual EMAC firmware. HSR/PRP/SWITCH are the firmware offload cases. Please -refer to RSTP section on PRUETH SWITCH driver. When a HSR/PRP firmware is -loaded, the PRU Ethernet driver will do proper firmware configurations and -notify the Linux HSR/PRP driver (under net/hsr directory. Also referred to -as upper driver) stack that offload has been enabled through netdev feature -flags. From then on, LRE functionality at the rx side is disabled in Linux -HSR/PRP upper driver and carried out in firmware. Tx LRE function continues -to be in Linux HSR/PRP driver. i.e Tx frame duplication and Supervision frame -generation is still done in the upper driver. - -Notice that, from the user point of view, all of the above mentioned -driver behavior is transparent to the user. - -.. note:: For all discussion and examples shown, AM57xx device is used as - example, but different devices will use different ports. Please - see :ref:`SITARA_HSR_PRP_id_if_number_mapping` for interface - number and PRU-ICSS ID information for different SoCs. - -As of Processor SDK 5.1.x, the driver supports 2 instances of HSR/PRP -one on each of PRU-ICSS on AM5xxx as per table below. - - +------------+-----------+ - | PRU-ICSS1 | PRU-ICSS2 | - +============+===========+ - | HSR | HSR | - +------------+-----------+ - | HSR | PRP | - +------------+-----------+ - | PRP | PRP | - +------------+-----------+ - | PRP | HSR | - +------------+-----------+ - -Queue Usage and VLAN PCP to Queue Map -"""""""""""""""""""""""""""""""""""""" - -At the Ingress, there are two queues available for queueing the frames -coming from each port or PRU to Host and two queues available for packets -from Host to each PRU. At the Egress, there are additionally two more -queues used for forward traffic from PRU1 to PRU0 and vice-versa. PRUETH -driver configures the PCP to Queue MAP in Shared RAM which is used by firmware -to decide which queue to pick to enqueue frames towards Host or other -PRU. Priority queues are assigned based on the PCP value in VLAN tag -of an Ethernet frame. Untagged frame is treated like PCP 0. Here is -the mapping value configured by driver in 4 bytes starting at offset -QUEUE_2_PCP_MAP_OFFSET (defined in icss_lre_firmware.h). Same mapping is -used for Ingress and Egress traffic. - -The convention is that higher queue value corresponds to lower priority - -**For HSR/PRP Ethernet types** - -- At ingress to Host - -:: - - byte 0 - To host from PRU 1, PCP 0-3 => Q3 - byte 1 - To host from PRU 1, PCP 4-7 => Q2 - byte 2 - To host from PRU 0, PCP 0-3 => Q1 - byte 3 - To host from PRU 0, PCP 4-7 => Q0 - -At the ingress, firmware inspect the PCP value in the incoming Ethernet -frame's VLAN tag and choose a priority queue to enqueue the frame based on -the above mapping. - -- At egress from host to wire/network - -:: - - PRU0/PRU1 - --------- - byte 0 - from Host to PRU, PCP 0-3 => Q3 - byte 1 - from Host to PRU, PCP 4-7 => Q2 - - PRU0 - ----- - byte 2 - from PRU1 to PRU0, PCP 0-3 => Q1 - byte 3 - from PRU1 to PRU0, PCP 4-7 => Q0 - - PRU1 - ----- - byte 2 - from PRU0 to PRU1, PCP 0-3 => Q1 - byte 3 - from PRU0 to PRU1, PCP 4-7 => Q0 - -Driver choose the priority queue for egress transmission based on the -PCP value of the Ethernet frame received from the upper layer. Firmware -sends the frames first from Q0 and Q2 in a round robin fashion. Once these -queues are drained, it then sends from the next higher queues Q1 and Q3 -again in a round robin fashion. At the egress, Q0/Q1 are port queues and -Q2/Q3 are host queues. - -**For Dual EMAC Ethernet type** - -In Dual EMAC case, mapping is hard coded in firmware. - -- At ingress to Host - -:: - - From PRU0 to Host, PCP 0-3 => Q1 - From PRU0 to Host, PCP 4-7 => Q0 - - From PRU1 to Host, PCP 0-3 => Q3 - From PRU1 to Host, PCP 4-7 => Q2 - -- At egress from host to wire/network - -:: - - PRU0/PRU1 - -- --------- - From Host to PRU0/PRU1, PCP 0-1 => Q3 - From Host to PRU0/PRU1, PCP 2-3 => Q2 - From Host to PRU0/PRU1, PCP 4-5 => Q1 - From Host to PRU0/PRU1, PCP 6-7 => Q0 - -Firmware sends the frames first from Q1, and then from the next higher -queue (Q2) and so forth. - -For Dual EMAC and SWITCH ethernet types, at the Ingress, two separate irq -handlers are assigned to each port to process the packets. Driver uses -NAPI and NAPI polling is kicked once the interrupt event is received by -for each port. Packets are drained by the NAPI Poll function. - -For HSR/PRP Ethernet type, an interrupt is attached to a pair of High -Priority Queues and another interrupt to the pair of low priority queues. -each queue is associated with a port. Two NAPI instances used, one for -high priority queues and another for low priority queues to independently -scan and drain the queues from the two ports. Interrupt handler kicks -NAPI. NAPI poll handler drains packets from the High priority or Low -priority queues based on timestamp maintained in memory. i.e packets are -ordered based on the timestamp. - -.. _Changing_protocol_at_PRU_Ethernet: - -Changing protocol at PRU Ethernet -""""""""""""""""""""""""""""""""""" - -PRU Ethernet driver supports multiple protocols/Ethernet types based -on the firmware loaded on ICSS PRU. By default, the PRU Ethernet driver -is probed to be in the Dual EMAC mode and EMAC firmware is loaded on to the -PRU. From this mode, user will be able to change to one of the Ethernet -type without having to reboot the board:- - -* HSR -* PRP - -Two feature flags are added to help offload HSR or PRP in the PRU -Ethernet driver :- hsr-rx-offload and prp-rx-offload. PRU Firmware -essentially offload the rx side processing of LRE, such as duplicate -detection and drop, node table update, stats update etc. To reflect the -same, the features are named with a rx-offload suffx to the protocol name. -Ethtool command has an option -K to set or clear the feature in a network -device. So this flag can be set or reset rx offload feature in the PRU -Ethernet device. As the device may be hooked up to a upper HSR/PRP network -device, user is expected to delete the hsr or prp interface before -changing the flag at the PRU Ethernet device. General procedure to change -protocol at PRU Ethernet device is as follows:- - -Below assumes that hsr or prp interface using the PRU Ethernet devices -is currently deleted. Here are the steps at a high level:- - -1. Bring down the two PRU Ethernet interfaces using ifconfig and -unassign the ip address using ifconfig. For example - -:: - - ifconfig eth2 down 0.0.0.0 - ifconfig eth3 down 0.0.0.0 - -2. If the PRU Ethernet device is currently running HSR or PRP offload -feature, the same has to be disabled before switching to Dual EMAC or another -protocol using ethtool -K option. For example if HSR is currently -running, do - -:: - - ethtool -K eth2 hsr-rx-offload off - ethtool -K eth3 hsr-rx-offload off - -Similarly if PRP is currently running, do - -:: - - ethtool -K eth2 prp-rx-offload off - ethtool -K eth3 prp-rx-offload off - -3. If user would like to offload HSR, enable the feature hsr-rx-offload -on both devices. - -:: - - ethtool -K eth2 hsr-rx-offload on - ethtool -K eth3 hsr-rx-offload on - -4. Now the PRU Ethernet devices can be paired to create an HSR interface -using ip link command. To offload PRP user does following command in -step 3 - -:: - - ethtool -K eth2 prp-rx-offload on - ethtool -K eth3 prp-rx-offload on - -To display the offload feature currently active at the PRU Ethernet, -user may type following command for example for eth2 - -:: - - ethtool -k eth2 - -.. rubric:: Sample commands - :name: sample-commands - -Before using these commands, save the MAC address of both interfaces. -These sample commands assumes a MAC address of 70:FF:76:1C:0E:8C for -both PRU Ethernet interfaces and an IP address of 192.168.2.20 for the -hsr/prp interface. Eth3 MAC address is assumed to be 70:FF:76:1C:0E:8E. -Also assumes user create hsr0 or prp0 interface using eth2 and eth3 -interfaces. Please note that for each DAN, user needs to assign unique -MAC address and IP address from the same subnet. - -- To switch from Dual EMAC to HSR - -:: - - ifconfig eth2 0.0.0.0 down - ifconfig eth3 0.0.0.0 down - ifconfig eth2 hw ether 70:FF:76:1C:0E:8C - ifconfig eth3 hw ether 70:FF:76:1C:0E:8C - ethtool -K eth2 hsr-rx-offload on - ethtool -K eth3 hsr-rx-offload on - ifconfig eth2 up - ifconfig eth3 up - ip link add name hsr0 type hsr slave1 eth2 slave2 eth3 supervision 45 version 1 - ifconfig hsr0 192.168.2.20 - -- To switch from HSR to PRP - -:: - - ip link delete hsr0 - ifconfig eth2 down - ifconfig eth3 down - ethtool -K eth2 hsr-rx-offload off - ethtool -K eth3 hsr-rx-offload off - ethtool -K eth2 prp-rx-offload on - ethtool -K eth3 prp-rx-offload on - ifconfig eth2 up - ifconfig eth3 up - ip link add name prp0 type hsr slave1 eth2 slave2 eth3 supervision 45 proto 1 - ifconfig prp0 192.168.2.20 - -- To switch from PRP to HSR - -:: - - ip link delete prp0 - ifconfig eth2 down - ifconfig eth3 down - ethtool -K eth2 prp-rx-offload off - ethtool -K eth3 prp-rx-offload off - ethtool -K eth2 hsr-rx-offload on - ethtool -K eth3 hsr-rx-offload on - ifconfig eth2 up - ifconfig eth3 up - ip link add name hsr0 type hsr slave1 eth2 slave2 eth3 supervision 45 version 1 - ifconfig hsr0 192.168.2.20 - -- To switch from HSR to Dual EMAC - -:: - - ip link delete hsr0 - ifconfig eth2 down - ifconfig eth3 down - #Restore eth3 MAC address - ifconfig eth3 hw ether 70:FF:76:1C:0E:8E - ethtool -K eth2 hsr-rx-offload off - ethtool -K eth3 hsr-rx-offload off - ifconfig eth2 192.168.2.20 - ifconfig eth3 192.168.3.20 - -- To switch from PRP to Dual EMAC - -:: - - ip link delete prp0 - ifconfig eth2 down - ifconfig eth3 down - ethtool -K eth2 prp-rx-offload off - ethtool -K eth3 prp-rx-offload off - #Restore eth3 MAC address - ifconfig eth3 hw ether 70:FF:76:1C:0E:8E - ifconfig eth2 192.168.2.20 - ifconfig eth3 192.168.3.20 - -Multicast filtering --------------------- - -Multicast filtering is an Ethernet frame filtering feature in PRU firmware based -on the destination MAC address of the received frame. The PRU provides a -Multicast filter table in Data RAM1 of PRU with a size of 256 entries of 1 -byte each. Firmware implements an imperfect match for filtering the frames based -on a hash calculated using the destination MAC address of the frame if the -destination address is a multicast MAC address. - -:: - - Hash = (MAC_ADDR[0] XOR - MAC_ADDR[1] XOR - MAC_ADDR[2] XOR - MAC_ADDR[3] XOR - MAC_ADDR[4] XOR - MAC_ADDR[5]) - -Where MAC_ADDR is the multicast MAC address which is extracted from the destination -address of the Ethernet frame. A bitwise XOR operation is performed on each byte of -MAC address to get the hash value. The hash is used to index into the Multicast -filter table to check if it is set (1) or reset (0). If set, the frame is forwarded -to ARM core (a.k.a Host). If reset, the frame is dropped at the PRU. This is an -imperfect match since there can be multiple MAC addresses that produces the same -hash value. So these frames will get forwarded to the ARM core. - -Typically, an application joins the multicast group either using a raw socket of type -SOCK_DGRAM and use setsockopt() API to Join or leave the multicast group. An -interesting article on this is available at - -http://www.tenouk.com/Module41c.html - -This causes the Multicast MAC address to be added to the mc_list of the -socket and the associated network device in kernel and finally get passed -to the Ethernet device driver (in our case, it is PRU Ethernet device -driver). The relevant API is ndo_set_rx_mode() of the net_device_ops -structure in Linux kernel associated with the network device. The PRU -Ethernet device driver calculates the hash as described above and then -writes 1 to MC filter table using the hash value as index. The PRU Ethernet -device driver also supports allmulti which is used to enable receieve of -all multicast frames at an interface. This is an option passed to the -ifconfig command. - -:: - - Example - >ifconfig eth2 192.168.2.20 allmulti - - To remove the option - >ifconfig eth2 192.168.2.20 -allmulti - - To display the Multicast address list of an interface, say eth2, user types - >ip maddr show dev eth2 - -Sample display - -:: - - root@am57xx-evm:~# ip maddr show dev eth2 - 6: eth2 - link 33:33:00:00:00:01 users 2 - link 01:00:5e:00:00:01 users 2 - link 33:33:ff:1c:16:e0 users 2 - link 01:00:5e:00:00:fb - link 01:00:5e:00:00:fc - link 33:33:00:01:00:03 users 2 - link 33:33:00:00:00:fb users 2 - inet 224.0.0.1 - inet6 ff02::fb - inet6 ff02::1:3 - inet6 ff02::1:ff1c:16e0 - inet6 ff02::1 - inet6 ff01::1 - -Dual EMAC -^^^^^^^^^ - -The multicast filter table(s) are stored in each PRU's Data RAM (PRU0->Data RAM0, -PRU1->Data RAM1) instead of one table in Data RAM1 as for HSR/PRP. - -RSTP Switch -^^^^^^^^^^^ - -In case of RSTP switch mode, multicast filtering is available for -Host/CPU port only. There is a per port multicast filter -table in firmware that can be configured to indicate which of the -multicast addresses are allowed to forwarded to host port from the given -port. Linux driver sets up both filter table to be identical. -Note that currently there is no way to disable multicast filter in RSTP -switch mode (setting ALLMULTI on the bridge port has no effect -currently). - -Multicast filter has no affect on L2 cut-throughput forwarding of -multicast packets. - -Testing Multicast filtering -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -On slave side (i.e device connected to Dual EMAC or Switch port) start -UDP iperf client: - -:: - - root@slave:~# ifconfig eth0 10.0.0.55 - root@slave:~# route add 224.1.100.1 eth0 - root@slave:~# iperf -c 224.1.100.1 -u -t 600 - -On host side, multicast packets are reported as being dropped as -firmware filter is not set to allow this unregistered addresses to host -port. Here host port refers to one of the PRU Ethernet's port in Dual EMAC -mode or the bridge port in case of RSTP switch mode. This can be -verified with ethtool - -:: - - root@am57xx-evm:~# ethtool -S eth2 | grep multicastDropped - multicastDropped: 35 - -This shows that filtering is indeed working. - -Now start a UDP iperf server bound to same multicast IP on host side -(one of the Dual EMAC ports say eth2 or bridge port say br0 in case of -RSTP switch mode): - -:: - - root@am57xx-evm:~# ifconfig eth2 10.0.0.1 - root@am57xx-evm:~# route add 224.1.100.1 eth2 - root@am57xx-evm:~# iperf -s -u -B 224.1.100.1 -i 5 - ------------------------------------------------------------ - Server listening on UDP port 5001 - Binding to local address 224.1.100.1 - Joining multicast group 224.1.100.1 - Receiving 1470 byte datagrams - UDP buffer size: 176 KByte (default) - ------------------------------------------------------------ - [ 3] local 224.1.100.1 port 5001 connected with 10.0.0.55 port 34241 - [ ID] Interval Transfer Bandwidth Jitter Lost/Total - Datagrams - [ 3] 0.0- 5.0 sec 639 KBytes 1.05 Mbits/sec 0.011 ms 2096/ 2541 - (82%) - [ 3] 5.0-10.0 sec 640 KBytes 1.05 Mbits/sec 0.028 ms 0/ 446 - (0%) - [ 3] 10.0-15.0 sec 640 KBytes 1.05 Mbits/sec 0.022 ms 0/ 446 - (0%) - -Packets are no longer dropped and are received by the host. - -VLAN over PRU Ethernet ------------------------ - -Virtual LAN (VLAN) is a standard Linux feature that can be enabled over -PRU Ethernet devices. There are many websites that describes how Linux -VLAN works. Some of them are at -[`[2] `__] or at -[`[3] `__] and some -configuration details are also discussed at -[`[4] `__]. - -User may use ip link command to setup vlan interface over prueth -interfaces. For example, over a hsr interface, if user would like to -setup two vlan interfaces say, hsr0.2 and hsr0.3, user execute the -following commands assuming the hsr0 interface is already setup:- - -Node-1 - -:: - - ifconfig hsr0 0.0.0.0 - ip link add link hsr0 name hsr0.2 type vlan id 2 - ip link add link hsr0 name hsr0.3 type vlan id 3 - ifconfig hsr0.2 192.168.2.40 - ifconfig hsr0.3 192.168.3.40 - ip link set hsr0.2 type vlan egress 0:0 - ip link set hsr0.3 type vlan egress 0:7 - -Node-2 - -:: - - ifconfig hsr0 0.0.0.0 - ip link add link hsr0 name hsr0.2 type vlan id 2 - ip link add link hsr0 name hsr0.3 type vlan id 3 - ifconfig hsr0.2 192.168.2.50 - ifconfig hsr0.3 192.168.3.50 - ip link set hsr0.2 type vlan egress 0:0 - ip link set hsr0.3 type vlan egress 0:7 - -The above assume we have a network with two nodes connected back to -back. The procedure is same if more than two nodes are present in the -network. Using similar commands, user would be able to overlay multiple -virtual LANs over the physical LAN created. The egress option of ip link -command allow mapping packet priority to VLAN PCP values. In the example -the packets on VLAN ID 2 is mapped to PCP value of 0 and VLAN ID 3 is -mapped to PCP value of 7. At the Egress PRU Ethernet device looks at the -PCP value and places it into one of the 4 queues. PRU scan the high -priority queue first for packets and transmits them before transmitting -packets from the lower priority queues. At the ingress, the PRU checks -the PCP value of the packet in the VLAN header and places the frame into -one of the ingress queues. More details on Queue usage is available at -`Queue Usage and VLAN PCP to Queue Map <#queue-usage-and-vlan-pcp-to-queue-map>`__ - -In the above example, after passing some UDP traffic over hsr0.2 and -hsr0.3, the user may check following statistics to verify if the packets -are going over the right VLAN interface - -On Node-1 - -:: - - cat /proc/net/vlan/hsr0.3 - hsr0.3 VID: 3 REORDER_HDR: 1 dev->priv_flags: 1001 - total frames received 68090 - total bytes received 52598480 - Broadcast/Multicast Rcvd 52 - total frames transmitted 68090 - total bytes transmitted 52598459 - Device: hsr0 - INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 - EGRESS priority mappings: 0:7 - root@am57xx-evm:~# cat /proc/net/vlan/hsr0.2 - hsr0.2 VID: 2 REORDER_HDR: 1 dev->priv_flags: 1001 - total frames received 68105 - total bytes received 52604702 - Broadcast/Multicast Rcvd 53 - - total frames transmitted 68074 - total bytes transmitted 52583138 - Device: hsr0 - INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 - EGRESS priority mappings: 0:0 - -Similar procedure can be used for setting up VLAN interfaces over PRU -Dual EMAC and HSR Ethernet types. - -VLAN Filtering ---------------- - -The PRU has a 4096 entry VLAN filter table that allows filtering out -unwanted VLAN traffic to the host. As soon a VLAN interface is created, -the 802.1q Linux kernel module sends the VID information down to the -lower layer HSR or PRP Linux device which in turn pass it down to the -slave Ethernet devices below it (or directly to the Ethernet device in the -case of Dual EMAC). The PRU Ethernet driver gets the VID information via -net_device_ops:ndo_vlan_rx_add_vid(). On receiving this, PRU Ethernet -driver sets the entry at the VID index in VLAN filter table -to 1. When the VLAN interface is deleted, the driver receives the same -information through ndo_vlan_rx_kill_vid() and reset the entry at the -VID index. - -PRU firmware on receiving a VLAN frame, extracts the VID and look up the -VLAN filter table for an entry at the VID if VLAN filtering is enabled -in firmware. If the entry is 1, it forwards the frame to the Host. -Otherwise the frame is dropped. There are additional controls to allow -priority tagged frames to Host if the corrsponding bit is set in firmware -shared memory. PRU Ethernet driver always enables Priority tagged frames -to the Host. User may setup a VLAN interface with VID 0 to send or -receive priority tagged frames. See section `VLAN <#vlan-over-pru-ethernet>`_ for details -on how to assign egress priority mapping for the priority tagged VLAN -interface. - -.. rubric:: Useful commands - :name: Useful-commands - -Internally, the VLAN filter table(s) are stored in each PRU's Data RAM -(PRU0->Data RAM0, PRU1->Data RAM1) instead of one table in Shared RAM -as for HSR/PRP. - -.. rubric:: Limitation - -Currently, the PRU firmware is configured to receive all of the -untagged frames from the network when the VLAN filtering is enabled. -However there is no support for port VLAN which allows these frames -to be received at a designated VLAN interface. - -**Dumping VLAN table and Multicast filter table:** -Firmware maintained VLAN table and Multicast filter table can be dumped -using switch-config tool for advanced debugging. For example: - -:: - - root@am57xx-evm:~# switch-config -I eth2 -d - PRUSS Ethernet driver version 0.2 Reg dump version 256 - - VLAN Filter : enabled - VLAN Filter untagged : allowed to Host - VLAN Filter priority tagged: allowed to Host - - 0: 0001000000000000000000000000000000000000000000000000000000000000 - 64: 0000000000000000000000000000000000000000000000000000000000000000 - 128: 0000000000000000000000000000000000000000000000000000000000000000 - 192: 0000000000000000000000000000000000000000000000000000000000000000 - 256: 0000000000000000000000000000000000000000000000000000000000000000 - 320: 0000000000000000000000000000000000000000000000000000000000000000 - 384: 0000000000000000000000000000000000000000000000000000000000000000 - 448: 0000000000000000000000000000000000000000000000000000000000000000 - 512: 0000000000000000000000000000000000000000000000000000000000000000 - 576: 0000000000000000000000000000000000000000000000000000000000000000 - 640: 0000000000000000000000000000000000000000000000000000000000000000 - 704: 0000000000000000000000000000000000000000000000000000000000000000 - 768: 0000000000000000000000000000000000000000000000000000000000000000 - 832: 0000000000000000000000000000000000000000000000000000000000000000 - 896: 0000000000000000000000000000000000000000000000000000000000000000 - 960: 0000000000000000000000000000000000000000000000000000000000000000 - 1024: 0000000000000000000000000000000000000000000000000000000000000000 - 1088: 0000000000000000000000000000000000000000000000000000000000000000 - 1152: 0000000000000000000000000000000000000000000000000000000000000000 - 1216: 0000000000000000000000000000000000000000000000000000000000000000 - 1280: 0000000000000000000000000000000000000000000000000000000000000000 - 1344: 0000000000000000000000000000000000000000000000000000000000000000 - 1408: 0000000000000000000000000000000000000000000000000000000000000000 - 1472: 0000000000000000000000000000000000000000000000000000000000000000 - 1536: 0000000000000000000000000000000000000000000000000000000000000000 - 1600: 0000000000000000000000000000000000000000000000000000000000000000 - 1664: 0000000000000000000000000000000000000000000000000000000000000000 - 1728: 0000000000000000000000000000000000000000000000000000000000000000 - 1792: 0000000000000000000000000000000000000000000000000000000000000000 - 1856: 0000000000000000000000000000000000000000000000000000000000000000 - 1920: 0000000000000000000000000000000000000000000000000000000000000000 - 1984: 0000000000000000000000000000000000000000000000000000000000000000 - 2048: 0000000000000000000000000000000000000000000000000000000000000000 - 2112: 0000000000000000000000000000000000000000000000000000000000000000 - 2176: 0000000000000000000000000000000000000000000000000000000000000000 - 2240: 0000000000000000000000000000000000000000000000000000000000000000 - 2304: 0000000000000000000000000000000000000000000000000000000000000000 - 2368: 0000000000000000000000000000000000000000000000000000000000000000 - 2432: 0000000000000000000000000000000000000000000000000000000000000000 - 2496: 0000000000000000000000000000000000000000000000000000000000000000 - 2560: 0000000000000000000000000000000000000000000000000000000000000000 - 2624: 0000000000000000000000000000000000000000000000000000000000000000 - 2688: 0000000000000000000000000000000000000000000000000000000000000000 - 2752: 0000000000000000000000000000000000000000000000000000000000000000 - 2816: 0000000000000000000000000000000000000000000000000000000000000000 - 2880: 0000000000000000000000000000000000000000000000000000000000000000 - 2944: 0000000000000000000000000000000000000000000000000000000000000000 - 3008: 0000000000000000000000000000000000000000000000000000000000000000 - 3072: 0000000000000000000000000000000000000000000000000000000000000000 - 3136: 0000000000000000000000000000000000000000000000000000000000000000 - 3200: 0000000000000000000000000000000000000000000000000000000000000000 - 3264: 0000000000000000000000000000000000000000000000000000000000000000 - 3328: 0000000000000000000000000000000000000000000000000000000000000000 - 3392: 0000000000000000000000000000000000000000000000000000000000000000 - 3456: 0000000000000000000000000000000000000000000000000000000000000000 - 3520: 0000000000000000000000000000000000000000000000000000000000000000 - 3584: 0000000000000000000000000000000000000000000000000000000000000000 - 3648: 0000000000000000000000000000000000000000000000000000000000000000 - 3712: 0000000000000000000000000000000000000000000000000000000000000000 - 3776: 0000000000000000000000000000000000000000000000000000000000000000 - 3840: 0000000000000000000000000000000000000000000000000000000000000000 - 3904: 0000000000000000000000000000000000000000000000000000000000000000 - 3968: 0000000000000000000000000000000000000000000000000000000000000000 - 4032: 0000000000000000000000000000000000000000000000000000000000000000 - MC Filter : enabled - MC Mask : ff:ff:ff:ff:ff:ff - MC Filter table below 1 - Allowed, 0 - Dropped - - 0: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 10: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 20: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 30: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 40: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 50: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 - 60: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 70: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 80: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 90: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - a0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - b0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - c0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - d0: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - e0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - f0: 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 - - -Network Storm Prevention --------------------------- -Network storm is defined as an excessive amount of Ethernet -frames at the ingress of a network interface -causing resources being wasted in the device for processing -these frames and thereby affecting the device performance. - -PRUETH driver implements a control mechanism that user can -enable to drop these frames if the number of frames received -during a window (100 msec) reaches a threshold. PRUETH uses -a credit value as the threshold which is user configurable -on a per interface and packet type (broadcast/multicast/unicast) basis. - -The driver writes the credit value in DRAM based on the user tc -command. The PRU firmware uses the credit value as a counter. The -driver refreshes the counter every 100 msec. i.e write the credit -value to memory every 100 msec. PRU Firmware upon receiving a frame -decrements this counter until it becomes zero. Firmware forwards -the frames to Host or ARM until the counter is non zero. PRU Firmware -drops the frames if the counter is zero. Since driver writes the -credit value to DRAM every 100 msec, the number of frames sent to -host or ARM during a 100 msec window is limited to the credit value -and anything beyond that is dropped by the firmware. Firmware maintains -statistics counters, stormPrevCounterBC/stormPrevCounterMC/stormPrevCounterUC, -for the number of frames dropped due to storm prevention control -for each packet type and can be seen using ethtool -S command. - -Note that this feature is disabled by default and user needs to -configure it explicitely to enable the feature. A write of non zero -value to the sysfs file enables the feature and zero disables the -feature. The value to be used may be experimented in a particular -network situation and configured by the user. E.g. In a typical network, -there will be few broadcast frames per 100 msec window such as ARP broadcast, -DHCP broadcast, router advetisement etc. So user may observe the -broadcast traffic in the network using network tools such as wireshark -and set the credit value accordingly. - -Use tc command to configure the credit in unit of kbit. - -For BC - -:: - - tc qdisc add dev eth2 clsact - tc qdisc add dev eth3 clsact - tc filter add dev eth2 ingress flower skip_sw dst_mac ff:ff:ff:ff:ff:ff action police rate 29kbit burst 64k - tc filter add dev eth3 ingress flower skip_sw dst_mac ff:ff:ff:ff:ff:ff action police rate 29kbit burst 64k - -For MC - -:: - - tc qdisc add dev eth2 clsact - tc qdisc add dev eth3 clsact - tc filter add dev eth2 ingress flower skip_sw dst_mac 01:00:00:00:00:00 action police rate 29kbit burst 64k - tc filter add dev eth2 ingress flower skip_sw dst_mac 01:00:00:00:00:00 action police rate 29kbit burst 64k - -For UC - -:: - - tc qdisc add dev eth2 clsact - tc qdisc add dev eth3 clsact - tc filter add dev eth2 ingress flower skip_sw dst_mac 70:FF:76:1C:0F:A5 action police rate 29kbit burst 64k - tc filter add dev eth3 ingress flower skip_sw dst_mac 70:FF:76:1C:0F:A5 action police rate 29kbit burst 64k - -To delete classifier - -:: - - tc qdisc del dev eth2 clsact - tc qdisc del dev eth3 clsact - -The calculation for rate is as below (29kbit in the above command). - -* Credit (Packets allowed in 100 msec) = (rate_bits_per_sec * 100) /(8 * 60 * 1000) -* In the above tc command, the rate_bits_per_sec = 29kbit = 29000. So Credit = (29000 * 100) / (8 * 60000) ~= 6 packets - -Or to get kbit/sec from credit in 100 msec, - -* Rate in kbits/sec = (credit * 8 * 60) / (100) -* For 6 packets, Rate (in kbit per second) = (6 * 8 * 60) / (100) = 28.8 ~= 29 - -Receive Interrupt Pacing -------------------------- - -Receive interrupt pacing is a firmware feature to decrease the number of -interrupts that need to be handled by the host. This control when interrupt -is generated by firmware and its use may result in less overhead in the Linux -kernel. NAPI already places the driver in a polling mode once interrupt is -triggered. If packets are bursty, all of them will be handled in a single -NAPI poll upto the NAPI budget. Once NAPI budget is reached, then driver -re-enables interrupt. However in situations where packets are randomly -spaced, then it may add additional overhead in NAPI scheduling and it is -beneficial to even out the handling using interrupt pacing. - -This receive interrupt pacing allows Ethernet frames to accumulate -in the ingress ring buffer between the host and PRU for a configurable -time, and triggers an interrupt on timeout expiry. The driver processes all -queued frames upon receiving an RX interrupt. The firmware implements -this RX pacing timer, which is configured by the PRUETH driver when the -network device is opened and stopped when the device is closed. For HSR/PRP, -one RX pacing timer is shared between ports. One timer is used because -the HSR/PRP ports trigger common priority-based interrupts. For Dual EMAC, -there is one RX pacing timer per port. - -The user may show the timer value using the ethtool –c option which -is a standard Linux command to show different coalesce parameters at -the network device. –C option allows user to set rx interrupt pacing -at the device. There are limited number of buffers in the receive -path between Host and PRU and using a bigger value can result in -packet loss. ethtool –c option is implemented in the PRUETH driver -to show current setting in the driver and -C to change it if needed. -Driver supports rx-usecs and adaptive-rx parameters from the available -list of parameters. There are 3 modes of pacing available: - -**Pacing enabled :** -At each timer expiry, firmware checks if any frames were received during the -interval, and if so triggers an interrupt. Frames received during timer interval -set a flag but do not trigger an interrupt. - -**Adaptive pacing enabled:** -At each timer expiry, firmware checks if any frames were received during the -interval, and if so triggers an interrupt. Frames received during timer interval -in an *empty* queue trigger an interrupt immediately, frames received to a -non-empty queue set a flag but do not trigger an interrupt. (This can help -improve latency when using pacing, but is disabled by default because as it -results in lower throughput.) - -**Pacing disabled:** -An interrupt is triggered for each frame received. By default interrupt -pacing is disabled at the PRUETH interface and user has to use ethtool command -to enable it. - -Example - -To show the current value of pacing timer, use - -:: - - >ethtool –c - -To change the current value, use - -:: - - >ethtool –C - -For example for eth2, user type - -:: - - >ethtool –c eth2 - -Note that this changes the timer at both PRUs (for HSR/PRP). So the command -may be issued to one of the pair of Ethernet interfaces used for the HSR -or PRP interface. -i.e for ICSS2 (assuming eth2 and eth3), user may use either of the below -command to set the timer - -:: - - >ethtool –C eth2 rx-usecs 123 - -or - -:: - - >ethtool –C eth3 rx-usecs 123 - -Similarly to enable adaptive-rx, user types - -:: - - >ethtool –C eth2 adaptive-rx on - -or - -:: - - >ethtool –C eth3 adaptive-rx on - -Both parameters may be updated in one go as - -:: - - >ethtool –C eth2 rx-usecs 123 adaptive-rx on - -More details on the command syntax are available by typing man ethtool -on a Linux PC as this is a standard Linux command. - -VLAN Tag in Supervision frame ------------------------------ - -HSR/PRP protocol standard IEC62439-3 defines that the PRP_Supervision frame -as well as HSR_Supervision frames optionally include a VLAN tag header. -Starting with Processor SDK 5.1.x, VLAN tag is supprted in Linux HSR/PRP -implementation. - -In Linux, user use the ip link add command to create an HSR/PRP -interface. ip link command is supported by the iproute2 package which is an open -source software. hsr or prp type is currently a supported link type by ip -link command. To support VLAN tag in SV frames, the command now accepts -3 more parameters from user. They are:- - - * VLAN Identifier (VID) - sv_vid - * Priority code point (PCP) - sv_pcp - * Drop eligible indicator (DEI) or formerly known as Canonical Format Indicator (CFI) - sv_dei - -User provides following values in the ip link add command for this purpose. - -:: - - sv_vid sv_pcp sv_dei - -These are all optional parameters. At least one of the value to be provided -to use vlan. A default value of zero is used if not supplied by the user. - -Node Table ----------- - -HSR/PRP offloaded LRE supports a Node Table (NT) of 256 entries on AM5 -devices and 128 entries on AM3/4 devices. NT entries are maintained in -shared RAM of the PRU ICSS. For HSR, an entry containing the MAC address -of the remote node is inserted to the Node table when a supervison(SV) frame -is received from that node. For PRP, this gets added for any frame received -from the node. Firmware first looks up the address in the NT upon receiving -a SV frame. The look up status is indicated in a bit in the buffer descriptor. -The same is checked by the driver and if the look up status indicates no -success, the MAC entry is inserted to the NT by driver. For subsequent -frames received from the node, the firmware updates the NT and the insertion -process is skipped in the driver. - -The driver also runs an ageing timer to forget the node if there was no -frame received from the remote node for a period of time as specified by -the standard. During the timeout, if the entry is aged, then the same is -deleted from the NT. - -In Summary, search/update of an NT entry is done in firmware and insert/ -delete of an entry is done by the driver. - -The NT entries can be displayed by the user at the console using the proc -file /proc//node-table. - -Example: If the interface name is prp0, a sample command is shown below to -display the NT entries. - -:: - - root@am57xx-evm:~# cat /proc/prp0/node-table - - Remote nodes in network: 1 - - Node[0]: - MAC ADDR: 70:ff:76:1c:16:ef - DANP - Time Last Seen: RxA=0 RxB=0 - -Net-SNMP --------- - -The TI SDK release ships tisdk-default-image-am57xx-evm.tar.xz with -Net-SNMP 5.8 binaries pre-installed and snmpd is started as part of -the user space initialization. TI has developed a Net-SNMP module to -support IEC-62439-3 related MIB access at the DAN using snmp commands -such as snmpwalk, snmpget etc. **NOTE:** IEC-62439-3 MIB is supported -only in the offloaded case. So user is expected to create HSR/PRP -interface with offload. For details on how to setup HSR/PRP interface -with offload, please refer :ref:`SITARA_HSR_PRP_Testing_Firmware_Offload` - -.. rubric:: Command examples - :name: command-examples - -An example snmpwalk command execution is shown below where 192.168.2.20 -is the IP address of the remote DAN-P or DAN-H prp/hsr interface. - -:: - - root@am57xx-evm:/etc/snmp# snmpwalk -v 2c -c public 192.168.2.20 iec62439 - IEC-62439-3-MIB::lreManufacturerName.0 = STRING: TI LRE - IEC-62439-3-MIB::lreInterfaceCount.0 = INTEGER: 1 - IEC-62439-3-MIB::lreRowStatus.1 = INTEGER: active(1) - IEC-62439-3-MIB::lreNodeType.1 = INTEGER: hsr(2) - IEC-62439-3-MIB::lreNodeName.1 = STRING: hsr0 - IEC-62439-3-MIB::lreVersionName.1 = "" - IEC-62439-3-MIB::lreMacAddress.1 = STRING: d2:ef:e6:2a:1f:5b - IEC-62439-3-MIB::lrePortAdminStateA.1 = INTEGER: active(2) - IEC-62439-3-MIB::lrePortAdminStateB.1 = INTEGER: active(2) - IEC-62439-3-MIB::lreLinkStatusA.1 = INTEGER: up(1) - IEC-62439-3-MIB::lreLinkStatusB.1 = INTEGER: up(1) - IEC-62439-3-MIB::lreDuplicateDiscard.1 = INTEGER: discard(2) - IEC-62439-3-MIB::lreTransparentReception.1 = INTEGER: 0 - IEC-62439-3-MIB::lreHsrLREMode.1 = INTEGER: modeh(1) - IEC-62439-3-MIB::lreSwitchingEndNode.1 = INTEGER: hsrnode(5) - IEC-62439-3-MIB::lreRedBoxIdentity.1 = INTEGER: id1a(2) - IEC-62439-3-MIB::lreEvaluateSupervision.1 = INTEGER: true(1) - IEC-62439-3-MIB::lreNodesTableClear.1 = INTEGER: noOp(0) - IEC-62439-3-MIB::lreProxyNodeTableClear.1 = INTEGER: noOp(0) - IEC-62439-3-MIB::lreDupListResideMaxTime.1 = INTEGER: 26214 binaryFractionOfSecond - IEC-62439-3-MIB::lreCntTxA.1 = Counter32: 7384 - IEC-62439-3-MIB::lreCntTxB.1 = Counter32: 7385 - IEC-62439-3-MIB::lreCntTxC.1 = Counter32: 4032 - IEC-62439-3-MIB::lreCntErrWrongLanA.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntErrWrongLanB.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntErrWrongLanC.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntRxA.1 = Counter32: 4024 - IEC-62439-3-MIB::lreCntRxB.1 = Counter32: 4025 - IEC-62439-3-MIB::lreCntRxC.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntErrorsA.1 = Counter32: 3351 - IEC-62439-3-MIB::lreCntErrorsB.1 = Counter32: 3351 - IEC-62439-3-MIB::lreCntErrorsC.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntNodes.1 = INTEGER: 1 - IEC-62439-3-MIB::lreCntProxyNodes.1 = INTEGER: 0 - IEC-62439-3-MIB::lreCntUniqueA.1 = Counter32: 4 - IEC-62439-3-MIB::lreCntUniqueB.1 = Counter32: 4 - IEC-62439-3-MIB::lreCntUniqueC.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntDuplicateA.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntDuplicateB.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntDuplicateC.1 = Counter32: 3992 - IEC-62439-3-MIB::lreCntMultiA.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntMultiB.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntMultiC.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntOwnRxA.1 = Counter32: 0 - IEC-62439-3-MIB::lreCntOwnRxB.1 = Counter32: 0 - IEC-62439-3-MIB::lreNodesMacAddress.1.1 = STRING: 70:ff:76:1c:f:8d - IEC-62439-3-MIB::lreTimeLastSeenA.1.1 = Timeticks: (0) 0:00:00.00 - IEC-62439-3-MIB::lreTimeLastSeenB.1.1 = Timeticks: (1) 0:00:00.01 - IEC-62439-3-MIB::lreRemNodeType.1.1 = INTEGER: danh(3) - -Individual MIB variable may be queried or set using snmpset or snmpget commands. Below are some examples:- - -snmpset - -:: - - snmpset -v 2c -c private 192.168.2.20 IEC-62439-3-MIB::lreHsrLREMode.1 i 3 - -snmpget - -:: - - snmpget -v 2c -c public 192.168.2.20 IEC-62439-3-MIB::lreManufacturerName.0 - -.. rubric:: MIB Support - :name: mib-support - -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| MIB variable | Group | Actions Specified by Standard | Action supported | -+===========================+==================================+=================================+====================+ -| lreManufacturerName | lreConfigurationGeneralGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreInterfaceCount | lreConfigurationGeneralGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreInterfaceConfigTable | lreConfigurationInterfaceGroup | NA | NA | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreInterfaceConfigEntry | lreConfigurationInterfaceGroup | NA | NA | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreInterfaceConfigIndex | lreConfigurationInterfaceGroup | NA | NA | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreRowStatus | lreConfigurationInterfaceGroup | NA | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreNodeType | lreConfigurationInterfaceGroup | get/set | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreNodeName | lreConfigurationInterfaceGroup | get/set | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreVersionName | lreConfigurationInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreMacAddress | lreConfigurationInterfaceGroup | get/set | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lrePortAdminStateA | lreConfigurationInterfaceGroup | get/set | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lrePortAdminStateB | lreConfigurationInterfaceGroup | get/set | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreLinkStatusA | lreConfigurationInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreLinkStatusB | lreConfigurationInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreDuplicateDiscard | lreConfigurationInterfaceGroup | get/set | get/set | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreTransparentReception | lreConfigurationInterfaceGroup | get/set | get/set | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreHsrLREMode | lreConfigurationInterfaceGroup | get/set | get/set | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreSwitchingEndNode | lreConfigurationInterfaceGroup | get/set | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreRedBoxIdentity | lreConfigurationInterfaceGroup | get/set | NS | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreEvaluateSupervision | lreConfigurationInterfaceGroup | get/set | NS | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreNodesTableClear | lreConfigurationInterfaceGroup | get/set | get/set | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreProxyNodeTableClear | lreConfigurationInterfaceGroup | get/set | NS | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreDupListResideMaxTime | lreConfigurationInterfaceGroup | get/set | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreInterfaceStatsTable | lreStatisticsInterfaceGroup | NA | NA | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreInterfaceStatsEntry | lreStatisticsInterfaceGroup | NA | NA | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreInterfaceStatsIndex | lreStatisticsInterfaceGroup | NA | Yes | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntTxA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntTxB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntTxC | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntErrWrongLanA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntErrWrongLanB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntErrWrongLanC | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntRxA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntRxB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntRxC | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntErrorsA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntErrorsB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntErrorsC | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntNodes | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntProxyNodes | lreStatisticsInterfaceGroup | get | NS | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntUniqueA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntUniqueB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntUniqueC | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntDuplicateA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntDuplicateB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntDuplicateC | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntMultiA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntMultiB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntMultiC | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntOwnRxA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreCntOwnRxB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreNodesTable | lreStatisticsInterfaceGroup | NA | Yes | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreNodesIndex | lreStatisticsInterfaceGroup | NA | Yes | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreNodesMacAddress | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreTimeLastSeenA | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreTimeLastSeenB | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreRemNodeType | lreStatisticsInterfaceGroup | get | get | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreProxyNodeTable | lreStatisticsInterfaceGroup | | NS | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreProxyNodeEntry | lreStatisticsInterfacesGroup | NA | NS | -+---------------------------+----------------------------------+---------------------------------+--------------------+ -| lreProxyNodeMacAddress | lreStatisticsInterfacesGroup | get | NS | -+---------------------------+----------------------------------+---------------------------------+--------------------+ - -**Note** NS: Not supported, NA: Not Applicable - -iproute2 --------- - -iproute2 is enhanced to allow creating a prp interface similar to hsr -interface using two slave interfaces. - -Test Procedure ---------------- -.. _SITARA_HSR_PRP_Testing_Firmware_Offload: - -Testing HSR/PRP Firmware Offload -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The setup of the IDKs for testing HSR/PRP firmware offload and the -configuration of the HSR/PRP interfaces after kernel boot up are no -different than the case without firmware offload. The differences are, -in the case of firmware offload, the correct PRU firmware needs to be -loaded and the PRUETH driver needs to be configured to interface with -the type of firmware loaded, during ndo_open() or when interface is up. - -To verify PRU Ethernet type after boot, do following that display TI PRU -ethernet type - -:: - - dmesg | grep "EMAC mode" - -Now change Ethernet type to HSR or PRP as explained :ref:`Changing_protocol_at_PRU_Ethernet` - -Node Tables -^^^^^^^^^^^ -In the case of HSR/PRP firmware offload, the Node Table can be displayed -as follows. Note: the locations are different from those when there is -no firmware offload. - -To show the **HSR Node Table** do below command (assume hsr0 is the -interface name) - - >cat /proc/hsr0/node-table - -Sample display - -:: - - root@am57xx-evm:~# cat /proc/hsr0/node-table - Remote nodes in network: 1 - Node[0]: - DANH - MAC ADDR: 70:ff:76:1c:0e:0d - Time Last Seen: RxA=5015 RxB=5015 - -To show the PRP Node Table, under the kernel prompt on the terminal connected to the IDK, do (assume prp0 is the interface name) - - >cat /proc/prp0/node-table - -Sample display - -:: - - root@am57xx-evm:~# cat /proc/prp0/node-table - Remote nodes in network: 1 - Node[0]: - MAC ADDR: 70:ff:76:1c:0e:0d - DANP - Time Last Seen: RxA=4094 RxB=4414 - -LRE Statistics -^^^^^^^^^^^^^^ -There is a lre-stats file to dump this under /proc/. For -example to dump this for prp0 interface, do: - -:: - - root@am57xx-evm:~# cat /proc/prp0/lre-stats - LRE statistics: - Rx Offloaded: 1 - lreTxA: 15915369 - lreTxB: 15915369 - lreTxC: 673 - lreErrWrongLanA: 207816 - lreErrWrongLanB: 207789 - lreErrWrongLanC: 0 - lreRxA: 0 - lreRxB: 27 - lreRxC: 15707590 - lreErrorsA: 0 - lreErrorsB: 0 - lreErrorsC: 0 - lreNodes: 1 - lreProxyNodes: 0 - lreUniqueRxA: 0 - lreUniqueRxB: 0 - lreUniqueRxC: 0 - lreDuplicateRxA: 0 - lreDuplicateRxB: 0 - lreDuplicateRxC: 0 - lreMultiRxA: 0 - lreMultiRxB: 0 - lreMultiRxC: 0 - lreOwnRxA: 0 - lreOwnRxB: 0 - -.. _SITARA_HSR_Testing: - -HSR Testing -^^^^^^^^^^^^^^ - -To test HSR, user would need two AM572x EVMs. - -#. Setup HSR Ring network as per diagram below. Connect the PRU2ETH0 - (See the marking on the EVM) Ethernet ports of the two EVMs together - (corresponds to Linux interface eth2) as shown below. Similarly, - connect the PRU2ETH1 ports (Linux interface eth3) as well. - -#. Boot the EVMs using the pre-built images from the Processor SDK - release. These images are built with Linux HSR/PRP driver enabled. - Login to the console using root user name. - -#. Now change Ethernet type to HSR as - explained :ref:`Changing_protocol_at_PRU_Ethernet` - -#. Note the MAC Address of eth2 at DAN-H-1(Say MAC-A) using the ifconfig - command. Do ifconfig eth2 at the Linux console of DAN-H-1 -#. Note the MAC Address of eth2 at DAN-H-2(Say MAC-B) using the ifconfig - command. Do ifconfig eth2 at the Linux console of DAN-H-2 - - #. ifconfig eth2 down - #. ifconfig eth3 down - #. ifconfig eth3 hw ether - #. ifconfig eth2 up - #. ifconfig eth3 up - #. ip link add name hsr0 type hsr slave1 eth2 slave2 eth3 supervision - 45 version 1 - #. ifconfig hsr0 up - -#. Repeat the above steps for DAN-H-2, but this time use MAC-B in step - 4.3 above. And use IP Address from the same subnet as that of DAN-H-1 - hsr interface hsr0. - -.. Image:: /images/Hsr-network-setup-v2.jpg - -For example use Ip Address 192.168.2.10 for DAN-H-1 and 192.168.2.20 for -DAN-H-2. Assume CPSW ports at the EVM are on a different Subnet than the -HSR interface. - -Once both hsr0 interfaces are created, user should be able to do a ping -from DAN-H-1 to DAN-H-2 or vice-versa. Disconnect Ethernet cable at eth2 -or eth3. The Ping should continue to go through. User could run iperf -between the two HSR interfaces and test the iperf is not affected when -one of the cable is disconnected. This verifies redundancy. - -A Sample script that automates the steps using eth2 and eth3 is provided -below - -:: - - #!/bin/sh - # - # on AM57x only - # Dual EMAC to HSR/PRP on DUT-A - if [ "$#" != "1" ] - then - echo "$0 " - exit - fi - - if [ "$1" != "hsr" ] && [ "$1" != "prp" ] - then - echo "$0 " - exit - fi - - if [ "$1" == "hsr" ] - then - if=hsr0 - else - if=prp0 - fi - - ifa=eth2 - ifb=eth3 - ip=192.168.2.10 - mac=70:FF:76:1C:02:0A - echo "ip=$ip" - echo "if=$if" - echo "mac=$mac" - echo "slave-a=$ifa" - echo "slave-b=$ifb" - - ifconfig $ifa 0.0.0.0 down - ifconfig $ifb 0.0.0.0 down - ifconfig $ifa hw ether $mac - ifconfig $ifb hw ether $mac - if [ "$1" == "hsr" ] - then - ethtool -K $ifa hsr-rx-offload on - ethtool -K $ifb hsr-rx-offload on - else - ethtool -K $ifa prp-rx-offload on - ethtool -K $ifb prp-rx-offload on - fi - - ifconfig $ifa up - ifconfig $ifb up - if [ "$1" == "hsr" ] - then - ip link add name $if type hsr slave1 $ifa slave2 $ifb supervision 45 version 1 sv_vid 3 sv_pcp 7 sv_dei 0 - else - ip link add name $if type hsr slave1 $ifa slave2 $ifb supervision 45 proto 1 sv_vid 3 sv_pcp 7 sv_dei 0 - fi - - ifconfig $if $ip - ifconfig $if - ifconfig $ifa - ifconfig $ifb - -To customize the script for another device, please change the mac and ip -variables. Similarly to use a different vid, pcp and dei for supervision -frame VLAN, change the same in the above script. To delete the hsr or prp -interface, user may use ip link command as - -ip link delete . Example for hsr0 interface name, user type - -:: - - ip link delete hsr0 - -Note that the Ethernet interfaces should be updated with original MAC address -after this as below assuming eth2 and eth3 interfaces - -:: - - ifconfig eth2 0.0.0.0 down - ifconfig eth3 0.0.0.0 down - ifconfig eth2 hw ether 70:FF:76:1C:02:0A - ifconfig eth3 hw ether 70:FF:76:1C:02:0B - - -**DAN-H-1** - -:: - - root@am57xx-evm:~# ifconfig eth2 - eth2 Link encap:Ethernet HWaddr 70:FF:76:1C:0F:8D - BROADCAST MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:1000 - RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) - root@am57xx-evm:~# - root@am57xx-evm:~#