DornerWorks

AVB vs. TSN: Choose the Best Deterministic Ethernet Solution for Your Networked Devices

Posted on November 26, 2019 by David Verbree

Historical Perspective

At nearly 40 years old, TCP (Transmission Control Protocol; RFC 793, 1981) and UDP (User Datagram Protocol; RFC 768, 1980) over IPv4 (Internet Protocol version 4; RFC 760, 1980) are still the most common protocols for sending data over Ethernet.

Unfortunately, TCP and UDP are widely considered unpredictable and/or unreliable.

UDP is a connectionless protocol that provides no guarantee that the transmitted data ever made it to its intended recipient. TCP is a connection-based protocol that has the opposite problem. It will retransmit a message several times until it receives a response and it schedules retransmissions with randomness to ensure that multiple end-points do not retransmit at the same interval. With TCP, large messages are broken apart and transmitted as multiple fragments and can be received in any order. It is the recipient’s responsibility to reorder the fragments and reassemble the packet. Therefore, both protocols are poorly suited for high-assurance communications.

Rather than changing the underlying protocols over the past four decades, we have layered countless additional protocols on top of TCP and UDP to add capabilities or improve reliability that did not exist in the original implementations. This adds substantial overhead in bandwidth and in latency. As the demand for deterministic communications with low overhead has risen, new protocols implemented at layer 3 replace TCP, UDP, and IP in many cases.

An example of AVB networking is connecting two speakers on either side of a stadium by Ethernet, enabling them to play sound at exactly the same time with no audible delay, even in a noisy network.

Two examples of these protocols are Audio-Video Bridging (AVB) and emerging Time Sensitive Networking (TSN).

AVB for Bandwidth Allocation

AVB is a collection of standards originally designed for transmitting high bandwidth and time-sensitive multimedia streams as the name implies. A typical use-case is to imagine two speakers on opposite ends of a stadium connected by Ethernet via multiple switches. The goal of AVB then is to allow those two speakers to play sound at exactly the same time with no audible delay even on a network saturated with traffic of lesser importance. Put simply, AVB offers three key capabilities that depend on each other:

  1. Bandwidth-reservation that depends on
  2. Traffic-prioritization and
  3. Time-synchronization

Despite the name, it is easy to see how valuable the key capabilities of AVB are for many non-multimedia applications.

AVB uses the Generalized Precisions Time Protocol (gPTP; IEEE 802.1AS-2011) for time-synchronization, which I discussed in another blog. It also uses virtual LANs (VLANs) and Quality of Service (QoS) capabilities standardized in IEEE 802.1Q-2014 for traffic prioritization. AVB adds a credit-based scheduler (section 8.6.8.2), also referred to as FQTSS (Forwarding and Queuing for Time-Sensitive Streams), to the default strict priority scheduler (section 8.6.8.1). AVB traffic uses the credit-based scheduler that has priority over the strict priority scheduler used for best-effort traffic.

AVB credit-shaper allows the highest priority AVB traffic class with positive “credits” to transmit. An AVB traffic class loses credits when it is actively transmitting data and gains credits when it has data waiting to be transmitted. The rate that credits are gained or lost (i.e. idle slope and send slope) depend on the amount of bandwidth allocated to each traffic class. High and low credit limits are also established, based on the maximum frame size and maximum interference frame size for each traffic class.

TSN for Time Scheduling

TSN is another collection of standards designed to extend AVB. It also leverages traffic prioritization, time-synchronization, and can be used with both the credit shaper and strict priority schedulers.

Aside from improving performance and provided performance guarantees, TSN adds two new capabilities:

  1. Time-scheduled traffic
  2. Frame-preemption

TSN schedules transmissions by adding a timed gate control list (or schedule) that turns on and off each of the queues or traffic classes. The credit-shaper or strict priority schedulers will only select a queue for transmission if its gate is open. However, multiple gates can be open at the same time.

Feature Best-effort AVB TSN
Traffic prioritization VLAN tagging with QoS prioritization
Time-synchronization PTP
IEEE 1588
Generalize PTP
IEEE 802.1AS
Generalized PTP
IEEE 802.1AS-Rev
Traffic scheduler Strict-priority scheduler
(IEEE 802.1Q, section 8.6.8.1)
Strict-priority and Credit-based shaper
(IEEE 802.1Q, section 8.6.8.2)
Strict priority, Credit-shaper, and Gate control list
(IEEE 802.1Q-D2.1, section 8.6.9)

For both AVB and TSN, one of interesting features that was not immediately apparent to me is that a single queue or traffic class can have multiple streams and these streams may also be individually scheduled using a separate instance of the credit-shaper and gate control list upstream of the primary scheduler. Although more difficult to implement, this feature offers very precise control of traffic flow.

The Drawback

AVB and TSN both sound like great improvements… There must be a draw-back, right?

The most substantial drawback is system-wide configuration. There are currently no ratified standards for distributing static bandwidth reservations throughout a network. In the meantime, AVB utilizes higher-level protocols (best-effort traffic) to allow talkers and listeners to dynamically request bandwidth. Specifically, the Multiple Stream Registration Protocol (MSRP) and Multiple VLAN Registration Protocol (MVRP) allow an end-point to dynamically join or leave a stream (as talker or listener) or a VLAN. These protocols are complex and difficult to implement in hardware. Software implementations of these protocols typically require a hard processor, DDR memory, and Operating System services.

Configuration is also likely to be the single greatest limitation for adoption of TSN standards until a standard for configuration is ratified. Fortunately, one is currently being drafted as IEEE 802.1Qcc that support centralized configuration for TSN.

I am confident that both AVB and TSN adoption will continue to grow as more and more people realize that complex systems need the high-accuracy time-synchronization and high-assurance communications offered by these protocols.

David Verbree
by David Verbree
Embedded Engineer
David Verbree is an embedded engineer at DornerWorks.