wifi: merge CalculateOverallTxTime and CalculateOverallTxFragmentTime in MacLow
This commit is contained in:
@@ -1002,7 +1002,7 @@ EdcaTxopN::GetTxopFragmentSize () const
|
||||
while (!found)
|
||||
{
|
||||
size = (minSize + ((maxSize - minSize) / 2));
|
||||
if (GetLow ()->CalculateOverallTxFragmentTime (m_currentPacket, &m_currentHdr, m_currentParams, size) > txopDuration)
|
||||
if (GetLow ()->CalculateOverallTxTime (m_currentPacket, &m_currentHdr, m_currentParams, size) > txopDuration)
|
||||
{
|
||||
maxSize = size;
|
||||
}
|
||||
@@ -1010,8 +1010,8 @@ EdcaTxopN::GetTxopFragmentSize () const
|
||||
{
|
||||
minSize = size;
|
||||
}
|
||||
if (GetLow ()->CalculateOverallTxFragmentTime (m_currentPacket, &m_currentHdr, m_currentParams, size) <= txopDuration
|
||||
&& GetLow ()->CalculateOverallTxFragmentTime (m_currentPacket, &m_currentHdr, m_currentParams, size + 1) > txopDuration)
|
||||
if (GetLow ()->CalculateOverallTxTime (m_currentPacket, &m_currentHdr, m_currentParams, size) <= txopDuration
|
||||
&& GetLow ()->CalculateOverallTxTime (m_currentPacket, &m_currentHdr, m_currentParams, size + 1) > txopDuration)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
|
||||
@@ -1251,7 +1251,8 @@ MacLow::GetAckTxVectorForData (Mac48Address to, WifiMode dataTxMode) const
|
||||
Time
|
||||
MacLow::CalculateOverallTxTime (Ptr<const Packet> packet,
|
||||
const WifiMacHeader* hdr,
|
||||
const MacLowTransmissionParameters& params) const
|
||||
const MacLowTransmissionParameters& params,
|
||||
uint32_t fragmentSize) const
|
||||
{
|
||||
Time txTime = Seconds (0);
|
||||
if (params.MustSendRts ())
|
||||
@@ -1262,33 +1263,16 @@ MacLow::CalculateOverallTxTime (Ptr<const Packet> packet,
|
||||
txTime += Time (GetSifs () * 2);
|
||||
}
|
||||
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
|
||||
uint32_t dataSize = GetSize (packet, hdr, m_ampdu);
|
||||
txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, m_phy->GetFrequency ());
|
||||
txTime += GetSifs ();
|
||||
if (params.MustWaitAck ())
|
||||
uint32_t dataSize;
|
||||
if (fragmentSize > 0)
|
||||
{
|
||||
txTime += GetAckDuration (hdr->GetAddr1 (), dataTxVector);
|
||||
Ptr<const Packet> fragment = Create<Packet> (fragmentSize);
|
||||
dataSize = GetSize (fragment, hdr, m_ampdu);
|
||||
}
|
||||
return txTime;
|
||||
}
|
||||
|
||||
Time
|
||||
MacLow::CalculateOverallTxFragmentTime (Ptr<const Packet> packet,
|
||||
const WifiMacHeader* hdr,
|
||||
const MacLowTransmissionParameters& params,
|
||||
uint32_t fragmentSize) const
|
||||
{
|
||||
Time txTime = Seconds (0);
|
||||
if (params.MustSendRts ())
|
||||
else
|
||||
{
|
||||
WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr);
|
||||
txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_phy->GetFrequency ());
|
||||
txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector);
|
||||
txTime += Time (GetSifs () * 2);
|
||||
dataSize = GetSize (packet, hdr, m_ampdu);
|
||||
}
|
||||
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
|
||||
Ptr<const Packet> fragment = Create<Packet> (fragmentSize);
|
||||
uint32_t dataSize = GetSize (fragment, hdr, m_ampdu);
|
||||
txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, m_phy->GetFrequency ());
|
||||
txTime += GetSifs ();
|
||||
if (params.MustWaitAck ())
|
||||
|
||||
@@ -455,6 +455,7 @@ public:
|
||||
* \param packet to send (does not include the 802.11 MAC header and checksum)
|
||||
* \param hdr header associated to the packet to send.
|
||||
* \param params transmission parameters of packet.
|
||||
* \param fragmentSize the packet fragment size (if fragmentation is used)
|
||||
* \return the transmission time that includes the time for the next packet transmission
|
||||
*
|
||||
* This transmission time includes the time required for
|
||||
@@ -462,22 +463,8 @@ public:
|
||||
*/
|
||||
Time CalculateOverallTxTime (Ptr<const Packet> packet,
|
||||
const WifiMacHeader* hdr,
|
||||
const MacLowTransmissionParameters ¶ms) const;
|
||||
|
||||
/**
|
||||
* \param packet to send (does not include the 802.11 MAC header and checksum)
|
||||
* \param hdr header associated to the packet to send.
|
||||
* \param params transmission parameters of packet.
|
||||
* \param fragmentSize the packet fragment size
|
||||
* \return the transmission time that includes the time for the next packet transmission
|
||||
*
|
||||
* This transmission time includes the time required for
|
||||
* the next packet fragment transmission if one was selected.
|
||||
*/
|
||||
Time CalculateOverallTxFragmentTime (Ptr<const Packet> packet,
|
||||
const WifiMacHeader* hdr,
|
||||
const MacLowTransmissionParameters& params,
|
||||
uint32_t fragmentSize) const;
|
||||
const MacLowTransmissionParameters& params,
|
||||
uint32_t fragmentSize = 0) const;
|
||||
|
||||
/**
|
||||
* \param packet packet to send
|
||||
|
||||
Reference in New Issue
Block a user