flow-monitor: (fixes #2479) Keep track of packets dropped by queue discs

This commit is contained in:
Stefano Avallone
2016-08-22 14:50:59 +02:00
parent 638d7c0c14
commit 01fcd078f9
5 changed files with 63 additions and 0 deletions

View File

@@ -93,6 +93,7 @@ Bugs fixed
- Bug 2454 - DsrRouting::NotifyDataReceipt is also triggered for wifi management packets
- Bug 2468 - Simulation with A-MPDU enabled hangs when fragmentation threshold is smaller than MSDU size
- Bug 2469 - send Block Ack Request upon short/long retry failures
- Bug 2479 - Flow monitor does not a have a "DROP_QUEUE_DISC" drop reason
Known issues
------------

View File

@@ -252,6 +252,10 @@ Ipv4FlowProbe::Ipv4FlowProbe (Ptr<FlowMonitor> monitor,
NS_FATAL_ERROR ("trace fail");
}
std::ostringstream qd;
qd << "/NodeList/" << node->GetId () << "/$ns3::TrafficControlLayer/RootQueueDiscList/*/Drop";
Config::ConnectWithoutContext (qd.str (), MakeCallback (&Ipv4FlowProbe::QueueDiscDropLogger, Ptr<Ipv4FlowProbe> (this)));
// code copied from point-to-point-helper.cc
std::ostringstream oss;
oss << "/NodeList/" << node->GetId () << "/DeviceList/*/TxQueue/Drop";
@@ -463,6 +467,27 @@ Ipv4FlowProbe::QueueDropLogger (Ptr<const Packet> ipPayload)
m_flowMonitor->ReportDrop (this, flowId, packetId, size, DROP_QUEUE);
}
void
Ipv4FlowProbe::QueueDiscDropLogger (Ptr<const QueueItem> item)
{
Ipv4FlowProbeTag fTag;
bool tagFound = item->GetPacket ()->FindFirstMatchingByteTag (fTag);
if (!tagFound)
{
return;
}
FlowId flowId = fTag.GetFlowId ();
FlowPacketId packetId = fTag.GetPacketId ();
uint32_t size = fTag.GetPacketSize ();
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << DROP_QUEUE_DISC
<< "); ");
m_flowMonitor->ReportDrop (this, flowId, packetId, size, DROP_QUEUE_DISC);
}
} // namespace ns3

View File

@@ -70,6 +70,9 @@ public:
/// PointToPoint devices, but not with WiFi or WiMax.
DROP_QUEUE,
/// Packet dropped by the queue disc
DROP_QUEUE_DISC,
DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */
DROP_ROUTE_ERROR, /**< Route error */
DROP_FRAGMENT_TIMEOUT, /**< Fragment timeout exceeded */
@@ -108,6 +111,9 @@ private:
/// Log a packet being dropped by a queue
/// \param ipPayload IP payload
void QueueDropLogger (Ptr<const Packet> ipPayload);
/// Log a packet being dropped by a queue disc
/// \param item queue item
void QueueDiscDropLogger (Ptr<const QueueItem> item);
Ptr<Ipv4FlowClassifier> m_classifier; //!< the Ipv4FlowClassifier this probe is associated with
Ptr<Ipv4L3Protocol> m_ipv4; //!< the Ipv4L3Protocol this probe is bound to

View File

@@ -222,6 +222,10 @@ Ipv6FlowProbe::Ipv6FlowProbe (Ptr<FlowMonitor> monitor,
NS_FATAL_ERROR ("trace fail");
}
std::ostringstream qd;
qd << "/NodeList/" << node->GetId () << "/$ns3::TrafficControlLayer/RootQueueDiscList/*/Drop";
Config::ConnectWithoutContext (qd.str (), MakeCallback (&Ipv6FlowProbe::QueueDiscDropLogger, Ptr<Ipv6FlowProbe> (this)));
// code copied from point-to-point-helper.cc
std::ostringstream oss;
oss << "/NodeList/" << node->GetId () << "/DeviceList/*/TxQueue/Drop";
@@ -407,6 +411,27 @@ Ipv6FlowProbe::QueueDropLogger (Ptr<const Packet> ipPayload)
m_flowMonitor->ReportDrop (this, flowId, packetId, size, DROP_QUEUE);
}
void
Ipv6FlowProbe::QueueDiscDropLogger (Ptr<const QueueItem> item)
{
Ipv6FlowProbeTag fTag;
bool tagFound = item->GetPacket ()->FindFirstMatchingByteTag (fTag);
if (!tagFound)
{
return;
}
FlowId flowId = fTag.GetFlowId ();
FlowPacketId packetId = fTag.GetPacketId ();
uint32_t size = fTag.GetPacketSize ();
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << DROP_QUEUE_DISC
<< "); ");
m_flowMonitor->ReportDrop (this, flowId, packetId, size, DROP_QUEUE_DISC);
}
} // namespace ns3

View File

@@ -71,6 +71,9 @@ public:
/// PointToPoint devices, but not with WiFi or WiMax.
DROP_QUEUE,
/// Packet dropped by the queue disc
DROP_QUEUE_DISC,
DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */
DROP_ROUTE_ERROR, /**< Route error */
@@ -114,6 +117,9 @@ private:
/// Log a packet being dropped by a queue
/// \param ipPayload IP payload
void QueueDropLogger (Ptr<const Packet> ipPayload);
/// Log a packet being dropped by a queue disc
/// \param item queue item
void QueueDiscDropLogger (Ptr<const QueueItem> item);
Ptr<Ipv6FlowClassifier> m_classifier; //!< the Ipv6FlowClassifier this probe is associated with
};