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

(-)a/src/wifi/examples/wifi-phy-test.cc (-4 / +4 lines)
 Lines 59-65    Link Here 
59
59
60
private:
60
private:
61
  void Send (void);
61
  void Send (void);
62
  void Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble);
62
  void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble);
63
  Ptr<WifiPhy> m_tx;
63
  Ptr<WifiPhy> m_tx;
64
  struct Input m_input;
64
  struct Input m_input;
65
  struct Output m_output;
65
  struct Output m_output;
 Lines 77-83    Link Here 
77
}
77
}
78
78
79
void
79
void
80
PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble)
80
PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble)
81
{
81
{
82
  m_output.received++;
82
  m_output.received++;
83
}
83
}
 Lines 161-167    Link Here 
161
private:
161
private:
162
  void SendA (void) const;
162
  void SendA (void) const;
163
  void SendB (void) const;
163
  void SendB (void) const;
164
  void Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble);
164
  void Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble);
165
  Ptr<WifiPhy> m_txA;
165
  Ptr<WifiPhy> m_txA;
166
  Ptr<WifiPhy> m_txB;
166
  Ptr<WifiPhy> m_txB;
167
  uint32_t m_flowIdA;
167
  uint32_t m_flowIdA;
 Lines 193-199    Link Here 
193
}
193
}
194
194
195
void
195
void
196
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble)
196
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiTxVector txVector, enum WifiPreamble preamble)
197
{
197
{
198
  FlowIdTag tag;
198
  FlowIdTag tag;
199
  if (p->FindFirstMatchingByteTag (tag))
199
  if (p->FindFirstMatchingByteTag (tag))
(-)a/src/wifi/model/ap-wifi-mac.cc (+8 lines)
 Lines 314-319    Link Here 
314
    {
314
    {
315
      WifiMode mode = m_phy->GetMode (i);
315
      WifiMode mode = m_phy->GetMode (i);
316
      rates.AddSupportedRate (mode.GetDataRate ());
316
      rates.AddSupportedRate (mode.GetDataRate ());
317
      // add rates that are part of the BSSBasicRateSet (manufacturer dependent!)
318
      // here we choose to add the mandatory rates to the BSSBasicRateSet,
319
      // exept for 802.11b where we assume that only the two lowest mandatory rates are part of the BSSBasicRateSet
320
      if (mode.IsMandatory() &&
321
         ((mode.GetModulationClass () != WIFI_MOD_CLASS_DSSS) || mode == WifiPhy::GetDsssRate1Mbps () || mode == WifiPhy::GetDsssRate2Mbps ()))
322
      {
323
        m_stationManager->AddBasicMode (mode);
324
      }
317
    }
325
    }
318
  // set the basic rates
326
  // set the basic rates
319
  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
327
  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
(-)a/src/wifi/model/constant-rate-wifi-manager.cc (-1 / +1 lines)
 Lines 43-49    Link Here 
43
                   StringValue ("OfdmRate6Mbps"),
43
                   StringValue ("OfdmRate6Mbps"),
44
                   MakeWifiModeAccessor (&ConstantRateWifiManager::m_dataMode),
44
                   MakeWifiModeAccessor (&ConstantRateWifiManager::m_dataMode),
45
                   MakeWifiModeChecker ())
45
                   MakeWifiModeChecker ())
46
    .AddAttribute ("ControlMode", "The transmission mode to use for every control packet transmission.",
46
    .AddAttribute ("ControlMode", "The transmission mode to use for every RTS packet transmission.",
47
                   StringValue ("OfdmRate6Mbps"),
47
                   StringValue ("OfdmRate6Mbps"),
48
                   MakeWifiModeAccessor (&ConstantRateWifiManager::m_ctlMode),
48
                   MakeWifiModeAccessor (&ConstantRateWifiManager::m_ctlMode),
49
                   MakeWifiModeChecker ())
49
                   MakeWifiModeChecker ())
(-)a/src/wifi/model/constant-rate-wifi-manager.h (-2 / +2 lines)
 Lines 28-34    Link Here 
28
28
29
/**
29
/**
30
 * \ingroup wifi
30
 * \ingroup wifi
31
 * \brief use constant rates for data and control transmissions
31
 * \brief use constant rates for data and RTS transmissions
32
 *
32
 *
33
 * This class uses always the same transmission rate for every
33
 * This class uses always the same transmission rate for every
34
 * packet sent.
34
 * packet sent.
 Lines 58-64    Link Here 
58
  virtual bool IsLowLatency (void) const;
58
  virtual bool IsLowLatency (void) const;
59
59
60
  WifiMode m_dataMode; //!< Wifi mode for unicast DATA frames
60
  WifiMode m_dataMode; //!< Wifi mode for unicast DATA frames
61
  WifiMode m_ctlMode; //!< Wifi mode for request control frames
61
  WifiMode m_ctlMode; //!< Wifi mode for RTS frames
62
};
62
};
63
63
64
} // namespace ns3
64
} // namespace ns3
(-)a/src/wifi/model/interference-helper.cc (-17 / +14 lines)
 Lines 32-47    Link Here 
32
 *       Phy event class
32
 *       Phy event class
33
 ****************************************************************/
33
 ****************************************************************/
34
34
35
InterferenceHelper::Event::Event (uint32_t size, WifiMode payloadMode,
35
InterferenceHelper::Event::Event (uint32_t size, WifiTxVector txVector,
36
                                  enum WifiPreamble preamble,
36
                                  enum WifiPreamble preamble,
37
                                  Time duration, double rxPower, WifiTxVector txVector)
37
                                  Time duration, double rxPower)
38
  : m_size (size),
38
  : m_size (size),
39
    m_payloadMode (payloadMode),
39
    m_txVector (txVector),
40
    m_preamble (preamble),
40
    m_preamble (preamble),
41
    m_startTime (Simulator::Now ()),
41
    m_startTime (Simulator::Now ()),
42
    m_endTime (m_startTime + duration),
42
    m_endTime (m_startTime + duration),
43
    m_rxPowerW (rxPower),
43
    m_rxPowerW (rxPower)
44
    m_txVector (txVector)
45
{
44
{
46
}
45
}
47
InterferenceHelper::Event::~Event ()
46
InterferenceHelper::Event::~Event ()
 Lines 73-82    Link Here 
73
{
72
{
74
  return m_size;
73
  return m_size;
75
}
74
}
75
WifiTxVector
76
InterferenceHelper::Event::GetTxVector (void) const
77
{
78
  return m_txVector;
79
}
76
WifiMode
80
WifiMode
77
InterferenceHelper::Event::GetPayloadMode (void) const
81
InterferenceHelper::Event::GetPayloadMode (void) const
78
{
82
{
79
  return m_payloadMode;
83
  return m_txVector.GetMode();
80
}
84
}
81
enum WifiPreamble
85
enum WifiPreamble
82
InterferenceHelper::Event::GetPreambleType (void) const
86
InterferenceHelper::Event::GetPreambleType (void) const
 Lines 84-95    Link Here 
84
  return m_preamble;
88
  return m_preamble;
