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

(-)a/src/wifi/model/ap-wifi-mac.cc (+23 lines)
 Lines 77-82    Link Here 
77
                   BooleanValue (true),
77
                   BooleanValue (true),
78
                   MakeBooleanAccessor (&ApWifiMac::m_enableNonErpProtection),
78
                   MakeBooleanAccessor (&ApWifiMac::m_enableNonErpProtection),
79
                   MakeBooleanChecker ())
79
                   MakeBooleanChecker ())
80
    .AddAttribute ("RifsMode", "Whether or not RIFS is permitted within the BSS."
81
                   "This parameter only applies to HT APs and is rejected by VHT APs.",
82
                   BooleanValue (false),
83
                   MakeBooleanAccessor (&ApWifiMac::SetRifsMode,
84
                                        &ApWifiMac::GetRifsMode),
85
                   MakeBooleanChecker ())
80
  ;
86
  ;
81
  return tid;
87
  return tid;
82
}
88
}
 Lines 496-501    Link Here 
496
  operations.SetHtSupported (1);
502
  operations.SetHtSupported (1);
497
  if (m_htSupported)
503
  if (m_htSupported)
498
    {
504
    {
505
      operations.SetRifsMode (GetRifsMode ());
499
      if (!m_nonHtStations.empty ())
506
      if (!m_nonHtStations.empty ())
500
        {
507
        {
501
          operations.SetHtProtection (MIXED_MODE_PROTECTION);
508
          operations.SetHtProtection (MIXED_MODE_PROTECTION);
 Lines 1037-1040    Link Here 
1037
  return useProtection;
1044
  return useProtection;
1038
}
1045
}
1039
1046
1047
void
1048
ApWifiMac::SetRifsMode (bool enable)
1049
{
1050
  if (m_htSupported && !m_vhtSupported) //RIFS mode is forbidden for VHT
1051
    {
1052
      m_enableRifs = enable;
1053
      m_stationManager->SetRifsPermitted (enable);
1054
    }
1055
}
1056
1057
bool
1058
ApWifiMac::GetRifsMode (void) const
1059
{
1060
  return m_enableRifs;
1061
}
1062
1040
} //namespace ns3
1063
} //namespace ns3
(-)a/src/wifi/model/ap-wifi-mac.h (+14 lines)
 Lines 259-264    Link Here 
259
   *         false otherwise
259
   *         false otherwise
260
   */
260
   */
261
  bool GetUseNonErpProtection (void) const;
261
  bool GetUseNonErpProtection (void) const;
262
  /**
263
   * Enable or disable RIFS in the BSS.
264
   *
265
   * \param enable enable or disable RIFS in the BSS
266
   */
267
  void SetRifsMode (bool enable);
268
  /**
269
   * Return whether RIFS is used in the BSS.
270
   *
271
   * \return true if RIFS is used in the BSS,
272
   *         false otherwise
273
   */
274
  bool GetRifsMode (void) const;
262
275
263
  virtual void DoDispose (void);
276
  virtual void DoDispose (void);
264
  virtual void DoInitialize (void);
277
  virtual void DoInitialize (void);
 Lines 273-278    Link Here 
273
  std::list<Mac48Address> m_nonErpStations;  //!< List of all non-ERP stations currently associated to the AP
286
  std::list<Mac48Address> m_nonErpStations;  //!< List of all non-ERP stations currently associated to the AP
274
  std::list<Mac48Address> m_nonHtStations;   //!< List of all non-HT stations currently associated to the AP
287
  std::list<Mac48Address> m_nonHtStations;   //!< List of all non-HT stations currently associated to the AP
275
  bool m_enableNonErpProtection;             //!< Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS
288
  bool m_enableNonErpProtection;             //!< Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS
289
  bool m_enableRifs;                         //!< Flag whether RIFS is used within the BSS
276
};
290
};
277
291
278
} //namespace ns3
292
} //namespace ns3
(-)a/src/wifi/model/mac-low.cc (-22 / +40 lines)
 Lines 363-369    Link Here 
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),
 Lines 428-436    Link Here 
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)
 Lines 493-506    Link Here 
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 ())
 Lines 1000-1012    Link Here 
1000
        }
994
        }
1001
      if (m_txParams.HasNextPacket ())
995
      if (m_txParams.HasNextPacket ())
