I Introduction
TimeSensitive Networking (TSN) is an IEEE 802.1 working group that defines networking mechanisms for supporting realtime data flows with latency guarantees and zero packet loss [1]. TSN targets applications in avionics, automotive, industrial networks, etc., where data loss or latency violation causes catastrophic damage. One of the main buildingblocks of TSN is the CreditBased Shaper (CBS), which provides rate allocation for a number of priority classes, called AudioVideo Bridging (AVB) classes, using a credit mechanism (Section II). In recent studies [2, 3, 4], latency and backlog bounds in TSN are derived by using network calculus and service curve characterizations of CBS [5]. The latency parameters of such service curves is directly derived from credit upper bounds, i.e. bounds on the values of the credit counters of CBS. Two sets of results were published for credit upper bounds. The former, by J. De Azua and M. Boyer, (“Jbounds”, [6]) applies only to the case with two AVB classes and its proof is not fully described. The latter set of bounds, by H. Daigmorte et al (“Hbounds”, [3]), applies to any number of AVB classes and is formally proven. For the top priority AVB class, J and Hbounds are identical. For the second priority class, Jbounds are generally smaller than Hbounds, but not always. For third and lower priority classes, only Hbounds are available.
In this paper, we derive and formally prove credit upper bounds for CBS with any number of AVB classes, which improve on both sets of existing bounds. Specifically, our bound is the same as J and Hbounds for the top priority AVB class. For the second priority class, our bound is lower than the Hbound and is lower than or equal to the Jbound, depending on maximum packet lengths. For all other priority classes, our bounds are lower than the only available bounds, namely the Hbounds. Moreover, we formally show that our credit bounds are tight for the two classes of highest priority, which is the first tightness result presented in the literature. In Section IV, we perform numerical evaluations and show that the improvement in latency guarantees is significant.
Ii System Model & Existing Credit Bounds
We assume a TSN scheduler with the following elements: 1) A set of queues representing a set of classes including, in decreasing priority, one ControlData Traffic (CDT) class, AVB classes 1, 2, 3, …, , and a set of Best Effort (BE) classes; 2) A set of gates, one per queue, such that if a gate is closed, the corresponding queue cannot transmit. A GateControl List (GCL) contains the information of the opening/closing times of gates. Moreover, there are several integration policies that determine the preemption or nonpreemption of CDT over the rest of the classes [3]. The analysis in this paper is valid for all integration policies; 3) A set of CBSs, one per AVB queue, to control the allocated rate of each AVB class. The CBS of an AVB class has two parameters: the idle slope, , and the send slope, . Note that , where is the line transmission rate. The idle slope is interpreted as the rate guaranteed to class and therefore, the condition is assumed to hold. Packets are scheduled according to the following rules (we repeat here the description in [3]):
R1: If the transmission line is free, the scheduler transmits a packet of the highest priority class that satisfies all the conditions: 1) it has a positive backlog; 2) its gate is open; 3) it has a nonnegative credit if it is an AVB class.
R2: The credit of the AVB class reduces linearly with rate the send slope, , if transmits.
R3: The credit of the AVB class increases linearly with rate , when the following conditions hold simultaneously for class : 1) its gate is open; 2) it has a positive backlog; and 3) other AVB or BE classes are transmitting.
R4: The credit of an AVB class remains constant, if the corresponding gate is closed, and during any additional overhead in the case of preemption mode for CDT.
R5: When class has a positive credit and its backlog becomes zero, the credit is set to zero; this is the credit reset. If the credit is negative and the backlog becomes zero, the credit increases with rate until the zero value.
Let denote the value of the credit counter for AVB class at time . We assume that the system is idle at time and . The function may take positive or negative values and is continuous, except at credit reset times, which, by R5, may occur only when the queue of class becomes empty. At all other times it is linearly increasing, decreasing or constant.
The Jbounds in [6] apply to the case , as:
(1)  
(2) 
where and are maximum packet lengths of AVB class and BE, and The proof of Eq. (2) in [6] is not completely formal (in contrast, we provide formal proofs for our improved credit bounds).
The Hbounds in [3] apply to any value of and give, for :
(3) 
where , and is the maximum packet length of the classes having less priority than class . These bounds are formally proven in [3].
When we can compare the J and Hbounds. For class 1 the bounds are identical, i.e., . For class , whenever , which is often but not always assumed, we have ; otherwise it may happen that for some values of the system parameters.
We use the following result, proven as Theorem 7 in [3]; for :
(4) 
Iii Improved Upper Bound on the Credit of an arbitrary AVB class
Theorem 1 (Improved Credit Bounds).
The credit of an AVB class , , is upper bounded, , by:
(5) 
Proof.
Consider a time and define time instant . Based on the definition of : First, . This implies no credit reset during , i.e., is continuous during this interval. Second, CDT either finishes a transmission at or is not transmitting at . Indeed, otherwise, since , and the credit of is frozen during the transmission of CDT, it would be true that and thus, .
If , then and the result is straightforward. Since is continuous in , and , then, either or . If , then and the theorem is straightforward to show. As a result, the rest of the proof focuses on the case , i.e., . The class cannot start a transmission at time , otherwise, by rule R2 since , its credit would decrease to negative values, which contradicts our assumption that . Note that since the credit of class is positive in , its backlog is also positive in .
Since and due to rule R1, a class with lower priority than cannot start a transmission in . However, in order to consider nonpreemptive AVB and BE classes, we should account for the case that a lower priority class has initiated a transmission the latest on and is still transmitting at . To do so, we define the time instant , with , as the end of the transmission of the residual of a lower priority packet after time . The latter is denoted by . If there is no transmission of a lower priority packet, then . If CDT is preemptive then the transmission of may be interrupted and recontinued. Let be the aggregated time period that the credit is frozen within . Then, and we assume .
The interval can be split into a sequence of subintervals during which class alternates between nontransmission and transmission. Let be such a sequence, with . We allow as this makes it possible to assume that class does not transmit in the first interval (i.e., if class starts transmission at time we set ). It follows that for the even intervals , with , we have ,
. Indeed, during non transmission, the credit either increases or remains constant, by rules R3 and R4. Conversely, for the odd intervals
, with , we have , .Let us define as the aggregated time period that the credit is frozen within the even interval . Next, we study the credit variation for all classes, starting with the interval , then following with even and odd intervals in . In :

