Review issue 88093: Minor changes in wifi module needed by 802.11s
authorPavel Boyko <boyko@iitp.ru>
Thu Jul 16 16:55:20 2009 +0400 (7 months ago)
changeset 4712f4cd995f1718
parent 4711 43e7ee285fdc
child 4713 ca8cbdd42786
Review issue 88093: Minor changes in wifi module needed by 802.11s
src/devices/wifi/mgt-headers.cc
src/devices/wifi/mgt-headers.h
src/devices/wifi/qos-tag.cc
src/devices/wifi/qos-tag.h
src/devices/wifi/wifi-mac-header.cc
src/devices/wifi/wifi-mac-header.h
src/devices/wifi/wifi-remote-station-manager.cc
src/devices/wifi/wifi-remote-station-manager.h
src/devices/wifi/wscript
     1.1 --- a/src/devices/wifi/mgt-headers.cc	Thu Jul 16 15:57:19 2009 +0400
     1.2 +++ b/src/devices/wifi/mgt-headers.cc	Thu Jul 16 16:55:20 2009 +0400
     1.3 @@ -108,7 +108,11 @@
     1.4  {}
     1.5  MgtProbeResponseHeader::~MgtProbeResponseHeader ()
     1.6  {}
     1.7 -
     1.8 +uint64_t
     1.9 +MgtProbeResponseHeader::GetTimestamp()
    1.10 +{
    1.11 +  return m_timestamp;
    1.12 +}
    1.13  Ssid 
    1.14  MgtProbeResponseHeader::GetSsid (void) const
    1.15  {
    1.16 @@ -198,7 +202,7 @@
    1.17  MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
    1.18  {
    1.19    Buffer::Iterator i = start;
    1.20 -  i.Next (8); // timestamp
    1.21 +  m_timestamp = i.ReadNtohU64();
    1.22    m_beaconInterval = i.ReadNtohU16 ();
    1.23    m_beaconInterval *= 1024;
    1.24    i = m_capability.Deserialize (i);
     2.1 --- a/src/devices/wifi/mgt-headers.h	Thu Jul 16 15:57:19 2009 +0400
     2.2 +++ b/src/devices/wifi/mgt-headers.h	Thu Jul 16 16:55:20 2009 +0400
     2.3 @@ -116,7 +116,7 @@
     2.4    void SetSsid (Ssid ssid);
     2.5    void SetBeaconIntervalUs (uint64_t us);
     2.6    void SetSupportedRates (SupportedRates rates);
     2.7 -
     2.8 +  uint64_t GetTimestamp();
     2.9    static TypeId GetTypeId (void);
    2.10    virtual TypeId GetInstanceTypeId (void) const;
    2.11    virtual void Print (std::ostream &os) const;
    2.12 @@ -125,6 +125,7 @@
    2.13    virtual uint32_t Deserialize (Buffer::Iterator start);
    2.14  
    2.15  private:
    2.16 +  uint64_t m_timestamp;
    2.17    Ssid m_ssid;
    2.18    uint64_t m_beaconInterval;
    2.19    SupportedRates m_rates;
     3.1 --- a/src/devices/wifi/qos-tag.cc	Thu Jul 16 15:57:19 2009 +0400
     3.2 +++ b/src/devices/wifi/qos-tag.cc	Thu Jul 16 16:55:20 2009 +0400
     3.3 @@ -43,7 +43,11 @@
     3.4    return GetTypeId ();
     3.5  }
     3.6  
     3.7 -QosTag::QosTag()
     3.8 +QosTag::QosTag ():
     3.9 +  m_tid (0)
    3.10 +{}
    3.11 +QosTag::QosTag (uint8_t tid):
    3.12 +  m_tid (tid)
    3.13  {}
    3.14  
    3.15  uint32_t 
     4.1 --- a/src/devices/wifi/qos-tag.h	Thu Jul 16 15:57:19 2009 +0400
     4.2 +++ b/src/devices/wifi/qos-tag.h	Thu Jul 16 16:55:20 2009 +0400
     4.3 @@ -33,6 +33,7 @@
     4.4    virtual TypeId GetInstanceTypeId (void) const;
     4.5    
     4.6    QosTag ();
     4.7 +  QosTag (uint8_t tid);
     4.8    virtual void Serialize (TagBuffer i) const;
     4.9    virtual void Deserialize (TagBuffer i);
    4.10    virtual uint32_t GetSerializedSize () const;
     5.1 --- a/src/devices/wifi/wifi-mac-header.cc	Thu Jul 16 15:57:19 2009 +0400
     5.2 +++ b/src/devices/wifi/wifi-mac-header.cc	Thu Jul 16 16:55:20 2009 +0400
     5.3 @@ -128,6 +128,18 @@
     5.4    m_ctrlType = TYPE_DATA;
     5.5    m_ctrlSubtype = 0;
     5.6  }
     5.7 +void
     5.8 +WifiMacHeader::SetAction (void)
     5.9 +{
    5.10 + m_ctrlType = TYPE_MGT;
    5.11 + m_ctrlSubtype = 0x0D;
    5.12 +}
    5.13 +void
    5.14 +WifiMacHeader::SetMultihopAction (void)
    5.15 +{
    5.16 + m_ctrlType = TYPE_MGT;
    5.17 + m_ctrlSubtype = 0x0F;
    5.18 +}
    5.19  void 
    5.20  WifiMacHeader::SetType (enum WifiMacType type)
    5.21  {
    5.22 @@ -191,6 +203,15 @@
    5.23    case WIFI_MAC_MGT_DEAUTHENTICATION:
    5.24      m_ctrlType = TYPE_MGT;
    5.25      m_ctrlSubtype = 12;
    5.26 +  case WIFI_MAC_MGT_ACTION:
    5.27 +    m_ctrlType = TYPE_MGT;
    5.28 +    m_ctrlSubtype = 13;
    5.29 +  case WIFI_MAC_MGT_ACTION_NO_ACK:
    5.30 +    m_ctrlType = TYPE_MGT;
    5.31 +    m_ctrlSubtype = 14;
    5.32 +  case WIFI_MAC_MGT_MULTIHOP_ACTION:
    5.33 +    m_ctrlType = TYPE_MGT;
    5.34 +    m_ctrlSubtype = 15;
    5.35      break;
    5.36  
    5.37    case WIFI_MAC_DATA:
    5.38 @@ -397,6 +418,15 @@
    5.39      case 12:
    5.40        return WIFI_MAC_MGT_DEAUTHENTICATION;
    5.41        break;
    5.42 +    case 13:
    5.43 +      return WIFI_MAC_MGT_ACTION;
    5.44 +      break;
    5.45 +    case 14:
    5.46 +      return WIFI_MAC_MGT_ACTION_NO_ACK;
    5.47 +      break;
    5.48 +    case 15:
    5.49 +      return WIFI_MAC_MGT_MULTIHOP_ACTION;
    5.50 +      break;
    5.51  
    5.52      }
    5.53      break;
    5.54 @@ -590,6 +620,16 @@
    5.55  {
    5.56    return (GetType () == WIFI_MAC_MGT_DEAUTHENTICATION)?true:false;
    5.57  }
    5.58 +bool
    5.59 +WifiMacHeader::IsAction (void) const
    5.60 +{
    5.61 +  return (GetType () == WIFI_MAC_MGT_ACTION)?true:false;
    5.62 +}
    5.63 +bool
    5.64 +WifiMacHeader::IsMultihopAction (void) const
    5.65 +{
    5.66 +  return (GetType () == WIFI_MAC_MGT_MULTIHOP_ACTION)?true:false;
    5.67 +}
    5.68  
    5.69  
    5.70  uint16_t 
    5.71 @@ -810,6 +850,9 @@
    5.72      FOO (MGT_PROBE_RESPONSE);
    5.73      FOO (MGT_AUTHENTICATION);
    5.74      FOO (MGT_DEAUTHENTICATION);
    5.75 +    FOO (MGT_ACTION);
    5.76 +    FOO (MGT_ACTION_NO_ACK);
    5.77 +    FOO (MGT_MULTIHOP_ACTION);
    5.78      
    5.79      FOO (DATA);
    5.80      FOO (DATA_CFACK);
    5.81 @@ -895,6 +938,16 @@
    5.82           << ", BSSID=" << m_addr3 << ", FragNumber=" << m_seqFrag
    5.83           << ", SeqNumber=" << m_seqSeq;
    5.84        break;
    5.85 +    case WIFI_MAC_MGT_ACTION:
    5.86 +    case WIFI_MAC_MGT_ACTION_NO_ACK:
    5.87 +      PrintFrameControl (os);
    5.88 +      os << " Duration/ID=" << m_duration << "us"
    5.89 +         << "DA=" << m_addr1 << ", SA=" << m_addr2 << ", BSSID=" << m_addr3
    5.90 +         << ", FragNumber=" << m_seqFrag << ", SeqNumber=" << m_seqSeq;
    5.91 +    case WIFI_MAC_MGT_MULTIHOP_ACTION:
    5.92 +      os << " Duration/ID=" << m_duration << "us"
    5.93 +         << "RA=" << m_addr1 << ", TA=" << m_addr2 << ", DA=" << m_addr3
    5.94 +         << ", FragNumber=" << m_seqFrag << ", SeqNumber=" << m_seqSeq;
    5.95      case WIFI_MAC_DATA:
    5.96        PrintFrameControl (os);
    5.97        os << " Duration/ID=" << m_duration << "us";
    5.98 @@ -916,7 +969,7 @@
    5.99          }
   5.100        else
   5.101          {
   5.102 -          NS_ASSERT (false);
   5.103 +          NS_FATAL_ERROR ("Impossible ToDs and FromDs flags combination");
   5.104          }
   5.105        os << ", FragNumber=" << m_seqFrag
   5.106           << ", SeqNumber=" << m_seqSeq;
     6.1 --- a/src/devices/wifi/wifi-mac-header.h	Thu Jul 16 15:57:19 2009 +0400
     6.2 +++ b/src/devices/wifi/wifi-mac-header.h	Thu Jul 16 16:55:20 2009 +0400
     6.3 @@ -46,6 +46,9 @@
     6.4    WIFI_MAC_MGT_PROBE_RESPONSE,
     6.5    WIFI_MAC_MGT_AUTHENTICATION,
     6.6    WIFI_MAC_MGT_DEAUTHENTICATION,
     6.7 +  WIFI_MAC_MGT_ACTION,
     6.8 +  WIFI_MAC_MGT_ACTION_NO_ACK,
     6.9 +  WIFI_MAC_MGT_MULTIHOP_ACTION,
    6.10  
    6.11    WIFI_MAC_DATA,
    6.12    WIFI_MAC_DATA_CFACK,
    6.13 @@ -98,6 +101,8 @@
    6.14    void SetProbeResp (void);
    6.15    void SetBeacon (void);
    6.16    void SetTypeData (void);
    6.17 +  void SetAction ();
    6.18 +  void SetMultihopAction();
    6.19    void SetDsFrom (void);
    6.20    void SetDsNotFrom (void);
    6.21    void SetDsTo (void);
    6.22 @@ -150,6 +155,8 @@
    6.23    bool IsDisassociation (void) const;
    6.24    bool IsAuthentication (void) const;
    6.25    bool IsDeauthentication (void) const;
    6.26 +  bool IsAction () const;
    6.27 +  bool IsMultihopAction () const;
    6.28    uint16_t GetRawDuration (void) const;
    6.29    Time GetDuration (void) const;
    6.30    uint16_t GetSequenceControl (void) const;
     7.1 --- a/src/devices/wifi/wifi-remote-station-manager.cc	Thu Jul 16 15:57:19 2009 +0400
     7.2 +++ b/src/devices/wifi/wifi-remote-station-manager.cc	Thu Jul 16 16:55:20 2009 +0400
     7.3 @@ -433,7 +433,9 @@
     7.4  WifiRemoteStation::WifiRemoteStation ()
     7.5    : m_state (BRAND_NEW),
     7.6      m_ssrc (0),
     7.7 -    m_slrc (0)
     7.8 +    m_slrc (0),
     7.9 +    m_avgSlrcCoefficient(0.9),
    7.10 +    m_avgSlrc (0)
    7.11  {}
    7.12  WifiRemoteStation::~WifiRemoteStation ()
    7.13  {}
    7.14 @@ -557,7 +559,11 @@
    7.15  {
    7.16    return GetControlAnswerMode (dataMode);
    7.17  }
    7.18 -
    7.19 +double
    7.20 +WifiRemoteStation::GetAvgSlrc () const
    7.21 +{
    7.22 +  return m_avgSlrc;
    7.23 +}
    7.24  uint32_t 
    7.25  WifiRemoteStation::GetNSupportedModes (void) const
    7.26  {
    7.27 @@ -712,6 +718,7 @@
    7.28  void 
    7.29  WifiRemoteStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr)
    7.30  {
    7.31 +  m_avgSlrc = m_avgSlrc * m_avgSlrcCoefficient + (double) m_slrc * (1 - m_avgSlrcCoefficient);
    7.32    m_slrc = 0;
    7.33    DoReportDataOk (ackSnr, ackMode, dataSnr);
    7.34  }
     8.1 --- a/src/devices/wifi/wifi-remote-station-manager.h	Thu Jul 16 15:57:19 2009 +0400
     8.2 +++ b/src/devices/wifi/wifi-remote-station-manager.h	Thu Jul 16 16:55:20 2009 +0400
     8.3 @@ -260,7 +260,10 @@
     8.4     *          handshake.
     8.5     */
     8.6    WifiMode GetAckMode (WifiMode dataMode);
     8.7 -
     8.8 +  /**
     8.9 +   * \return exponentially weighted average SLRC, this is used by Airtime link metric of 802.11s
    8.10 +   */
    8.11 +  double GetAvgSlrc () const;
    8.12  private:
    8.13    virtual Ptr<WifiRemoteStationManager> GetManager (void) const = 0;
    8.14    virtual WifiMode DoGetDataMode (uint32_t size) = 0;
    8.15 @@ -289,6 +292,8 @@
    8.16    SupportedModes m_modes;
    8.17    TracedValue<uint32_t> m_ssrc;
    8.18    TracedValue<uint32_t> m_slrc;
    8.19 +  double m_avgSlrcCoefficient;
    8.20 +  double m_avgSlrc;
    8.21  };
    8.22  
    8.23  } // namespace ns3 
     9.1 --- a/src/devices/wifi/wscript	Thu Jul 16 15:57:19 2009 +0400
     9.2 +++ b/src/devices/wifi/wscript	Thu Jul 16 16:55:20 2009 +0400
     9.3 @@ -106,6 +106,13 @@
     9.4          'msdu-aggregator.h',
     9.5          'amsdu-subframe-header.h',
     9.6          'qos-tag.h',
     9.7 +# Need this for module devices/mesh
     9.8 +        'mgt-headers.h',
     9.9 +        'status-code.h',
    9.10 +        'capability-information.h',
    9.11 +        'dcf-manager.h',
    9.12 +        'mac-rx-middle.h', 
    9.13 +        'mac-low.h',
    9.14          ]
    9.15  
    9.16      if bld.env['ENABLE_GSL']: