diff --git a/src/devices/wifi/edca-txop-n.cc b/src/devices/wifi/edca-txop-n.cc index f1bbf4bc5..9473da398 100644 --- a/src/devices/wifi/edca-txop-n.cc +++ b/src/devices/wifi/edca-txop-n.cc @@ -132,6 +132,13 @@ EdcaTxopN::GetTypeId (void) MakeUintegerAccessor (&EdcaTxopN::SetBlockAckThreshold, &EdcaTxopN::GetBlockAckThreshold), MakeUintegerChecker (0, 64)) + .AddAttribute ("BlockAckInactivityTimeout", "Represents max time (blocks of 1024 micro seconds) allowed for block ack\ + inactivity. If this value isn't equal to 0 a timer start after that a\ + block ack setup is completed and will be reset every time that a block\ + ack frame is received. If this value is 0, block ack inactivity timeout won't be used.", + UintegerValue(0), + MakeUintegerAccessor (&EdcaTxopN::m_blockAckInactivityTimeout), + MakeUintegerChecker ()) ; return tid; } @@ -846,6 +853,14 @@ EdcaTxopN::GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address RestartAccessIfNeeded (); } +void +EdcaTxopN::GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient) +{ + NS_LOG_FUNCTION (this); + MY_DEBUG ("received DELBA frame from="<TearDownBlockAck (recipient, delBaHdr->GetTid ()); +} + void EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient) { @@ -904,7 +919,7 @@ EdcaTxopN::SetupBlockAckIfNeeded () { /* Block ack setup */ uint16_t startingSequence = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient); - SendAddBaRequest (recipient, tid, startingSequence, 0, true); + SendAddBaRequest (recipient, tid, startingSequence, m_blockAckInactivityTimeout, true); return true; } return false; @@ -960,6 +975,7 @@ EdcaTxopN::CompleteConfig (void) NS_LOG_FUNCTION (this); m_baManager->SetTxMiddle (m_txMiddle); m_low->RegisterBlockAckListenerForAc (m_ac, m_blockAckListener); + m_baManager->SetBlockAckInactivityCallback (MakeCallback (&EdcaTxopN::SendDelbaFrame, this)); } void @@ -1011,7 +1027,6 @@ EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq, * will choose how many packets it can receive under block ack. */ reqHdr.SetBufferSize (0); - /* Also timeout field is not used for now */ reqHdr.SetTimeout (timeout); reqHdr.SetStartingSequence (startSeq); diff --git a/src/devices/wifi/edca-txop-n.h b/src/devices/wifi/edca-txop-n.h index e8ca4661f..fc395e40a 100644 --- a/src/devices/wifi/edca-txop-n.h +++ b/src/devices/wifi/edca-txop-n.h @@ -49,6 +49,7 @@ class QosBlockedDestinations; class MsduAggregator; class MgtAddBaResponseHeader; class BlockAckManager; +class MgtDelBaHeader; /* This queue contains packets for a particular access class. @@ -118,6 +119,7 @@ public: void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient); void MissedBlockAck (void); void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient); + void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient); void MissedAck (void); void StartNext (void); void Cancel (void); @@ -217,6 +219,7 @@ private: uint8_t m_blockAckThreshold; enum BlockAckType m_blockAckType; Time m_currentPacketTimestamp; + uint16_t m_blockAckInactivityTimeout; }; } //namespace ns3 diff --git a/src/devices/wifi/qadhoc-wifi-mac.cc b/src/devices/wifi/qadhoc-wifi-mac.cc index fe52839ee..be98c41bf 100644 --- a/src/devices/wifi/qadhoc-wifi-mac.cc +++ b/src/devices/wifi/qadhoc-wifi-mac.cc @@ -409,6 +409,8 @@ QadhocWifiMac::Receive (Ptr packet, const WifiMacHeader *hdr) else { /* We must notify correct queue tear down of agreement */ + AccessClass ac = QosUtilsMapTidToAc (delBaHdr.GetTid ()); + m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ()); } } } diff --git a/src/devices/wifi/qap-wifi-mac.cc b/src/devices/wifi/qap-wifi-mac.cc index 690c97b74..fbdd69a8f 100644 --- a/src/devices/wifi/qap-wifi-mac.cc +++ b/src/devices/wifi/qap-wifi-mac.cc @@ -730,6 +730,8 @@ QapWifiMac::Receive (Ptr packet, const WifiMacHeader *hdr) else { /* We must notify correct queue tear down of agreement */ + AccessClass ac = QosUtilsMapTidToAc (delBaHdr.GetTid ()); + m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ()); } } } diff --git a/src/devices/wifi/qsta-wifi-mac.cc b/src/devices/wifi/qsta-wifi-mac.cc index 6965b663a..24b2a22b5 100644 --- a/src/devices/wifi/qsta-wifi-mac.cc +++ b/src/devices/wifi/qsta-wifi-mac.cc @@ -730,6 +730,8 @@ QstaWifiMac::Receive (Ptr packet, const WifiMacHeader *hdr) else { /* We must notify correct queue tear down of agreement */ + AccessClass ac = QosUtilsMapTidToAc (delBaHdr.GetTid ()); + m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ()); } } }