85
}
89
}
86
90
87
WifiTxVector
88
InterferenceHelper::Event::GetTxVector (void) const
89
{
90
  return m_txVector;
91
}
92
93
91
94
/****************************************************************
92
/****************************************************************
95
 *       Class which records SNIR change events for a
93
 *       Class which records SNIR change events for a
 Lines 134-151    Link Here 
134
}
132
}
135
133
136
Ptr<InterferenceHelper::Event>
134
Ptr<InterferenceHelper::Event>
137
InterferenceHelper::Add (uint32_t size, WifiMode payloadMode,
135
InterferenceHelper::Add (uint32_t size, WifiTxVector txVector,
138
                         enum WifiPreamble preamble,
136
                         enum WifiPreamble preamble,
139
                         Time duration, double rxPowerW, WifiTxVector txVector)
137
                         Time duration, double rxPowerW)
140
{
138
{
141
  Ptr<InterferenceHelper::Event> event;
139
  Ptr<InterferenceHelper::Event> event;
142
140
143
  event = Create<InterferenceHelper::Event> (size,
141
  event = Create<InterferenceHelper::Event> (size,
144
                                             payloadMode,
142
                                             txVector,
145
                                             preamble,
143
                                             preamble,
146
                                             duration,
144
                                             duration,
147
                                             rxPowerW,
145
                                             rxPowerW);
148
                                             txVector);
149
  AppendEvent (event);
146
  AppendEvent (event);
150
  return event;
147
  return event;
151
}
148
}
(-)a/src/wifi/model/interference-helper.h (-16 / +14 lines)
 Lines 51-65    Link Here 
51
     * Create an Event with the given parameters.
51
     * Create an Event with the given parameters.
52
     *
52
     *
53
     * \param size packet size
53
     * \param size packet size
54
     * \param payloadMode Wi-Fi mode used for the payload
54
     * \param txvector TXVECTOR of the packet
55
     * \param preamble preamble type
55
     * \param preamble preamble type
56
     * \param duration duration of the signal
56
     * \param duration duration of the signal
57
     * \param rxPower the receive power (w)
57
     * \param rxPower the receive power (w)
58
     * \param txvector TXVECTOR of the packet
59
     */
58
     */
60
    Event (uint32_t size, WifiMode payloadMode,
59
    Event (uint32_t size, WifiTxVector txvector,
61
           enum WifiPreamble preamble,
60
           enum WifiPreamble preamble,
62
           Time duration, double rxPower, WifiTxVector txvector);
61
           Time duration, double rxPower);
63
    ~Event ();
62
    ~Event ();
64
63
65
    /**
64
    /**
 Lines 93-98    Link Here 
93
     */
92
     */
94
    uint32_t GetSize (void) const;
93
    uint32_t GetSize (void) const;
95
    /**
94
    /**
95
     * Return the TXVECTOR of the packet.
96
     *
97
     * \return the TXVECTOR of the packet
98
     */
99
    WifiTxVector GetTxVector (void) const;
100
    /**
96
     * Return the Wi-Fi mode used for the payload.
101
     * Return the Wi-Fi mode used for the payload.
97
     *
102
     *
98
     * \return the Wi-Fi mode used for the payload
103
     * \return the Wi-Fi mode used for the payload
 Lines 104-123    Link Here 
104
     * \return the preamble type of the packet
109
     * \return the preamble type of the packet
105
     */
110
     */
106
    enum WifiPreamble GetPreambleType (void) const;
111
    enum WifiPreamble GetPreambleType (void) const;
107
    /**
112
108
     * Return the TXVECTOR of the packet.
109
     *
110
     * \return the TXVECTOR of the packet
111
     */
112
    WifiTxVector GetTxVector (void) const;
113
private:
113
private:
114
    uint32_t m_size;
114
    uint32_t m_size;
115
    WifiMode m_payloadMode;
115
    WifiTxVector m_txVector;
116
    enum WifiPreamble m_preamble;
116
    enum WifiPreamble m_preamble;
117
    Time m_startTime;
117
    Time m_startTime;
118
    Time m_endTime;
118
    Time m_endTime;
119
    double m_rxPowerW;
119
    double m_rxPowerW;
120
    WifiTxVector m_txVector;
121
  };
120
  };
122
  /**
121
  /**
123
   * A struct for both SNR and PER
122
   * A struct for both SNR and PER
 Lines 170-185    Link Here 
170
   * Add the packet-related signal to interference helper.
169
   * Add the packet-related signal to interference helper.
171
   *
170
   *
172
   * \param size packet size
171
   * \param size packet size
173
   * \param payloadMode Wi-Fi mode for the payload
172
   * \param txvector TXVECTOR of the packet
174
   * \param preamble Wi-Fi preamble for the packet
173
   * \param preamble Wi-Fi preamble for the packet
175
   * \param duration the duration of the signal
174
   * \param duration the duration of the signal
176
   * \param rxPower receive power (w)
175
   * \param rxPower receive power (w)
177
   * \param txvector TXVECTOR of the packet
178
   * \return InterferenceHelper::Event
176
   * \return InterferenceHelper::Event
179
   */
177
   */
180
  Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiMode payloadMode,
178
  Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiTxVector txvector,
181
                                      enum WifiPreamble preamble,
179
                                      enum WifiPreamble preamble,
182
                                      Time duration, double rxPower, WifiTxVector txvector);
180
                                      Time duration, double rxPower);