Each class gains credit if it has backlog or negative credit (rule R3), except if CDT transmits, i.e.,
(6) By summing up for all , we have:
(7) 
Class gains credit because it has backlog as explained above, except if CDT transmits
(8) and since and , we get:
(9)
For the odd intervals, , we have:

Since the credit of class reduces, the higher priority classes do not transmit within and . They gain credit if they have positive backlog or negative credit, i.e.,
(10) Summing them up for all :
(11) 
The credit of class reduces due to transmission (R2):
(12)
In even intervals , we have:

There should exist an AVB class that transmits or all AVB and BE classes wait for CDT (for an aggregated time ). Define as the aggregated period of time that class transmits packets in . Then, by using that , we obtain,
(13) Summing up for all , and considering that , we obtain,
(14) 
The credit of class increases or is frozen for an aggregated time , i.e.,
(15)
Next, we study the credit variation within . First we assume that is odd. By summing up the credit variations for all intervals and all classes , we have:
(16) 
Therefore, by setting and , we can write,
(17) 
Next, by summing up the credit variations for all intervals for class and considering ,
(18) 
By Eq. (4), we obtain
(19) 
We lower bound the left handside of Eq. (17) using the lower bound of Eq. (3) and the bound of Eq. (19); therefore,
(20) 
where .
Eq. (20) gives an upper bound on , i.e.,
(21) 
By using Eq. (21) in Eq. (18), we obtain:
(22) 
Next, considering , and since by Eq. (9) , we obtain:
(23) 
By replacing the value of , the credit of class at time , where is odd, is upper bounded by given in the statement. If is even, then:
(24) 
Since , it is true that . As is even, is odd. We have already found a bound for when is odd, which is . Since , and is either odd or even, then and this completes the proof. ∎
Proposition 1.
The credit bound, , given in (5) is tight for the two highest priority classes, i.e., for each set of parameter values and each class 1,2, there is a scenario for which the credit counter attains the bound.
Proof.
The credit of class 1 achieves the value in the following scenario. Assume that all queues have zero backlog. Just before the backlog of class 1 becomes positive, there is an arrival of a lower priority class packet with length . This packet starts being transmitted according to R1 (assuming the gate is open for it). It takes to transmit the lower priority packet. During the transmission, since class 1 has positive backlog it gains credit according to the rule R3. At the end of the transmission, the credit of class 1 becomes i.e., equal to (Eq. (5)).
The tightness scenario for class 2 is as follows. Assume that all queues for all classes have zero backlog. Just before the backlog of class 2 becomes positive, there is an arrival of a lower priority class packet with length
. This packet starts being transmitted (rule R1) since at this moment there is no packet of class 1, 2 and the gate is open. Just after the transmission, the backlog of class 1 becomes also positive. Due to positive backlog, the classes 1,2 gain credit according to the rule R3. At the end of transmission of the lower priority packet, the credit values of classes 1 and 2 are
and , respectively. Then, class 1 starts transmission for a time interval until its credit becomes zero. During the latter transmission, class 2 gains credit of . When the credit value of class 1 is zero, it transmits a packet with maximum length for a time interval , during which class 2 gains credit equal to . The total credit gained by class 2 is , which is equal to Eq. (5). ∎We now formally compare with the existing J and Hbounds and show that our bounds improve on all existing bounds.
Proposition 2.

