RED Operation
On packet arrival, do the following:
- avg < minth: queue packet normally
- avg > maxth: drop/mark packet
- minth < avg < maxth: mark/drop w/prob p
Probability p given by:
- t = maxp*(avg-minth)/(maxth-minth)
- p = t/(1-cnt*t)
- gives initial p on [0…maxp]
- cnt is pkt cnt since last random mark/drop