183
181
184
  /**
182
  /**
185
   * Calculate the SNIR at the start of the packet and accumulate
183
   * Calculate the SNIR at the start of the packet and accumulate
(-)a/src/wifi/model/mac-low.cc (-106 / +75 lines)
 Lines 503-509    Link Here 
503
void
503
void
504
MacLow::ResetPhy (void)
504
MacLow::ResetPhy (void)
505
{
505
{
506
  m_phy->SetReceiveOkCallback (MakeNullCallback<void,Ptr<Packet>, double, WifiMode, enum WifiPreamble>  ());
506
  m_phy->SetReceiveOkCallback (MakeNullCallback<void,Ptr<Packet>, double, WifiTxVector, enum WifiPreamble>  ());
507
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void,Ptr<const Packet>, double> ());
507
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void,Ptr<const Packet>, double> ());
508
  RemovePhyMacLowListener (m_phy);
508
  RemovePhyMacLowListener (m_phy);
509
  m_phy = 0;
509
  m_phy = 0;
 Lines 759-765    Link Here 
759
                                                hdr.GetQosTid(),
759
                                                hdr.GetQosTid(),
760
                                                hdr.GetAddr2 (),
760
                                                hdr.GetAddr2 (),
761
                                                hdr.GetDuration (),
761
                                                hdr.GetDuration (),
762
                                                m_currentMode);
762
                                                m_currentTxVector);
763
        }
763
        }
764
      else if (hdr.IsBlockAckReq())
764
      else if (hdr.IsBlockAckReq())
765
        {
765
        {
 Lines 808-816    Link Here 
808
}
808
}
809
809
810
void
810
void
811
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble, bool ampduSubframe)
811
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe)
812
{
812
{
813
  NS_LOG_FUNCTION (this << packet << rxSnr << txMode << preamble);
813
  NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode  () << preamble);
814
  /* A packet is received from the PHY.
814
  /* A packet is received from the PHY.
815
   * When we have handled this packet,
815
   * When we have handled this packet,
816
   * we handle any packet present in the
816
   * we handle any packet present in the
 Lines 821-827    Link Here 
821
821
822
  bool isPrevNavZero = IsNavZero ();
822
  bool isPrevNavZero = IsNavZero ();
823
  NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
823
  NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
824
  NotifyNav (packet,hdr, txMode, preamble);
824
  NotifyNav (packet, hdr, preamble);
825
  if (hdr.IsRts ())
825
  if (hdr.IsRts ())
826
    {
826
    {
827
      /* see section 9.2.5.7 802.11-1999
827
      /* see section 9.2.5.7 802.11-1999
 Lines 842-853    Link Here 
842
              NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", schedule CTS");
842
              NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", schedule CTS");
843
              NS_ASSERT (m_sendCtsEvent.IsExpired ());
843
              NS_ASSERT (m_sendCtsEvent.IsExpired ());
844
              m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
844
              m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
845
                                            rxSnr, txMode);
845
                                            rxSnr, txVector.GetMode  ());
846
              m_sendCtsEvent = Simulator::Schedule (GetSifs (),
846
              m_sendCtsEvent = Simulator::Schedule (GetSifs (),
847
                                                    &MacLow::SendCtsAfterRts, this,
847
                                                    &MacLow::SendCtsAfterRts, this,
848
                                                    hdr.GetAddr2 (),
848
                                                    hdr.GetAddr2 (),
849
                                                    hdr.GetDuration (),
849
                                                    hdr.GetDuration (),
850
                                                    txMode,
850
                                                    txVector,
851
                                                    rxSnr);
851
                                                    rxSnr);
852
            }
852
            }
853
          else
853
          else
 Lines 869-887    Link Here 
869
      SnrTag tag;
869
      SnrTag tag;
870
      packet->RemovePacketTag (tag);
870
      packet->RemovePacketTag (tag);
871
      m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
871
      m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
872
                                    rxSnr, txMode);
872
                                    rxSnr, txVector.GetMode  ());
873
      m_stationManager->ReportRtsOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
873
      m_stationManager->ReportRtsOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
874
                                     rxSnr, txMode, tag.Get ());
874
                                     rxSnr, txVector.GetMode  (), tag.Get ());
875
875
876
      m_ctsTimeoutEvent.Cancel ();
876
      m_ctsTimeoutEvent.Cancel ();
877
      NotifyCtsTimeoutResetNow ();
877
      NotifyCtsTimeoutResetNow ();
878
      m_listener->GotCts (rxSnr, txMode);
878
      m_listener->GotCts (rxSnr, txVector.GetMode  ());
879
      NS_ASSERT (m_sendDataEvent.IsExpired ());
879
      NS_ASSERT (m_sendDataEvent.IsExpired ());
880
      m_sendDataEvent = Simulator::Schedule (GetSifs (),
880
      m_sendDataEvent = Simulator::Schedule (GetSifs (),
881
                                             &MacLow::SendDataAfterCts, this,
881
                                             &MacLow::SendDataAfterCts, this,
882
                                             hdr.GetAddr1 (),
882
                                             hdr.GetAddr1 (),
883
                                             hdr.GetDuration (),
883
                                             hdr.GetDuration ());
884
                                             txMode);
885
    }
884
    }
886
  else if (hdr.IsAck ()
885
  else if (hdr.IsAck ()
887
           && hdr.GetAddr1 () == m_self
886
           && hdr.GetAddr1 () == m_self
 Lines 894-902    Link Here 
894
      SnrTag tag;
893
      SnrTag tag;
895
      packet->RemovePacketTag (tag);
894
      packet->RemovePacketTag (tag);
896
      m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
895
      m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
897
                                    rxSnr, txMode);
896
                                    rxSnr, txVector.GetMode  ());
898
      m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
897
      m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
899
                                      rxSnr, txMode, tag.Get ());
898
                                      rxSnr, txVector.GetMode  (), tag.Get ());
900
        
899
        
901
      bool gotAck = false;
900
      bool gotAck = false;
902
      if (m_txParams.MustWaitNormalAck ()
901
      if (m_txParams.MustWaitNormalAck ()
 Lines 915-921    Link Here 
915
        }
914
        }
916
      if (gotAck)
915
      if (gotAck)
917
        {
916
        {
918
          m_listener->GotAck (rxSnr, txMode);
917
          m_listener->GotAck (rxSnr, txVector.GetMode  ());
919
        }
918
        }
920
      if (m_txParams.HasNextPacket ())
919
      if (m_txParams.HasNextPacket ())
921
        {
920
        {
 Lines 932-938    Link Here 
932
      packet->RemoveHeader (blockAck);
931
      packet->RemoveHeader (blockAck);
933
      m_blockAckTimeoutEvent.Cancel ();
932
      m_blockAckTimeoutEvent.Cancel ();
934
      NotifyAckTimeoutResetNow ();
933
      NotifyAckTimeoutResetNow ();
935
      m_listener->GotBlockAck (&blockAck, hdr.GetAddr2 (),txMode);
934
      m_listener->GotBlockAck (&blockAck, hdr.GetAddr2 (),txVector.GetMode  ());
936
      m_sentMpdus = 0;
935
      m_sentMpdus = 0;
937
      m_ampdu = false;
936
      m_ampdu = false;
938
    }
937
    }
 Lines 962-968    Link Here 
962
                                                        blockAckReq,
961
                                                        blockAckReq,
963
                                                        hdr.GetAddr2 (),
962
                                                        hdr.GetAddr2 (),
964
                                                        hdr.GetDuration (),
963
                                                        hdr.GetDuration (),
965
                                                        txMode);
964
                                                        txVector.GetMode ());
966
                }
965
                }
967
              else
966
              else
968
                {
967
                {
 Lines 988-994    Link Here 
988
  else if (hdr.GetAddr1 () == m_self)
987
  else if (hdr.GetAddr1 () == m_self)
989
    {
988
    {
990
      m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
989
      m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
991
                                    rxSnr, txMode);
990
                                    rxSnr, txVector.GetMode  ());
992
      if (hdr.IsQosData () && ReceiveMpdu (packet, hdr))
991
      if (hdr.IsQosData () && ReceiveMpdu (packet, hdr))
993
        {
992
        {
994
          /* From section 9.10.4 in IEEE 802.11:
993
          /* From section 9.10.4 in IEEE 802.11:
 Lines 1009-1015    Link Here 
1009
                                                    &MacLow::SendAckAfterData, this,
1008
                                                    &MacLow::SendAckAfterData, this,
1010
                                                    hdr.GetAddr2 (),
1009
                                                    hdr.GetAddr2 (),
1011
                                                    hdr.GetDuration (),
1010
                                                    hdr.GetDuration (),
1012
                                                    txMode,
1011
                                                    txVector.GetMode  (),
1013
                                                    rxSnr);
1012
                                                    rxSnr);
1014
              m_receivedAtLeastOneMpdu = false;
1013
              m_receivedAtLeastOneMpdu = false;
1015
            }
1014
            }
 Lines 1060-1066    Link Here 
1060
                                                    &MacLow::SendAckAfterData, this,
1059
                                                    &MacLow::SendAckAfterData, this,
1061
                                                    hdr.GetAddr2 (),
1060
                                                    hdr.GetAddr2 (),
1062
                                                    hdr.GetDuration (),
1061
                                                    hdr.GetDuration (),
1063
                                                    txMode,
1062
                                                    txVector.GetMode (),
1064
                                                    rxSnr);
1063
                                                    rxSnr);
1065
            }
1064
            }
1066
        }
1065
        }
 Lines 1165-1196    Link Here 
1165
Time
1164
Time
1166
MacLow::GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const
1165
MacLow::GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const
1167
{
1166
{
1168
  WifiTxVector ackTxVector = GetAckTxVectorForData (to, dataTxVector.GetMode());
1167
  WifiTxVector ackTxVector = GetAckTxVectorForData (to, dataTxVector.GetMode ());
1169
  return GetAckDuration (ackTxVector);
1168
  return GetAckDuration (ackTxVector);
1170
}
1169
}
1171
Time
1170
Time
1172
MacLow::GetAckDuration (WifiTxVector ackTxVector) const
1171
MacLow::GetAckDuration (WifiTxVector ackTxVector) const
1173
{
1172
{
1174
  WifiPreamble preamble;
1173
  NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); // ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
1175
  if (ackTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1174
  return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency(), 0, 0);
1176
    preamble= WIFI_PREAMBLE_HT_MF;
1177
  else
1178
    preamble=WIFI_PREAMBLE_LONG;
1179
  return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, preamble, m_phy->GetFrequency(), 0, 0);
1180
}
1175
}
1181
Time
1176
Time
1182
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const
1177
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const
1183
{
1178
{
1184
  /*
1179
  /*
1185
   * For immediate BlockAck we should transmit the frame with the same WifiMode
1180
   * For immediate Basic BlockAck we should transmit the frame with the same WifiMode
1186
   * as the BlockAckReq.
1181
   * as the BlockAckReq.
1187
   *
1188
   * from section 9.6 in IEEE 802.11e:
1189
   * The BlockAck control frame shall be sent at the same rate and modulation class as
1190
   * the BlockAckReq frame if it is sent in response to a BlockAckReq frame.
1191
   */