.

and the inequality is strict if .

For , .
Proof.
1) is straightforward. For 2), observe that can be obtained by replacing with in . For 3), after some algebra we find:
(25) 
By hypothesis, . Since , and , it follows that , thus the last term of Eq. (25) is strictly positive. ∎
Iv Numerical Evaluation
Consider a TSN scheduler with one CDT, three AVB and one BE classes, that is connected to a link with line rate Mbps. Assume , , and are , , and of the link rate, and for any AVB class , . Also, KB, KB, and KB; KB. The CDT is is constrained by an affine arrival curve [5] with parameters Kbps and Kb.
The credit upper bounds for the three AVB classes computed by Jbounds (1), Hbounds (3), and Theorem 1 are shown in Table I. As we know, the bounds coincide for class 1. In contrast, for class 2, our new credit bound is less than the Jbound by ^{1}^{1}1As aforementioned, Jbounds exist only for the case . Thus, in the computation of the Jbound, class is treated as a BE class. and than the Hbound by . For class 3 the bound by Theorem 1 is less than the Hbound by , while the Jbound does not exist for class 3.
(Kb)  
(Kb)    
(Kb) 
As discussed, the credit upper bound has an impact on the latency bound of a FIFO system and subsequently of the endtoend latency, as shown in [2]. This can be seen by the improvement in the latency term of the service curves provided to the AVB classes, analyzed below. According to Eq. (22) of [7] (that is the companion paper of [2]), a service curve for the AVB class is:
(26) 
where is a credit bound for class and is the maximum packet length of all classes except CDT. For class 2, the service curve latency in microseconds is , and if computed with , and , respectively. Thus, Theorem 1 improves the service curve latency of class 2 by compared with [6] and by compared with [3]. For class 3, the service curve latency in microseconds is and if computed with and , respectively. Thus, Theorem 1 improves the service curve latency of class 3 by compared with [3].
References
 [1] TimeSensitive Networking (TSN) Task Group. [Online]. Available: https://1.ieee802.org/tsn/,(Accessed:15/01/2019).
 [2] E. Mohammadpour, E. Stai, M. Mohiuddin, and J. L. Boudec, “Latency and Backlog Bounds in TimeSensitive Networking with Credit Based Shapers and Asynchronous Traffic Shaping,” in the 30th International Teletraffic Congress (ITC 30), vol. 02, 2018, pp. 1–6.
 [3] H. Daigmorte, M. Boyer, and L. Zhao, “Modelling in Network Calculus a TSN Architecture Mixing TimeTriggered, Credit Based Shaper and BestEffort Queues,” 2018. [Online]. Available: https://hal.archivesouvertes.fr/hal01814211
 [4] L. Zhao, P. Pop, Z. Zheng, and Q. Li, “Timing Analysis of AVB Traffic in TSN Networks using Network Calculus,” in the IEEE RealTime and Embedded Technology and App. Symp. (RTAS ’18), 2018, pp. 25–36.
 [5] J.Y. Le Boudec and P. Thiran, Network Calculus: A Theory of Deterministic Queuing Systems for the Internet. SpringerVerlag Berlin Heidelberg, 2001, vol. 2050.
 [6] J. A. R. De Azua and M. Boyer, “Complete Modelling of AVB in Network Calculus Framework,” in the 22nd ACM Int’l Conf. on RealTime Networks and Systems (RTNS), NY, USA, 2014, pp. 55–64.
 [7] E. Mohammadpour, E. Stai, M. Mohiuddin, and J.Y. Le Boudec, “Endtoend Latency and Backlog Bounds in TimeSensitive Networking with Credit Based Shapers and Asynchronous Traffic Shaping,” arXiv:1804.10608 [cs.NI], 2018. [Online]. Available: https://arxiv.org/abs/1804.10608/
Comments
There are no comments yet.