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

(-)a/src/wifi/model/adhoc-wifi-mac.cc (+9 lines)
 Lines 86-91    Link Here 
86
    {
86
    {
87
      //In ad hoc mode, we assume that every destination supports all
87
      //In ad hoc mode, we assume that every destination supports all
88
      //the rates we support.
88
      //the rates we support.
89
      if (m_htSupported || m_vhtSupported)
90
        {
91
          m_stationManager->AddAllSupportedMcs (to);
92
          m_stationManager->AddStationHtCapabilities (to, GetHtCapabilities());
93
        }
94
      if (m_vhtSupported)
95
        {
96
          m_stationManager->AddStationVhtCapabilities (to, GetVhtCapabilities());
97
        }
89
      m_stationManager->AddAllSupportedModes (to);
98
      m_stationManager->AddAllSupportedModes (to);
90
      m_stationManager->RecordDisassociated (to);
99
      m_stationManager->RecordDisassociated (to);
91
    }
100
    }
(-)a/src/wifi/model/ap-wifi-mac.cc (-82 lines)
 Lines 421-465    Link Here 
421
  return information;
421
  return information;
422
}
422
}
423
423
424
HtCapabilities
425
ApWifiMac::GetHtCapabilities (void) const
426
{
427
  HtCapabilities capabilities;
428
  capabilities.SetHtSupported (1);
429
  if (m_htSupported)
430
    {
431
      capabilities.SetLdpc (m_phy->GetLdpc ());
432
      capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () == 40);
433
      capabilities.SetShortGuardInterval20 (m_phy->GetGuardInterval ());
434
      capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () == 40 && m_phy->GetGuardInterval ());
435
      capabilities.SetGreenfield (m_phy->GetGreenfield ());
436
      capabilities.SetMaxAmsduLength (1); //hardcoded for now (TBD)
437
      capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ());
438
      capabilities.SetMaxAmpduLength (3); //hardcoded for now (TBD)
439
      uint64_t maxSupportedRate = 0; //in bit/s
440
      for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
441
        {
442
          WifiMode mcs = m_phy->GetMcs (i);
443
          if (mcs.GetModulationClass () != WIFI_MOD_CLASS_HT)
444
            {
445
              continue;
446
            }
447
          capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
448
          uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
449
          NS_ASSERT (nss > 0 && nss < 5);
450
          if (mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), nss) > maxSupportedRate)
451
            {
452
              maxSupportedRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), nss);
453
              NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
454
            }
455
        }
456
      capabilities.SetRxHighestSupportedDataRate (maxSupportedRate / 1e6); //in Mbit/s
457
      capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
458
      capabilities.SetTxMaxNSpatialStreams (m_phy->GetSupportedTxSpatialStreams ());
459
    }
460
  return capabilities;
461
}
462
463
HtOperations
424
HtOperations
464
ApWifiMac::GetHtOperations (void) const
425
ApWifiMac::GetHtOperations (void) const
465
{
426
{
 Lines 479-527    Link Here 
479
  return operations;
440
  return operations;
480
}
441
}
481
442
482
VhtCapabilities
483
ApWifiMac::GetVhtCapabilities (void) const
484
{
485
  VhtCapabilities capabilities;
486
  capabilities.SetVhtSupported (1);
487
  if (m_vhtSupported)
488
    {
489
      if (m_phy->GetChannelWidth () == 160)
490
        {
491
          capabilities.SetSupportedChannelWidthSet (1);
492
        }
493
      else
494
        {
495
          capabilities.SetSupportedChannelWidthSet (0);
496
        }
497
      capabilities.SetMaxMpduLength (2); //hardcoded for now (TBD)
498
      capabilities.SetRxLdpc (m_phy->GetLdpc ());
499
      capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && m_phy->GetGuardInterval ());
500
      capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && m_phy->GetGuardInterval ());
501
      capabilities.SetMaxAmpduLengthExponent (7); //hardcoded for now (TBD)
502
      uint8_t maxMcs = 0;
503
      for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
504
        {
505
          WifiMode mcs = m_phy->GetMcs (i);
506
          if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
507
              && (mcs.GetMcsValue () > maxMcs))
508
            {
509
              maxMcs = mcs.GetMcsValue ();
510
            }
511
        }
512
      // Support same MaxMCS for each spatial stream 
513
      for (uint8_t nss = 1; nss <= m_phy->GetSupportedRxSpatialStreams (); nss++)
