traffic-control: (merges !121) Add functors for chaining of ECN Mark trace

This commit is contained in:
Tom Henderson
2019-10-19 17:20:26 -07:00
parent 588b9df40b
commit f02875cbff
3 changed files with 17 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ is stopped. Waking a queue disc is equivalent to make it run.
Every queue disc collects statistics about the total number of packets/bytes
received from the upper layers (in case of root queue disc) or from the parent
queue disc (in case of child queue disc), enqueued, dequeued, requeued, dropped,
dropped before enqueue, dropped after dequeue, stored in the queue disc and
dropped before enqueue, dropped after dequeue, marked, and stored in the queue disc and
sent to the netdevice or to the parent queue disc. Note that packets that are
dequeued may be requeued, i.e., retained by the traffic control infrastructure,
if the netdevice is not ready to receive them. Requeued packets are not part
@@ -126,6 +126,7 @@ The base class QueueDisc provides many trace sources:
* ``Dequeue``
* ``Requeue``
* ``Drop``
* ``Mark``
* ``PacketsInQueue``
* ``BytesInQueue``

View File

@@ -360,6 +360,11 @@ QueueDisc::QueueDisc (QueueDiscSizePolicy policy)
return DropAfterDequeue (item,
m_childQueueDiscDropMsg.assign (CHILD_QUEUE_DISC_DROP).append (r).data ());
};
m_childQueueDiscMarkFunctor = [this] (Ptr<const QueueDiscItem> item, const char* r)
{
return Mark (const_cast<QueueDiscItem *> (PeekPointer (item)),
m_childQueueDiscMarkMsg.assign (CHILD_QUEUE_DISC_MARK).append (r).data ());
};
}
QueueDisc::QueueDisc (QueueDiscSizePolicy policy, QueueSizeUnit unit)
@@ -636,7 +641,7 @@ QueueDisc::AddQueueDiscClass (Ptr<QueueDiscClass> qdClass)
"A queue disc with WAKE_CHILD as wake mode can only be a root queue disc");
// set the parent callbacks on the child queue disc, so that it can notify
// the parent queue disc of packets enqueued, dequeued or dropped
// the parent queue disc of packets enqueued, dequeued, dropped, or marked
qdClass->GetQueueDisc ()->TraceConnectWithoutContext ("Enqueue",
MakeCallback (&QueueDisc::PacketEnqueued, this));
qdClass->GetQueueDisc ()->TraceConnectWithoutContext ("Dequeue",
@@ -647,6 +652,9 @@ QueueDisc::AddQueueDiscClass (Ptr<QueueDiscClass> qdClass)
qdClass->GetQueueDisc ()->TraceConnectWithoutContext ("DropAfterDequeue",
MakeCallback (&ChildQueueDiscDropFunctor::operator(),
&m_childQueueDiscDadFunctor));
qdClass->GetQueueDisc ()->TraceConnectWithoutContext ("Mark",
MakeCallback (&ChildQueueDiscMarkFunctor::operator(),
&m_childQueueDiscMarkFunctor));
m_classes.push_back (qdClass);
}

View File

@@ -515,6 +515,7 @@ public:
// Reasons for dropping packets
static constexpr const char* INTERNAL_QUEUE_DROP = "Dropped by internal queue"; //!< Packet dropped by an internal queue
static constexpr const char* CHILD_QUEUE_DISC_DROP = "(Dropped by child queue disc) "; //!< Packet dropped by a child queue disc
static constexpr const char* CHILD_QUEUE_DISC_MARK = "(Marked by child queue disc) "; //!< Packet marked by a child queue disc
protected:
/**
@@ -709,6 +710,7 @@ private:
Ptr<QueueDiscItem> m_requeued; //!< The last packet that failed to be transmitted
bool m_peeked; //!< A packet was dequeued because Peek was called
std::string m_childQueueDiscDropMsg; //!< Reason why a packet was dropped by a child queue disc
std::string m_childQueueDiscMarkMsg; //!< Reason why a packet was marked by a child queue disc
QueueDiscSizePolicy m_sizePolicy; //!< The queue disc size policy
bool m_prohibitChangeMode; //!< True if changing mode is prohibited
@@ -731,6 +733,8 @@ private:
typedef std::function<void (Ptr<const QueueDiscItem>)> InternalQueueDropFunctor;
/// Type for the function objects notifying that a packet has been dropped by a child queue disc
typedef std::function<void (Ptr<const QueueDiscItem>, const char*)> ChildQueueDiscDropFunctor;
/// Type for the function objects notifying that a packet has been marked by a child queue disc
typedef std::function<void (Ptr<const QueueDiscItem>, const char*)> ChildQueueDiscMarkFunctor;
/// Function object called when an internal queue dropped a packet before enqueue
InternalQueueDropFunctor m_internalQueueDbeFunctor;
@@ -740,6 +744,8 @@ private:
ChildQueueDiscDropFunctor m_childQueueDiscDbeFunctor;
/// Function object called when a child queue disc dropped a packet after dequeue
ChildQueueDiscDropFunctor m_childQueueDiscDadFunctor;
/// Function object called when a child queue disc marked a packet
ChildQueueDiscMarkFunctor m_childQueueDiscMarkFunctor;
};
/**