|
|
| 503 |
void |
503 |
void |
| 504 |
MacLow::ResetPhy (void) |
504 |
MacLow::ResetPhy (void) |
| 505 |
{ |
505 |
{ |
| 506 |
m_phy->SetReceiveOkCallback (MakeNullCallback<void,Ptr<Packet>, double, WifiMode, enum WifiPreamble> ()); |
506 |
m_phy->SetReceiveOkCallback (MakeNullCallback<void,Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> ()); |
| 507 |
m_phy->SetReceiveErrorCallback (MakeNullCallback<void,Ptr<const Packet>, double> ()); |
507 |
m_phy->SetReceiveErrorCallback (MakeNullCallback<void,Ptr<const Packet>, double> ()); |
| 508 |
RemovePhyMacLowListener (m_phy); |
508 |
RemovePhyMacLowListener (m_phy); |
| 509 |
m_phy = 0; |
509 |
m_phy = 0; |
|
|
| 759 |
hdr.GetQosTid(), |
759 |
hdr.GetQosTid(), |
| 760 |
hdr.GetAddr2 (), |
760 |
hdr.GetAddr2 (), |
| 761 |
hdr.GetDuration (), |
761 |
hdr.GetDuration (), |
| 762 |
m_currentMode); |
762 |
m_currentTxVector); |
| 763 |
} |
763 |
} |
| 764 |
else if (hdr.IsBlockAckReq()) |
764 |
else if (hdr.IsBlockAckReq()) |
| 765 |
{ |
765 |
{ |
|
|
| 808 |
} |
808 |
} |
| 809 |
|
809 |
|
| 810 |
void |
810 |
void |
| 811 |
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble, bool ampduSubframe) |
811 |
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe) |
| 812 |
{ |
812 |
{ |
| 813 |
NS_LOG_FUNCTION (this << packet << rxSnr << txMode << preamble); |
813 |
NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode () << preamble); |
| 814 |
/* A packet is received from the PHY. |
814 |
/* A packet is received from the PHY. |
| 815 |
* When we have handled this packet, |
815 |
* When we have handled this packet, |
| 816 |
* we handle any packet present in the |
816 |
* we handle any packet present in the |
|
|
| 821 |
|
821 |
|
| 822 |
bool isPrevNavZero = IsNavZero (); |
822 |
bool isPrevNavZero = IsNavZero (); |
| 823 |
NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ()); |
823 |
NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ()); |
| 824 |
NotifyNav (packet,hdr, txMode, preamble); |
824 |
NotifyNav (packet, hdr, preamble); |
| 825 |
if (hdr.IsRts ()) |
825 |
if (hdr.IsRts ()) |
| 826 |
{ |
826 |
{ |
| 827 |
/* see section 9.2.5.7 802.11-1999 |
827 |
/* see section 9.2.5.7 802.11-1999 |
|
|
| 842 |
NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", schedule CTS"); |
842 |
NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", schedule CTS"); |
| 843 |
NS_ASSERT (m_sendCtsEvent.IsExpired ()); |
843 |
NS_ASSERT (m_sendCtsEvent.IsExpired ()); |
| 844 |
m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr, |
844 |
m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr, |
| 845 |
rxSnr, txMode); |
845 |
rxSnr, txVector.GetMode ()); |
| 846 |
m_sendCtsEvent = Simulator::Schedule (GetSifs (), |
846 |
m_sendCtsEvent = Simulator::Schedule (GetSifs (), |
| 847 |
&MacLow::SendCtsAfterRts, this, |
847 |
&MacLow::SendCtsAfterRts, this, |
| 848 |
hdr.GetAddr2 (), |
848 |
hdr.GetAddr2 (), |
| 849 |
hdr.GetDuration (), |
849 |
hdr.GetDuration (), |
| 850 |
txMode, |
850 |
txVector, |
| 851 |
rxSnr); |
851 |
rxSnr); |
| 852 |
} |
852 |
} |
| 853 |
else |
853 |
else |
|
|
| 869 |
SnrTag tag; |
869 |
SnrTag tag; |
| 870 |
packet->RemovePacketTag (tag); |
870 |
packet->RemovePacketTag (tag); |
| 871 |
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
871 |
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
| 872 |
rxSnr, txMode); |
872 |
rxSnr, txVector.GetMode ()); |
| 873 |
m_stationManager->ReportRtsOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
873 |
m_stationManager->ReportRtsOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
| 874 |
rxSnr, txMode, tag.Get ()); |
874 |
rxSnr, txVector.GetMode (), tag.Get ()); |
| 875 |
|
875 |
|
| 876 |
m_ctsTimeoutEvent.Cancel (); |
876 |
m_ctsTimeoutEvent.Cancel (); |
| 877 |
NotifyCtsTimeoutResetNow (); |
877 |
NotifyCtsTimeoutResetNow (); |
| 878 |
m_listener->GotCts (rxSnr, txMode); |
878 |
m_listener->GotCts (rxSnr, txVector.GetMode ()); |
| 879 |
NS_ASSERT (m_sendDataEvent.IsExpired ()); |
879 |
NS_ASSERT (m_sendDataEvent.IsExpired ()); |
| 880 |
m_sendDataEvent = Simulator::Schedule (GetSifs (), |
880 |
m_sendDataEvent = Simulator::Schedule (GetSifs (), |
| 881 |
&MacLow::SendDataAfterCts, this, |
881 |
&MacLow::SendDataAfterCts, this, |
| 882 |
hdr.GetAddr1 (), |
882 |
hdr.GetAddr1 (), |
| 883 |
hdr.GetDuration (), |
883 |
hdr.GetDuration ()); |
| 884 |
txMode); |
|
|
| 885 |
} |
884 |
} |
| 886 |
else if (hdr.IsAck () |
885 |
else if (hdr.IsAck () |
| 887 |
&& hdr.GetAddr1 () == m_self |
886 |
&& hdr.GetAddr1 () == m_self |
|
|
| 894 |
SnrTag tag; |
893 |
SnrTag tag; |
| 895 |
packet->RemovePacketTag (tag); |
894 |
packet->RemovePacketTag (tag); |
| 896 |
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
895 |
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
| 897 |
rxSnr, txMode); |
896 |
rxSnr, txVector.GetMode ()); |
| 898 |
m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
897 |
m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
| 899 |
rxSnr, txMode, tag.Get ()); |
898 |
rxSnr, txVector.GetMode (), tag.Get ()); |
| 900 |
|
899 |
|
| 901 |
bool gotAck = false; |
900 |
bool gotAck = false; |
| 902 |
if (m_txParams.MustWaitNormalAck () |
901 |
if (m_txParams.MustWaitNormalAck () |
|
|
| 915 |
} |
914 |
} |
| 916 |
if (gotAck) |
915 |
if (gotAck) |
| 917 |
{ |
916 |
{ |
| 918 |
m_listener->GotAck (rxSnr, txMode); |
917 |
m_listener->GotAck (rxSnr, txVector.GetMode ()); |
| 919 |
} |
918 |
} |
| 920 |
if (m_txParams.HasNextPacket ()) |
919 |
if (m_txParams.HasNextPacket ()) |
| 921 |
{ |
920 |
{ |
|
|
| 932 |
packet->RemoveHeader (blockAck); |
931 |
packet->RemoveHeader (blockAck); |
| 933 |
m_blockAckTimeoutEvent.Cancel (); |
932 |
m_blockAckTimeoutEvent.Cancel (); |
| 934 |
NotifyAckTimeoutResetNow (); |
933 |
NotifyAckTimeoutResetNow (); |
| 935 |
m_listener->GotBlockAck (&blockAck, hdr.GetAddr2 (),txMode); |
934 |
m_listener->GotBlockAck (&blockAck, hdr.GetAddr2 (),txVector.GetMode ()); |
| 936 |
m_sentMpdus = 0; |
935 |
m_sentMpdus = 0; |
| 937 |
m_ampdu = false; |
936 |
m_ampdu = false; |
| 938 |
} |
937 |
} |
|
|
| 962 |
blockAckReq, |
961 |
blockAckReq, |
| 963 |
hdr.GetAddr2 (), |
962 |
hdr.GetAddr2 (), |
| 964 |
hdr.GetDuration (), |
963 |
hdr.GetDuration (), |
| 965 |
txMode); |
964 |
txVector.GetMode ()); |
| 966 |
} |
965 |
} |
| 967 |
else |
966 |
else |
| 968 |
{ |
967 |
{ |
|
|
| 988 |
else if (hdr.GetAddr1 () == m_self) |
987 |
else if (hdr.GetAddr1 () == m_self) |
| 989 |
{ |
988 |
{ |
| 990 |
m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr, |
989 |
m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr, |
| 991 |
rxSnr, txMode); |
990 |
rxSnr, txVector.GetMode ()); |
| 992 |
if (hdr.IsQosData () && ReceiveMpdu (packet, hdr)) |
991 |
if (hdr.IsQosData () && ReceiveMpdu (packet, hdr)) |
| 993 |
{ |
992 |
{ |
| 994 |
/* From section 9.10.4 in IEEE 802.11: |
993 |
/* From section 9.10.4 in IEEE 802.11: |
|
|
| 1009 |
&MacLow::SendAckAfterData, this, |
1008 |
&MacLow::SendAckAfterData, this, |
| 1010 |
hdr.GetAddr2 (), |
1009 |
hdr.GetAddr2 (), |
| 1011 |
hdr.GetDuration (), |
1010 |
hdr.GetDuration (), |
| 1012 |
txMode, |
1011 |
txVector.GetMode (), |
| 1013 |
rxSnr); |
1012 |
rxSnr); |
| 1014 |
m_receivedAtLeastOneMpdu = false; |
1013 |
m_receivedAtLeastOneMpdu = false; |
| 1015 |
} |
1014 |
} |
|
|
| 1060 |
&MacLow::SendAckAfterData, this, |
1059 |
&MacLow::SendAckAfterData, this, |
| 1061 |
hdr.GetAddr2 (), |
1060 |
hdr.GetAddr2 (), |
| 1062 |
hdr.GetDuration (), |
1061 |
hdr.GetDuration (), |
| 1063 |
txMode, |
1062 |
txVector.GetMode (), |
| 1064 |
rxSnr); |
1063 |
rxSnr); |
| 1065 |
} |
1064 |
} |
| 1066 |
} |
1065 |
} |
|
|
| 1165 |
Time |
1164 |
Time |
| 1166 |
MacLow::GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const |
1165 |
MacLow::GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const |
| 1167 |
{ |
1166 |
{ |
| 1168 |
WifiTxVector ackTxVector = GetAckTxVectorForData (to, dataTxVector.GetMode()); |
1167 |
WifiTxVector ackTxVector = GetAckTxVectorForData (to, dataTxVector.GetMode ()); |
| 1169 |
return GetAckDuration (ackTxVector); |
1168 |
return GetAckDuration (ackTxVector); |
| 1170 |
} |
1169 |
} |
| 1171 |
Time |
1170 |
Time |
| 1172 |
MacLow::GetAckDuration (WifiTxVector ackTxVector) const |
1171 |
MacLow::GetAckDuration (WifiTxVector ackTxVector) const |
| 1173 |
{ |
1172 |
{ |
| 1174 |
WifiPreamble preamble; |
1173 |
NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); // ACK should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1175 |
if (ackTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1174 |
return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency(), 0, 0); |
| 1176 |
preamble= WIFI_PREAMBLE_HT_MF; |
|
|
| 1177 |
else |
| 1178 |
preamble=WIFI_PREAMBLE_LONG; |
| 1179 |
return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, preamble, m_phy->GetFrequency(), 0, 0); |
| 1180 |
} |
1175 |
} |
| 1181 |
Time |
1176 |
Time |
| 1182 |
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const |
1177 |
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const |
| 1183 |
{ |
1178 |
{ |
| 1184 |
/* |
1179 |
/* |
| 1185 |
* For immediate BlockAck we should transmit the frame with the same WifiMode |
1180 |
* For immediate Basic BlockAck we should transmit the frame with the same WifiMode |
| 1186 |
* as the BlockAckReq. |
1181 |
* as the BlockAckReq. |
| 1187 |
* |
|
|
| 1188 |
* from section 9.6 in IEEE 802.11e: |
| 1189 |
* The BlockAck control frame shall be sent at the same rate and modulation class as |
| 1190 |
* the BlockAckReq frame if it is sent in response to a BlockAckReq frame. |
| 1191 |
*/ |
1182 |
*/ |
| 1192 |
WifiPreamble preamble; |
1183 |
WifiPreamble preamble; |
| 1193 |
if (blockAckReqTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1184 |
if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && type == BASIC_BLOCK_ACK) |
| 1194 |
preamble= WIFI_PREAMBLE_HT_MF; |
1185 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 1195 |
else |
1186 |
else |
| 1196 |
preamble=WIFI_PREAMBLE_LONG; |
1187 |
preamble=WIFI_PREAMBLE_LONG; |
|
|
| 1199 |
Time |
1190 |
Time |
| 1200 |
MacLow::GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const |
1191 |
MacLow::GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const |
| 1201 |
{ |
1192 |
{ |
| 1202 |
WifiTxVector ctsTxVector = GetCtsTxVectorForRts (to, rtsTxVector.GetMode()); |
1193 |
WifiTxVector ctsTxVector = GetCtsTxVectorForRts (to, rtsTxVector.GetMode ()); |
| 1203 |
return GetCtsDuration (ctsTxVector); |
1194 |
return GetCtsDuration (ctsTxVector); |
| 1204 |
} |
1195 |
} |
| 1205 |
|
1196 |
|
| 1206 |
Time |
1197 |
Time |
| 1207 |
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const |
1198 |
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const |
| 1208 |
{ |
1199 |
{ |
| 1209 |
WifiPreamble preamble; |
1200 |
NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); // CTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1210 |
if (ctsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1201 |
return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency(), 0, 0); |
| 1211 |
preamble= WIFI_PREAMBLE_HT_MF; |
|
|
| 1212 |
else |
| 1213 |
preamble=WIFI_PREAMBLE_LONG; |
| 1214 |
return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency(), 0, 0); |
| 1215 |
} |
1202 |
} |
| 1216 |
uint32_t |
1203 |
uint32_t |
| 1217 |
MacLow::GetCtsSize (void) const |
1204 |
MacLow::GetCtsSize (void) const |
|
|
| 1296 |
{ |
1283 |
{ |
| 1297 |
preamble = WIFI_PREAMBLE_HT_GF; |
1284 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 1298 |
} |
1285 |
} |
| 1299 |
else if (rtsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
|
|
| 1300 |
{ |
| 1301 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 1302 |
} |
| 1303 |
else |
1286 |
else |
| 1304 |
{ |
1287 |
{ |
|
|
1288 |
//Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1305 |
preamble = WIFI_PREAMBLE_LONG; |
1289 |
preamble = WIFI_PREAMBLE_LONG; |
| 1306 |
} |
1290 |
} |
| 1307 |
txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency(), 0, 0); |
1291 |
txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency(), 0, 0); |
|
|
| 1309 |
txTime += Time (GetSifs () * 2); |
1293 |
txTime += Time (GetSifs () * 2); |
| 1310 |
} |
1294 |
} |
| 1311 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
1295 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
| 1312 |
//standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 |
|
|
| 1313 |
if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
1296 |
if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1314 |
preamble= WIFI_PREAMBLE_HT_GF; |
1297 |
preamble= WIFI_PREAMBLE_HT_GF; |
| 1315 |
else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1298 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1316 |
preamble= WIFI_PREAMBLE_HT_MF; |
1299 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 1317 |
else |
1300 |
else |
| 1318 |
preamble=WIFI_PREAMBLE_LONG; |
1301 |
preamble=WIFI_PREAMBLE_LONG; |
|
|
| 1336 |
{ |
1319 |
{ |
| 1337 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
1320 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
| 1338 |
WifiPreamble preamble; |
1321 |
WifiPreamble preamble; |
| 1339 |
//standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 |
1322 |
//standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 |
| 1340 |
if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
1323 |
if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1341 |
preamble= WIFI_PREAMBLE_HT_GF; |
1324 |
preamble= WIFI_PREAMBLE_HT_GF; |
| 1342 |
else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1325 |
else //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1343 |
preamble= WIFI_PREAMBLE_HT_MF; |
1326 |
preamble = WIFI_PREAMBLE_LONG; |
| 1344 |
else |
|
|
| 1345 |
preamble=WIFI_PREAMBLE_LONG; |
| 1346 |
txTime += GetSifs (); |
1327 |
txTime += GetSifs (); |
| 1347 |
txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency(), 0, 0); |
1328 |
txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency(), 0, 0); |
| 1348 |
} |
1329 |
} |
|
|
| 1350 |
} |
1331 |
} |
| 1351 |
|
1332 |
|
| 1352 |
void |
1333 |
void |
| 1353 |
MacLow::NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble) |
1334 |
MacLow::NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiPreamble preamble) |
| 1354 |
{ |
1335 |
{ |
| 1355 |
NS_ASSERT (m_lastNavStart <= Simulator::Now ()); |
1336 |
NS_ASSERT (m_lastNavStart <= Simulator::Now ()); |
| 1356 |
Time duration = hdr.GetDuration (); |
1337 |
Time duration = hdr.GetDuration (); |
|
|
| 1468 |
NS_LOG_DEBUG ("send " << hdr->GetTypeString () << |
1449 |
NS_LOG_DEBUG ("send " << hdr->GetTypeString () << |
| 1469 |
", to=" << hdr->GetAddr1 () << |
1450 |
", to=" << hdr->GetAddr1 () << |
| 1470 |
", size=" << packet->GetSize () << |
1451 |
", size=" << packet->GetSize () << |
| 1471 |
", mode=" << txVector.GetMode() << |
1452 |
", mode=" << txVector.GetMode () << |
| 1472 |
", duration=" << hdr->GetDuration () << |
1453 |
", duration=" << hdr->GetDuration () << |
| 1473 |
", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); |
1454 |
", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); |
| 1474 |
if (!m_ampdu || hdr->IsRts ()) |
1455 |
if (!m_ampdu || hdr->IsRts ()) |
|
|
| 1629 |
|
1610 |
|
| 1630 |
WifiPreamble preamble; |
1611 |
WifiPreamble preamble; |
| 1631 |
//standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 |
1612 |
//standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 |
| 1632 |
if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
1613 |
if (m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1633 |
preamble= WIFI_PREAMBLE_HT_GF; |
1614 |
preamble= WIFI_PREAMBLE_HT_GF; |
| 1634 |
else if (rtsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1615 |
else //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1635 |
preamble= WIFI_PREAMBLE_HT_MF; |
1616 |
preamble = WIFI_PREAMBLE_LONG; |
| 1636 |
else |
|
|
| 1637 |
preamble=WIFI_PREAMBLE_LONG; |
| 1638 |
|
1617 |
|
| 1639 |
if (m_txParams.HasDurationId ()) |
1618 |
if (m_txParams.HasDurationId ()) |
| 1640 |
{ |
1619 |
{ |
|
|
| 1651 |
duration += GetSifs (); |
1630 |
duration += GetSifs (); |
| 1652 |
if (m_txParams.MustWaitBasicBlockAck ()) |
1631 |
if (m_txParams.MustWaitBasicBlockAck ()) |
| 1653 |
{ |
1632 |
{ |
| 1654 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode()); |
1633 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode ()); |
| 1655 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
1634 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
| 1656 |
} |
1635 |
} |
| 1657 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
1636 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
| 1658 |
{ |
1637 |
{ |
| 1659 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode()); |
1638 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode ()); |
| 1660 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
1639 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 1661 |
} |
1640 |
} |
| 1662 |
else if (m_txParams.MustWaitAck ()) |
1641 |
else if (m_txParams.MustWaitAck ()) |
|
|
| 1699 |
//Since it is data then it can have format = GF |
1678 |
//Since it is data then it can have format = GF |
| 1700 |
if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
1679 |
if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1701 |
preamble= WIFI_PREAMBLE_HT_GF; |
1680 |
preamble= WIFI_PREAMBLE_HT_GF; |
| 1702 |
else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1681 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1703 |
preamble= WIFI_PREAMBLE_HT_MF; |
1682 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 1704 |
else |
1683 |
else |
| 1705 |
preamble=WIFI_PREAMBLE_LONG; |
1684 |
preamble=WIFI_PREAMBLE_LONG; |
|
|
| 1774 |
if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
1753 |
if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1775 |
//In the future has to make sure that receiver has greenfield enabled |
1754 |
//In the future has to make sure that receiver has greenfield enabled |
| 1776 |
preamble= WIFI_PREAMBLE_HT_GF; |
1755 |
preamble= WIFI_PREAMBLE_HT_GF; |
| 1777 |
else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1756 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1778 |
preamble= WIFI_PREAMBLE_HT_MF; |
1757 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 1779 |
else |
1758 |
else |
| 1780 |
preamble=WIFI_PREAMBLE_LONG; |
1759 |
preamble=WIFI_PREAMBLE_LONG; |
|
|
| 1791 |
if (m_txParams.MustWaitBasicBlockAck ()) |
1770 |
if (m_txParams.MustWaitBasicBlockAck ()) |
| 1792 |
{ |
1771 |
{ |
| 1793 |
duration += GetSifs (); |
1772 |
duration += GetSifs (); |
| 1794 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1773 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 1795 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
1774 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
| 1796 |
} |
1775 |
} |
| 1797 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
1776 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
| 1798 |
{ |
1777 |
{ |
| 1799 |
duration += GetSifs (); |
1778 |
duration += GetSifs (); |
| 1800 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1779 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 1801 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
1780 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 1802 |
} |
1781 |
} |
| 1803 |
else if (m_txParams.MustWaitAck ()) |
1782 |
else if (m_txParams.MustWaitAck ()) |
|
|
| 1826 |
m_currentPacket->AddTrailer (fcs); |
1805 |
m_currentPacket->AddTrailer (fcs); |
| 1827 |
} |
1806 |
} |
| 1828 |
|
1807 |
|
| 1829 |
ForwardDown (m_currentPacket, &m_currentHdr, dataTxVector,preamble); |
1808 |
ForwardDown (m_currentPacket, &m_currentHdr, dataTxVector, preamble); |
| 1830 |
m_currentPacket = 0; |
1809 |
m_currentPacket = 0; |
| 1831 |
} |
1810 |
} |
| 1832 |
|
1811 |
|
|
|
| 1856 |
WifiTxVector ctsTxVector = GetCtsToSelfTxVector (m_currentPacket, &m_currentHdr); |
1835 |
WifiTxVector ctsTxVector = GetCtsToSelfTxVector (m_currentPacket, &m_currentHdr); |
| 1857 |
|
1836 |
|
| 1858 |
WifiPreamble preamble; |
1837 |
WifiPreamble preamble; |
| 1859 |
if (ctsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1838 |
if (ctsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1860 |
preamble= WIFI_PREAMBLE_HT_MF; |
1839 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 1861 |
else |
1840 |
else |
| 1862 |
preamble=WIFI_PREAMBLE_LONG; |
1841 |
preamble=WIFI_PREAMBLE_LONG; |
|
|
| 1877 |
{ |
1856 |
{ |
| 1878 |
|
1857 |
|
| 1879 |
duration += GetSifs (); |
1858 |
duration += GetSifs (); |
| 1880 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1859 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 1881 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
1860 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
| 1882 |
} |
1861 |
} |
| 1883 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
1862 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
| 1884 |
{ |
1863 |
{ |
| 1885 |
duration += GetSifs (); |
1864 |
duration += GetSifs (); |
| 1886 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1865 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 1887 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
1866 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 1888 |
} |
1867 |
} |
| 1889 |
else if (m_txParams.MustWaitAck ()) |
1868 |
else if (m_txParams.MustWaitAck ()) |
|
|
| 1899 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
1878 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
| 1900 |
{ |
1879 |
{ |
| 1901 |
duration += GetSifs (); |
1880 |
duration += GetSifs (); |
| 1902 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1881 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 1903 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
1882 |
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 1904 |
} |
1883 |
} |
| 1905 |
else if (m_txParams.MustWaitAck ()) |
1884 |
else if (m_txParams.MustWaitAck ()) |
|
|
| 1926 |
m_sendDataEvent = Simulator::Schedule (txDuration, |
1905 |
m_sendDataEvent = Simulator::Schedule (txDuration, |
| 1927 |
&MacLow::SendDataAfterCts, this, |
1906 |
&MacLow::SendDataAfterCts, this, |
| 1928 |
cts.GetAddr1 (), |
1907 |
cts.GetAddr1 (), |
| 1929 |
duration, |
1908 |
duration); |
| 1930 |
ctsTxVector.GetMode()); |
|
|
| 1931 |
} |
1909 |
} |
| 1932 |
void |
1910 |
void |
| 1933 |
MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiMode rtsTxMode, double rtsSnr) |
1911 |
MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiTxVector rtsTxVector, double rtsSnr) |
| 1934 |
{ |
1912 |
{ |
| 1935 |
NS_LOG_FUNCTION (this << source << duration << rtsTxMode << rtsSnr); |
1913 |
NS_LOG_FUNCTION (this << source << duration << rtsTxVector.GetMode () << rtsSnr); |
| 1936 |
/* send a CTS when you receive a RTS |
1914 |
/* send a CTS when you receive a RTS |
| 1937 |
* right after SIFS. |
1915 |
* right after SIFS. |
| 1938 |
*/ |
1916 |
*/ |
| 1939 |
WifiTxVector ctsTxVector = GetCtsTxVector (source, rtsTxMode); |
1917 |
WifiTxVector ctsTxVector = GetCtsTxVector (source, rtsTxVector.GetMode ()); |
| 1940 |
WifiMacHeader cts; |
1918 |
WifiMacHeader cts; |
| 1941 |
cts.SetType (WIFI_MAC_CTL_CTS); |
1919 |
cts.SetType (WIFI_MAC_CTL_CTS); |
| 1942 |
cts.SetDsNotFrom (); |
1920 |
cts.SetDsNotFrom (); |
|
|
| 1944 |
cts.SetNoMoreFragments (); |
1922 |
cts.SetNoMoreFragments (); |
| 1945 |
cts.SetNoRetry (); |
1923 |
cts.SetNoRetry (); |
| 1946 |
cts.SetAddr1 (source); |
1924 |
cts.SetAddr1 (source); |
| 1947 |
duration -= GetCtsDuration (source, ctsTxVector); |
1925 |
duration -= GetCtsDuration (source, rtsTxVector); |
| 1948 |
duration -= GetSifs (); |
1926 |
duration -= GetSifs (); |
| 1949 |
NS_ASSERT (duration >= MicroSeconds (0)); |
1927 |
NS_ASSERT (duration >= MicroSeconds (0)); |
| 1950 |
cts.SetDuration (duration); |
1928 |
cts.SetDuration (duration); |
|
|
| 1958 |
tag.Set (rtsSnr); |
1936 |
tag.Set (rtsSnr); |
| 1959 |
packet->AddPacketTag (tag); |
1937 |
packet->AddPacketTag (tag); |
| 1960 |
|
1938 |
|
| 1961 |
WifiPreamble preamble; |
1939 |
//CTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1962 |
if (ctsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1940 |
ForwardDown (packet, &cts, ctsTxVector, WIFI_PREAMBLE_LONG); |
| 1963 |
preamble= WIFI_PREAMBLE_HT_MF; |
|
|
| 1964 |
else |
| 1965 |
preamble=WIFI_PREAMBLE_LONG; |
| 1966 |
ForwardDown (packet, &cts, ctsTxVector,preamble); |
| 1967 |
} |
1941 |
} |
| 1968 |
|
1942 |
|
| 1969 |
void |
1943 |
void |
| 1970 |
MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode) |
1944 |
MacLow::SendDataAfterCts (Mac48Address source, Time duration) |
| 1971 |
{ |
1945 |
{ |
| 1972 |
NS_LOG_FUNCTION (this); |
1946 |
NS_LOG_FUNCTION (this); |
| 1973 |
/* send the third step in a |
1947 |
/* send the third step in a |
|
|
| 1980 |
if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
1954 |
if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1981 |
//In the future has to make sure that receiver has greenfield enabled |
1955 |
//In the future has to make sure that receiver has greenfield enabled |
| 1982 |
preamble= WIFI_PREAMBLE_HT_GF; |
1956 |
preamble= WIFI_PREAMBLE_HT_GF; |
| 1983 |
else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
1957 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1984 |
preamble= WIFI_PREAMBLE_HT_MF; |
1958 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 1985 |
else |
1959 |
else |
| 1986 |
preamble=WIFI_PREAMBLE_LONG; |
1960 |
preamble=WIFI_PREAMBLE_LONG; |
|
|
| 1990 |
if (m_txParams.MustWaitBasicBlockAck ()) |
1964 |
if (m_txParams.MustWaitBasicBlockAck ()) |
| 1991 |
{ |
1965 |
{ |
| 1992 |
newDuration += GetSifs (); |
1966 |
newDuration += GetSifs (); |
| 1993 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1967 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 1994 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
1968 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
| 1995 |
} |
1969 |
} |
| 1996 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
1970 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
| 1997 |
{ |
1971 |
{ |
| 1998 |
newDuration += GetSifs (); |
1972 |
newDuration += GetSifs (); |
| 1999 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1973 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 2000 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
1974 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 2001 |
} |
1975 |
} |
| 2002 |
else if (m_txParams.MustWaitAck ()) |
1976 |
else if (m_txParams.MustWaitAck ()) |
|
|
| 2011 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
1985 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
| 2012 |
{ |
1986 |
{ |
| 2013 |
newDuration += GetSifs (); |
1987 |
newDuration += GetSifs (); |
| 2014 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode()); |
1988 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ()); |
| 2015 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
1989 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 2016 |
} |
1990 |
} |
| 2017 |
else if (m_txParams.MustWaitAck ()) |
1991 |
else if (m_txParams.MustWaitAck ()) |
|
|
| 2093 |
tag.Set (dataSnr); |
2067 |
tag.Set (dataSnr); |
| 2094 |
packet->AddPacketTag (tag); |
2068 |
packet->AddPacketTag (tag); |
| 2095 |
|
2069 |
|
| 2096 |
//since ACK is a control response it can't have format GF |
2070 |
//ACK should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 2097 |
WifiPreamble preamble; |
2071 |
ForwardDown (packet, &ack, ackTxVector, WIFI_PREAMBLE_LONG); |
| 2098 |
if (ackTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
|
|
| 2099 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 2100 |
else |
| 2101 |
preamble=WIFI_PREAMBLE_LONG; |
| 2102 |
ForwardDown (packet, &ack, ackTxVector, preamble); |
| 2103 |
} |
2072 |
} |
| 2104 |
|
2073 |
|
| 2105 |
bool |
2074 |
bool |
|
|
| 2389 |
WifiMacTrailer fcs; |
2358 |
WifiMacTrailer fcs; |
| 2390 |
packet->AddTrailer (fcs); |
2359 |
packet->AddTrailer (fcs); |
| 2391 |
WifiPreamble preamble; |
2360 |
WifiPreamble preamble; |
| 2392 |
if (blockAckReqTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) |
2361 |
if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 2393 |
preamble= WIFI_PREAMBLE_HT_MF; |
2362 |
preamble= WIFI_PREAMBLE_HT_MF; |
| 2394 |
else |
2363 |
else |
| 2395 |
preamble=WIFI_PREAMBLE_LONG; |
2364 |
preamble=WIFI_PREAMBLE_LONG; |
|
|
| 2397 |
m_currentPacket = 0; |
2366 |
m_currentPacket = 0; |
| 2398 |
} |
2367 |
} |
| 2399 |
void |
2368 |
void |
| 2400 |
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode) |
2369 |
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector) |
| 2401 |
{ |
2370 |
{ |
| 2402 |
NS_LOG_FUNCTION (this); |
2371 |
NS_LOG_FUNCTION (this); |
| 2403 |
CtrlBAckResponseHeader blockAck; |
2372 |
CtrlBAckResponseHeader blockAck; |
|
|
| 2415 |
NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber); |
2384 |
NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber); |
| 2416 |
(*i).second.FillBlockAckBitmap (&blockAck); |
2385 |
(*i).second.FillBlockAckBitmap (&blockAck); |
| 2417 |
|
2386 |
|
| 2418 |
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxMode); |
2387 |
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode ()); |
| 2419 |
} |
2388 |
} |
| 2420 |
|
2389 |
|
| 2421 |
void |
2390 |
void |
|
|
| 2514 |
} |
2483 |
} |
| 2515 |
|
2484 |
|
| 2516 |
void |
2485 |
void |
| 2517 |
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiMode txMode, WifiPreamble preamble) |
2486 |
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble) |
| 2518 |
{ |
2487 |
{ |
| 2519 |
m_currentMode = txMode; |
2488 |
m_currentTxVector = txVector; |
| 2520 |
AmpduTag ampdu; |
2489 |
AmpduTag ampdu; |
| 2521 |
bool normalAck = false; |
2490 |
bool normalAck = false; |
| 2522 |
bool ampduSubframe = false; |
2491 |
bool ampduSubframe = false; |
|
|
| 2529 |
WifiMacHeader firsthdr; |
2498 |
WifiMacHeader firsthdr; |
| 2530 |
(*n).first->PeekHeader(firsthdr); |
2499 |
(*n).first->PeekHeader(firsthdr); |
| 2531 |
NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ()); |
2500 |
NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ()); |
| 2532 |
NotifyNav ((*n).first,firsthdr, txMode, preamble); |
2501 |
NotifyNav ((*n).first,firsthdr, preamble); |
| 2533 |
if (firsthdr.GetAddr1 () == m_self) |
2502 |
if (firsthdr.GetAddr1 () == m_self) |
| 2534 |
{ |
2503 |
{ |
| 2535 |
m_receivedAtLeastOneMpdu = true; |
2504 |
m_receivedAtLeastOneMpdu = true; |
| 2536 |
if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) |
2505 |
if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) |
| 2537 |
ReceiveOk ((*n).first, rxSnr, txMode, preamble, ampduSubframe); |
2506 |
ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); |
| 2538 |
else if (firsthdr.IsData () || firsthdr.IsQosData ()) |
2507 |
else if (firsthdr.IsData () || firsthdr.IsQosData ()) |
| 2539 |
{ |
2508 |
{ |
| 2540 |
NS_LOG_DEBUG ("Deaagregate packet with sequence=" << firsthdr.GetSequenceNumber ()); |
2509 |
NS_LOG_DEBUG ("Deaagregate packet with sequence=" << firsthdr.GetSequenceNumber ()); |
| 2541 |
ReceiveOk ((*n).first, rxSnr, txMode, preamble, ampduSubframe); |
2510 |
ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); |
| 2542 |
if (firsthdr.IsQosAck ()) |
2511 |
if (firsthdr.IsQosAck ()) |
| 2543 |
{ |
2512 |
{ |
| 2544 |
NS_LOG_DEBUG ("Normal Ack"); |
2513 |
NS_LOG_DEBUG ("Normal Ack"); |
|
|
| 2569 |
firsthdr.GetQosTid(), |
2538 |
firsthdr.GetQosTid(), |
| 2570 |
firsthdr.GetAddr2 (), |
2539 |
firsthdr.GetAddr2 (), |
| 2571 |
firsthdr.GetDuration (), |
2540 |
firsthdr.GetDuration (), |
| 2572 |
txMode); |
2541 |
txVector); |
| 2573 |
} |
2542 |
} |
| 2574 |
else |
2543 |
else |
| 2575 |
{ |
2544 |
{ |
|
|
| 2580 |
} |
2549 |
} |
| 2581 |
else |
2550 |
else |
| 2582 |
{ |
2551 |
{ |
| 2583 |
ReceiveOk (aggregatedPacket,rxSnr, txMode, preamble, ampduSubframe); |
2552 |
ReceiveOk (aggregatedPacket,rxSnr, txVector, preamble, ampduSubframe); |
| 2584 |
} |
2553 |
} |
| 2585 |
} |
2554 |
} |
| 2586 |
|
2555 |
|
|
|
| 2591 |
WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); |
2560 |
WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); |
| 2592 |
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
2561 |
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 2593 |
preamble = WIFI_PREAMBLE_HT_GF; |
2562 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 2594 |
else |
2563 |
else //Block ACK following implicit BAR always use non-HT PPDU |
| 2595 |
preamble = WIFI_PREAMBLE_HT_MF; |
2564 |
preamble = WIFI_PREAMBLE_LONG; |
| 2596 |
|
2565 |
|
| 2597 |
if (peekedPacket == 0) |
2566 |
if (peekedPacket == 0) |
| 2598 |
return true; |
2567 |
return true; |
| 2599 |
|
2568 |
|
| 2600 |
//An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds) |
2569 |
//An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds) |
| 2601 |
if(m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () +WIFI_MAC_FCS_LENGTH,dataTxVector, preamble, m_phy->GetFrequency(), 0, 0) > MilliSeconds(10)) |
2570 |
if(m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, dataTxVector, preamble, m_phy->GetFrequency(), 0, 0) > MilliSeconds(10)) |
| 2602 |
return true; |
2571 |
return true; |
| 2603 |
|
2572 |
|
| 2604 |
if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size)) |
2573 |
if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size)) |