1182
   */
1192
  WifiPreamble preamble;
1183
  WifiPreamble preamble;
1193
  if (blockAckReqTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1184
  if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && type == BASIC_BLOCK_ACK)
1194
    preamble= WIFI_PREAMBLE_HT_MF;
1185
    preamble= WIFI_PREAMBLE_HT_MF;
1195
  else
1186
  else
1196
    preamble=WIFI_PREAMBLE_LONG;
1187
    preamble=WIFI_PREAMBLE_LONG;
 Lines 1199-1217    Link Here 
1199
Time
1190
Time
1200
MacLow::GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const
1191
MacLow::GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const
1201
{
1192
{
1202
  WifiTxVector ctsTxVector = GetCtsTxVectorForRts (to, rtsTxVector.GetMode());
1193
  WifiTxVector ctsTxVector = GetCtsTxVectorForRts (to, rtsTxVector.GetMode ());
1203
  return GetCtsDuration (ctsTxVector);
1194
  return GetCtsDuration (ctsTxVector);
1204
}
1195
}
1205
1196
1206
Time
1197
Time
1207
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const
1198
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const
1208
{
1199
{
1209
  WifiPreamble preamble;
1200
  NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); // CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1210
  if (ctsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1201
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency(), 0, 0);
1211
    preamble= WIFI_PREAMBLE_HT_MF;
1212
  else
1213
    preamble=WIFI_PREAMBLE_LONG;
1214
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency(), 0, 0);
1215
}
1202
}
1216
uint32_t
1203
uint32_t
1217
MacLow::GetCtsSize (void) const
1204
MacLow::GetCtsSize (void) const
 Lines 1296-1307    Link Here 
1296
        {
1283
        {
1297
          preamble = WIFI_PREAMBLE_HT_GF;
1284
          preamble = WIFI_PREAMBLE_HT_GF;
1298
        }
1285
        }
1299
      else if (rtsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1300
        {
1301
          preamble = WIFI_PREAMBLE_HT_MF;
1302
        }
1303
      else
1286
      else
1304
        {
1287
        {
1288
          //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1305
          preamble = WIFI_PREAMBLE_LONG;
1289
          preamble = WIFI_PREAMBLE_LONG;
1306
        }
1290
        }
1307
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency(), 0, 0);
1291
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency(), 0, 0);
 Lines 1309-1318    Link Here 
1309
      txTime += Time (GetSifs () * 2);
1293
      txTime += Time (GetSifs () * 2);
1310
    }
1294
    }
1311
  WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1295
  WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1312
  //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2
1313
  if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1296
  if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1314
    preamble= WIFI_PREAMBLE_HT_GF;
1297
    preamble= WIFI_PREAMBLE_HT_GF;
1315
  else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1298
  else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1316
    preamble= WIFI_PREAMBLE_HT_MF;
1299
    preamble= WIFI_PREAMBLE_HT_MF;
1317
  else
1300
  else
1318
    preamble=WIFI_PREAMBLE_LONG;
1301
    preamble=WIFI_PREAMBLE_LONG;
 Lines 1336-1348    Link Here 
1336
    {
1319
    {
1337
      WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1320
      WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
1338
      WifiPreamble preamble;
1321
      WifiPreamble preamble;
1339
        //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2
1322
      //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2
1340
      if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1323
      if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1341
         preamble= WIFI_PREAMBLE_HT_GF;
1324
         preamble= WIFI_PREAMBLE_HT_GF;
1342
      else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1325
      else //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1343
        preamble= WIFI_PREAMBLE_HT_MF;
1326
         preamble = WIFI_PREAMBLE_LONG;
1344
      else
1345
        preamble=WIFI_PREAMBLE_LONG;
1346
      txTime += GetSifs ();
1327
      txTime += GetSifs ();
1347
      txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency(), 0, 0);
1328
      txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency(), 0, 0);
1348
    }
1329
    }
 Lines 1350-1356    Link Here 
