wifi: Have WifiRemoteStationManager methods handle MU transmissions
This commit is contained in:
committed by
Stefano Avallone
parent
f3bccfd4c9
commit
12cd5774b2
@@ -543,7 +543,7 @@ FrameExchangeManager::GetFrameDurationId (const WifiMacHeader& header, uint32_t
|
||||
uint32_t nextFragmentSize = std::min (fragmentedPacket->GetSize () - nextFragmentOffset,
|
||||
payloadSize);
|
||||
WifiTxVector ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (header.GetAddr1 (),
|
||||
txParams.m_txVector.GetMode ());
|
||||
txParams.m_txVector);
|
||||
|
||||
durationId += 2 * m_phy->GetSifs ()
|
||||
+ m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, m_phy->GetPhyBand ())
|
||||
@@ -688,7 +688,7 @@ FrameExchangeManager::SendNormalAck (const WifiMacHeader& hdr, const WifiTxVecto
|
||||
{
|
||||
NS_LOG_FUNCTION (this << hdr << dataTxVector << dataSnr);
|
||||
|
||||
WifiTxVector ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (hdr.GetAddr2 (), dataTxVector.GetMode ());
|
||||
WifiTxVector ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (hdr.GetAddr2 (), dataTxVector);
|
||||
WifiMacHeader ack;
|
||||
ack.SetType (WIFI_MAC_CTL_ACK);
|
||||
ack.SetDsNotFrom ();
|
||||
@@ -903,7 +903,7 @@ FrameExchangeManager::Receive (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
|
||||
if (!psdu->GetHeader (0).IsAck () && !psdu->GetHeader (0).IsCts ())
|
||||
{
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRxOk (psdu->GetHeader (0).GetAddr2 (),
|
||||
rxSignalInfo, txVector.GetMode ());
|
||||
rxSignalInfo, txVector);
|
||||
}
|
||||
ReceiveMpdu (*(psdu->begin ()), rxSignalInfo, txVector, perMpduStatus.empty ());
|
||||
}
|
||||
@@ -1028,7 +1028,7 @@ FrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rxSi
|
||||
|
||||
SnrTag tag;
|
||||
mpdu->GetPacket ()->PeekPacketTag (tag);
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector.GetMode ());
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector);
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRtsOk (m_mpdu->GetHeader (),
|
||||
rxSnr, txVector.GetMode (), tag.Get ());
|
||||
|
||||
@@ -1095,7 +1095,7 @@ FrameExchangeManager::ReceivedNormalAck (Ptr<WifiMacQueueItem> mpdu, const WifiT
|
||||
// When fragmentation is used, only update manager when the last fragment is acknowledged
|
||||
if (!mpdu->GetHeader ().IsMoreFragments ())
|
||||
{
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxInfo, ackTxVector.GetMode ());
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxInfo, ackTxVector);
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportDataOk (mpdu, rxInfo.snr, ackTxVector.GetMode (),
|
||||
snr, txVector);
|
||||
}
|
||||
|
||||
@@ -1260,7 +1260,7 @@ HtFrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rx
|
||||
|
||||
SnrTag tag;
|
||||
mpdu->GetPacket ()->PeekPacketTag (tag);
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector.GetMode ());
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector);
|
||||
m_mac->GetWifiRemoteStationManager ()->ReportRtsOk (m_psdu->GetHeader (0),
|
||||
rxSnr, txVector.GetMode (), tag.Get ());
|
||||
|
||||
@@ -1321,7 +1321,7 @@ HtFrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rx
|
||||
NS_LOG_DEBUG ("Schedule Block Ack");
|
||||
Simulator::Schedule (m_phy->GetSifs (), &HtFrameExchangeManager::SendBlockAck, this,
|
||||
agreementIt->second, hdr.GetDuration (),
|
||||
m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (sender, txVector.GetMode ()),
|
||||
m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (sender, txVector),
|
||||
rxSnr);
|
||||
}
|
||||
else
|
||||
@@ -1382,7 +1382,7 @@ HtFrameExchangeManager::EndReceiveAmpdu (Ptr<const WifiPsdu> psdu, const RxSigna
|
||||
|
||||
Simulator::Schedule (m_phy->GetSifs (), &HtFrameExchangeManager::SendBlockAck, this,
|
||||
agreementIt->second, psdu->GetDuration (),
|
||||
m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (psdu->GetAddr2 (), txVector.GetMode ()),
|
||||
m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (psdu->GetAddr2 (), txVector),
|
||||
rxSignalInfo.snr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +185,7 @@ WifiDefaultAckManager::TryAddMpdu (Ptr<const WifiMacQueueItem> mpdu,
|
||||
{
|
||||
NS_LOG_DEBUG ("Non-QoS data frame or Block Ack agreement not established, request Normal Ack");
|
||||
WifiNormalAck* acknowledgment = new WifiNormalAck;
|
||||
WifiMode mode = txParams.m_txVector.GetMode ();
|
||||
acknowledgment->ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (receiver, mode);
|
||||
acknowledgment->ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (receiver, txParams.m_txVector);
|
||||
if (hdr.IsQosData ())
|
||||
{
|
||||
acknowledgment->SetQosAckPolicy (receiver, hdr.GetQosTid (), WifiMacHeader::NORMAL_ACK);
|
||||
@@ -224,8 +223,7 @@ WifiDefaultAckManager::TryAddMpdu (Ptr<const WifiMacQueueItem> mpdu,
|
||||
{
|
||||
NS_LOG_DEBUG ("Sending a single MPDU, no previous frame to ack: request Normal Ack");
|
||||
WifiNormalAck* acknowledgment = new WifiNormalAck;
|
||||
WifiMode mode = txParams.m_txVector.GetMode ();
|
||||
acknowledgment->ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (receiver, mode);
|
||||
acknowledgment->ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (receiver, txParams.m_txVector);
|
||||
acknowledgment->SetQosAckPolicy (receiver, tid, WifiMacHeader::NORMAL_ACK);
|
||||
return std::unique_ptr<WifiAcknowledgment> (acknowledgment);
|
||||
}
|
||||
@@ -240,8 +238,7 @@ WifiDefaultAckManager::TryAddMpdu (Ptr<const WifiMacQueueItem> mpdu,
|
||||
NS_LOG_DEBUG ("Request to schedule a Block Ack Request");
|
||||
|
||||
WifiBarBlockAck* acknowledgment = new WifiBarBlockAck;
|
||||
WifiMode mode = txParams.m_txVector.GetMode ();
|
||||
acknowledgment->blockAckReqTxVector = m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (receiver, mode);
|
||||
acknowledgment->blockAckReqTxVector = m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (receiver, txParams.m_txVector);
|
||||
acknowledgment->blockAckTxVector = acknowledgment->blockAckReqTxVector;
|
||||
acknowledgment->barType = m_mac->GetQosTxop (tid)->GetBlockAckReqType (receiver, tid);
|
||||
acknowledgment->baType = m_mac->GetQosTxop (tid)->GetBlockAckType (receiver, tid);
|
||||
@@ -251,8 +248,7 @@ WifiDefaultAckManager::TryAddMpdu (Ptr<const WifiMacQueueItem> mpdu,
|
||||
|
||||
NS_LOG_DEBUG ("A-MPDU using Implicit Block Ack Request policy or BlockAckReq, request Block Ack");
|
||||
WifiBlockAck* acknowledgment = new WifiBlockAck;
|
||||
WifiMode mode = txParams.m_txVector.GetMode ();
|
||||
acknowledgment->blockAckTxVector = m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (receiver, mode);
|
||||
acknowledgment->blockAckTxVector = m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (receiver, txParams.m_txVector);
|
||||
acknowledgment->baType = m_mac->GetQosTxop (tid)->GetBlockAckType (receiver, tid);
|
||||
acknowledgment->SetQosAckPolicy (receiver, tid, WifiMacHeader::NORMAL_ACK);
|
||||
return std::unique_ptr<WifiAcknowledgment> (acknowledgment);
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#include "ns3/simulator.h"
|
||||
#include "wifi-remote-station-manager.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "wifi-mac.h"
|
||||
#include "ap-wifi-mac.h"
|
||||
#include "sta-wifi-mac.h"
|
||||
#include "wifi-mac-header.h"
|
||||
#include "wifi-mac-queue-item.h"
|
||||
#include "wifi-mac-trailer.h"
|
||||
@@ -472,6 +473,33 @@ WifiRemoteStationManager::RecordDisassociated (Mac48Address address)
|
||||
LookupState (address)->m_state = WifiRemoteStationState::DISASSOC;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
WifiRemoteStationManager::GetStaId (Mac48Address address, const WifiTxVector& txVector) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address << txVector);
|
||||
|
||||
uint16_t staId = SU_STA_ID;
|
||||
|
||||
if (txVector.IsMu ())
|
||||
{
|
||||
if (m_wifiMac->GetTypeOfStation () == AP)
|
||||
{
|
||||
staId = StaticCast<ApWifiMac> (m_wifiMac)->GetAssociationId (address);
|
||||
}
|
||||
else if (m_wifiMac->GetTypeOfStation () == STA)
|
||||
{
|
||||
Ptr<StaWifiMac> staMac = StaticCast<StaWifiMac> (m_wifiMac);
|
||||
if (staMac->IsAssociated ())
|
||||
{
|
||||
staId = staMac->GetAssociationId ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_LOG_DEBUG ("Returning STAID = " << staId);
|
||||
return staId;
|
||||
}
|
||||
|
||||
WifiTxVector
|
||||
WifiRemoteStationManager::GetDataTxVector (const WifiMacHeader &header)
|
||||
{
|
||||
@@ -597,10 +625,10 @@ WifiRemoteStationManager::GetCtsTxVector (Mac48Address to, WifiMode rtsTxMode) c
|
||||
}
|
||||
|
||||
WifiTxVector
|
||||
WifiRemoteStationManager::GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const
|
||||
WifiRemoteStationManager::GetAckTxVector (Mac48Address to, const WifiTxVector& dataTxVector) const
|
||||
{
|
||||
NS_ASSERT (!to.IsGroup ());
|
||||
WifiMode ackMode = GetControlAnswerMode (dataTxMode);
|
||||
WifiMode ackMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
|
||||
WifiTxVector v;
|
||||
v.SetMode (ackMode);
|
||||
v.SetPreambleType (GetPreambleForTransmission (ackMode.GetModulationClass (), GetShortPreambleEnabled ()));
|
||||
@@ -613,10 +641,10 @@ WifiRemoteStationManager::GetAckTxVector (Mac48Address to, WifiMode dataTxMode)
|
||||
}
|
||||
|
||||
WifiTxVector
|
||||
WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const
|
||||
WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address to, const WifiTxVector& dataTxVector) const
|
||||
{
|
||||
NS_ASSERT (!to.IsGroup ());
|
||||
WifiMode blockAckMode = GetControlAnswerMode (dataTxMode);
|
||||
WifiMode blockAckMode = GetControlAnswerMode (dataTxVector.GetMode (GetStaId (to, dataTxVector)));
|
||||
WifiTxVector v;
|
||||
v.SetMode (blockAckMode);
|
||||
v.SetPreambleType (GetPreambleForTransmission (blockAckMode.GetModulationClass (), GetShortPreambleEnabled ()));
|
||||
@@ -831,7 +859,8 @@ WifiRemoteStationManager::ReportDataOk (Ptr<const WifiMacQueueItem> mpdu, double
|
||||
station->m_state->m_info.NotifyTxSuccess (m_ssrc[ac]);
|
||||
m_ssrc[ac] = 0;
|
||||
}
|
||||
DoReportDataOk (station, ackSnr, ackMode, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss ());
|
||||
DoReportDataOk (station, ackSnr, ackMode, dataSnr, dataTxVector.GetChannelWidth (),
|
||||
dataTxVector.GetNss (GetStaId (hdr.GetAddr1 (), dataTxVector)));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -869,15 +898,15 @@ WifiRemoteStationManager::ReportFinalDataFailed (Ptr<const WifiMacQueueItem> mpd
|
||||
}
|
||||
|
||||
void
|
||||
WifiRemoteStationManager::ReportRxOk (Mac48Address address, RxSignalInfo rxSignalInfo, WifiMode txMode)
|
||||
WifiRemoteStationManager::ReportRxOk (Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address << rxSignalInfo << txMode);
|
||||
NS_LOG_FUNCTION (this << address << rxSignalInfo << txVector);
|
||||
if (address.IsGroup ())
|
||||
{
|
||||
return;
|
||||
}
|
||||
WifiRemoteStation *station = Lookup (address);
|
||||
DoReportRxOk (station, rxSignalInfo.snr, txMode);
|
||||
DoReportRxOk (station, rxSignalInfo.snr, txVector.GetMode (GetStaId (address, txVector)));
|
||||
station->m_rssiAndUpdateTimePair = std::make_pair (rxSignalInfo.rssi, Simulator::Now ());
|
||||
}
|
||||
|
||||
@@ -892,7 +921,7 @@ WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address,
|
||||
{
|
||||
m_macTxDataFailed (address);
|
||||
}
|
||||
DoReportAmpduTxStatus (Lookup (address), nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss ());
|
||||
DoReportAmpduTxStatus (Lookup (address), nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr, dataTxVector.GetChannelWidth (), dataTxVector.GetNss (GetStaId (address, dataTxVector)));
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -648,19 +648,19 @@ public:
|
||||
* used by the sender.
|
||||
*
|
||||
* \param to the MAC address of the Ack receiver
|
||||
* \param dataTxMode the mode of the Data used by the sender
|
||||
* \param dataTxVector the TXVECTOR of the Data used by the sender
|
||||
* \return TXVECTOR for the Ack
|
||||
*/
|
||||
WifiTxVector GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
|
||||
WifiTxVector GetAckTxVector (Mac48Address to, const WifiTxVector& dataTxVector) const;
|
||||
/**
|
||||
* Return a TXVECTOR for the BlockAck frame given the destination and the mode of the Data
|
||||
* used by the sender.
|
||||
*
|
||||
* \param to the MAC address of the BlockAck receiver
|
||||
* \param dataTxMode the mode of the Data used by the sender
|
||||
* \param dataTxVector the TXVECTOR of the Data used by the sender
|
||||
* \return TXVECTOR for the BlockAck
|
||||
*/
|
||||
WifiTxVector GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
|
||||
WifiTxVector GetBlockAckTxVector (Mac48Address to, const WifiTxVector& dataTxVector) const;
|
||||
/**
|
||||
* Get control answer mode function.
|
||||
*
|
||||
@@ -739,11 +739,11 @@ public:
|
||||
/**
|
||||
* \param address remote address
|
||||
* \param rxSignalInfo the info on the received signal (\see RxSignalInfo)
|
||||
* \param txMode the transmission mode used for the packet received
|
||||
* \param txVector the TXVECTOR used for the packet received
|
||||
*
|
||||
* Should be invoked whenever a packet is successfully received.
|
||||
*/
|
||||
void ReportRxOk (Mac48Address address, RxSignalInfo rxSignalInfo, WifiMode txMode);
|
||||
void ReportRxOk (Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector);
|
||||
|
||||
/**
|
||||
* \param header MAC header
|
||||
@@ -1026,6 +1026,13 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* If the given TXVECTOR is used for a MU transmission, return the STAID of
|
||||
* the station with the given address if we are an AP or our own STAID if we
|
||||
* are a STA associated with some AP. Otherwise, return SU_STA_ID.
|
||||
*/
|
||||
uint16_t GetStaId (Mac48Address address, const WifiTxVector& txVector) const;
|
||||
|
||||
/**
|
||||
* \param station the station that we need to communicate
|
||||
* \param size the size of the frame to send in bytes
|
||||
|
||||
Reference in New Issue
Block a user