diff --git a/src/traffic-control/doc/queue-discs.rst b/src/traffic-control/doc/queue-discs.rst index 763151ebe..d54d5edd9 100644 --- a/src/traffic-control/doc/queue-discs.rst +++ b/src/traffic-control/doc/queue-discs.rst @@ -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`` diff --git a/src/traffic-control/model/queue-disc.cc b/src/traffic-control/model/queue-disc.cc index deda5601b..d15cc35a4 100644 --- a/src/traffic-control/model/queue-disc.cc +++ b/src/traffic-control/model/queue-disc.cc @@ -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 item, const char* r) + { + return Mark (const_cast (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 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 qdClass) qdClass->GetQueueDisc ()->TraceConnectWithoutContext ("DropAfterDequeue", MakeCallback (&ChildQueueDiscDropFunctor::operator(), &m_childQueueDiscDadFunctor)); + qdClass->GetQueueDisc ()->TraceConnectWithoutContext ("Mark", + MakeCallback (&ChildQueueDiscMarkFunctor::operator(), + &m_childQueueDiscMarkFunctor)); m_classes.push_back (qdClass); } diff --git a/src/traffic-control/model/queue-disc.h b/src/traffic-control/model/queue-disc.h index 6e7295433..af69f7b90 100644 --- a/src/traffic-control/model/queue-disc.h +++ b/src/traffic-control/model/queue-disc.h @@ -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 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)> InternalQueueDropFunctor; /// Type for the function objects notifying that a packet has been dropped by a child queue disc typedef std::function, const char*)> ChildQueueDiscDropFunctor; + /// Type for the function objects notifying that a packet has been marked by a child queue disc + typedef std::function, 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; }; /**