1350
}
1331
}
1351
1332
1352
void
1333
void
1353
MacLow::NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble)
1334
MacLow::NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiPreamble preamble)
1354
{
1335
{
1355
  NS_ASSERT (m_lastNavStart <= Simulator::Now ());
1336
  NS_ASSERT (m_lastNavStart <= Simulator::Now ());
1356
  Time duration = hdr.GetDuration ();
1337
  Time duration = hdr.GetDuration ();
 Lines 1468-1474    Link Here 
1468
  NS_LOG_DEBUG ("send " << hdr->GetTypeString () <<
1449
  NS_LOG_DEBUG ("send " << hdr->GetTypeString () <<
1469
                ", to=" << hdr->GetAddr1 () <<
1450
                ", to=" << hdr->GetAddr1 () <<
1470
                ", size=" << packet->GetSize () <<
1451
                ", size=" << packet->GetSize () <<
1471
                ", mode=" << txVector.GetMode() <<
1452
                ", mode=" << txVector.GetMode  () <<
1472
                ", duration=" << hdr->GetDuration () <<
1453
                ", duration=" << hdr->GetDuration () <<
1473
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1454
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1474
  if (!m_ampdu || hdr->IsRts ())
1455
  if (!m_ampdu || hdr->IsRts ())
 Lines 1629-1640    Link Here 
1629
1610
1630
  WifiPreamble preamble;
1611
  WifiPreamble preamble;
1631
  //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2
1612
  //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2
1632
  if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1613
  if (m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1633
    preamble= WIFI_PREAMBLE_HT_GF;
1614
    preamble= WIFI_PREAMBLE_HT_GF;
1634
  else if (rtsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1615
  else //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1635
    preamble= WIFI_PREAMBLE_HT_MF;
1616
    preamble = WIFI_PREAMBLE_LONG;
1636
  else
1637
    preamble=WIFI_PREAMBLE_LONG;
1638
1617
1639
  if (m_txParams.HasDurationId ())
1618
  if (m_txParams.HasDurationId ())
1640
    {
1619
    {
 Lines 1651-1662    Link Here 
1651
      duration += GetSifs ();
1630
      duration += GetSifs ();
1652
      if (m_txParams.MustWaitBasicBlockAck ())
1631
      if (m_txParams.MustWaitBasicBlockAck ())
1653
        {
1632
        {
1654
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode());
1633
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode  ());
1655
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1634
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1656
        }
1635
        }
1657
      else if (m_txParams.MustWaitCompressedBlockAck ())
1636
      else if (m_txParams.MustWaitCompressedBlockAck ())
1658
        {
1637
        {
1659
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode());
1638
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2(), dataTxVector.GetMode  ());
1660
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1639
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1661
        }
1640
        }
1662
      else if (m_txParams.MustWaitAck ())
1641
      else if (m_txParams.MustWaitAck ())
 Lines 1699-1705    Link Here 
1699
  //Since it is data then it can have format = GF
1678
  //Since it is data then it can have format = GF
1700
  if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1679
  if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1701
    preamble= WIFI_PREAMBLE_HT_GF;
1680
    preamble= WIFI_PREAMBLE_HT_GF;
1702
  else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1681
  else if (dataTxVector.GetMode  ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1703
    preamble= WIFI_PREAMBLE_HT_MF;
1682
    preamble= WIFI_PREAMBLE_HT_MF;
1704
  else
1683
  else
1705
    preamble=WIFI_PREAMBLE_LONG;
1684
    preamble=WIFI_PREAMBLE_LONG;
 Lines 1774-1780    Link Here 
1774
  if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1753
  if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1775
     //In the future has to make sure that receiver has greenfield enabled
1754
     //In the future has to make sure that receiver has greenfield enabled
1776
     preamble= WIFI_PREAMBLE_HT_GF;
1755
     preamble= WIFI_PREAMBLE_HT_GF;
1777
  else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1756
  else if (dataTxVector.GetMode  ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1778
    preamble= WIFI_PREAMBLE_HT_MF;
1757
    preamble= WIFI_PREAMBLE_HT_MF;
1779
  else
1758
  else
1780
     preamble=WIFI_PREAMBLE_LONG;
1759
     preamble=WIFI_PREAMBLE_LONG;
 Lines 1791-1803    Link Here 
1791
      if (m_txParams.MustWaitBasicBlockAck ())
1770
      if (m_txParams.MustWaitBasicBlockAck ())
1792
        {
1771
        {
1793
          duration += GetSifs ();
1772
          duration += GetSifs ();
1794
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1773
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
1795
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1774
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1796
        }
1775
        }
1797
      else if (m_txParams.MustWaitCompressedBlockAck ())
1776
      else if (m_txParams.MustWaitCompressedBlockAck ())
1798
        {
1777
        {
1799
          duration += GetSifs ();
1778
          duration += GetSifs ();
1800
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1779
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
1801
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1780
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1802
        }
1781
        }
1803
      else if (m_txParams.MustWaitAck ())
1782
      else if (m_txParams.MustWaitAck ())
 Lines 1826-1832    Link Here 
1826
      m_currentPacket->AddTrailer (fcs);
1805
      m_currentPacket->AddTrailer (fcs);
1827
    }
1806
    }
1828
1807
1829
  ForwardDown (m_currentPacket, &m_currentHdr, dataTxVector,preamble);
1808
  ForwardDown (m_currentPacket, &m_currentHdr, dataTxVector, preamble);
1830
  m_currentPacket = 0;
1809
  m_currentPacket = 0;
1831
}
1810
}
1832
1811
 Lines 1856-1862    Link Here 
1856
  WifiTxVector ctsTxVector = GetCtsToSelfTxVector (m_currentPacket, &m_currentHdr);
1835
  WifiTxVector ctsTxVector = GetCtsToSelfTxVector (m_currentPacket, &m_currentHdr);
1857
1836
1858
  WifiPreamble preamble;
1837
  WifiPreamble preamble;
1859
  if (ctsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1838
  if (ctsTxVector.GetMode  ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1860
    preamble= WIFI_PREAMBLE_HT_MF;
1839
    preamble= WIFI_PREAMBLE_HT_MF;
1861
  else
1840
  else
1862
    preamble=WIFI_PREAMBLE_LONG;
1841
    preamble=WIFI_PREAMBLE_LONG;
 Lines 1877-1889    Link Here 
1877
        {
1856
        {
1878
          
1857
          
1879
          duration += GetSifs ();
1858
          duration += GetSifs ();
1880
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1859
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
1881
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1860
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1882
        }
1861
        }
1883
      else if (m_txParams.MustWaitCompressedBlockAck ())
1862
      else if (m_txParams.MustWaitCompressedBlockAck ())
1884
        {
1863
        {
1885
          duration += GetSifs ();
1864
          duration += GetSifs ();
1886
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1865
          WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
1887
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1866
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1888
        }
1867
        }
1889
      else if (m_txParams.MustWaitAck ())
1868
      else if (m_txParams.MustWaitAck ())
 Lines 1899-1905    Link Here 
1899
          if (m_txParams.MustWaitCompressedBlockAck ())
1878
          if (m_txParams.MustWaitCompressedBlockAck ())
1900
            {
1879
            {
1901
              duration += GetSifs ();
1880
              duration += GetSifs ();
1902
              WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1881
              WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
1903
              duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1882
              duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1904
            }
1883
            }
1905
          else if (m_txParams.MustWaitAck ())
1884
          else if (m_txParams.MustWaitAck ())
 Lines 1926-1942    Link Here 
1926
  m_sendDataEvent = Simulator::Schedule (txDuration,
1905
  m_sendDataEvent = Simulator::Schedule (txDuration,
1927
                                         &MacLow::SendDataAfterCts, this,
1906
                                         &MacLow::SendDataAfterCts, this,
1928
                                         cts.GetAddr1 (),
1907
                                         cts.GetAddr1 (),
1929
                                         duration,
1908
                                         duration);
1930
                                         ctsTxVector.GetMode());
1931
}
1909
}
1932
void
1910
void
1933
MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiMode rtsTxMode, double rtsSnr)
1911
MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiTxVector rtsTxVector, double rtsSnr)
1934
{
1912
{
1935
  NS_LOG_FUNCTION (this << source << duration << rtsTxMode << rtsSnr);
1913
  NS_LOG_FUNCTION (this << source << duration << rtsTxVector.GetMode () << rtsSnr);
1936
  /* send a CTS when you receive a RTS
1914
  /* send a CTS when you receive a RTS
1937
   * right after SIFS.
1915
   * right after SIFS.
1938
   */
1916
   */
1939
 WifiTxVector ctsTxVector = GetCtsTxVector (source, rtsTxMode);
1917
  WifiTxVector ctsTxVector = GetCtsTxVector (source, rtsTxVector.GetMode ());
1940
  WifiMacHeader cts;
1918
  WifiMacHeader cts;
1941
  cts.SetType (WIFI_MAC_CTL_CTS);
1919
  cts.SetType (WIFI_MAC_CTL_CTS);
1942
  cts.SetDsNotFrom ();
1920
  cts.SetDsNotFrom ();
 Lines 1944-1950    Link Here 
1944
  cts.SetNoMoreFragments ();
1922
  cts.SetNoMoreFragments ();
1945
  cts.SetNoRetry ();
1923
  cts.SetNoRetry ();
1946
  cts.SetAddr1 (source);
1924
  cts.SetAddr1 (source);
1947
  duration -= GetCtsDuration (source, ctsTxVector);
1925
  duration -= GetCtsDuration (source, rtsTxVector);
1948
  duration -= GetSifs ();
1926
  duration -= GetSifs ();
1949
  NS_ASSERT (duration >= MicroSeconds (0));
1927
  NS_ASSERT (duration >= MicroSeconds (0));
1950
  cts.SetDuration (duration);
1928
  cts.SetDuration (duration);
 Lines 1958-1973    Link Here 
1958
  tag.Set (rtsSnr);
1936
  tag.Set (rtsSnr);
1959
  packet->AddPacketTag (tag);
1937
  packet->AddPacketTag (tag);
1960
1938
1961
  WifiPreamble preamble;
1939
  //CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1962
  if (ctsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1940
  ForwardDown (packet, &cts, ctsTxVector, WIFI_PREAMBLE_LONG);
1963
    preamble= WIFI_PREAMBLE_HT_MF;
1964
  else
1965
    preamble=WIFI_PREAMBLE_LONG;
1966
  ForwardDown (packet, &cts, ctsTxVector,preamble);
1967
}
1941
}
1968
1942
1969
void
1943
void
1970
MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode)
1944
MacLow::SendDataAfterCts (Mac48Address source, Time duration)
1971
{
1945
{
1972
  NS_LOG_FUNCTION (this);
1946
  NS_LOG_FUNCTION (this);
1973
  /* send the third step in a
1947
  /* send the third step in a
 Lines 1980-1986    Link Here 
1980
  if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1954
  if (m_phy->GetGreenfield() && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
1981
     //In the future has to make sure that receiver has greenfield enabled
1955
     //In the future has to make sure that receiver has greenfield enabled
1982
     preamble= WIFI_PREAMBLE_HT_GF;
1956
     preamble= WIFI_PREAMBLE_HT_GF;
1983
  else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
1957
  else if (dataTxVector.GetMode  ().GetModulationClass () == WIFI_MOD_CLASS_HT)
1984
    preamble= WIFI_PREAMBLE_HT_MF;
1958
    preamble= WIFI_PREAMBLE_HT_MF;
1985
  else
1959
  else
1986
     preamble=WIFI_PREAMBLE_LONG;
1960
     preamble=WIFI_PREAMBLE_LONG;
 Lines 1990-2002    Link Here 
1990
  if (m_txParams.MustWaitBasicBlockAck ())
1964
  if (m_txParams.MustWaitBasicBlockAck ())
1991
    {
1965
    {
1992
      newDuration += GetSifs ();
1966
      newDuration += GetSifs ();
1993
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1967
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
1994
      newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1968
      newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
1995
    }
1969
    }
1996
  else if (m_txParams.MustWaitCompressedBlockAck ())
1970
  else if (m_txParams.MustWaitCompressedBlockAck ())
1997
    {
1971
    {
1998
      newDuration += GetSifs ();
1972
      newDuration += GetSifs ();
1999
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1973
      WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
2000
      newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1974
      newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
2001
    }
1975
    }
2002
  else if (m_txParams.MustWaitAck ())
1976
  else if (m_txParams.MustWaitAck ())
 Lines 2011-2017    Link Here 
2011
      if (m_txParams.MustWaitCompressedBlockAck ())
1985
      if (m_txParams.MustWaitCompressedBlockAck ())
2012
        {
1986
        {
2013
           newDuration += GetSifs ();
1987
           newDuration += GetSifs ();
2014
           WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode());
1988
           WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode  ());
2015
           newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
1989
           newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
2016
        }
1990
        }
2017
      else if (m_txParams.MustWaitAck ())
1991
      else if (m_txParams.MustWaitAck ())
 Lines 2093-2105    Link Here 
2093
  tag.Set (dataSnr);
2067
  tag.Set (dataSnr);
2094
  packet->AddPacketTag (tag);
2068
  packet->AddPacketTag (tag);
2095
2069
2096
   //since ACK is a control response it can't have format GF
2070
  //ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
2097
  WifiPreamble preamble;
2071
  ForwardDown (packet, &ack, ackTxVector, WIFI_PREAMBLE_LONG);
2098
  if (ackTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
2099
    preamble= WIFI_PREAMBLE_HT_MF;
2100
  else
2101
    preamble=WIFI_PREAMBLE_LONG;
2102
  ForwardDown (packet, &ack, ackTxVector, preamble);
2103
}
2072
}
2104
2073
2105
bool
2074
bool
 Lines 2389-2395    Link Here 
2389
  WifiMacTrailer fcs;
2358
  WifiMacTrailer fcs;
2390
  packet->AddTrailer (fcs);
2359
  packet->AddTrailer (fcs);
2391
  WifiPreamble preamble;
2360
  WifiPreamble preamble;
2392
  if (blockAckReqTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
2361
  if (blockAckReqTxVector.GetMode  ().GetModulationClass () == WIFI_MOD_CLASS_HT)
2393
    preamble= WIFI_PREAMBLE_HT_MF;
2362
    preamble= WIFI_PREAMBLE_HT_MF;
2394
  else
2363
  else
2395
    preamble=WIFI_PREAMBLE_LONG;
2364
    preamble=WIFI_PREAMBLE_LONG;
 Lines 2397-2403    Link Here 
2397
  m_currentPacket = 0;
2366
  m_currentPacket = 0;
2398
}
2367
}
2399
void 
2368
void 
2400
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode)
2369
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector)
2401
{
2370
{
2402
  NS_LOG_FUNCTION (this);
2371
  NS_LOG_FUNCTION (this);
2403
  CtrlBAckResponseHeader blockAck;
2372
  CtrlBAckResponseHeader blockAck;
 Lines 2415-2421    Link Here 
2415
  NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
2384
  NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
2416
  (*i).second.FillBlockAckBitmap (&blockAck);  
2385
  (*i).second.FillBlockAckBitmap (&blockAck);  
2417
2386
2418
  SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxMode);
2387
  SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode  ());
2419
}
2388
}
2420
2389
2421
void
2390
void
 Lines 2514-2522    Link Here 
2514
}
2483
}
2515
2484
2516
void
2485
void
2517
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiMode txMode, WifiPreamble preamble)
2486
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble)
2518
{
2487
{
2519
  m_currentMode = txMode;
2488
  m_currentTxVector = txVector;
2520
  AmpduTag ampdu;
2489
  AmpduTag ampdu;
2521
  bool normalAck = false;
2490
  bool normalAck = false;
2522
  bool ampduSubframe = false;
2491
  bool ampduSubframe = false;
 Lines 2529-2544    Link Here 
2529
      WifiMacHeader firsthdr;
2498
      WifiMacHeader firsthdr;
2530
      (*n).first->PeekHeader(firsthdr);
2499
      (*n).first->PeekHeader(firsthdr);
2531
      NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ());
2500
      NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ());
2532
      NotifyNav ((*n).first,firsthdr, txMode, preamble);
2501
      NotifyNav ((*n).first,firsthdr, preamble);
2533
      if (firsthdr.GetAddr1 () == m_self)
2502
      if (firsthdr.GetAddr1 () == m_self)
2534
        {
2503
        {
2535
          m_receivedAtLeastOneMpdu = true;
2504
          m_receivedAtLeastOneMpdu = true;
2536
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
2505
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
2537
              ReceiveOk ((*n).first, rxSnr, txMode, preamble, ampduSubframe);
2506
              ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe);
2538
          else if (firsthdr.IsData () || firsthdr.IsQosData ())
2507
          else if (firsthdr.IsData () || firsthdr.IsQosData ())
2539
            {
2508
            {
2540
              NS_LOG_DEBUG ("Deaagregate packet with sequence=" << firsthdr.GetSequenceNumber ());
2509
              NS_LOG_DEBUG ("Deaagregate packet with sequence=" << firsthdr.GetSequenceNumber ());
2541
              ReceiveOk ((*n).first, rxSnr, txMode, preamble, ampduSubframe);
2510
              ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe);
2542
              if (firsthdr.IsQosAck ())
2511
              if (firsthdr.IsQosAck ())
2543
                {
2512
                {
2544
                  NS_LOG_DEBUG ("Normal Ack");
2513
                  NS_LOG_DEBUG ("Normal Ack");
 Lines 2569-2575    Link Here 
2569
                                                    firsthdr.GetQosTid(),
2538
                                                    firsthdr.GetQosTid(),
2570
                                                    firsthdr.GetAddr2 (),
2539
                                                    firsthdr.GetAddr2 (),
2571
                                                    firsthdr.GetDuration (),
2540
                                                    firsthdr.GetDuration (),
2572
                                                    txMode);
2541
                                                    txVector);
2573
            } 
2542
            } 
2574
          else
2543
          else
2575
            { 
2544
            { 
 Lines 2580-2586    Link Here 
2580
    }
2549
    }
2581
  else
2550
  else
2582
    {     
2551
    {     
2583
          ReceiveOk (aggregatedPacket,rxSnr, txMode, preamble, ampduSubframe);
2552
          ReceiveOk (aggregatedPacket,rxSnr, txVector, preamble, ampduSubframe);
2584
    }
2553
    }
2585
}
2554
}
2586
2555
 Lines 2591-2604    Link Here 
2591
    WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
2560
    WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
2592
    if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
2561
    if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
2593
        preamble = WIFI_PREAMBLE_HT_GF;
2562
        preamble = WIFI_PREAMBLE_HT_GF;
2594
    else
2563
    else //Block ACK following implicit BAR always use non-HT PPDU
2595
        preamble = WIFI_PREAMBLE_HT_MF;
2564
        preamble = WIFI_PREAMBLE_LONG;
2596
    
2565
    
2597
    if (peekedPacket == 0)
2566
    if (peekedPacket == 0)
2598
        return true;
2567
        return true;
2599
    
2568
    
2600
    //An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds)
2569
    //An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds)
2601
    if(m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () +WIFI_MAC_FCS_LENGTH,dataTxVector, preamble, m_phy->GetFrequency(), 0, 0) > MilliSeconds(10))
2570
    if(m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, dataTxVector, preamble, m_phy->GetFrequency(), 0, 0) > MilliSeconds(10))
2602
        return true;
2571
        return true;
2603
    
2572
    
2604
    if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size))
2573
    if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size))
(-)a/src/wifi/model/mac-low.h (-11 / +10 lines)
 Lines 698-711    Link Here 
698
  /**
698
  /**
699
   * \param packet packet received
699
   * \param packet packet received
700
   * \param rxSnr snr of packet received
700
   * \param rxSnr snr of packet received
701
   * \param txMode transmission mode of packet received
701
   * \param txVector TXVECTOR of packet received
702
   * \param preamble type of preamble used for the packet received
702
   * \param preamble type of preamble used for the packet received
703
   * \param ampduSubframe true if this MPDU is part of an A-MPDU
703
   * \param ampduSubframe true if this MPDU is part of an A-MPDU
704
   *
704
   *
705
   * This method is typically invoked by the lower PHY layer to notify
705
   * This method is typically invoked by the lower PHY layer to notify
706
   * the MAC layer that a packet was successfully received.
706
   * the MAC layer that a packet was successfully received.
707
   */
707
   */
708
  void ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble, bool ampduSubframe);
708
  void ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe);