514
        {
515
          capabilities.SetRxMcsMap (maxMcs, nss);
516
        }
517
      for (uint8_t nss = 1; nss <= m_phy->GetSupportedTxSpatialStreams (); nss++)
518
        {
519
          capabilities.SetTxMcsMap (maxMcs, nss);
520
        }
521
    }
522
  return capabilities;
523
}
524
525
void
443
void
526
ApWifiMac::SendProbeResp (Mac48Address to)
444
ApWifiMac::SendProbeResp (Mac48Address to)
527
{
445
{
(-)a/src/wifi/model/ap-wifi-mac.h (-12 lines)
 Lines 209-232    Link Here 
209
   */
209
   */
210
  ErpInformation GetErpInformation (void) const;
210
  ErpInformation GetErpInformation (void) const;
211
  /**
211
  /**
212
   * Return the HT capability of the current AP.
213
   *
214
   * \return the HT capability that we support
215
   */
216
  HtCapabilities GetHtCapabilities (void) const;
217
  /**
218
   * Return the HT operations of the current AP.
212
   * Return the HT operations of the current AP.
219
   *
213
   *
220
   * \return the HT operations that we support
214
   * \return the HT operations that we support
221
   */
215
   */
222
  HtOperations GetHtOperations (void) const;
216
  HtOperations GetHtOperations (void) const;
223
  /**
217
  /**
224
   * Return the VHT capability of the current AP.
225
   *
226
   * \return the VHT capability that we support
227
   */
228
  VhtCapabilities GetVhtCapabilities (void) const;
229
  /**
230
   * Return an instance of SupportedRates that contains all rates that we support
218
   * Return an instance of SupportedRates that contains all rates that we support
231
   * including HT rates.
219
   * including HT rates.
232
   *
220
   *
(-)a/src/wifi/model/regular-wifi-mac.cc (+82 lines)
 Lines 140-145    Link Here 
140
  return m_stationManager;
140
  return m_stationManager;
141
}
141
}
142
142
143
HtCapabilities
144
RegularWifiMac::GetHtCapabilities (void) const
145
{
146
  HtCapabilities capabilities;
147
  capabilities.SetHtSupported (1);
148
  if (m_htSupported)
149
    {
150
      capabilities.SetLdpc (m_phy->GetLdpc ());
151
      capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () == 40);
152
      capabilities.SetShortGuardInterval20 (m_phy->GetGuardInterval ());
153
      capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () == 40 && m_phy->GetGuardInterval ());
154
      capabilities.SetGreenfield (m_phy->GetGreenfield ());
155
      capabilities.SetMaxAmsduLength (1); //hardcoded for now (TBD)
156
      capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ());
157
      capabilities.SetMaxAmpduLength (3); //hardcoded for now (TBD)
158
      uint64_t maxSupportedRate = 0; //in bit/s
159
      for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
160
        {
161
          WifiMode mcs = m_phy->GetMcs (i);
162
          if (mcs.GetModulationClass () != WIFI_MOD_CLASS_HT)
163
            {
164
              continue;
165
            }
166
          capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
167
          uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
168
          NS_ASSERT (nss > 0 && nss < 5);
169
          if (mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), nss) > maxSupportedRate)
170
            {
171
              maxSupportedRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), nss);
172
              NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
173
            }
174
        }
175
      capabilities.SetRxHighestSupportedDataRate (maxSupportedRate / 1e6); //in Mbit/s
176
      capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
177
      capabilities.SetTxMaxNSpatialStreams (m_phy->GetSupportedTxSpatialStreams ());
178
    }
179
  return capabilities;
180
}
181
182
VhtCapabilities
183
RegularWifiMac::GetVhtCapabilities (void) const
184
{
185
  VhtCapabilities capabilities;
186
  capabilities.SetVhtSupported (1);
187
  if (m_vhtSupported)
188
    {
189
      if (m_phy->GetChannelWidth () == 160)
190
        {
191
          capabilities.SetSupportedChannelWidthSet (1);
192
        }
193
      else
194
        {
195
          capabilities.SetSupportedChannelWidthSet (0);
196
        }
197
      capabilities.SetMaxMpduLength (2); //hardcoded for now (TBD)
198
      capabilities.SetRxLdpc (m_phy->GetLdpc ());
199
      capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && m_phy->GetGuardInterval ());
200
      capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && m_phy->GetGuardInterval ());
201
      capabilities.SetMaxAmpduLengthExponent (7); //hardcoded for now (TBD)
202
      uint8_t maxMcs = 0;
203
      for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
204
        {
205
          WifiMode mcs = m_phy->GetMcs (i);
206
          if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
207
              && (mcs.GetMcsValue () > maxMcs))
208
            {
209
              maxMcs = mcs.GetMcsValue ();
210
            }
211
        }
212
      // Support same MaxMCS for each spatial stream
213
      for (uint8_t nss = 1; nss <= m_phy->GetSupportedRxSpatialStreams (); nss++)
214
        {
215
          capabilities.SetRxMcsMap (maxMcs, nss);
216
        }
217
      for (uint8_t nss = 1; nss <= m_phy->GetSupportedTxSpatialStreams (); nss++)
218
        {
219
          capabilities.SetTxMcsMap (maxMcs, nss);
220
        }
221
    }
222
  return capabilities;
223
}
224
143
void
225
void
144
RegularWifiMac::SetVoMaxAmsduSize (uint32_t size)
226
RegularWifiMac::SetVoMaxAmsduSize (uint32_t size)
145
{
227
{
(-)a/src/wifi/model/regular-wifi-mac.h (+12 lines)
 Lines 220-225    Link Here 
220
   * \return the station manager attached to this MAC.
220
   * \return the station manager attached to this MAC.
221
   */
221
   */
222
  virtual Ptr<WifiRemoteStationManager> GetWifiRemoteStationManager (void) const;
222
  virtual Ptr<WifiRemoteStationManager> GetWifiRemoteStationManager (void) const;
223
  /**
224
   * Return the HT capability of the device.
225
   *
226
   * \return the HT capability that we support
227
   */
228
  HtCapabilities GetHtCapabilities (void) const;
229
  /**
230
   * Return the VHT capability of the device.
231
   *
232
   * \return the VHT capability that we support
233
   */
234
  VhtCapabilities GetVhtCapabilities (void) const;
223
235
224
  /**
236
  /**
225
   * This type defines the callback of a higher layer that a
237
   * This type defines the callback of a higher layer that a
(-)a/src/wifi/model/sta-wifi-mac.cc (-82 lines)
 Lines 763-850    Link Here 
763
  return capabilities;
763
  return capabilities;
764
}
764
}
765
765
766
HtCapabilities
767
StaWifiMac::GetHtCapabilities (void) const
768
{
769
  HtCapabilities capabilities;
770
  capabilities.SetHtSupported (1);
771
  if (m_htSupported)
772
    {
773
      capabilities.SetLdpc (m_phy->GetLdpc ());
774
      capabilities.SetSupportedChannelWidth (m_phy->GetChannelWidth () == 40);
775
      capabilities.SetShortGuardInterval20 (m_phy->GetGuardInterval ());
776
      capabilities.SetShortGuardInterval40 (m_phy->GetChannelWidth () == 40 && m_phy->GetGuardInterval ());
777
      capabilities.SetGreenfield (m_phy->GetGreenfield ());
778
      capabilities.SetMaxAmsduLength (1); //hardcoded for now (TBD)
779
      capabilities.SetLSigProtectionSupport (!m_phy->GetGreenfield ());
780
      capabilities.SetMaxAmpduLength (3); //hardcoded for now (TBD)
781
      uint64_t maxSupportedRate = 0; //in bit/s
782
      for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
783
        {
784
          WifiMode mcs = m_phy->GetMcs (i);
785
          if (mcs.GetModulationClass () != WIFI_MOD_CLASS_HT)
786
            {
787
              continue;
788
            }
789
          capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
790
          uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
791
          NS_ASSERT (nss > 0 && nss < 5);
792
          if (mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), nss) > maxSupportedRate)
793
            {
794
              maxSupportedRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetGuardInterval (), nss);
795
              NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
796
            }
797
        }
798
      capabilities.SetRxHighestSupportedDataRate (maxSupportedRate / 1e6); //in Mbit/s
799
      capabilities.SetTxMcsSetDefined (m_phy->GetNMcs () > 0);
800
      capabilities.SetTxMaxNSpatialStreams (m_phy->GetSupportedTxSpatialStreams ());
801
    }
802
  return capabilities;
803
}
804
805
VhtCapabilities
806
StaWifiMac::GetVhtCapabilities (void) const
807
{
808
  VhtCapabilities capabilities;
809
  capabilities.SetVhtSupported (1);
810
  if (m_vhtSupported)
811
    {
812
      if (m_phy->GetChannelWidth () == 160)
813
        {
814
          capabilities.SetSupportedChannelWidthSet (1);
815
        }
816
      else
817
        {
818
          capabilities.SetSupportedChannelWidthSet (0);
819
        }
820
      capabilities.SetMaxMpduLength (2); //hardcoded for now (TBD)
821
      capabilities.SetRxLdpc (m_phy->GetLdpc ());
822
      capabilities.SetShortGuardIntervalFor80Mhz ((m_phy->GetChannelWidth () == 80) && m_phy->GetGuardInterval ());
823
      capabilities.SetShortGuardIntervalFor160Mhz ((m_phy->GetChannelWidth () == 160) && m_phy->GetGuardInterval ());
824
      capabilities.SetMaxAmpduLengthExponent (7); //hardcoded for now (TBD)
825
      uint8_t maxMcs = 0;
826
      for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
827
        {
828
          WifiMode mcs = m_phy->GetMcs (i);
829
          if ((mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT)
830
              && (mcs.GetMcsValue () > maxMcs))
831
            {
832
              maxMcs = mcs.GetMcsValue ();
833
            }
834
        }
835
      // Support same MaxMCS for each spatial stream
836
      for (uint8_t nss = 1; nss <= m_phy->GetSupportedRxSpatialStreams (); nss++)
837
        {
838
          capabilities.SetRxMcsMap (maxMcs, nss);
839
        }
840
      for (uint8_t nss = 1; nss <= m_phy->GetSupportedTxSpatialStreams (); nss++)
841
        {
842
          capabilities.SetTxMcsMap (maxMcs, nss);
843
        }
844
    }
845
  return capabilities;
846
}
847
848
void
766
void
849
StaWifiMac::SetState (MacState value)
767
StaWifiMac::SetState (MacState value)
850
{
768
{
(-)a/src/wifi/model/sta-wifi-mac.h (-12 lines)
 Lines 177-194    Link Here 
177
   * \return the Capability information that we support
177
   * \return the Capability information that we support
178
   */
178
   */
179
  CapabilityInformation GetCapabilities (void) const;
179
  CapabilityInformation GetCapabilities (void) const;
180
  /**
181
   * Return the HT capability of the current STA.
182
   *
183
   * \return the HT capability that we support
184
   */
185
  HtCapabilities GetHtCapabilities (void) const;
186
  /**
187
   * Return the VHT capability of the current STA.
188
   *
189
   * \return the VHT capability that we support
190
   */
191
  VhtCapabilities GetVhtCapabilities (void) const;
192
180
193
  enum MacState m_state;
181
  enum MacState m_state;
194
  Time m_probeRequestTimeout;
182
  Time m_probeRequestTimeout;
(-)a/src/wifi/model/wifi-remote-station-manager.cc (+12 lines)
 Lines 579-584    Link Here 
579
}
579
}
580
580
581
void
581
void
582
WifiRemoteStationManager::AddAllSupportedMcs (Mac48Address address)
583
{
584
  NS_ASSERT (!address.IsGroup ());
585
  WifiRemoteStationState *state = LookupState (address);
586
  state->m_operationalMcsSet.clear ();
587
  for (uint32_t i = 0; i < m_wifiPhy->GetNMcs (); i++)
588
    {
589
      state->m_operationalMcsSet.push_back (m_wifiPhy->GetMcs (i));
590
    }
591
}
592
593
void
582
WifiRemoteStationManager::AddSupportedMcs (Mac48Address address, WifiMode mcs)
594
WifiRemoteStationManager::AddSupportedMcs (Mac48Address address, WifiMode mcs)
583
{
595
{
584
  NS_LOG_FUNCTION (this << address << mcs);
596
  NS_LOG_FUNCTION (this << address << mcs);
(-)a/src/wifi/model/wifi-remote-station-manager.h (+7 lines)
 Lines 402-407    Link Here 
402
   */
402
   */
403
  void AddAllSupportedModes (Mac48Address address);
403
  void AddAllSupportedModes (Mac48Address address);
404
  /**
404
  /**
405
   * Invoked in a STA or AP to store all of the MCS supported
406
   * by a destination which is also supported locally.
407
   *
408
   * \param address the address of the station being recorded
409
   */
410
  void AddAllSupportedMcs (Mac48Address address);
411
  /**
405
   * Record whether the short PLCP preamble is supported by the station.
412
   * Record whether the short PLCP preamble is supported by the station.
406
   *
413
   *
407
   * \param address the address of the station
414
   * \param address the address of the station

Return to bug 2275