## 3 Shaping in TSN  
### Overview of Traffic Shapers  
One shaping mechanism commonly used in traditional Ethernet is Strict Priority (SP) [18], which selects packets for transmission based on their queue priority. While successful for non-time-sensitive traffic, it lacks sufficient QoS guarantees for time-sensitive applications. Without proper admission control, real-time video streaming, for instance, can experience unpredictable delays due to network congestion. Network calculus techniques, as mentioned in [16], can estimate worst-case latency if flow data rates and burst sizes are known, aiding admission control decisions. However, latency variance can increase burst sizes, leading to the continuous accumulation of frames and potential QoS violations, known as the snowball effect. To address this issue, the AVB task group (later renamed TSN task group) introduced the credit-based shaper (CBS) [19]. CBS assigns a credit counter to each CBS queue, allowing transmission only when the credit is positive. This mechanism reintroduces gaps between frames, reducing burst accumulation and robustly improving audio/video transmission quality. However, the shared nature of the credit pool among different streams does not fully solve the snowball effect. According to IEEE 802.1 Qav [19], the credit is increasing based on the sum of the data rate of all streams. Therefore, frames of one stream can be sent back-to-back using the credit accumulated by the frames of another stream without waiting, undermining the gap introduction concept. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Traffic Category**} & \multicolumn{3}{c}{**Traffic Characteristic**} & \multirow{2}{*}{**Traffic Type**} \\ \cline{2-2} \cline{4-5}  & **Regularity** & **Timeliness** & **Delivery** & \\ \hline \multirow{2}{*}{Time-Aware Stream (HTS)} & \multirow{2}{*}{Cyclic} & \multirow{2}{*}{\(TT\)} & Deadline & Isochronous \\ \cline{3-5}  & & & Latency & Cyclic Synchronous \\ \hline Stream (LTS) & Cyclic & \(ET\) & Latency & Cyclic Asynchronous \\ \hline \multirow{3}{*}{Traffic-Engineered nonstream (LTS)} & \multirow{2}{*}{Optional} & \multirow{2}{*}{\(ET\)} & \multirow{2}{*}{Latency} & Network Control \\ \cline{3-5}  & & & & Alarms and Events \\ \cline{3-5}  & & & & Configuration and Diagnostics \\ \hline Nonstream (BE) & \multirow{2}{*}{Acyclic} & \multirow{2}{*}{\(ET\)} & N/A & Best-Effort \\ \hline \hline \end{tabular}
\begin{tabular}{c} \(TT\) = Time-triggered, \(ET\) = Event-triggered, N/A = not applicable. \(HTS\) = High time-sensitive, \(LTS\) = Low time-sensitive, \(BE\) = Best-Effort. \\ \end{tabular}
\end{table} 
Table 2: Summary of traffic categories. Asynchronous Traffic Shaping (ATS) [20] overcomes the snowball effect by allocating a token bucket to each stream. Upon frame arrival, the decision to transmit or to place on wait depends on the availability of tokens and ongoing transmissions. However, frames waiting longer than the maximum residence time are discarded. ATS also addresses the head-of-the-queue blocking problem by queuing frames based on ingress port and traffic class, resulting in smoother traffic patterns and reduced congestion loss. While ATS resolves the burst-size problem and offers per-hop latency bounds, it still falls short of meeting stringent latency and jitter requirements for Time-Aware Streams due to its asynchronous nature. The TSN Task group introduced two more shaping strategies which are the Cyclic Queuing and Forwarding (CQF) [21] and the Time-Aware Shaper (TAS) [13]. Both of them are synchronous and require time synchronization through all the involved network elements. CQF defines a cycle time of fixed duration \(d\) that starts and ends at the same moment in all the network elements. Every frame that is received and queued by a switch during cycle \(i\) is transmitted to the next switch during cycle \(i+1\). Consequently, a frame traversing a path of \(n\) hops would experience a bounded latency of maximum \((n+1)*d\) and minimum \((n-1)*d\).