709
  /**
709
  /**
710
   * \param packet packet received.
710
   * \param packet packet received.
711
   * \param rxSnr snr of packet received.
711
   * \param rxSnr snr of packet received.
 Lines 775-787    Link Here 
775
  /**
775
  /**
776
   * \param aggregatedPacket which is the current A-MPDU
776
   * \param aggregatedPacket which is the current A-MPDU
777
   * \param rxSnr snr of packet received
777
   * \param rxSnr snr of packet received
778
   * \param txMode transmission mode of packet received
778
   * \param txVector TXVECTOR of packet received
779
   * \param preamble type of preamble used for the packet received        
779
   * \param preamble type of preamble used for the packet received        
780
   *
780
   *
781
   * This function de-aggregates an A-MPDU and decide if each MPDU is received correctly or not
781
   * This function de-aggregates an A-MPDU and decide if each MPDU is received correctly or not
782
   * 
782
   * 
783
   */
783
   */
784
  void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiMode txMode, WifiPreamble preamble);
784
  void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble);
785
  /**
785
  /**
786
   * \param peekedPacket the packet to be aggregated
786
   * \param peekedPacket the packet to be aggregated
787
   * \param peekedHdr the WifiMacHeader for the packet.
787
   * \param peekedHdr the WifiMacHeader for the packet.
 Lines 998-1004    Link Here 
998
  Time CalculateOverallTxTime (Ptr<const Packet> packet,
998
  Time CalculateOverallTxTime (Ptr<const Packet> packet,
999
                               const WifiMacHeader* hdr,
999
                               const WifiMacHeader* hdr,
1000
                               const MacLowTransmissionParameters &params) const;
1000
                               const MacLowTransmissionParameters &params) const;
1001
  void NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble);
1001
  void NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiPreamble preamble);
1002
  /**
1002
  /**
1003
   * Reset NAV with the given duration.
1003
   * Reset NAV with the given duration.
1004
   *
1004
   *
 Lines 1086-1095    Link Here 
1086
   *
1086
   *
1087
   * \param source
1087
   * \param source
1088
   * \param duration
1088
   * \param duration
1089
   * \param txMode
1089
   * \param rtsTxVector
1090
   * \param rtsSnr
1090
   * \param rtsSnr
1091
   */
