# Improved Credit Bounds for the Credit-Based Shaper in Time-Sensitive Networking

In Time Sensitive Networking (TSN), it is important to formally prove per flow latency and backlog bounds. To this end, recent works apply network calculus and obtain latency bounds from service curves. The latency component of such service curves is directly derived from upper bounds on the values of the credit counters used by the Credit-Based Shaper (CBS), an essential building block of TSN. In this paper, we derive and formally prove credit upper bounds for CBS, which improve on existing bounds.

## Authors

• 5 publications
• 2 publications
• 10 publications
• ### End-to-End Latency and Backlog Bounds in Time-Sensitive Networking with Credit Based Shapers and Asynchronous Traffic Shaping

We compute bounds on end-to-end worst-case latency and on nodal backlog ...
04/27/2018 ∙ by Ehsan Mohammadpour, et al. ∙ 0

• ### Improved Delay Bound for a Service Curve Element with Known Transmission Rate

In deterministic and time-sensitive networking, it is important to bound...
05/13/2019 ∙ by Ehsan Mohammadpour, et al. ∙ 0

• ### DoS Protection through Credit Based Metering – Simulation Based Evaluation for Time-Sensitive Networking in Cars

Ethernet is the most promising solution to reduce complexity and enhance...
08/26/2019 ∙ by Philipp Meyer, et al. ∙ 0

• ### The Effect of Network Topology on Credit Network Throughput

