wifi: Allow QosTxop to prepare Block Ack Requests for other ACs

This commit is contained in:
Stefano Avallone
2019-07-23 19:09:29 +02:00
parent 84f2f437a3
commit f0bee86835
6 changed files with 69 additions and 10 deletions

View File

@@ -590,22 +590,27 @@ BlockAckManager::NotifyDiscardedMpdu (Ptr<const WifiMacQueueItem> mpdu)
ScheduleBlockAckReq (recipient, tid);
}
CtrlBAckRequestHeader
BlockAckManager::GetBlockAckReqHeader (Mac48Address recipient, uint8_t tid) const
{
NS_LOG_FUNCTION (this << recipient << +tid);
AgreementsCI it = m_agreements.find (std::make_pair (recipient, tid));
NS_ASSERT (it != m_agreements.end ());
CtrlBAckRequestHeader reqHdr;
reqHdr.SetType (m_blockAckType);
reqHdr.SetTidInfo (tid);
reqHdr.SetStartingSequence ((*it).second.first.GetStartingSequence ());
return reqHdr;
}
void
BlockAckManager::ScheduleBlockAckReq (Mac48Address recipient, uint8_t tid)
{
NS_LOG_FUNCTION (this << recipient << +tid);
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
NS_ASSERT (it != m_agreements.end ());
OriginatorBlockAckAgreement &agreement = (*it).second.first;
CtrlBAckRequestHeader reqHdr;
reqHdr.SetType (m_blockAckType);
reqHdr.SetTidInfo (agreement.GetTid ());
reqHdr.SetStartingSequence (agreement.GetStartingSequence ());
Ptr<Packet> bar = Create<Packet> ();
bar->AddHeader (reqHdr);
bar->AddHeader (GetBlockAckReqHeader (recipient, tid));
WifiMacHeader hdr;
hdr.SetAddr1 (recipient);
hdr.SetType (WIFI_MAC_CTL_BACKREQ);

View File

@@ -35,6 +35,7 @@ class WifiRemoteStationManager;
class MgtAddBaResponseHeader;
class MgtAddBaRequestHeader;
class CtrlBAckResponseHeader;
class CtrlBAckRequestHeader;
class MacTxMiddle;
class WifiMacQueue;
class WifiMode;
@@ -388,6 +389,15 @@ public:
*/
void NotifyDiscardedMpdu (Ptr<const WifiMacQueueItem> mpdu);
/**
* \param recipient the recipient
* \param tid the TID
*
* Get the block ack request header for the established BA agreement
* (<i>recipient</i>,<i>tid</i>).
*/
CtrlBAckRequestHeader GetBlockAckReqHeader (Mac48Address recipient, uint8_t tid) const;
/**
* \param recipient the recipient
* \param tid the TID

View File

@@ -268,6 +268,14 @@ MacLow::ResetPhy (void)
m_phy = 0;
}
Ptr<QosTxop>
MacLow::GetEdca (uint8_t tid) const
{
auto it = m_edca.find (QosUtilsMapTidToAc (tid));
NS_ASSERT (it != m_edca.end ());
return it->second;
}
void
MacLow::SetMac (const Ptr<WifiMac> mac)
{

View File

@@ -88,6 +88,11 @@ public:
* Remove WifiPhy associated with this MacLow.
*/
void ResetPhy (void);
/**
* \param tid the Traffic ID
* \return the QosTxop corresponding to the given TID
*/
Ptr<QosTxop> GetEdca (uint8_t tid) const;
/**
* Set up WifiMac associated with this MacLow.
*

View File

@@ -142,6 +142,27 @@ QosTxop::GetBaStartingSequence (Mac48Address address, uint8_t tid) const
return m_baManager->GetOriginatorStartingSequence (address, tid);
}
Ptr<const WifiMacQueueItem>
QosTxop::PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const
{
NS_LOG_FUNCTION (this << recipient << +tid);
CtrlBAckRequestHeader reqHdr = m_low->GetEdca (tid)->m_baManager->GetBlockAckReqHeader (recipient, tid);
Ptr<Packet> bar = Create<Packet> ();
bar->AddHeader (reqHdr);
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_CTL_BACKREQ);
hdr.SetAddr1 (recipient);
hdr.SetAddr2 (m_low->GetAddress ());
hdr.SetDsNotTo ();
hdr.SetDsNotFrom ();
hdr.SetNoRetry ();
hdr.SetNoMoreFragments ();
return Create<const WifiMacQueueItem> (bar, hdr);
}
void
QosTxop::ScheduleBlockAckReq (Mac48Address address, uint8_t tid)
{

View File

@@ -185,6 +185,16 @@ public:
* recipient for the given TID.
*/
uint16_t GetBaStartingSequence (Mac48Address address, uint8_t tid) const;
/**
* \param recipient Address of recipient.
* \param tid Traffic ID.
*
* Prepare a Block Ack Request to be sent to <i>recipient</i> for Traffic ID
* <i>tid</i>. The header for the Block Ack Request is requested to the QosTxop
* corresponding to the given TID. A block ack agreement with the given recipient
* for the given TID must have been established by such QosTxop.
*/
Ptr<const WifiMacQueueItem> PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const;
/**
* \param address recipient address
* \param tid traffic ID