1091
   */
1092
  void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr);
1092
  void SendCtsAfterRts (Mac48Address source, Time duration, WifiTxVector rtsTxVector, double rtsSnr);
1093
  /**
1093
  /**
1094
   * Send ACK after receiving DATA.
1094
   * Send ACK after receiving DATA.
1095
   *
1095
   *
 Lines 1104-1112    Link Here 
1104
   *
1104
   *
1105
   * \param source
1105
   * \param source
1106
   * \param duration
1106
   * \param duration
1107
   * \param txMode
1108
   */
1107
   */
1109
  void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode);
1108
  void SendDataAfterCts (Mac48Address source, Time duration);
1110
  /**
1109
  /**
1111
   * Event handler that is usually scheduled to fired at the appropriate time
1110
   * Event handler that is usually scheduled to fired at the appropriate time
1112
   * after completing transmissions.
1111
   * after completing transmissions.
 Lines 1200-1206    Link Here 
1200
   * block ack agreement and creates block ack bitmap on a received packets basis.
1199
   * block ack agreement and creates block ack bitmap on a received packets basis.
1201
   */
1200
   */
1202
  void SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator,
1201
  void SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator,
1203
                                          Time duration, WifiMode blockAckReqTxMode);
1202
                                          Time duration, WifiTxVector blockAckReqTxVector);