Credit networks rely on decentralized, pairwise trust relationships (cha...
03/04/2021 ∙ by Vibhaalakshmi Sivaraman, et al. ∙ 0

• ### Some Properties of Length Rate Quotient Shapers

Length Rate Quotient (LRQ) is the first algorithm of interleaved shaping...
07/11/2021 ∙ by Yuming Jiang, et al. ∙ 0

• ### Non-asymptotic error bounds for scaled underdamped Langevin MCMC

Recent works have derived non-asymptotic upper bounds for convergence of...
12/06/2019 ∙ by Tim Zajic, et al. ∙ 0

• ### A Core Calculus for Static Latency Tracking with Placement Types

Developing efficient geo-distributed applications is challenging as prog...
07/30/2020 ∙ by Tobias Reinhard, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## I Introduction

Time-Sensitive Networking (TSN) is an IEEE 802.1 working group that defines networking mechanisms for supporting real-time 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 building-blocks of TSN is the Credit-Based Shaper (CBS), which provides rate allocation for a number of priority classes, called Audio-Video 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, (“J-bounds”, [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 (“H-bounds”, [3]), applies to any number of AVB classes and is formally proven. For the top priority AVB class, J- and H-bounds are identical. For the second priority class, J-bounds are generally smaller than H-bounds, but not always. For third and lower priority classes, only H-bounds 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 H-bounds for the top priority AVB class. For the second priority class, our bound is lower than the H-bound and is lower than or equal to the J-bound, depending on maximum packet lengths. For all other priority classes, our bounds are lower than the only available bounds, namely the H-bounds. 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 Control-Data 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 Gate-Control List (GCL) contains the information of the opening/closing times of gates. Moreover, there are several integration policies that determine the preemption or non-preemption 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 J-bounds in [6] apply to the case , as:

 V1(t)≤¯LI1c:=Vmax,J1, (1) V2(t)≤I2c(LBE+L1+¯LI1−S1):=Vmax,J2, (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 H-bounds in [3] apply to any value of and give, for :

 LiSic≤Vi(t)≤¯Lici∑j=1Ij−i−1∑j=1SjLjc:=Vmax,\mathrm{H}i, (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 H-bounds. 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 :

 i∑j=1Vj(t)≤¯Lici∑j=1Ij. (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:

 Vmaxi=Iic(c−∑i−1j=1Ij)(c¯Li−i−1∑j=1SjLj). (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 non-preemptive 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 re-continued. 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 sub-intervals during which class alternates between non-transmission 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.,

 Vj(t0)−Vj(s)≤Ij(t0−s). (6)

By summing up for all , we have:

 i−1∑j=1(Vj(t0)−Vj(s))≤i−1∑j=1Ij(t0−s). (7)
• Class gains credit because it has backlog as explained above, except if CDT transmits

 Vi(t0)−Vi(s)=Ii(t0−s)−IidLO, (8)

and since and , we get:

 Vi(t0)=Ii(t0−s−dLO)≤IilLOc≤Ii¯Lic. (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.,

 Vj(t2k)−Vj(t2k−1)≤Ij(t2k−t2k−1). (10)

Summing them up for all :

 i−1∑j=1(Vj(t2k)−Vj(t2k−1))≤i−1∑j=1Ij(t2k−t2k−1). (11)
• The credit of class reduces due to transmission (R2):

 Vi(t2k)−Vi(t2k−1)=Si(t2k−t2k−1). (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,

 Vj(t2k+1)−Vj(t2k)≤Ij(t2k+1−t2k)−caj,2k−Ijd2k. (13)

Summing up for all , and considering that , we obtain,

 i−1∑j=1(Vj(t2k+1)−Vj(t2k)) ≤−(c−i−1∑j=1Ij)(t2k+1−t2k)+(c−i−1∑j=1Ij)d2k. (14)
• The credit of class increases or is frozen for an aggregated time , i.e.,

 Vi(t2k+1)−Vi(t2k)=Ii(t2k+1−t2k)−Iid2k. (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:

 i−1∑j=1[(Vj(t1)−Vj(t0))+(Vj(t2)−Vj(t1))+... +(Vj(tn−1)−Vj(tn−2))+(Vj(tn)−Vj(tn−1))] ≤ −(c−i−1∑j=1Ij)(t1−t0)+...+i−1∑j=1Ij(tn−1−tn−2) −(c−i−1∑j=1Ij)(tn−tn−1)+(c−i−1∑j=1Ij)k=⌊n2⌋∑k=0d2k. (16)

Therefore, by setting and , we can write,

 i−1∑j=1(Vj (tn)−Vj(t0))≤−(c−i−1∑j=1Ij)Δt+cα. (17)

Next, by summing up the credit variations for all intervals for class and considering ,

 Vi(tn)−Vi(t0)=Ii(t1−t0)+(Ii−c)(t2−t1)+... +(Ii−c)(tn−1−tn−2)+Ii(tn−tn−1)−Iik=⌊n2⌋∑k=0d2k =IiΔt−cα. (18)

By Eq. (4), we obtain

 i−1∑j=1Vj(t0) ≤−Vi(t0)+¯LicIi+¯Lici−1∑j=1Ij. (19)

We lower bound the left hand-side of Eq. (17) using the lower bound of Eq. (3) and the bound of Eq. (19); therefore,

 Vi(t0)−K≤cα−(c−i−1∑j=1Ij)Δt, (20)

where .

Eq. (20) gives an upper bound on , i.e.,

 Δt≤cα+K−Vi(t0)c−∑i−1j=1Ij. (21)

By using Eq. (21) in Eq. (18), we obtain:

 Vi(tn) ≤Ii(cα+K−Vi(t0)c−∑i−1j=1Ij)−cα+Vi(t0) =Ii(Kc−∑i−1j=1Ij)+Vi(t0)(c−∑i−1j=1Ij−Iic−∑i−1j=1Ij) −cα(c−∑i−1j=1Ij−Iic−∑i−1j=1Ij). (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:

 Vi(tn)=Vi(tn−1)+Si(tn−tn−1). (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 H-bounds and show that our bounds improve on all existing bounds.

###### Proposition 2.
1. .

2. and the inequality is strict if .

3. For , .

###### Proof.

1) is straightforward. For 2), observe that can be obtained by replacing with in . For 3), after some algebra we find:

 Vmax,Hi−Vmaxi=c−∑ij=1Ijc(c−∑i−1j=1Ij)(¯Lii−1∑j=1Ij−i−1∑j=1SjLj). (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 J-bounds (1), H-bounds (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 J-bound by 111As aforementioned, J-bounds exist only for the case . Thus, in the computation of the J-bound, class is treated as a BE class. and than the H-bound by . For class 3 the bound by Theorem 1 is less than the H-bound by , while the J-bound does not exist for class 3.

As discussed, the credit upper bound has an impact on the latency bound of a FIFO system and subsequently of the end-to-end 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:

 βi(t)=(c−r)IiIi−Si[t−cVMi(c−r)Ii+b+rLNcc−r]+, (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].