# Proportional Rate Reduction – TCP Loss Recovery Algorithm

• Difficulty Level : Expert
• Last Updated : 04 Mar, 2022

TCP CUBIC is becoming the default in Linux Kernel and the Rate Halving technique for congestion avoidance was becoming the default in Linux Kernel. So, there was a mismatch between these two. Because Rate Halving was good for TCP Reno, Tahoe, and NewReno. It is good for those TCPs only which reduce the cwnd by half when packet loss occurs. But TCP Cubic reduces the cwnd by 30%, unlike other TCPs. Thus, Rate Halving and CUBIC couldn’t fit as default in Linux Kernel. This was the motivation of Google and they invented a new algorithm known as Proportional Rate Reduction. This is covered in RFC 6937.

### Proportional Rate Reduction:

PRR calculates the number of new packets to be sent when an ACK arrives using some equations. Some new terms are coined for these equations, the new terminologies are as follows:

1. sndcnt (read as ‘send count’): the amount of data to be sent on the arrival of a DupACK. This is the number of new packets that the sender sends on the arrival of a new ACK. Unlike Fast Recovery, it is not equal to 2 and unlike Rate Halving it does not send 1 new packet on the arrival of two DUP-ACKs. It can send any number of new packets which is calculated using a formula.

2. RecoverFS: the value of pipe at the beginning of the recovery phase

3. prr_delivered: the amount of data delivered ‘during’ the recovery phase. This is the count of accumulated data delivered so far to the receiver ever since the recovery phase has begun. This is equal to the number of DUP-ACKs arrived during the recovery phase. How many packets are delivered before the recovery phase is not important? It only counts packets delivered after packet loss.

4. prr_out: the amount of data transmitted ‘during’ the recovery phase. This counts the accumulated number of new packets sent by the sender once it has entered the recovery phase.

5. DeliveredData: the amount of data delivered as indicated by an ACK packet (look at sequence numbers). Don’t confuse this with “prr_delivered”. DeliveredData indicates the number of packets delivered by this DUP_ACK. It can be 1 or more if ACKs arrive out-of-order.

6. limit: data sending limit (calculated in PRR algorithm). This can be considered as the threshold. It is used inside the equation and calculated in intermediary steps.

7. MSS: Maximum Segment Size. This is the typical size of one segment. Since we will be using the granularity of all terms as segments, MSS becomes 1.

### Mode of Proportional Rate Reduction:

Proportional Rate Reduction (PRR) has two modes, which are as follows:

1. Conservative Reduction Bound (CRB)
2. Slow Start Reduction Bound (SSRB) [this one is enabled by default in Linux]

We can only use one mode at a time, both modes can’t be used simultaneously.

### Working of PRR:

When the recovery phase begins, the pipe value is greater than cwnd. But there can be the case when SACK blocks confirm the packet loss and pipe value becomes lesser than cwnd. All these cases are handled differently by the PRR algorithm.

#### CASE 1: PRR (Case: pipe > ssthresh)

When sender enters the recovery phase:

```pipe = 10 segments,
RecoverFS = 10 segments
ssthresh = 7 segments,```

cwnd is calculated by PRR:

```cwnd = pipe + sndcnt
sndcnt = CEIL(p_d * ssthresh / RecoverFS) - p_o, {p_d=prr_delivered, p_o=prr_out}```

Step 1: one DupACK comes, pipe=10-1=9, p_d=1, p_o=0, (Pipe reduces by one). DupACK tells that 1 packet was delivered. So,  p_d=1, no new packet has been sent yet, so p_o=0

```sndcnt= CEIL(1*7/10)-0 = CEIL(0.7)-0 = 1
sender sends one new packet and pipe becomes =9+1=10 again.```

Step 2: one DupACK comes, pipe=10-1=9, p_d=2, p_o=1, (Pipe reduces by one). DupACK tells that one packet was delivered, so p_d=2 (cumulative). One new packet has been sent yet, so, p_o=1.

```sndcnt= CEIL(2*7/10)-1 = CEIL(1.4)-1= 1
sender sends one new packet and pipe becomes 9 + 1 = 10 again.```

This is how it continues.

Recommended Articles
Page :