in simulation/src/traffic-control/model/pie-queue-disc.cc [270:332]
bool PieQueueDisc::DropEarly (Ptr<QueueDiscItem> item, uint32_t qSize)
{
NS_LOG_FUNCTION (this << item << qSize);
if (m_burstAllowance.GetSeconds () > 0)
{
// If there is still burst_allowance left, skip random early drop.
return false;
}
if (m_burstState == NO_BURST)
{
m_burstState = IN_BURST_PROTECTING;
m_burstAllowance = m_maxBurst;
}
double p = m_dropProb;
uint32_t packetSize = item->GetSize ();
if (GetMaxSize ().GetUnit () == QueueSizeUnit::BYTES)
{
p = p * packetSize / m_meanPktSize;
}
// Safeguard PIE to be work conserving (Section 4.1 of RFC 8033)
if ((m_qDelayOld.GetSeconds () < (0.5 * m_qDelayRef.GetSeconds ())) && (m_dropProb < 0.2))
{
return false;
}
else if (GetMaxSize ().GetUnit () == QueueSizeUnit::BYTES && qSize <= 2 * m_meanPktSize)
{
return false;
}
else if (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS && qSize <= 2)
{
return false;
}
if (m_useDerandomization)
{
if (m_dropProb == 0)
{
m_accuProb = 0;
}
m_accuProb += m_dropProb;
if (m_accuProb < 0.85)
{
return false;
}
else if (m_accuProb >= 8.5)
{
return true;
}
}
double u = m_uv->GetValue ();
if (u > p)
{
return false;
}
return true;
}