1002
        {
996
        {
1003
          m_waitSifsEvent = Simulator::Schedule (GetSifs (),
997
          if (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 (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 ();
 Lines 1965-1981    Link Here 
1965
    }
1975
    }
1966
  else if (m_txParams.HasNextPacket ())
1976
  else if (m_txParams.HasNextPacket ())
1967
    {
1977
    {
1968
      if (m_stationManager->HasHtSupported ())
1978
      if (m_stationManager->GetRifsPermitted ())
1979
1969
        {
1980
        {
1970
          Time delay = txDuration + GetRifs ();
1981
          Time delay = txDuration + GetRifs ();
1971
          NS_ASSERT (m_waitRifsEvent.IsExpired ());
1982
          NS_ASSERT (m_waitIfsEvent.IsExpired ());
1972
          m_waitRifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTxFragment, this);
1983
          m_waitIfsEvent = Simulator::Schedule (delay, &MacLow::WaitIfsAfterEndTxFragment, this);
1973
        }
1984
        }
1974
      else
1985
      else
1975
        {
1986
        {
1976
          Time delay = txDuration + GetSifs ();
1987
          Time delay = txDuration + GetSifs ();
1977
          NS_ASSERT (m_waitSifsEvent.IsExpired ());
1988
          NS_ASSERT (m_waitIfsEvent.IsExpired ());
1978
          m_waitSifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTxFragment, this);
1989
          m_waitIfsEvent = Simulator::Schedule (delay, &MacLow::WaitIfsAfterEndTxFragment, this);
1979
        }
1990
        }
1980
    }
1991
    }
1981
  else
1992
  else
 Lines 2281-2287    Link Here 
2281
    }
2292
    }
2282
  if (m_txParams.HasNextPacket ())
2293
  if (m_txParams.HasNextPacket ())
2283
    {
2294
    {
2284
      newDuration += GetSifs ();
2295
      if (m_stationManager->GetRifsPermitted ())
2296
        {
2297
          newDuration += GetRifs ();
2298
        }
2299
      else
2300
        {
2301
          newDuration += GetSifs ();
2302
        }
2285
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, preamble, m_phy->GetFrequency ());
2303
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, preamble, m_phy->GetFrequency ());
2286
      if (m_txParams.MustWaitCompressedBlockAck ())
2304
      if (m_txParams.MustWaitCompressedBlockAck ())
2287
        {
2305
        {
 Lines 2316-2328    Link Here 
2316
}
2334
}
2317
2335
2318
void
2336
void
2319
MacLow::WaitSifsAfterEndTxFragment (void)
2337
MacLow::WaitIfsAfterEndTxFragment (void)
2320
{
2338
{
2321
  m_listener->StartNextFragment ();
2339
  m_listener->StartNextFragment ();
2322
}
2340
}
2323
2341
2324
void
2342
void
2325
MacLow::WaitSifsAfterEndTx (void)
2343
MacLow::WaitIfsAfterEndTx (void)
2326
{
2344
{
2327
  m_listener->StartNext ();
2345
  m_listener->StartNext ();
2328
}
2346
}
(-)a/src/wifi/model/mac-low.h (-4 / +3 lines)
 Lines 1149-1156    Link Here 
1149
   * Event handler that is usually scheduled to fired at the appropriate time
1149
   * Event handler that is usually scheduled to fired at the appropriate time
1150
   * after completing transmissions.
1150
   * after completing transmissions.
1151
   */
1151
   */
1152
  void WaitSifsAfterEndTxFragment (void);
1152
  void WaitIfsAfterEndTxFragment (void);
1153
  void WaitSifsAfterEndTx (void);
1153
  void WaitIfsAfterEndTx (void);
