-
Notifications
You must be signed in to change notification settings - Fork 4
Changes made in PIE code
We have modified pie-queue-disc.cc and pie-queue-disc.h files to support ECN.
-
Added 1 additional attribute for ECN
- UseEcn - It's a Boolean flag. Default value = false. It's True when ECN is enabled otherwise false.
-
Changed DoEnqueue function
In DoEnqueue function, instead of directly dropping first we have declared packet type -DTYPE_NONE, DTYPE_FORCED, DTYPE_UNFORCED
. First check if ECN is enabled and drop probability exceeds threshold mark_ecnth then drop the packet. WhenDropType = DTYPE_UNFORCED
then check whether ECN is enabled, if enabled then mark the packet. If mark is unsuccessful then drop the packet. IfDropType = DTYPE_FORCED
then drop the packet.
In the beginning of the code where all attributes are added. At the end of them add the following attribute -
.AddAttribute ("UseEcn",
"True to use ECN (packets are marked instead of being dropped)",
BooleanValue(false),
MakeBooleanAccessor (&PieQueueDisc::m_useEcn),
MakeBooleanChecker())
bool
PieQueueDisc::DoEnqueue (Ptr<QueueDiscItem> item)
{
NS_LOG_FUNCTION (this << item);
QueueSize nQueued = GetCurrentSize ();
uint32_t dropType = DTYPE_NONE;
if (nQueued + item > GetMaxSize ()){
// Drops due to queue limit: reactive
dropType = DTYPE_FORCED;
}
else if (DropEarly (item, nQueued.GetValue ()))
{
// Early probability drop: proactive
dropType = DTYPE_UNFORCED;
}
if(m_useEcn && m_dropProb > m_mark_ecnth)
{
NS_LOG_DEBUG("\t Dropping packet due to mark_ecnth ");
DropBeforeEnqueue(item, UNFORCED_DROP);
return false;
}
else if(dropType==DTYPE_UNFORCED)
{
if(!m_useEcn || !Mark(item, UNFORCED_MARK))
{
NS_LOG_DEBUG("\t Dropping packet due to Prob Mark ");
DropBeforeEnqueue(item, UNFORCED_DROP);
return false;
}
NS_LOG_DEBUG("\t Marking due to Prob Mark ");
}
else if(dropType==DTYPE_FORCED)
{
NS_LOG_DEBUG("\t Dropping due to queue limit ");
DropBeforeEnqueue(item, FORCED_DROP);
return false;
}
// No drop
bool retval = GetInternalQueue (0)->Enqueue (item);
// If Queue::Enqueue fails, QueueDisc::DropBeforeEnqueue is called by the
// internal queue because QueueDisc::AddInternalQueue sets the trace callback
NS_LOG_LOGIC ("\t bytesInQueue " << GetInternalQueue (0)->GetNBytes ());
NS_LOG_LOGIC ("\t packetsInQueue " << GetInternalQueue (0)->GetNPackets ());
return retval;
}
- Added drop types
- Declared
FORCED_MARK
andUNFORCED_MARK
. - Added variables
m_useEcn
andm_mark_ecnth
.
Add the following code after burst types. It declares an enum datatype to specify drop types.
/** drop types
*
*/
enum
{
DTYPE_NONE, // no drop
DTYPE_FORCED, //forced drop
DTYPE_UNFORCED, // unforced(random) drop
};
Add the following code after the declaration of FORCED_DROP
.
// reasons for marking packets
static constexpr const char* UNFORCED_MARK = "Unforced mark"; //!< Early probability mark
static constexpr const char* FORCED_MARK = "Forced mark"; //!< forced mark
Add the following code at the end where all the variables are declared.
bool m_useEcn; // true if ecn is used
double m_mark_ecnth; // additional thresold to revert packet-marking to packet-dropping
Computer Networks Project
Under the guidance of Mohit P. Tahiliani