|
|
| 363 |
m_sendCtsEvent (), |
363 |
m_sendCtsEvent (), |
| 364 |
m_sendAckEvent (), |
364 |
m_sendAckEvent (), |
| 365 |
m_sendDataEvent (), |
365 |
m_sendDataEvent (), |
| 366 |
m_waitSifsEvent (), |
366 |
m_waitIfsEvent (), |
| 367 |
m_endTxNoAckEvent (), |
367 |
m_endTxNoAckEvent (), |
| 368 |
m_currentPacket (0), |
368 |
m_currentPacket (0), |
| 369 |
m_listener (0), |
369 |
m_listener (0), |
|
|
| 428 |
m_sendCtsEvent.Cancel (); |
428 |
m_sendCtsEvent.Cancel (); |
| 429 |
m_sendAckEvent.Cancel (); |
429 |
m_sendAckEvent.Cancel (); |
| 430 |
m_sendDataEvent.Cancel (); |
430 |
m_sendDataEvent.Cancel (); |
| 431 |
m_waitSifsEvent.Cancel (); |
431 |
m_waitIfsEvent.Cancel (); |
| 432 |
m_endTxNoAckEvent.Cancel (); |
432 |
m_endTxNoAckEvent.Cancel (); |
| 433 |
m_waitRifsEvent.Cancel (); |
|
|
| 434 |
m_phy = 0; |
433 |
m_phy = 0; |
| 435 |
m_stationManager = 0; |
434 |
m_stationManager = 0; |
| 436 |
if (m_phyMacLowListener != 0) |
435 |
if (m_phyMacLowListener != 0) |
|
|
| 493 |
m_sendDataEvent.Cancel (); |
492 |
m_sendDataEvent.Cancel (); |
| 494 |
oneRunning = true; |
493 |
oneRunning = true; |
| 495 |
} |
494 |
} |
| 496 |
if (m_waitSifsEvent.IsRunning ()) |
495 |
if (m_waitIfsEvent.IsRunning ()) |
| 497 |
{ |
496 |
{ |
| 498 |
m_waitSifsEvent.Cancel (); |
497 |
m_waitIfsEvent.Cancel (); |
| 499 |
oneRunning = true; |
|
|
| 500 |
} |
| 501 |
if (m_waitRifsEvent.IsRunning ()) |
| 502 |
{ |
| 503 |
m_waitRifsEvent.Cancel (); |
| 504 |
oneRunning = true; |
498 |
oneRunning = true; |
| 505 |
} |
499 |
} |
| 506 |
if (m_endTxNoAckEvent.IsRunning ()) |
500 |
if (m_endTxNoAckEvent.IsRunning ()) |
|
|
| 1000 |
} |
994 |
} |
| 1001 |
if (m_txParams.HasNextPacket ()) |
995 |
if (m_txParams.HasNextPacket ()) |
| 1002 |
{ |
996 |
{ |
| 1003 |
m_waitSifsEvent = Simulator::Schedule (GetSifs (), |
997 |
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
| 1004 |
&MacLow::WaitSifsAfterEndTxFragment, this); |
998 |
{ |
|
|
999 |
m_waitIfsEvent = Simulator::Schedule (GetRifs (), |
| 1000 |
&MacLow::WaitIfsAfterEndTxFragment, this); |
| 1001 |
} |
| 1002 |
else |
| 1003 |
{ |
| 1004 |
m_waitIfsEvent = Simulator::Schedule (GetSifs (), |
| 1005 |
&MacLow::WaitIfsAfterEndTxFragment, this); |
| 1006 |
} |
| 1005 |
} |
1007 |
} |
| 1006 |
else if (m_currentHdr.IsQosData () && !m_ampdu) |
1008 |
else if (m_currentHdr.IsQosData () && !m_ampdu) |
| 1007 |
{ |
1009 |
{ |
| 1008 |
m_waitSifsEvent = Simulator::Schedule (GetSifs (), |
1010 |
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
| 1009 |
&MacLow::WaitSifsAfterEndTx, this); |
1011 |
{ |
|
|
1012 |
m_waitIfsEvent = Simulator::Schedule (GetRifs (), |
| 1013 |
&MacLow::WaitIfsAfterEndTx, this); |
| 1014 |
} |
| 1015 |
else |
| 1016 |
{ |
| 1017 |
m_waitIfsEvent = Simulator::Schedule (GetSifs (), |
| 1018 |
&MacLow::WaitIfsAfterEndTx, this); |
| 1019 |
} |
| 1010 |
} |
1020 |
} |
| 1011 |
|
1021 |
|
| 1012 |
FlushAggregateQueue (); |
1022 |
FlushAggregateQueue (); |
|
|
| 1050 |
if ((*it).second.first.IsImmediateBlockAck ()) |
1060 |
if ((*it).second.first.IsImmediateBlockAck ()) |
| 1051 |
{ |
1061 |
{ |
| 1052 |
NS_LOG_DEBUG ("rx blockAckRequest/sendImmediateBlockAck from=" << hdr.GetAddr2 ()); |
1062 |
NS_LOG_DEBUG ("rx blockAckRequest/sendImmediateBlockAck from=" << hdr.GetAddr2 ()); |
| 1053 |
m_sendAckEvent = Simulator::Schedule (GetSifs (), |
1063 |
Time delay; |
|
|
1064 |
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
| 1065 |
{ |
| 1066 |
delay = GetRifs (); |
| 1067 |
} |
| 1068 |
else |
| 1069 |
{ |
| 1070 |
delay = GetSifs (); |
| 1071 |
} |
| 1072 |
m_sendAckEvent = Simulator::Schedule (delay, |
| 1054 |
&MacLow::SendBlockAckAfterBlockAckRequest, this, |
1073 |
&MacLow::SendBlockAckAfterBlockAckRequest, this, |
| 1055 |
blockAckReq, |
1074 |
blockAckReq, |
| 1056 |
hdr.GetAddr2 (), |
1075 |
hdr.GetAddr2 (), |
|
|
| 1965 |
} |
1984 |
} |
| 1966 |
else if (m_txParams.HasNextPacket ()) |
1985 |
else if (m_txParams.HasNextPacket ()) |
| 1967 |
{ |
1986 |
{ |
| 1968 |
if (m_stationManager->HasHtSupported ()) |
1987 |
if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
1988 |
|
| 1969 |
{ |
1989 |
{ |
| 1970 |
Time delay = txDuration + GetRifs (); |
1990 |
Time delay = txDuration + GetRifs (); |
| 1971 |
NS_ASSERT (m_waitRifsEvent.IsExpired ()); |
1991 |
NS_ASSERT (m_waitIfsEvent.IsExpired ()); |
| 1972 |
m_waitRifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTxFragment, this); |
1992 |
m_waitIfsEvent = Simulator::Schedule (delay, &MacLow::WaitIfsAfterEndTxFragment, this); |
| 1973 |
} |
1993 |
} |
| 1974 |
else |
1994 |
else |
| 1975 |
{ |
1995 |
{ |
| 1976 |
Time delay = txDuration + GetSifs (); |
1996 |
Time delay = txDuration + GetSifs (); |
| 1977 |
NS_ASSERT (m_waitSifsEvent.IsExpired ()); |
1997 |
NS_ASSERT (m_waitIfsEvent.IsExpired ()); |
| 1978 |
m_waitSifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTxFragment, this); |
1998 |
m_waitIfsEvent = Simulator::Schedule (delay, &MacLow::WaitIfsAfterEndTxFragment, this); |
| 1979 |
} |
1999 |
} |
| 1980 |
} |
2000 |
} |
| 1981 |
else |
2001 |
else |
|
|
| 2264 |
Time newDuration = Seconds (0); |
2284 |
Time newDuration = Seconds (0); |
| 2265 |
if (m_txParams.MustWaitBasicBlockAck ()) |
2285 |
if (m_txParams.MustWaitBasicBlockAck ()) |
| 2266 |
{ |
2286 |
{ |
| 2267 |
newDuration += GetSifs (); |
2287 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
2288 |
{ |
| 2289 |
newDuration += GetRifs (); |
| 2290 |
} |
| 2291 |
else |
| 2292 |
{ |
| 2293 |
newDuration += GetSifs (); |
| 2294 |
} |
| 2268 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); |
2295 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); |
| 2269 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
2296 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); |
| 2270 |
} |
2297 |
} |
| 2271 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
2298 |
else if (m_txParams.MustWaitCompressedBlockAck ()) |
| 2272 |
{ |
2299 |
{ |
| 2273 |
newDuration += GetSifs (); |
2300 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
2301 |
{ |
| 2302 |
newDuration += GetRifs (); |
| 2303 |
} |
| 2304 |
else |
| 2305 |
{ |
| 2306 |
newDuration += GetSifs (); |
| 2307 |
} |
| 2274 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); |
2308 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); |
| 2275 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
2309 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 2276 |
} |
2310 |
} |
| 2277 |
else if (m_txParams.MustWaitAck ()) |
2311 |
else if (m_txParams.MustWaitAck ()) |
| 2278 |
{ |
2312 |
{ |
| 2279 |
newDuration += GetSifs (); |
2313 |
if (m_txParams.HasNextPacket () && m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
2314 |
{ |
| 2315 |
newDuration += GetRifs (); |
| 2316 |
} |
| 2317 |
else |
| 2318 |
{ |
| 2319 |
newDuration += GetSifs (); |
| 2320 |
} |
| 2280 |
newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); |
2321 |
newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); |
| 2281 |
} |
2322 |
} |
| 2282 |
if (m_txParams.HasNextPacket ()) |
2323 |
if (m_txParams.HasNextPacket ()) |
| 2283 |
{ |
2324 |
{ |
| 2284 |
newDuration += GetSifs (); |
2325 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
2326 |
{ |
| 2327 |
newDuration += GetRifs (); |
| 2328 |
} |
| 2329 |
else |
| 2330 |
{ |
| 2331 |
newDuration += GetSifs (); |
| 2332 |
} |
| 2285 |
newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, preamble, m_phy->GetFrequency ()); |
2333 |
newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, preamble, m_phy->GetFrequency ()); |
| 2286 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
2334 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
| 2287 |
{ |
2335 |
{ |
| 2288 |
newDuration += GetSifs (); |
2336 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
2337 |
{ |
| 2338 |
newDuration += GetRifs (); |
| 2339 |
} |
| 2340 |
else |
| 2341 |
{ |
| 2342 |
newDuration += GetSifs (); |
| 2343 |
} |
| 2289 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); |
2344 |
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); |
| 2290 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
2345 |
newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); |
| 2291 |
} |
2346 |
} |
| 2292 |
else if (m_txParams.MustWaitAck ()) |
2347 |
else if (m_txParams.MustWaitAck ()) |
| 2293 |
{ |
2348 |
{ |
| 2294 |
newDuration += GetSifs (); |
2349 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
2350 |
{ |
| 2351 |
newDuration += GetRifs (); |
| 2352 |
} |
| 2353 |
else |
| 2354 |
{ |
| 2355 |
newDuration += GetSifs (); |
| 2356 |
} |
| 2295 |
newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); |
2357 |
newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); |
| 2296 |
} |
2358 |
} |
| 2297 |
} |
2359 |
} |
|
|
| 2316 |
} |
2378 |
} |
| 2317 |
|
2379 |
|
| 2318 |
void |
2380 |
void |
| 2319 |
MacLow::WaitSifsAfterEndTxFragment (void) |
2381 |
MacLow::WaitIfsAfterEndTxFragment (void) |
| 2320 |
{ |
2382 |
{ |
| 2321 |
m_listener->StartNextFragment (); |
2383 |
m_listener->StartNextFragment (); |
| 2322 |
} |
2384 |
} |
| 2323 |
|
2385 |
|
| 2324 |
void |
2386 |
void |
| 2325 |
MacLow::WaitSifsAfterEndTx (void) |
2387 |
MacLow::WaitIfsAfterEndTx (void) |
| 2326 |
{ |
2388 |
{ |
| 2327 |
m_listener->StartNext (); |
2389 |
m_listener->StartNext (); |
| 2328 |
} |
2390 |
} |
|
|
| 2641 |
if (immediate) |
2703 |
if (immediate) |
| 2642 |
{ |
2704 |
{ |
| 2643 |
m_txParams.DisableAck (); |
2705 |
m_txParams.DisableAck (); |
| 2644 |
duration -= GetSifs (); |
2706 |
if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
|
|
2707 |
{ |
| 2708 |
duration -= GetRifs (); |
| 2709 |
} |
| 2710 |
else |
| 2711 |
{ |
| 2712 |
duration -= GetSifs (); |
| 2713 |
} |
| 2645 |
if (blockAck->IsBasic ()) |
2714 |
if (blockAck->IsBasic ()) |
| 2646 |
{ |
2715 |
{ |
| 2647 |
duration -= GetBlockAckDuration (originator, blockAckReqTxVector, BASIC_BLOCK_ACK); |
2716 |
duration -= GetBlockAckDuration (originator, blockAckReqTxVector, BASIC_BLOCK_ACK); |
|
|
| 2832 |
} |
2901 |
} |
| 2833 |
else if (preamble != WIFI_PREAMBLE_NONE || !m_sendAckEvent.IsRunning ()) |
2902 |
else if (preamble != WIFI_PREAMBLE_NONE || !m_sendAckEvent.IsRunning ()) |
| 2834 |
{ |
2903 |
{ |
| 2835 |
m_sendAckEvent = Simulator::Schedule (ampdu.GetRemainingAmpduDuration () + GetSifs (), |
2904 |
Time delay = ampdu.GetRemainingAmpduDuration (); |
|
|
2905 |
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_stationManager->GetRifsPermitted ()) |
| 2906 |
{ |
| 2907 |
delay += GetRifs (); |
| 2908 |
} |
| 2909 |
else |
| 2910 |
{ |
| 2911 |
delay += GetSifs (); |
| 2912 |
} |
| 2913 |
m_sendAckEvent = Simulator::Schedule (delay, |
| 2836 |
&MacLow::SendBlockAckAfterAmpdu, this, |
2914 |
&MacLow::SendBlockAckAfterAmpdu, this, |
| 2837 |
firsthdr.GetQosTid (), |
2915 |
firsthdr.GetQosTid (), |
| 2838 |
firsthdr.GetAddr2 (), |
2916 |
firsthdr.GetAddr2 (), |