|
|
| 2811 |
NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ()); |
2811 |
NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ()); |
| 2812 |
NotifyNav ((*n).first, firsthdr, preamble); |
2812 |
NotifyNav ((*n).first, firsthdr, preamble); |
| 2813 |
|
2813 |
|
| 2814 |
bool vhtSingleMpdu = (*n).second.GetEof (); |
|
|
| 2815 |
if (vhtSingleMpdu) |
| 2816 |
{ |
| 2817 |
//If the MPDU is sent as a VHT single MPDU (EOF=1 in A-MPDU subframe header), then the responder sends an ACK. |
| 2818 |
NS_LOG_DEBUG ("Receive VHT single MPDU"); |
| 2819 |
ampduSubframe = false; |
| 2820 |
} |
| 2821 |
else if (preamble != WIFI_PREAMBLE_NONE || !m_sendAckEvent.IsRunning ()) |
| 2822 |
{ |
| 2823 |
m_sendAckEvent = Simulator::Schedule (ampdu.GetRemainingAmpduDuration () + GetSifs (), |
| 2824 |
&MacLow::SendBlockAckAfterAmpdu, this, |
| 2825 |
firsthdr.GetQosTid (), |
| 2826 |
firsthdr.GetAddr2 (), |
| 2827 |
firsthdr.GetDuration (), |
| 2828 |
txVector, |
| 2829 |
rxSnr); |
| 2830 |
} |
| 2831 |
|
| 2832 |
if (firsthdr.GetAddr1 () == m_self) |
2814 |
if (firsthdr.GetAddr1 () == m_self) |
| 2833 |
{ |
2815 |
{ |
|
|
2816 |
bool vhtSingleMpdu = (*n).second.GetEof (); |
| 2817 |
if (vhtSingleMpdu) |
| 2818 |
{ |
| 2819 |
//If the MPDU is sent as a VHT single MPDU (EOF=1 in A-MPDU subframe header), then the responder sends an ACK. |
| 2820 |
NS_LOG_DEBUG ("Receive VHT single MPDU"); |
| 2821 |
ampduSubframe = false; |
| 2822 |
} |
| 2823 |
else if (preamble != WIFI_PREAMBLE_NONE || !m_sendAckEvent.IsRunning ()) |
| 2824 |
{ |
| 2825 |
m_sendAckEvent = Simulator::Schedule (ampdu.GetRemainingAmpduDuration () + GetSifs (), |
| 2826 |
&MacLow::SendBlockAckAfterAmpdu, this, |
| 2827 |
firsthdr.GetQosTid (), |
| 2828 |
firsthdr.GetAddr2 (), |
| 2829 |
firsthdr.GetDuration (), |
| 2830 |
txVector, |
| 2831 |
rxSnr); |
| 2832 |
} |
| 2833 |
|
| 2834 |
if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) |
2834 |
if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) |
| 2835 |
{ |
2835 |
{ |
| 2836 |
ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); |
2836 |
ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); |
|
|
| 2849 |
{ |
2849 |
{ |
| 2850 |
NS_FATAL_ERROR ("Received A-MPDU with invalid first MPDU type"); |
2850 |
NS_FATAL_ERROR ("Received A-MPDU with invalid first MPDU type"); |
| 2851 |
} |
2851 |
} |
| 2852 |
} |
|
|
| 2853 |
|
2852 |
|
| 2854 |
if (ampdu.GetRemainingNbOfMpdus () == 0 && !vhtSingleMpdu) |
2853 |
if (ampdu.GetRemainingNbOfMpdus () == 0 && !vhtSingleMpdu) |
| 2855 |
{ |
|
|
| 2856 |
if (normalAck) |
| 2857 |
{ |
2854 |
{ |
| 2858 |
//send block Ack |
2855 |
if (normalAck) |
| 2859 |
if (firsthdr.IsBlockAckReq ()) |
|
|
| 2860 |
{ |
2856 |
{ |
| 2861 |
NS_FATAL_ERROR ("Sending a BlockAckReq with QosPolicy equal to Normal Ack"); |
2857 |
//send block Ack |
| 2862 |
} |
2858 |
if (firsthdr.IsBlockAckReq ()) |
| 2863 |
uint8_t tid = firsthdr.GetQosTid (); |
2859 |
{ |
| 2864 |
AgreementsI it = m_bAckAgreements.find (std::make_pair (firsthdr.GetAddr2 (), tid)); |
2860 |
NS_FATAL_ERROR ("Sending a BlockAckReq with QosPolicy equal to Normal Ack"); |
| 2865 |
if (it != m_bAckAgreements.end ()) |
2861 |
} |
| 2866 |
{ |
2862 |
uint8_t tid = firsthdr.GetQosTid (); |
| 2867 |
/* See section 11.5.3 in IEEE 802.11 for mean of this timer */ |
2863 |
AgreementsI it = m_bAckAgreements.find (std::make_pair (firsthdr.GetAddr2 (), tid)); |
| 2868 |
ResetBlockAckInactivityTimerIfNeeded (it->second.first); |
2864 |
if (it != m_bAckAgreements.end ()) |
| 2869 |
NS_LOG_DEBUG ("rx A-MPDU/sendImmediateBlockAck from=" << firsthdr.GetAddr2 ()); |
2865 |
{ |
| 2870 |
NS_ASSERT (m_sendAckEvent.IsRunning ()); |
2866 |
/* See section 11.5.3 in IEEE 802.11 for mean of this timer */ |
| 2871 |
} |
2867 |
ResetBlockAckInactivityTimerIfNeeded (it->second.first); |
| 2872 |
else |
2868 |
NS_LOG_DEBUG ("rx A-MPDU/sendImmediateBlockAck from=" << firsthdr.GetAddr2 ()); |
| 2873 |
{ |
2869 |
NS_ASSERT (m_sendAckEvent.IsRunning ()); |
| 2874 |
NS_LOG_DEBUG ("There's not a valid agreement for this block ack request."); |
2870 |
} |
|
|
2871 |
else |
| 2872 |
{ |
| 2873 |
NS_LOG_DEBUG ("There's not a valid agreement for this block ack request."); |
| 2874 |
} |
| 2875 |
} |
2875 |
} |
| 2876 |
} |
2876 |
} |
| 2877 |
} |
2877 |
} |