1204
  /**
1203
  /**
1205
   * This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
1204
   * This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
1206
   *
1205
   *
 Lines 1318-1324    Link Here 
1318
  bool m_ctsToSelfSupported;          //!< Flag whether CTS-to-self is supported
1317
  bool m_ctsToSelfSupported;          //!< Flag whether CTS-to-self is supported
1319
  uint8_t m_sentMpdus;                //!< Number of transmitted MPDUs in an A-MPDU that have not been acknowledged yet
1318
  uint8_t m_sentMpdus;                //!< Number of transmitted MPDUs in an A-MPDU that have not been acknowledged yet
1320
  Ptr<WifiMacQueue> m_aggregateQueue; //!< Queue used for MPDU aggregation
1319
  Ptr<WifiMacQueue> m_aggregateQueue; //!< Queue used for MPDU aggregation
1321
  WifiMode m_currentMode;             //!< mode used for the current packet transmission
1320
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1322
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1321
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1323
};
1322
};
1324
1323
(-)a/src/wifi/model/wifi-phy-state-helper.cc (-3 / +3 lines)
 Lines 415-428    Link Here 
415
}
415
}
416
416
417
void
417
void
418
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
418
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector, enum WifiPreamble preamble)
419
{
419
{
420
  m_rxOkTrace (packet, snr, mode, preamble);
420
  m_rxOkTrace (packet, snr, txVector.GetMode(), preamble);
421
  NotifyRxEndOk ();
421
  NotifyRxEndOk ();
422
  DoSwitchFromRx ();
422
  DoSwitchFromRx ();
423
  if (!m_rxOkCallback.IsNull ())
423
  if (!m_rxOkCallback.IsNull ())
424
    {
424
    {
425
      m_rxOkCallback (packet, snr, mode, preamble);
425
      m_rxOkCallback (packet, snr, txVector, preamble);
426
    }
426
    }
427
427
428
}
428
}
(-)a/src/wifi/model/wifi-phy-state-helper.h (-2 / +2 lines)
 Lines 157-166    Link Here 
157
   *
157
   *
158
   * \param packet the successfully received packet
158
   * \param packet the successfully received packet
159
   * \param snr the SNR of the received packet
159
   * \param snr the SNR of the received packet
160
   * \param mode the transmission mode of the packet
160
   * \param txVector TXVECTOR of the packet
161
   * \param preamble the preamble of the received packet
161
   * \param preamble the preamble of the received packet
162
   */
162
   */
163
  void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
163
  void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector, enum WifiPreamble preamble);
164
  /**
164
  /**
165
   * Switch from RX after the reception failed.
165
   * Switch from RX after the reception failed.
166
   *
166
   *
(-)a/src/wifi/model/wifi-phy.h (-2 / +2 lines)
 Lines 160-169    Link Here 
160
  /**
160
  /**
161
   * arg1: packet received successfully
161
   * arg1: packet received successfully
162
   * arg2: snr of packet
162
   * arg2: snr of packet
163
   * arg3: mode of packet
163
   * arg3: TXVECTOR of packet
164
   * arg4: type of preamble used for packet.
164
   * arg4: type of preamble used for packet.
165
   */
165
   */
166
  typedef Callback<void,Ptr<Packet>, double, WifiMode, enum WifiPreamble> RxOkCallback;
166
  typedef Callback<void,Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> RxOkCallback;
167
  /**
167
  /**
168
   * arg1: packet received unsuccessfully
168
   * arg1: packet received unsuccessfully
169
   * arg2: snr of packet
169
   * arg2: snr of packet
(-)a/src/wifi/model/wifi-remote-station-manager.cc (-11 / +15 lines)
 Lines 935-942    Link Here 
935
       i != m_bssBasicRateSet.end (); i++)
935
       i != m_bssBasicRateSet.end (); i++)
936
    {
936
    {
937
      if ((!found || i->GetPhyRate () > mode.GetPhyRate ())
937
      if ((!found || i->GetPhyRate () > mode.GetPhyRate ())
938
          && i->GetPhyRate () <= reqMode.GetPhyRate ()
938
          && (i->GetPhyRate () <= reqMode.GetPhyRate ())
939
          && i->GetModulationClass () == reqMode.GetModulationClass ())
939
          && ((i->GetModulationClass () == reqMode.GetModulationClass ())
940
              || (reqMode.GetModulationClass () == WIFI_MOD_CLASS_HT)))
940
        {
941
        {
941
          mode = *i;
942
          mode = *i;
942
          // We've found a potentially-suitable transmit rate, but we
943
          // We've found a potentially-suitable transmit rate, but we
 Lines 946-958    Link Here 
946
        }
947
        }
947
    }
948
    }
948
  if(HasHtSupported())
949
  if(HasHtSupported())
949
      {
950
    {
950
        if (!found)
951
      if (!found)
951
          {
952
        {
952
            uint8_t mcs = GetDefaultMcs (); 
953
          uint8_t mcs = GetDefaultMcs ();
953
            mode=  m_wifiPhy->McsToWifiMode (mcs); 
954
          mode = m_wifiPhy->McsToWifiMode (mcs);
954
          }
955
            
955
        for (WifiMcsListIterator i = m_bssBasicMcsSet.begin ();
956
          for (WifiMcsListIterator i = m_bssBasicMcsSet.begin ();
956
             i != m_bssBasicMcsSet.end (); i++)
957
             i != m_bssBasicMcsSet.end (); i++)
957
          {
958
          {
958
            WifiMode thismode=  m_wifiPhy->McsToWifiMode (*i); 
959
            WifiMode thismode=  m_wifiPhy->McsToWifiMode (*i); 
 Lines 967-977    Link Here 
967
                found = true;
968
                found = true;
968
              }
969
              }
969
          }
970
          }
971
        }
970
      }
972
      }
971
  // If we found a suitable rate in the BSSBasicRateSet, then we are
973
  // If we found a suitable rate in the BSSBasicRateSet, then we are
972
  // done and can return that mode.
974
  // done and can return that mode.
973
  if (found)
975
  if (found)
974
    {
976
    {
977
      NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
975
      return mode;
978
      return mode;
976
    }
979
    }
977
980
 Lines 1007-1014    Link Here 
1007
       */
1010
       */
1008
      if (thismode.IsMandatory ()
1011
      if (thismode.IsMandatory ()
1009
          && (!found || thismode.GetPhyRate () > mode.GetPhyRate ())
1012
          && (!found || thismode.GetPhyRate () > mode.GetPhyRate ())
1010
          && thismode.GetPhyRate () <= reqMode.GetPhyRate ()
1013
          && (thismode.GetPhyRate () <= reqMode.GetPhyRate ())
1011
          && thismode.GetModulationClass () == reqMode.GetModulationClass ())
1014
          && ((thismode.GetModulationClass () == reqMode.GetModulationClass ()) ||
1015
             (reqMode.GetModulationClass () == WIFI_MOD_CLASS_HT)))
1012
        {
1016
        {
1013
          mode = thismode;
1017
          mode = thismode;
1014
          // As above; we've found a potentially-suitable transmit
1018
          // As above; we've found a potentially-suitable transmit
(-)a/src/wifi/model/yans-wifi-phy.cc (-4 / +3 lines)
 Lines 530-540    Link Here 
530
530
531
  Ptr<InterferenceHelper::Event> event;
531
  Ptr<InterferenceHelper::Event> event;
532
  event = m_interference.Add (packet->GetSize (),
532
  event = m_interference.Add (packet->GetSize (),
533
                              txMode,
533
                              txVector,
534
                              preamble,
534
                              preamble,
535
                              rxDuration,
535
                              rxDuration,
536
                              rxPowerW,
536
                              rxPowerW);
537
		          txVector);  // we need it to calculate duration of HT training symbols
538
537
539
  switch (m_state->GetState ())
538
  switch (m_state->GetState ())
540
    {
539
    {
 Lines 976-982    Link Here 
976
      double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
975
      double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
977
      double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
976
      double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
978
      NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
977
      NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
979
      m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
978
      m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
980
    }
979
    }
981
  else
980
  else
982
    {
981
    {

Return to bug 2097