[code=java]

Per-Port Switch Variables:

Nominal Capacity of the Port: C0

Advertised Rate for the ith interval: ri

Port State: Port Initialized

Measured Port Capacity for ith Measurement Interval: Ci

Bits received in the last measurement interval: bits received

Bits transmitted in the last measurement interval: bits sent

Bits in Queue at the beginning of current measurement interval: qlen

Total Busy (transmit) time during last measurement interval: time busy

Limited rate increase: r

Algorithm Parameters:

Initial Rate Divider: N0

Measurement Interval in Switches: T

T is also used for -timer (probe interval) in the sources

Queue Control Parameters: a, b, c

Exponential moving average:

Operational Parameters:

Queue equilibrium: Qeq

Queue Length under severe congestion: Qsc

Default Values:

N0 = 200, T = 1 ms,

Qeq = 192, 000 bits, a = 1.1, b = 1.002, c = 0.1, = 0.5

Variable Initialization:

Ci = C0, r = ri−1 = ri−2 = C0

N0

,

1

Port Initialized = FALSE.

Switch Event Routines:

procedure EVENT T Timer Expired Routine()

1: while T timer expires do

2: if Port Initialized then

3: Estimate Capacity()

4: if bits received > 0 then

5: Rate Allocation(qlen, bits received, ri−1, ri−2,Ci)

6: else

7: ri = C0

N0

8: end if

9: else

10: if bits received > 0 then

11: Port Initialized = TRUE

12: Rate Allocation(qlen, bits received, ri−1, ri−2,Ci)

13: end if

14: end if

15: Reset T timer

16: end while

procedure EVENT Transmit Packet()

1: if packet is tagged then

2: if Rate in Tag ri OR Rate in Tag == −1 then

3: Rate in Tag = ri

4: end if

5: end if

6: Forward the packet

Subroutines:

procedure Rate Allocation(qlen, bits received, ri−1, ri−2,Ci)

1: Queue Control(fq, qlen,Qeq)

2: = bits received

TCfq

3: if == 0 then

4: if qlen < 1 then

5: ri = Ci

6: else

7: ri = ri−1

8: end if

9: else

2

10: ri = min{Ci, ri−1

}

11: end if

12: Exponential Averaging(ri, ri−1, ri−2)

13: Limit Rate Increase(ri, ri−1, qlen,Qeq,r)

14: Variable Capapcity Adjustment(Ci,Ci−1, ri, ri−1, ri−2)

15: bits received = 0

procedure Queue Control(fq, qlen,Qeq)

1: if qlen Qeq then

2: fq = bQeq

(b−1)qlen+Qeq

3: else

4: fq = max

n

c, aQeq

(a−1)qlen+Qeq

o

5: end if

Note: Queue control function can be implemented as a precomputed table

procedure Exponential Averaging(ri, ri−2)

1: ri = ri + (1 − )ri−2

procedure Limit Rate Increase(ri, ri−1, qlen,Qeq,r)

1: if qlen < Qeq then

2: r = 1.414r

3: else if qlen > Qsc then

4: r = 0.707r

5: end if

6: if ri − ri−1 > r then

7: ri = ri−1 + r

8: end if

procedure Variable Capacity Adjustment(Ci,Ci−1, ri, ri−1, ri−2)

1: if Ci < Ci−1 then

2: ri = Ci

Ci−1

ri

3: ri−1 = Ci

Ci−1

ri−1

4: end if

5: ri−2 = ri−1

6: ri−1 = ri

3

procedure Estimate Capacity(Ci, bits sent, time busy)

1: Ci = bits sent

time busy

2: bits sent = 0

3: time busy = 0

Source Variables:

Current Rate: R

Source Parameters: = T

Feedback Valid Interval: 2T

Initial Rate: R0 = C0

N0

Source Initialization:

Set timer to expired

Tagging a sampled packet every sec

Set Feedback Valid Timer to expired

Source Event Routines:

procedure EVENT Send packet()

1: if timer expired then

2: if Feedback Valid timer expired then

3: R = R0

4: end if

5: Tag an outgoing packet and the rate field in Tag is set as -1;

6: Send following packets at current rate R

7: Reset timer

8: else

9: Send following packet without tag at rate R

10: end if

procedure EVENT FECN Received()

1: Set R to rate received

2: Reset Feedback Valid Timer to 2T

[/code]