wifi: (fixes #2477) Check that PHY state is not RX nor TX before sending BACK response to A-MPDU

This commit is contained in:
Sébastien Deronne
2016-10-30 09:21:08 +01:00
parent cccee8c146
commit 33bc706e2b
3 changed files with 32 additions and 38 deletions

View File

@@ -26,6 +26,7 @@ Bugs fixed
----------
- Bug 2007 - uan: Remove deprecation on SetRxThresholdDb
- Bug 2450 - LogDistancePropagationLossModel is not continuous
- Bug 2477 - DCF manager assert
- Bug 2492 - uan: Make use of RxGain attribute in UanPhyGen class
- Bug 2511 - HT Greenfield is not working
- Bug 2521 - Include ipv6-option.h in wscript

View File

@@ -808,27 +808,13 @@ DcfManager::NotifyTxStartNow (Time duration)
NS_LOG_FUNCTION (this << duration);
if (m_rxing)
{
if (Simulator::Now () - m_lastRxStart <= m_sifs)
{
//this may be caused if PHY has started to receive a packet
//inside SIFS, so, we check that lastRxStart was within a SIFS ago
m_lastRxEnd = Simulator::Now ();
m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
m_lastRxReceivedOk = true;
m_rxing = false;
}
else
{
// Bug 2477: It is possible for the DCF to fall out of
// sync with the PHY state if there are problems
// receiving A-MPDUs. PHY will cancel the reception
// and start to transmit
NS_LOG_DEBUG ("Phy is transmitting despite DCF being in receive state");
m_lastRxEnd = Simulator::Now ();
m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
m_lastRxReceivedOk = false;
m_rxing = false;
}
//this may be caused only if PHY has started to receive a packet
//inside SIFS, so, we check that lastRxStart was maximum a SIFS ago
NS_ASSERT (Simulator::Now () - m_lastRxStart <= m_sifs);
m_lastRxEnd = Simulator::Now ();
m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
m_lastRxReceivedOk = true;
m_rxing = false;
}
MY_DEBUG ("tx start for " << duration);
UpdateBackoff ();

View File

@@ -845,7 +845,7 @@ void
MacLow::ReceiveError (Ptr<Packet> packet, double rxSnr)
{
NS_LOG_FUNCTION (this << packet << rxSnr);
NS_LOG_DEBUG ("rx failed ");
NS_LOG_DEBUG ("rx failed");
if (m_txParams.MustWaitFastAck ())
{
NS_ASSERT (m_fastAckFailedTimeoutEvent.IsExpired ());
@@ -1681,9 +1681,9 @@ MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,
if (delay == Seconds (0))
{
NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
if (!vhtSingleMpdu)
{
NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
mpdutype = MPDU_IN_AGGREGATE;
}
else
@@ -2698,23 +2698,30 @@ MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addre
void
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector, double rxSnr)
{
NS_LOG_FUNCTION (this << (uint16_t) tid << originator << duration.As (Time::S) << blockAckReqTxVector << rxSnr);
CtrlBAckResponseHeader blockAck;
uint16_t seqNumber = 0;
BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid));
NS_ASSERT (i != m_bAckCaches.end ());
seqNumber = (*i).second.GetWinStart ();
if (!m_phy->IsStateTx () && !m_phy->IsStateRx ())
{
NS_LOG_FUNCTION (this << (uint16_t) tid << originator << duration.As (Time::S) << blockAckReqTxVector << rxSnr);
CtrlBAckResponseHeader blockAck;
uint16_t seqNumber = 0;
BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid));
NS_ASSERT (i != m_bAckCaches.end ());
seqNumber = (*i).second.GetWinStart ();
bool immediate = true;
AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
blockAck.SetStartingSequence (seqNumber);
blockAck.SetTidInfo (tid);
immediate = (*it).second.first.IsImmediateBlockAck ();
blockAck.SetType (COMPRESSED_BLOCK_ACK);
NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
(*i).second.FillBlockAckBitmap (&blockAck);
bool immediate = true;
AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
blockAck.SetStartingSequence (seqNumber);
blockAck.SetTidInfo (tid);
immediate = (*it).second.first.IsImmediateBlockAck ();
blockAck.SetType (COMPRESSED_BLOCK_ACK);
NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
(*i).second.FillBlockAckBitmap (&blockAck);
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode (), rxSnr);
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode (), rxSnr);
}
else
{
NS_LOG_DEBUG ("Skip block ack response!");
}
}
void