1154
1154
1155
  /**
1155
  /**
1156
   * A transmission that does not require an ACK has completed.
1156
   * A transmission that does not require an ACK has completed.
 Lines 1335-1344    Link Here 
1335
  EventId m_sendCtsEvent;               //!< Event to send CTS
1335
  EventId m_sendCtsEvent;               //!< Event to send CTS
1336
  EventId m_sendAckEvent;               //!< Event to send ACK
1336
  EventId m_sendAckEvent;               //!< Event to send ACK
1337
  EventId m_sendDataEvent;              //!< Event to send DATA
1337
  EventId m_sendDataEvent;              //!< Event to send DATA
1338
  EventId m_waitSifsEvent;              //!< Wait for SIFS event
1338
  EventId m_waitIfsEvent;               //!< Wait for IFS event
1339
  EventId m_endTxNoAckEvent;            //!< Event for finishing transmission that does not require ACK
1339
  EventId m_endTxNoAckEvent;            //!< Event for finishing transmission that does not require ACK
1340
  EventId m_navCounterResetCtsMissed;   //!< Event to reset NAV when CTS is not received
1340
  EventId m_navCounterResetCtsMissed;   //!< Event to reset NAV when CTS is not received
1341
  EventId m_waitRifsEvent;              //!< Wait for RIFS event
1342
1341
1343
  Ptr<Packet> m_currentPacket;              //!< Current packet transmitted/to be transmitted
1342
  Ptr<Packet> m_currentPacket;              //!< Current packet transmitted/to be transmitted
1344
  WifiMacHeader m_currentHdr;               //!< Header of the current transmitted packet
1343
  WifiMacHeader m_currentHdr;               //!< Header of the current transmitted packet
(-)a/src/wifi/model/sta-wifi-mac.cc (+1 lines)
 Lines 729-734    Link Here 
729
                  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
729
                  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
730
                  HtOperations htOperations = assocResp.GetHtOperations ();
730
                  HtOperations htOperations = assocResp.GetHtOperations ();
731
                  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (), htcapabilities);
731
                  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (), htcapabilities);
732
                  m_stationManager->SetRifsPermitted (htOperations.GetRifsMode ());
732
                }
733
                }
733
              if (m_vhtSupported)
734
              if (m_vhtSupported)
734
                {
735
                {
(-)a/src/wifi/model/wifi-mac.cc (-1 / +1 lines)
 Lines 191-197    Link Here 
191
                   MakeTimeAccessor (&WifiMac::SetPifs,
191
                   MakeTimeAccessor (&WifiMac::SetPifs,
192
                                     &WifiMac::GetPifs),
192
                                     &WifiMac::GetPifs),
193
                   MakeTimeChecker ())
193
                   MakeTimeChecker ())
194
    .AddAttribute ("Rifs", "The value of the RIFS constant (not supported yet!).",
194
    .AddAttribute ("Rifs", "The value of the RIFS constant.",
195
                   TimeValue (GetDefaultRifs ()),
195
                   TimeValue (GetDefaultRifs ()),
196
                   MakeTimeAccessor (&WifiMac::SetRifs,
196
                   MakeTimeAccessor (&WifiMac::SetRifs,
197
                                     &WifiMac::GetRifs),
197
                                     &WifiMac::GetRifs),
(-)a/src/wifi/model/wifi-remote-station-manager.cc (-1 / +17 lines)
 Lines 362-368    Link Here 
362
    m_vhtSupported (false),
362
    m_vhtSupported (false),
363
    m_useNonErpProtection (false),
363
    m_useNonErpProtection (false),
364
    m_shortPreambleEnabled (false),
364
    m_shortPreambleEnabled (false),
365
    m_shortSlotTimeEnabled (false)
365
    m_shortSlotTimeEnabled (false),
366
    m_rifsPermitted (false)
366
{
367
{
367
}
368
}
368
369
 Lines 459-464    Link Here 
459
  m_shortSlotTimeEnabled = enable;
460
  m_shortSlotTimeEnabled = enable;
460
}
461
}
461
462
463
void
464
WifiRemoteStationManager::SetRifsPermitted (bool allow)
465
{
466
  if (m_htSupported && !m_vhtSupported) //RIFS mode is forbidden for VHT
467
    {
468
      m_rifsPermitted = allow;
469
    }
470
}
471
462
bool
472
bool
463
WifiRemoteStationManager::GetShortSlotTimeEnabled (void) const
473
WifiRemoteStationManager::GetShortSlotTimeEnabled (void) const
464
{
474
{
 Lines 471-476    Link Here 
471
  return m_shortPreambleEnabled;
481
  return m_shortPreambleEnabled;
472
}
482
}
473
483
484
bool
485
WifiRemoteStationManager::GetRifsPermitted (void) const
486
{
487
  return m_rifsPermitted;
488
}
489
474
WifiRemoteStationManager::ProtectionMode
490
WifiRemoteStationManager::ProtectionMode
475
WifiRemoteStationManager::GetProtectionMode (void) const
491
WifiRemoteStationManager::GetProtectionMode (void) const
476
{
492
{
(-)a/src/wifi/model/wifi-remote-station-manager.h (+14 lines)
 Lines 257-262    Link Here 
257
   *         false otherwise
257
   *         false otherwise
258
   */
258
   */
259
  bool GetShortSlotTimeEnabled (void) const;
259
  bool GetShortSlotTimeEnabled (void) const;
260
  /**
261
   * Permit or prohibit RIFS.
262
   *
263
   * \param allow permit or prohibit RIFS
264
   */
265
  void SetRifsPermitted (bool allow);
266
  /**
267
   * Return whether the device can use RIFS.
268
   *
269
   * \return true if RIFS is permitted,
270
   *         false otherwise
271
   */
272
  bool GetRifsPermitted (void) const;
260
273
261
  /**
274
  /**
262
   * Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
275
   * Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
 Lines 1233-1238    Link Here 
1233
  bool m_useNonErpProtection; //!< flag if protection for non-ERP stations against ERP transmissions is enabled
1246
  bool m_useNonErpProtection; //!< flag if protection for non-ERP stations against ERP transmissions is enabled
1234
  bool m_shortPreambleEnabled; //!< flag if short PLCP preamble is enabled
1247
  bool m_shortPreambleEnabled; //!< flag if short PLCP preamble is enabled
1235
  bool m_shortSlotTimeEnabled; //!< flag if short slot time is enabled
1248
  bool m_shortSlotTimeEnabled; //!< flag if short slot time is enabled
1249
  bool m_rifsPermitted;        //!< flag if RIFS is enabled
1236
  ProtectionMode m_protectionMode; //!< Protection mode for ERP stations when non-ERP stations are detected
1250
  ProtectionMode m_protectionMode; //!< Protection mode for ERP stations when non-ERP stations are detected
1237
1251
1238
  /**
1252
  /**

Return to bug 2528