View | Details | Raw Unified | Return to bug 2271
Collapse All | Expand All

(-)a/src/wifi/model/dca-txop.cc (-26 lines)
 Lines 323-336    Link Here 
323
  return m_low;
323
  return m_low;
324
}
324
}
325
325
326
bool
327
DcaTxop::NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header)
328
{
329
  NS_LOG_FUNCTION (this << packet << header);
330
  return m_stationManager->NeedRts (header->GetAddr1 (), header,
331
                                    packet);
332
}
333
334
void
326
void
335
DcaTxop::DoInitialize ()
327
DcaTxop::DoInitialize ()
336
{
328
{
 Lines 475-488    Link Here 
475
        {
467
        {
476
          WifiMacHeader hdr;
468
          WifiMacHeader hdr;
477
          Ptr<Packet> fragment = GetFragmentPacket (&hdr);
469
          Ptr<Packet> fragment = GetFragmentPacket (&hdr);
478
          if (NeedRts (fragment, &hdr))
479
            {
480
              params.EnableRts ();
481
            }
482
          else
483
            {
484
              params.DisableRts ();
485
            }
486
          if (IsLastFragment ())
470
          if (IsLastFragment ())
487
            {
471
            {
488
              NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
472
              NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
 Lines 498-513    Link Here 
498
        }
482
        }
499
      else
483
      else
500
        {
484
        {
501
          if (NeedRts (m_currentPacket, &m_currentHdr))
502
            {
503
              params.EnableRts ();
504
              NS_LOG_DEBUG ("tx unicast rts");
505
            }
506
          else
507
            {
508
              params.DisableRts ();
509
              NS_LOG_DEBUG ("tx unicast");
510
            }
511
          params.DisableNextData ();
485
          params.DisableNextData ();
512
          Low ()->StartTransmission (m_currentPacket, &m_currentHdr,
486
          Low ()->StartTransmission (m_currentPacket, &m_currentHdr,
513
                                     params, m_transmissionListener);
487
                                     params, m_transmissionListener);
(-)a/src/wifi/model/dca-txop.h (-10 lines)
 Lines 256-271    Link Here 
256
  void StartAccessIfNeeded (void);
256
  void StartAccessIfNeeded (void);
257
257
258
  /**
258
  /**
259
   * Check if the current packet should be sent with a RTS protection.
260
   *
261
   * \param packet
262
   * \param header
263
   *
264
   * \return true if RTS protection should be used,
265
   *         false otherwise
266
   */
267
  bool NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header);
268
  /**
269
   * Check if RTS should be re-transmitted if CTS was missed.
259
   * Check if RTS should be re-transmitted if CTS was missed.
270
   *
260
   *
271
   * \return true if RTS should be re-transmitted,
261
   * \return true if RTS should be re-transmitted,
(-)a/src/wifi/model/edca-txop-n.cc (-25 / +4 lines)
 Lines 548-560    Link Here 
548
        {
548
        {
549
          params.EnableAck ();
549
          params.EnableAck ();
550
        }
550
        }
551
      if (NeedFragmentation () && ((m_currentHdr.IsQosData ()
551
      if (((m_currentHdr.IsQosData () && !m_currentHdr.IsQosAmsdu ())
552
                                    && !m_currentHdr.IsQosAmsdu ())
552
           ||(m_currentHdr.IsData () && !m_currentHdr.IsQosData () && m_currentHdr.IsQosAmsdu ()))
553
                                   ||
553
          && (m_blockAckThreshold == 0 || m_blockAckType == BASIC_BLOCK_ACK)
554
                                   (m_currentHdr.IsData ()
554
          && NeedFragmentation ())
555
                                    && !m_currentHdr.IsQosData () && m_currentHdr.IsQosAmsdu ()))
556
          && (m_blockAckThreshold == 0
557
              || m_blockAckType == BASIC_BLOCK_ACK))
558
        {
555
        {
559
          //With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
556
          //With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
560
          params.DisableRts ();
557
          params.DisableRts ();
 Lines 619-634    Link Here 
619
                  NS_LOG_DEBUG ("tx unicast A-MSDU");
616
                  NS_LOG_DEBUG ("tx unicast A-MSDU");
620
                }
617
                }
621
            }
618
            }
622
          if (NeedRts ())
623
            {
624
              params.EnableRts ();
625
              NS_LOG_DEBUG ("tx unicast rts");
626
            }
627
          else
628
            {
629
              params.DisableRts ();
630
              NS_LOG_DEBUG ("tx unicast");
631
            }
632
          params.DisableNextData ();
619
          params.DisableNextData ();
633
          m_low->StartTransmission (m_currentPacket, &m_currentHdr,
620
          m_low->StartTransmission (m_currentPacket, &m_currentHdr,
634
                                    params, m_transmissionListener);
621
                                    params, m_transmissionListener);
 Lines 985-998    Link Here 
985
}
972
}
986
973
987
bool
974
bool
988
EdcaTxopN::NeedRts (void)
989
{
990
  NS_LOG_FUNCTION (this);
991
  return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr,
992
                                    m_currentPacket);
993
}
994
995
bool
996
EdcaTxopN::NeedRtsRetransmission (void)
975
EdcaTxopN::NeedRtsRetransmission (void)
997
{
976
{
998
  NS_LOG_FUNCTION (this);
977
  NS_LOG_FUNCTION (this);
(-)a/src/wifi/model/edca-txop-n.h (-7 lines)
 Lines 288-300    Link Here 
288
   */
288
   */
289
  void StartAccessIfNeeded (void);
289
  void StartAccessIfNeeded (void);
290
  /**
290
  /**
291
   * Check if the current packet should be sent with a RTS protection.
292
   *
293
   * \return true if RTS protection should be used,
294
   *         false otherwise
295
   */
296
  bool NeedRts (void);
297
  /**
298
   * Check if RTS should be re-transmitted if CTS was missed.
291
   * Check if RTS should be re-transmitted if CTS was missed.
299
   *
292
   *
300
   * \return true if RTS should be re-transmitted,
293
   * \return true if RTS should be re-transmitted,
(-)a/src/wifi/model/mac-low.cc (-1 / +18 lines)
 Lines 786-791    Link Here 
786
            }
786
            }
787
        }
787
        }
788
    }
788
    }
789
    
790
  if (NeedRts ())
791
    {
792
      m_txParams.EnableRts ();
793
    }
794
  else
795
    {
796
      m_txParams.DisableRts ();
797
    }
789
798
790
  NS_LOG_DEBUG ("startTx size=" << GetSize (m_currentPacket, &m_currentHdr) <<
799
  NS_LOG_DEBUG ("startTx size=" << GetSize (m_currentPacket, &m_currentHdr) <<
791
                ", to=" << m_currentHdr.GetAddr1 () << ", listener=" << m_listener);
800
                ", to=" << m_currentHdr.GetAddr1 () << ", listener=" << m_listener);
 Lines 796-802    Link Here 
796
    }
805
    }
797
  else
806
  else
798
    {
807
    {
799
      if (NeedCtsToSelf () && m_ctsToSelfSupported)
808
      if (m_ctsToSelfSupported && NeedCtsToSelf ())
800
        {
809
        {
801
          SendCtsToSelf ();
810
          SendCtsToSelf ();
802
        }
811
        }
 Lines 811-816    Link Here 
811
}
820
}
812
821
813
bool
822
bool
823
MacLow::NeedRts (void)
824
{
825
  return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (),
826
                                    &m_currentHdr,
827
                                    m_currentPacket);
828
}
829
830
bool
814
MacLow::NeedCtsToSelf (void)
831
MacLow::NeedCtsToSelf (void)
815
{
832
{
816
  WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
833
  WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
(-)a/src/wifi/model/mac-low.h (+7 lines)
 Lines 1014-1019    Link Here 
1014
   */
1014
   */
1015
  Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const;
1015
  Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const;
1016
  /**
1016
  /**
1017
   * Check if the current packet should be sent with a RTS protection.
1018
   *
1019
   * \return true if RTS protection should be used,
1020
   *         false otherwise
1021
   */
1022
  bool NeedRts (void);
1023
  /**
1017
   * Check if CTS-to-self mechanism should be used for the current packet.
1024
   * Check if CTS-to-self mechanism should be used for the current packet.
1018
   *
1025
   *
1019
   * \return true if CTS-to-self mechanism should be used for the current packet,
1026
   * \return true if CTS-to-self mechanism should be used for the current packet,
(-)a/src/wifi/model/wifi-remote-station-manager.cc (-19 / +23 lines)
 Lines 282-327    Link Here 
282
  static TypeId tid = TypeId ("ns3::WifiRemoteStationManager")
282
  static TypeId tid = TypeId ("ns3::WifiRemoteStationManager")
283
    .SetParent<Object> ()
283
    .SetParent<Object> ()
284
    .SetGroupName ("Wifi")
284
    .SetGroupName ("Wifi")
285
    .AddAttribute ("IsLowLatency", "If true, we attempt to modelize a so-called low-latency device: a device"
285
    .AddAttribute ("IsLowLatency",
286
                   " where decisions about tx parameters can be made on a per-packet basis and feedback about the"
286
                   "If true, we attempt to modelize a so-called low-latency device: "
287
                   " transmission of each packet is obtained before sending the next. Otherwise, we modelize a "
287
                   "a device where decisions about tx parameters can be made on a per-packet basis and "
288
                   " high-latency device, that is a device where we cannot update our decision about tx parameters"
288
                   "feedback about the transmission of each packet is obtained before sending the next. "
289
                   " after every packet transmission.",
289
                   "Otherwise, we modelize a high-latency device, that is a device where we cannot update "
290
                   "our decision about tx parameters after every packet transmission.",
290
                   TypeId::ATTR_GET,
291
                   TypeId::ATTR_GET,
291
                   BooleanValue (true), //this value is ignored because there is no setter
292
                   BooleanValue (true), //this value is ignored because there is no setter
292
                   MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency),
293
                   MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency),
293
                   MakeBooleanChecker ())
294
                   MakeBooleanChecker ())
294
    .AddAttribute ("MaxSsrc", "The maximum number of retransmission attempts for an RTS. This value"
295
    .AddAttribute ("MaxSsrc",
295
                   " will not have any effect on some rate control algorithms.",
296
                   "The maximum number of retransmission attempts for an RTS. "
297
                   " This value will not have any effect on some rate control algorithms.",
296
                   UintegerValue (7),
298
                   UintegerValue (7),
297
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc),
299
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc),
298
                   MakeUintegerChecker<uint32_t> ())
300
                   MakeUintegerChecker<uint32_t> ())
299
    .AddAttribute ("MaxSlrc", "The maximum number of retransmission attempts for a DATA packet. This value"
301
    .AddAttribute ("MaxSlrc",
300
                   " will not have any effect on some rate control algorithms.",
302
                   "The maximum number of retransmission attempts for a DATA packet. "
303
                   "This value will not have any effect on some rate control algorithms.",
301
                   UintegerValue (7),
304
                   UintegerValue (7),
302
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc),
305
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc),
303
                   MakeUintegerChecker<uint32_t> ())
306
                   MakeUintegerChecker<uint32_t> ())
304
    .AddAttribute ("RtsCtsThreshold", "If  the size of the data packet + LLC header + MAC header + FCS trailer is bigger than "
307
    .AddAttribute ("RtsCtsThreshold",
305
                   "this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2012, Section 9.3.5. "
308
                   "If the size of the PSDU is bigger than this value, we use an RTS/CTS handshake before sending the data frame."
306
                   "This value will not have any effect on some rate control algorithms.",
309
                   "This value will not have any effect on some rate control algorithms.",
307
                   UintegerValue (2346),
310
                   UintegerValue (65535),
308
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold),
311
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold),
309
                   MakeUintegerChecker<uint32_t> ())
312
                   MakeUintegerChecker<uint32_t> ())
310
    .AddAttribute ("FragmentationThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger"
313
    .AddAttribute ("FragmentationThreshold",
311
                   "than this value, we fragment it such that the size of the fragments are equal or smaller "
314
                   "If the size of the PSDU is bigger than this value, we fragment it such that the size of the fragments are equal or smaller. "
312
                   "than this value, as per IEEE Std. 802.11-2012, Section 9.5. "
315
                   "This value does not apply when it is carried in an A-MPDU. "
313
                   "This value will not have any effect on some rate control algorithms.",
316
                   "This value will not have any effect on some rate control algorithms.",
314
                   UintegerValue (2346),
317
                   UintegerValue (2346),
315
                   MakeUintegerAccessor (&WifiRemoteStationManager::DoSetFragmentationThreshold,
318
                   MakeUintegerAccessor (&WifiRemoteStationManager::DoSetFragmentationThreshold,
316
                                         &WifiRemoteStationManager::DoGetFragmentationThreshold),
319
                                         &WifiRemoteStationManager::DoGetFragmentationThreshold),
317
                   MakeUintegerChecker<uint32_t> ())
320
                   MakeUintegerChecker<uint32_t> ())
318
    .AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.",
321
    .AddAttribute ("NonUnicastMode",
322
                   "Wifi mode used for non-unicast transmissions.",
319
                   WifiModeValue (),
323
                   WifiModeValue (),
320
                   MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
324
                   MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
321
                   MakeWifiModeChecker ())
325
                   MakeWifiModeChecker ())
322
    .AddAttribute ("DefaultTxPowerLevel", "Default power level to be used for transmissions. "
326
    .AddAttribute ("DefaultTxPowerLevel",
323
                   "This is the power level that is used by all those WifiManagers that do not"
327
                   "Default power level to be used for transmissions. "
324
                   "implement TX power control.",
328
                   "This is the power level that is used by all those WifiManagers that do not implement TX power control.",
325
                   UintegerValue (0),
329
                   UintegerValue (0),
326
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxPowerLevel),
330
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxPowerLevel),
327
                   MakeUintegerChecker<uint8_t> ())
331
                   MakeUintegerChecker<uint8_t> ())

Return to bug 2271