wifi: (fixes #1034) WifiMac::m_macTxDropTrace is fed with packets dropped in the wifi MAC queues
This commit is contained in:
@@ -34,6 +34,7 @@ New user-visible features
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
- Bug 1034 - No trace source for packet dropping from WifiMacQueue
|
||||
- Bug 2007 - uan: Remove deprecation on SetRxThresholdDb
|
||||
- Bug 2214 - tcp: Use of ScheduleNow only in selected part of the code
|
||||
- Bug 2221 - network: Remove constraint on size of ns3::Packet Tag objects
|
||||
|
||||
@@ -352,6 +352,10 @@ ApWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from
|
||||
{
|
||||
ForwardDown (packet, from, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyTxDrop (packet);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -142,6 +142,23 @@ DcaTxop::SetTxFailedCallback (TxFailed callback)
|
||||
m_txFailedCallback = callback;
|
||||
}
|
||||
|
||||
void
|
||||
DcaTxop::SetTxDroppedCallback (TxDropped callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_txDroppedCallback = callback;
|
||||
m_queue->TraceConnectWithoutContext ("Drop", MakeCallback (&DcaTxop::TxDroppedPacket, this));
|
||||
}
|
||||
|
||||
void
|
||||
DcaTxop::TxDroppedPacket (Ptr<const WifiMacQueueItem> item)
|
||||
{
|
||||
if (!m_txDroppedCallback.IsNull ())
|
||||
{
|
||||
m_txDroppedCallback (item->GetPacket ());
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<WifiMacQueue >
|
||||
DcaTxop::GetQueue () const
|
||||
{
|
||||
|
||||
@@ -80,6 +80,11 @@ public:
|
||||
* packet transmission was failed.
|
||||
*/
|
||||
typedef Callback <void, const WifiMacHeader&> TxFailed;
|
||||
/**
|
||||
* typedef for a callback to invoke when a
|
||||
* packet is dropped.
|
||||
*/
|
||||
typedef Callback <void, Ptr<const Packet> > TxDropped;
|
||||
|
||||
/**
|
||||
* Check for EDCA.
|
||||
@@ -123,6 +128,11 @@ public:
|
||||
* packet transmission was completed unsuccessfully.
|
||||
*/
|
||||
void SetTxFailedCallback (TxFailed callback);
|
||||
/**
|
||||
* \param callback the callback to invoke when a
|
||||
* packet is dropped.
|
||||
*/
|
||||
void SetTxDroppedCallback (TxDropped callback);
|
||||
|
||||
/**
|
||||
* Return the MacLow associated with this DcaTxop.
|
||||
@@ -382,11 +392,20 @@ protected:
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool IsLastFragment (void) const;
|
||||
/**
|
||||
*
|
||||
* Pass the packet included in the wifi MAC queue item to the
|
||||
* packet dropped callback.
|
||||
*
|
||||
* \param item the wifi MAC queue item.
|
||||
*/
|
||||
void TxDroppedPacket (Ptr<const WifiMacQueueItem> item);
|
||||
|
||||
DcfState *m_dcf; //!< the DCF state
|
||||
DcfManager *m_manager; //!< the DCF manager
|
||||
TxOk m_txOkCallback; //!< the transmit OK callback
|
||||
TxFailed m_txFailedCallback; //!< the transmit failed callback
|
||||
TxDropped m_txDroppedCallback; //!< the packet dropped callback
|
||||
Ptr<WifiMacQueue> m_queue; //!< the wifi MAC queue
|
||||
MacTxMiddle *m_txMiddle; //!< the MacTxMiddle
|
||||
Ptr <MacLow> m_low; //!< the MacLow
|
||||
|
||||
@@ -59,6 +59,7 @@ RegularWifiMac::RegularWifiMac ()
|
||||
m_dca->SetTxMiddle (m_txMiddle);
|
||||
m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
|
||||
m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
|
||||
m_dca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
|
||||
|
||||
//Construct the EDCAFs. The ordering is important - highest
|
||||
//priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
|
||||
@@ -425,6 +426,7 @@ RegularWifiMac::SetupEdcaQueue (AcIndex ac)
|
||||
edca->SetTxMiddle (m_txMiddle);
|
||||
edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
|
||||
edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
|
||||
edca->SetTxDroppedCallback (MakeCallback (&RegularWifiMac::NotifyTxDrop, this));
|
||||
edca->SetAccessCategory (ac);
|
||||
edca->CompleteConfig ();
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ WifiMac::GetTypeId (void)
|
||||
MakeTraceSourceAccessor (&WifiMac::m_macTxTrace),
|
||||
"ns3::Packet::TracedCallback")
|
||||
.AddTraceSource ("MacTxDrop",
|
||||
"A packet has been dropped in the MAC layer before being queued for transmission.",
|
||||
"A packet has been dropped in the MAC layer before transmission.",
|
||||
MakeTraceSourceAccessor (&WifiMac::m_macTxDropTrace),
|
||||
"ns3::Packet::TracedCallback")
|
||||
.AddTraceSource ("MacPromiscRx",
|
||||
|
||||
Reference in New Issue
Block a user