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

(-)a/src/devices/mesh/dot11s/airtime-metric.cc (-1 / +1 lines)
 Lines 86-92    Link Here 
86
   */
86
   */
87
  NS_ASSERT (!peerAddress.IsGroup ());
87
  NS_ASSERT (!peerAddress.IsGroup ());
88
  //obtain current rate:
88
  //obtain current rate:
89
  WifiMode mode = mac->GetStationManager ()->GetDataMode (peerAddress, &m_testHeader, m_testFrame, m_testFrame->GetSize ());
89
  WifiMode mode = mac->GetStationManager ()->GetDataTxVector (peerAddress, &m_testHeader, m_testFrame, m_testFrame->GetSize ()).mode;
90
  //obtain frame error rate:
90
  //obtain frame error rate:
91
  double failAvg = mac->GetStationManager ()->GetInfo (peerAddress).GetFrameErrorRate ();
91
  double failAvg = mac->GetStationManager ()->GetInfo (peerAddress).GetFrameErrorRate ();
92
  NS_ASSERT (failAvg < 1.0);
92
  NS_ASSERT (failAvg < 1.0);
(-)a/src/devices/wifi/aarf-wifi-manager.cc (-6 / +6 lines)
 Lines 200-218    Link Here 
200
AarfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
200
AarfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
201
{}
201
{}
202
202
203
WifiMode
203
WifiTxVector
204
AarfWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
204
AarfWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
205
{
205
{
206
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
206
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
207
  return GetSupported (station, station->m_rate);
207
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel ());
208
}
208
}
209
WifiMode
209
WifiTxVector
210
AarfWifiManager::DoGetRtsMode (WifiRemoteStation *st)
210
AarfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
211
{
211
{
212
  // XXX: we could/should implement the Aarf algorithm for
212
  // XXX: we could/should implement the Aarf algorithm for
213
  // RTS only by picking a single rate within the BasicRateSet.
213
  // RTS only by picking a single rate within the BasicRateSet.
214
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
214
  AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
215
  return GetSupported (station, 0);
215
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel ());
216
}
216
}
217
217
218
bool 
218
bool 
(-)a/src/devices/wifi/aarf-wifi-manager.h (-2 / +2 lines)
 Lines 51-58    Link Here 
51
                               double ackSnr, WifiMode ackMode, double dataSnr);
51
                               double ackSnr, WifiMode ackMode, double dataSnr);
52
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
52
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
53
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
53
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
54
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
54
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
55
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
55
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
56
  virtual bool IsLowLatency (void) const;
56
  virtual bool IsLowLatency (void) const;
57
57
58
  uint32_t m_minTimerThreshold;
58
  uint32_t m_minTimerThreshold;
(-)a/src/devices/wifi/aarfcd-wifi-manager.cc (-6 / +6 lines)
 Lines 279-297    Link Here 
279
AarfcdWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
279
AarfcdWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
280
{}
280
{}
281
281
282
WifiMode
282
WifiTxVector
283
AarfcdWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
283
AarfcdWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
284
{
284
{
285
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
285
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
286
  return GetSupported (station, station->m_rate);
286
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel ());
287
}
287
}
288
WifiMode
288
WifiTxVector
289
AarfcdWifiManager::DoGetRtsMode (WifiRemoteStation *st)
289
AarfcdWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
290
{
290
{
291
  // XXX: we could/should implement the Aarf algorithm for
291
  // XXX: we could/should implement the Aarf algorithm for
292
  // RTS only by picking a single rate within the BasicRateSet.
292
  // RTS only by picking a single rate within the BasicRateSet.
293
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
293
  AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
294
  return GetSupported (station, 0);
294
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel ());
295
}
295
}
296
296
297
bool
297
bool
(-)a/src/devices/wifi/aarfcd-wifi-manager.h (-2 / +2 lines)
 Lines 54-61    Link Here 
54
                               double ackSnr, WifiMode ackMode, double dataSnr);
54
                               double ackSnr, WifiMode ackMode, double dataSnr);
55
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
55
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
56
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
56
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
57
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
57
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
58
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
58
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
59
  virtual bool DoNeedRts (WifiRemoteStation *station, 
59
  virtual bool DoNeedRts (WifiRemoteStation *station, 
60
                          Ptr<const Packet> packet, bool normally);
60
                          Ptr<const Packet> packet, bool normally);
61
  virtual bool IsLowLatency (void) const;
61
  virtual bool IsLowLatency (void) const;
(-)a/src/devices/wifi/amrr-wifi-manager.cc (-6 / +6 lines)
 Lines 245-252    Link Here 
245
      ResetCnt (station);
245
      ResetCnt (station);
246
    }
246
    }
247
}
247
}
248
WifiMode 
248
WifiTxVector 
249
AmrrWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
249
AmrrWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
250
{
250
{
251
  AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
251
  AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
252
  UpdateMode (station);
252
  UpdateMode (station);
 Lines 290-304    Link Here 
290
        }
290
        }
291
    }
291
    }
292
292
293
  return GetSupported (station, rateIndex);
293
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel ());
294
}
294
}
295
WifiMode 
295
WifiTxVector 
296
AmrrWifiManager::DoGetRtsMode (WifiRemoteStation *st)
296
AmrrWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
297
{
297
{
298
  AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
298
  AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
299
  UpdateMode (station);
299
  UpdateMode (station);
300
  // XXX: can we implement something smarter ?
300
  // XXX: can we implement something smarter ?
301
  return GetSupported (station, 0);
301
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel ());
302
}
302
}
303
303
304
304
(-)a/src/devices/wifi/amrr-wifi-manager.h (-2 / +2 lines)
 Lines 55-62    Link Here 
55
                               double ackSnr, WifiMode ackMode, double dataSnr);
55
                               double ackSnr, WifiMode ackMode, double dataSnr);
56
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
56
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
57
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
57
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
58
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
58
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
59
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
59
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
60
  virtual bool IsLowLatency (void) const;
60
  virtual bool IsLowLatency (void) const;
61
61
62
  void UpdateRetry (AmrrWifiRemoteStation *station);
62
  void UpdateRetry (AmrrWifiRemoteStation *station);
(-)a/src/devices/wifi/arf-wifi-manager.cc (-6 / +6 lines)
 Lines 172-190    Link Here 
172
ArfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
172
ArfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
173
{}
173
{}
174
174
175
WifiMode
175
WifiTxVector
176
ArfWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
176
ArfWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
177
{
177
{
178
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
178
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
179
  return GetSupported (station, station->m_rate);
179
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel ());
180
}
180
}
181
WifiMode
181
WifiTxVector
182
ArfWifiManager::DoGetRtsMode (WifiRemoteStation *st)
182
ArfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
183
{
183
{
184
  // XXX: we could/should implement the Arf algorithm for
184
  // XXX: we could/should implement the Arf algorithm for
185
  // RTS only by picking a single rate within the BasicRateSet.
185
  // RTS only by picking a single rate within the BasicRateSet.
186
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
186
  ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
187
  return GetSupported (station, 0);
187
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel ());
188
}
188
}
189
189
190
bool 
190
bool 
(-)a/src/devices/wifi/arf-wifi-manager.h (-2 / +2 lines)
 Lines 58-65    Link Here 
58
                               double ackSnr, WifiMode ackMode, double dataSnr);
58
                               double ackSnr, WifiMode ackMode, double dataSnr);
59
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
59
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
60
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
60
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
61
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
61
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
62
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
62
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
63
  virtual bool IsLowLatency (void) const;
63
  virtual bool IsLowLatency (void) const;
64
64
65
  uint32_t m_timerThreshold;
65
  uint32_t m_timerThreshold;
(-)a/src/devices/wifi/cara-wifi-manager.cc (-6 / +6 lines)
 Lines 148-166    Link Here 
148
CaraWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
148
CaraWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
149
{}
149
{}
150
150
151
WifiMode
151
WifiTxVector
152
CaraWifiManager::DoGetDataMode (WifiRemoteStation *st,
152
CaraWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
153
                                      uint32_t size)
153
                                      uint32_t size)
154
{
154
{
155
  CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
155
  CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
156
  return GetSupported (station, station->m_rate);
156
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel ());
157
}
157
}
158
WifiMode
158
WifiTxVector
159
CaraWifiManager::DoGetRtsMode (WifiRemoteStation *st)
159
CaraWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
160
{
160
{
161
  // XXX: we could/should implement the Arf algorithm for
161
  // XXX: we could/should implement the Arf algorithm for
162
  // RTS only by picking a single rate within the BasicRateSet.
162
  // RTS only by picking a single rate within the BasicRateSet.
163
  return GetSupported (st, 0);
163
  return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel ());
164
}
164
}
165
165
166
bool
166
bool
(-)a/src/devices/wifi/cara-wifi-manager.h (-2 / +2 lines)
 Lines 54-61    Link Here 
54
                               double ackSnr, WifiMode ackMode, double dataSnr);
54
                               double ackSnr, WifiMode ackMode, double dataSnr);
55
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
55
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
56
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
56
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
57
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
57
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
58
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
58
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
59
  virtual bool DoNeedRts (WifiRemoteStation *station,
59
  virtual bool DoNeedRts (WifiRemoteStation *station,
60
                          Ptr<const Packet> packet, bool normally);
60
                          Ptr<const Packet> packet, bool normally);
61
  virtual bool IsLowLatency (void) const;
61
  virtual bool IsLowLatency (void) const;
(-)a/src/devices/wifi/constant-rate-wifi-manager.cc (-6 / +6 lines)
 Lines 86-100    Link Here 
86
ConstantRateWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
86
ConstantRateWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
87
{}
87
{}
88
88
89
WifiMode
89
WifiTxVector
90
ConstantRateWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
90
ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
91
{
91
{
92
  return m_dataMode;
92
  return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel ());
93
}
93
}
94
WifiMode
94
WifiTxVector
95
ConstantRateWifiManager::DoGetRtsMode (WifiRemoteStation *st)
95
ConstantRateWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
96
{
96
{
97
  return m_ctlMode;
97
  return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel ());
98
}
98
}
99
99
100
bool 
100
bool 
(-)a/src/devices/wifi/constant-rate-wifi-manager.h (-2 / +2 lines)
 Lines 52-59    Link Here 
52
                               double ackSnr, WifiMode ackMode, double dataSnr);
52
                               double ackSnr, WifiMode ackMode, double dataSnr);
53
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
53
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
54
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
54
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
55
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
55
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
56
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
56
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
57
  virtual bool IsLowLatency (void) const;
57
  virtual bool IsLowLatency (void) const;
58
58
59
  WifiMode m_dataMode;
59
  WifiMode m_dataMode;
(-)a/src/devices/wifi/ideal-wifi-manager.cc (-6 / +6 lines)
 Lines 125-132    Link Here 
125
IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
125
IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
126
{}
126
{}
127
127
128
WifiMode
128
WifiTxVector
129
IdealWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
129
IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
130
{
130
{
131
  IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
131
  IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
132
  // We search within the Supported rate set the mode with the 
132
  // We search within the Supported rate set the mode with the 
 Lines 145-154    Link Here 
145
          maxMode = mode;
145
          maxMode = mode;
146
        }
146
        }
147
    }
147
    }
148
  return maxMode;
148
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel ());
149
}
149
}
150
WifiMode
150
WifiTxVector
151
IdealWifiManager::DoGetRtsMode (WifiRemoteStation *st)
151
IdealWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
152
{
152
{
153
  IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
153
  IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
154
  // We search within the Basic rate set the mode with the highest 
154
  // We search within the Basic rate set the mode with the highest 
 Lines 167-173    Link Here 
167
          maxMode = mode;
167
          maxMode = mode;
168
        }
168
        }
169
    }
169
    }
170
  return maxMode;
170
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel ());
171
}
171
}
172
172
173
bool 
173
bool 
(-)a/src/devices/wifi/ideal-wifi-manager.h (-2 / +2 lines)
 Lines 63-70    Link Here 
63
                               double ackSnr, WifiMode ackMode, double dataSnr);
63
                               double ackSnr, WifiMode ackMode, double dataSnr);
64
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
64
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
65
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
65
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
66
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
66
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
67
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
67
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
68
  virtual bool IsLowLatency (void) const;
68
  virtual bool IsLowLatency (void) const;
69
69
70
  // return the min snr needed to successfully transmit
70
  // return the min snr needed to successfully transmit
(-)a/src/devices/wifi/mac-low.cc (-89 / +83 lines)
 Lines 913-918    Link Here 
913
MacLow::GetAckDuration (Mac48Address to, WifiMode dataTxMode) const
913
MacLow::GetAckDuration (Mac48Address to, WifiMode dataTxMode) const
914
{
914
{
915
  WifiMode ackMode = GetAckTxModeForData (to, dataTxMode);
915
  WifiMode ackMode = GetAckTxModeForData (to, dataTxMode);
916
  return GetAckDuration (ackMode);
917
}
918
Time
919
MacLow::GetAckDuration (WifiMode ackMode) const
920
{
916
  return m_phy->CalculateTxDuration (GetAckSize (), ackMode, WIFI_PREAMBLE_LONG);
921
  return m_phy->CalculateTxDuration (GetAckSize (), ackMode, WIFI_PREAMBLE_LONG);
917
}
922
}
918
Time
923
Time
 Lines 932-939    Link Here 
932
MacLow::GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const
937
MacLow::GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const
933
{
938
{
934
  WifiMode ctsMode = GetCtsTxModeForRts (to, rtsTxMode);
939
  WifiMode ctsMode = GetCtsTxModeForRts (to, rtsTxMode);
940
  return GetCtsDuration (ctsMode);
941
}
942
943
Time
944
MacLow::GetCtsDuration (WifiMode ctsMode) const
945
{
935
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsMode, WIFI_PREAMBLE_LONG);
946
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsMode, WIFI_PREAMBLE_LONG);
936
}
947
}
948
937
uint32_t 
949
uint32_t 
938
MacLow::GetCtsSize (void) const
950
MacLow::GetCtsSize (void) const
939
{
951
{
 Lines 948-1019    Link Here 
948
  return packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
960
  return packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
949
}
961
}
950
962
951
WifiMode
963
WifiTxVector
952
MacLow::GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
964
MacLow::GetRtsTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
953
{
965
{
954
  Mac48Address to = hdr->GetAddr1 ();
966
  Mac48Address to = hdr->GetAddr1 ();
955
  return m_stationManager->GetRtsMode (to, hdr, packet);
967
  return m_stationManager->GetRtsTxVector (to, hdr, packet);
956
}
968
}
957
WifiMode
969
WifiTxVector
958
MacLow::GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
970
MacLow::GetDataTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
959
{
971
{
960
  Mac48Address to = hdr->GetAddr1 ();
972
  Mac48Address to = hdr->GetAddr1 ();
961
  WifiMacTrailer fcs;
973
  WifiMacTrailer fcs;
962
  uint32_t size =  packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
974
  uint32_t size =  packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
963
  return m_stationManager->GetDataMode (to, hdr, packet, size);
975
  return m_stationManager->GetDataTxVector (to, hdr, packet, size);
976
}
977
WifiTxVector
978
MacLow::GetCtsTxVector (Mac48Address to, WifiMode rtsTxMode) const
979
{
980
  return m_stationManager->GetCtsTxVector (to, rtsTxMode);
981
}
982
WifiTxVector
983
MacLow::GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const
984
{
985
  return m_stationManager->GetAckTxVector (to, dataTxMode);
986
}
987
WifiTxVector
988
MacLow::GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const
989
{
990
  return m_stationManager->GetBlockAckTxVector (to, dataTxMode);
964
}
991
}
965
992
966
WifiMode
993
WifiMode
967
MacLow::GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const
994
MacLow::GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const
968
{
995
{
969
  return m_stationManager->GetCtsMode (to, rtsTxMode);
996
  return GetCtsTxVector (to, rtsTxMode).mode;
970
}
997
}
971
WifiMode
998
WifiMode
972
MacLow::GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const
999
MacLow::GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const
973
{
1000
{
974
  return m_stationManager->GetAckMode (to, dataTxMode);
1001
  return GetAckTxVector (to, dataTxMode).mode;
975
}
1002
}
976
1003
977
1004
978
Time
979
MacLow::CalculateOverallTxTime (Ptr<const Packet> packet,
980
                                const WifiMacHeader* hdr, 
981
                                const MacLowTransmissionParameters& params) const
982
{
983
  Time txTime = Seconds (0);
984
  WifiMode rtsMode = GetRtsTxMode (packet, hdr);
985
  WifiMode dataMode = GetDataTxMode (packet, hdr);
986
  if (params.MustSendRts ()) 
987
    {
988
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBLE_LONG);
989
      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode);
990
      txTime += GetSifs () * Scalar (2);
991
    }
992
  uint32_t dataSize = GetSize (packet, hdr);
993
  txTime += m_phy->CalculateTxDuration (dataSize, dataMode, WIFI_PREAMBLE_LONG);
994
  if (params.MustWaitAck ())
995
    {
996
      txTime += GetSifs ();
997
      txTime += GetAckDuration (hdr->GetAddr1 (), dataMode);
998
    }
999
  return txTime;
1000
}
1001
1002
Time
1003
MacLow::CalculateTransmissionTime (Ptr<const Packet> packet,
1004
                                   const WifiMacHeader* hdr, 
1005
                                   const MacLowTransmissionParameters& params) const
1006
{
1007
  Time txTime = CalculateOverallTxTime (packet, hdr, params);
1008
  if (params.HasNextPacket ()) 
1009
    {
1010
      WifiMode dataMode = GetDataTxMode (packet, hdr);
1011
      txTime += GetSifs ();
1012
      txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataMode, WIFI_PREAMBLE_LONG);
1013
    }
1014
  return txTime;
1015
}
1016
1017
void
1005
void
1018
MacLow::NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble)
1006
MacLow::NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble)
1019
{
1007
{
 Lines 1126-1141    Link Here 
1126
1114
1127
void
1115
void
1128
MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr, 
1116
MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr, 
1129
                     WifiMode txMode)
1117
                     WifiTxVector txVector)
1130
{
1118
{
1131
  NS_LOG_FUNCTION (this << packet << hdr << txMode);
1119
  NS_LOG_FUNCTION (this << packet << hdr << txVector);
1132
  NS_LOG_DEBUG ("send " << hdr->GetTypeString () <<
1120
  NS_LOG_DEBUG ("send " << hdr->GetTypeString () <<
1133
            ", to=" << hdr->GetAddr1 () <<
1121
                ", to=" << hdr->GetAddr1 () <<
1134
            ", size=" << packet->GetSize () <<
1122
                ", size=" << packet->GetSize () <<
1135
            ", mode=" << txMode <<
1123
                ", mode=" << txVector.mode <<
1136
            ", duration=" << hdr->GetDuration () <<
1124
                ", pwrlvl=" << (uint16_t) txVector.txPowerLevel <<
1137
            ", seq=0x"<< std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1125
                ", duration=" << hdr->GetDuration () <<
1138
  m_phy->SendPacket (packet, txMode, WIFI_PREAMBLE_LONG, 0);
1126
                ", seq=0x"<< std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1127
  m_phy->SendPacket (packet, txVector.mode, WIFI_PREAMBLE_LONG, txVector.txPowerLevel);
1139
}
1128
}
1140
1129
1141
void
1130
void
 Lines 1225-1231    Link Here 
1225
  rts.SetNoMoreFragments ();
1214
  rts.SetNoMoreFragments ();
1226
  rts.SetAddr1 (m_currentHdr.GetAddr1 ());
1215
  rts.SetAddr1 (m_currentHdr.GetAddr1 ());
1227
  rts.SetAddr2 (m_self);
1216
  rts.SetAddr2 (m_self);
1228
  WifiMode rtsTxMode = GetRtsTxMode (m_currentPacket, &m_currentHdr);
1217
  WifiTxVector rtsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr);
1229
  Time duration = Seconds (0);
1218
  Time duration = Seconds (0);
1230
  if (m_txParams.HasDurationId ()) 
1219
  if (m_txParams.HasDurationId ()) 
1231
    {
1220
    {
 Lines 1233-1250    Link Here 
1233
    } 
1222
    } 
1234
  else 
1223
  else 
1235
    {
1224
    {
1236
      WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
1225
      WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);      
1237
      duration += GetSifs ();
1226
      duration += GetSifs ();
1238
      duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxMode);
1227
      duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector.mode);
1239
      duration += GetSifs ();
1228
      duration += GetSifs ();
1240
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), 
1229
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), 
1241
                                              dataTxMode, WIFI_PREAMBLE_LONG);
1230
                                              dataTxVector.mode, WIFI_PREAMBLE_LONG);
1242
      duration += GetSifs ();
1231
      duration += GetSifs ();
1243
      duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
1232
      duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxVector.mode);
1244
    }
1233
    }
1245
  rts.SetDuration (duration);
1234
  rts.SetDuration (duration);
1246
1235
1247
  Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxMode, WIFI_PREAMBLE_LONG);
1236
  Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector.mode, WIFI_PREAMBLE_LONG);
1248
  Time timerDelay = txDuration + GetCtsTimeout ();
1237
  Time timerDelay = txDuration + GetCtsTimeout ();
1249
1238
1250
  NS_ASSERT (m_ctsTimeoutEvent.IsExpired ());
1239
  NS_ASSERT (m_ctsTimeoutEvent.IsExpired ());
 Lines 1256-1268    Link Here 
1256
  WifiMacTrailer fcs;
1245
  WifiMacTrailer fcs;
1257
  packet->AddTrailer (fcs);
1246
  packet->AddTrailer (fcs);
1258
1247
1259
  ForwardDown (packet, &rts, rtsTxMode);
1248
  ForwardDown (packet, &rts, rtsTxVector);
1260
}
1249
}
1261
1250
1262
void
1251
void
1263
MacLow::StartDataTxTimers (void)
1252
MacLow::StartDataTxTimers (WifiMode dataTxMode)
1264
{
1253
{
1265
  WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
1266
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxMode, WIFI_PREAMBLE_LONG);
1254
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxMode, WIFI_PREAMBLE_LONG);
1267
  if (m_txParams.MustWaitNormalAck ()) 
1255
  if (m_txParams.MustWaitNormalAck ()) 
1268
    {
1256
    {
 Lines 1316-1324    Link Here 
1316
{
1304
{
1317
  NS_LOG_FUNCTION (this);
1305
  NS_LOG_FUNCTION (this);
1318
  /* send this packet directly. No RTS is needed. */
1306
  /* send this packet directly. No RTS is needed. */
1319
  StartDataTxTimers ();
1320
1307
1321
  WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
1308
  WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
1309
  StartDataTxTimers (dataTxVector.mode);
1310
1322
  Time duration = Seconds (0.0);
1311
  Time duration = Seconds (0.0);
1323
  if (m_txParams.HasDurationId ()) 
1312
  if (m_txParams.HasDurationId ()) 
1324
    {
1313
    {
 Lines 1329-1355    Link Here 
1329
      if (m_txParams.MustWaitBasicBlockAck ())
1318
      if (m_txParams.MustWaitBasicBlockAck ())
1330
        {
1319
        {
1331
          duration += GetSifs ();
1320
          duration += GetSifs ();
1332
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), dataTxMode, BASIC_BLOCK_ACK);
1321
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), dataTxVector.mode, BASIC_BLOCK_ACK);
1333
        }
1322
        }
1334
      else if (m_txParams.MustWaitCompressedBlockAck ())
1323
      else if (m_txParams.MustWaitCompressedBlockAck ())
1335
        {
1324
        {
1336
          duration += GetSifs ();
1325
          duration += GetSifs ();
1337
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), dataTxMode, COMPRESSED_BLOCK_ACK);
1326
          duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), dataTxVector.mode, COMPRESSED_BLOCK_ACK);
1338
        }
1327
        }
1339
      else if (m_txParams.MustWaitAck ()) 
1328
      else if (m_txParams.MustWaitAck ()) 
1340
        {
1329
        {
1341
          duration += GetSifs ();
1330
          duration += GetSifs ();
1342
          duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
1331
          duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxVector.mode);
1343
        }
1332
        }
1344
      if (m_txParams.HasNextPacket ()) 
1333
      if (m_txParams.HasNextPacket ()) 
1345
        {
1334
        {
1346
          duration += GetSifs ();
1335
          duration += GetSifs ();
1347
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), 
1336
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), 
1348
                                                  dataTxMode, WIFI_PREAMBLE_LONG);
1337
                                                  dataTxVector.mode, WIFI_PREAMBLE_LONG);
1349
          if (m_txParams.MustWaitAck ()) 
1338
          if (m_txParams.MustWaitAck ()) 
1350
            {
1339
            {
1351
              duration += GetSifs ();
1340
              duration += GetSifs ();
1352
              duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
1341
              duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxVector.mode);
1353
            }
1342
            }
1354
        }
1343
        }
1355
    }
1344
    }
 Lines 1359-1365    Link Here 
1359
  WifiMacTrailer fcs;
1348
  WifiMacTrailer fcs;
1360
  m_currentPacket->AddTrailer (fcs);
1349
  m_currentPacket->AddTrailer (fcs);
1361
1350
1362
  ForwardDown (m_currentPacket, &m_currentHdr, dataTxMode);
1351
  ForwardDown (m_currentPacket, &m_currentHdr, dataTxVector);
1363
  m_currentPacket = 0;
1352
  m_currentPacket = 0;
1364
}
1353
}
1365
1354
 Lines 1383-1389    Link Here 
1383
  /* send a CTS when you receive a RTS 
1372
  /* send a CTS when you receive a RTS 
1384
   * right after SIFS.
1373
   * right after SIFS.
1385
   */
1374
   */
1386
  WifiMode ctsTxMode = GetCtsTxModeForRts (source, rtsTxMode);
1375
  WifiTxVector ctsTxVector = GetCtsTxVector (source, rtsTxMode);
1387
  WifiMacHeader cts;
1376
  WifiMacHeader cts;
1388
  cts.SetType (WIFI_MAC_CTL_CTS);
1377
  cts.SetType (WIFI_MAC_CTL_CTS);
1389
  cts.SetDsNotFrom ();
1378
  cts.SetDsNotFrom ();
 Lines 1391-1397    Link Here 
1391
  cts.SetNoMoreFragments ();
1380
  cts.SetNoMoreFragments ();
1392
  cts.SetNoRetry ();
1381
  cts.SetNoRetry ();
1393
  cts.SetAddr1 (source);
1382
  cts.SetAddr1 (source);
1394
  duration -= GetCtsDuration (source, rtsTxMode);
1383
  duration -= GetCtsDuration (ctsTxVector.mode);
1395
  duration -= GetSifs ();
1384
  duration -= GetSifs ();
1396
  NS_ASSERT (duration >= MicroSeconds (0));
1385
  NS_ASSERT (duration >= MicroSeconds (0));
1397
  cts.SetDuration (duration);
1386
  cts.SetDuration (duration);
 Lines 1405-1429    Link Here 
1405
  tag.Set (rtsSnr);
1394
  tag.Set (rtsSnr);
1406
  packet->AddPacketTag (tag);
1395
  packet->AddPacketTag (tag);
1407
1396
1408
  ForwardDown (packet, &cts, ctsTxMode);
1397
  ForwardDown (packet, &cts, ctsTxVector);
1409
}
1398
}
1410
1399
1411
void
1400
void
1412
MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode)
1401
MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode ctsTxMode)
1413
{
1402
{
1414
  NS_LOG_FUNCTION (this);
1403
  NS_LOG_FUNCTION (this);
1415
  /* send the third step in a 
1404
  /* send the third step in a 
1416
   * RTS/CTS/DATA/ACK hanshake 
1405
   * RTS/CTS/DATA/ACK hanshake 
1417
   */
1406
   */
1418
  NS_ASSERT (m_currentPacket != 0);
1407
  NS_ASSERT (m_currentPacket != 0);
1419
  StartDataTxTimers ();
1408
  WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
1409
  StartDataTxTimers (dataTxVector.mode);
1420
1410
1421
  WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
1411
1422
  Time newDuration = Seconds (0);
1412
  Time newDuration = Seconds (0);
1423
  newDuration += GetSifs ();
1413
  newDuration += GetSifs ();
1424
  newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
1414
  newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxVector.mode);
1425
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), 
1415
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), 
1426
                                                dataTxMode, WIFI_PREAMBLE_LONG);
1416
                                                dataTxVector.mode, WIFI_PREAMBLE_LONG);
1427
  duration -= txDuration;
1417
  duration -= txDuration;
1428
  duration -= GetSifs ();
1418
  duration -= GetSifs ();
1429
1419
 Lines 1435-1441    Link Here 
1435
  WifiMacTrailer fcs;
1425
  WifiMacTrailer fcs;
1436
  m_currentPacket->AddTrailer (fcs);
1426
  m_currentPacket->AddTrailer (fcs);
1437
1427
1438
  ForwardDown (m_currentPacket, &m_currentHdr, dataTxMode);
1428
  ForwardDown (m_currentPacket, &m_currentHdr, dataTxVector);
1439
  m_currentPacket = 0;
1429
  m_currentPacket = 0;
1440
}
1430
}
1441
1431
 Lines 1462-1468    Link Here 
1462
  /* send an ACK when you receive 
1452
  /* send an ACK when you receive 
1463
   * a packet after SIFS. 
1453
   * a packet after SIFS. 
1464
   */
1454
   */
1465
  WifiMode ackTxMode = GetAckTxModeForData (source, dataTxMode);
1455
  WifiTxVector ackTxVector = GetAckTxVector (source, dataTxMode);
1466
  WifiMacHeader ack;
1456
  WifiMacHeader ack;
1467
  ack.SetType (WIFI_MAC_CTL_ACK);
1457
  ack.SetType (WIFI_MAC_CTL_ACK);
1468
  ack.SetDsNotFrom ();
1458
  ack.SetDsNotFrom ();
 Lines 1473-1478    Link Here 
1473
  duration -= GetAckDuration (source, dataTxMode);
1463
  duration -= GetAckDuration (source, dataTxMode);
1474
  duration -= GetSifs ();
1464
  duration -= GetSifs ();
1475
  NS_ASSERT (duration >= MicroSeconds (0));
1465
  NS_ASSERT (duration >= MicroSeconds (0));
1466
  NS_ASSERT (ack.IsMoreFragments () ^ (duration == MicroSeconds (0))); // Section 7.2.1.3 ACK frame format
1476
  ack.SetDuration (duration);
1467
  ack.SetDuration (duration);
1477
1468
1478
  Ptr<Packet> packet = Create<Packet> ();
1469
  Ptr<Packet> packet = Create<Packet> ();
 Lines 1484-1490    Link Here 
1484
  tag.Set (dataSnr);
1475
  tag.Set (dataSnr);
1485
  packet->AddPacketTag (tag);
1476
  packet->AddPacketTag (tag);
1486
1477
1487
  ForwardDown (packet, &ack, ackTxMode);
1478
  ForwardDown (packet, &ack, ackTxVector);
1488
}
1479
}
1489
1480
1490
bool
1481
bool
 Lines 1539-1545    Link Here 
1539
      Time timeout = MicroSeconds (1024 * agreement.GetTimeout ());
1530
      Time timeout = MicroSeconds (1024 * agreement.GetTimeout ());
1540
 
1531
 
1541
      AcIndex ac = QosUtilsMapTidToAc (agreement.GetTid ());
1532
      AcIndex ac = QosUtilsMapTidToAc (agreement.GetTid ());
1542
      
1533
1543
      it->second.first.m_inactivityEvent = Simulator::Schedule (timeout,
1534
      it->second.first.m_inactivityEvent = Simulator::Schedule (timeout,
1544
                                                                &MacLowBlockAckEventListener::BlockAckInactivityTimeout,
1535
                                                                &MacLowBlockAckEventListener::BlockAckInactivityTimeout,
1545
                                                                m_edcaListeners[ac],
1536
                                                                m_edcaListeners[ac],
 Lines 1669-1685    Link Here 
1669
1660
1670
  m_currentPacket = packet;
1661
  m_currentPacket = packet;
1671
  m_currentHdr = hdr;
1662
  m_currentHdr = hdr;
1663
1664
  WifiTxVector blockAckTxVector = GetBlockAckTxVector (originator, blockAckReqTxMode);
1665
1672
  if (immediate)
1666
  if (immediate)
1673
    {
1667
    {
1674
      m_txParams.DisableAck ();
1668
      m_txParams.DisableAck ();
1675
      duration -= GetSifs ();
1669
      duration -= GetSifs ();
1676
      if (blockAck->IsBasic ())
1670
      if (blockAck->IsBasic ())
1677
        {
1671
        {
1678
          duration -= GetBlockAckDuration (originator, blockAckReqTxMode, BASIC_BLOCK_ACK);
1672
          duration -= GetBlockAckDuration (originator, blockAckTxVector.mode, BASIC_BLOCK_ACK);
1679
        }
1673
        }
1680
      else if (blockAck->IsCompressed ())
1674
      else if (blockAck->IsCompressed ())
1681
        {
1675
        {
1682
          duration -= GetBlockAckDuration (originator, blockAckReqTxMode, COMPRESSED_BLOCK_ACK);
1676
          duration -= GetBlockAckDuration (originator, blockAckTxVector.mode, COMPRESSED_BLOCK_ACK);
1683
        }
1677
        }
1684
      else if (blockAck->IsMultiTid ())
1678
      else if (blockAck->IsMultiTid ())
1685
        {
1679
        {
 Lines 1690-1700    Link Here 
1690
    {
1684
    {
1691
      m_txParams.EnableAck ();
1685
      m_txParams.EnableAck ();
1692
      duration += GetSifs ();
1686
      duration += GetSifs ();
1693
      duration += GetAckDuration (originator, blockAckReqTxMode);
1687
      duration += GetAckDuration (originator, blockAckTxVector.mode);
1694
    }
1688
    }
1695
  m_txParams.DisableNextData ();
1689
  m_txParams.DisableNextData ();
1696
1690
1697
  StartDataTxTimers ();
1691
  StartDataTxTimers (blockAckTxVector.mode);
1698
1692
1699
  NS_ASSERT (duration >= MicroSeconds (0));
1693
  NS_ASSERT (duration >= MicroSeconds (0));
1700
  hdr.SetDuration (duration);
1694
  hdr.SetDuration (duration);
 Lines 1703-1709    Link Here 
1703
  packet->AddHeader (hdr);
1697
  packet->AddHeader (hdr);
1704
  WifiMacTrailer fcs;
1698
  WifiMacTrailer fcs;
1705
  packet->AddTrailer (fcs);
1699
  packet->AddTrailer (fcs);
1706
  ForwardDown (packet, &hdr, blockAckReqTxMode);
1700
  ForwardDown (packet, &hdr, blockAckTxVector);
1707
  m_currentPacket = 0;
1701
  m_currentPacket = 0;
1708
}
1702
}
1709
1703
(-)a/src/devices/wifi/mac-low.h (-21 / +24 lines)
 Lines 399-415    Link Here 
399
   */
399
   */
400
  void RegisterDcfListener (MacLowDcfListener *listener);
400
  void RegisterDcfListener (MacLowDcfListener *listener);
401
401
402
  /**
402
  // /**
403
   * \param packet to send (does not include the 802.11 MAC header and checksum)
403
  //  * \param packet to send (does not include the 802.11 MAC header and checksum)
404
   * \param hdr header associated to the packet to send.
404
  //  * \param hdr header associated to the packet to send.
405
   * \param parameters transmission parameters of packet.
405
  //  * \param parameters transmission parameters of packet.
406
   *
406
  //  *
407
   * This transmission time includes the time required for
407
  //  * This transmission time includes the time required for
408
   * the next packet transmission if one was selected.
408
  //  * the next packet transmission if one was selected.
409
   */
409
  //  */
410
  Time CalculateTransmissionTime (Ptr<const Packet> packet,
410
  // Time CalculateTransmissionTime (Ptr<const Packet> packet,
411
                                  const WifiMacHeader* hdr, 
411
  //                                 const WifiMacHeader* hdr, 
412
                                  const MacLowTransmissionParameters& parameters) const;
412
  //                                 const MacLowTransmissionParameters& parameters) const;
413
413
414
  /**
414
  /**
415
   * \param packet packet to send
415
   * \param packet packet to send
 Lines 489-504    Link Here 
489
  uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
489
  uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
490
  Time NowUs (void) const;
490
  Time NowUs (void) const;
491
  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr, 
491
  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr, 
492
                    WifiMode txMode);
492
                    WifiTxVector txVector);
493
  Time CalculateOverallTxTime (Ptr<const Packet> packet,
493
  WifiTxVector GetRtsTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
494
                               const WifiMacHeader* hdr, 
494
  WifiTxVector GetDataTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
495
                               const MacLowTransmissionParameters &params) const;
495
  WifiTxVector GetCtsTxVector (Mac48Address to, WifiMode rtsTxMode) const;
496
  WifiMode GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
496
  WifiTxVector GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
497
  WifiMode GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
497
  WifiTxVector GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
498
498
  WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const;
499
  WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const;
499
  WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const;
500
  WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const;
500
501
502
  Time GetCtsDuration (WifiMode ctsTxMode) const;
501
  Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const;
503
  Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const;
504
  Time GetAckDuration (WifiMode ackTxMode) const;
502
  Time GetAckDuration (Mac48Address to, WifiMode dataTxMode) const;
505
  Time GetAckDuration (Mac48Address to, WifiMode dataTxMode) const;
503
  Time GetBlockAckDuration (Mac48Address to, WifiMode blockAckReqTxMode, enum BlockAckType type) const;
506
  Time GetBlockAckDuration (Mac48Address to, WifiMode blockAckReqTxMode, enum BlockAckType type) const;
504
  void NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble);
507
  void NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble);
 Lines 518-532    Link Here 
518
  void FastAckFailedTimeout (void);
521
  void FastAckFailedTimeout (void);
519
  void BlockAckTimeout (void);
522
  void BlockAckTimeout (void);
520
  void CtsTimeout (void);
523
  void CtsTimeout (void);
521
  void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr);
524
  void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode rtsTxMode, double rtsSnr);
522
  void SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr);
525
  void SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double rtsSnr);
523
  void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode);
526
  void SendDataAfterCts (Mac48Address source, Time duration, WifiMode ctsTxMode);
524
  void WaitSifsAfterEndTx (void);
527
  void WaitSifsAfterEndTx (void);
525
528
526
  void SendRtsForPacket (void);
529
  void SendRtsForPacket (void);
527
  void SendDataPacket (void);
530
  void SendDataPacket (void);
528
  void SendCurrentTxPacket (void);
531
  void SendCurrentTxPacket (void);
529
  void StartDataTxTimers (void);
532
  void StartDataTxTimers (WifiMode dataTxMode);
530
  virtual void DoDispose (void);
533
  virtual void DoDispose (void);
531
  /**
534
  /**
532
   * \param originator Address of peer participating in Block Ack mechanism.
535
   * \param originator Address of peer participating in Block Ack mechanism.
(-)a/src/devices/wifi/minstrel-wifi-manager.cc (-6 / +6 lines)
 Lines 425-432    Link Here 
425
  station->m_longRetry = 0;
425
  station->m_longRetry = 0;
426
}
426
}
427
427
428
WifiMode
428
WifiTxVector
429
MinstrelWifiManager::DoGetDataMode (WifiRemoteStation *st,
429
MinstrelWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
430
                                    uint32_t size)
430
                                    uint32_t size)
431
{
431
{
432
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
432
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
 Lines 438-453    Link Here 
438
      station->m_txrate = m_nsupported / 2;
438
      station->m_txrate = m_nsupported / 2;
439
    }
439
    }
440
  UpdateStats (station);
440
  UpdateStats (station);
441
  return GetSupported (station, station->m_txrate);
441
  return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel ());
442
}
442
}
443
443
444
WifiMode
444
WifiTxVector
445
MinstrelWifiManager::DoGetRtsMode (WifiRemoteStation *st)
445
MinstrelWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
446
{
446
{
447
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
447
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
448
  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
448
  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
449
449
450
  return GetSupported (station, 0);
450
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel ());
451
}
451
}
452
452
453
bool 
453
bool 
(-)a/src/devices/wifi/minstrel-wifi-manager.h (-2 / +2 lines)
 Lines 109-116    Link Here 
109
                               double ackSnr, WifiMode ackMode, double dataSnr);
109
                               double ackSnr, WifiMode ackMode, double dataSnr);
110
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
110
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
111
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
111
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
112
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
112
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
113
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
113
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
114
  virtual bool IsLowLatency (void) const;
114
  virtual bool IsLowLatency (void) const;
115
115
116
  /// for estimating the TxTime of a packet with a given mode  
116
  /// for estimating the TxTime of a packet with a given mode  
(-)a/src/devices/wifi/onoe-wifi-manager.cc (-6 / +6 lines)
 Lines 195-202    Link Here 
195
195
196
}
196
}
197
197
198
WifiMode 
198
WifiTxVector 
199
OnoeWifiManager::DoGetDataMode (WifiRemoteStation *st,
199
OnoeWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
200
                                      uint32_t size)
200
                                      uint32_t size)
201
{
201
{
202
  OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
202
  OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
 Lines 240-254    Link Here 
240
          rateIndex = station->m_txrate;
240
          rateIndex = station->m_txrate;
241
        }
241
        }
242
    }
242
    }
243
  return GetSupported (station, rateIndex);
243
  return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel ());
244
}
244
}
245
WifiMode 
245
WifiTxVector 
246
OnoeWifiManager::DoGetRtsMode (WifiRemoteStation *st)
246
OnoeWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
247
{
247
{
248
  OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
248
  OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
249
  UpdateMode (station);
249
  UpdateMode (station);
250
  // XXX: can we implement something smarter ?
250
  // XXX: can we implement something smarter ?
251
  return GetSupported (station, 0);
251
  return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel ());
252
}
252
}
253
253
254
bool 
254
bool 
(-)a/src/devices/wifi/onoe-wifi-manager.h (-2 / +2 lines)
 Lines 56-63    Link Here 
56
                               double ackSnr, WifiMode ackMode, double dataSnr);
56
                               double ackSnr, WifiMode ackMode, double dataSnr);
57
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
57
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
58
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
58
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
59
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
59
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
60
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
60
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
61
  virtual bool IsLowLatency (void) const;
61
  virtual bool IsLowLatency (void) const;
62
62
63
  void UpdateRetry (OnoeWifiRemoteStation *station);
63
  void UpdateRetry (OnoeWifiRemoteStation *station);
(-)a/src/devices/wifi/rraa-wifi-manager.cc (-6 / +6 lines)
 Lines 261-268    Link Here 
261
RraaWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
261
RraaWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
262
{}
262
{}
263
263
264
WifiMode
264
WifiTxVector
265
RraaWifiManager::DoGetDataMode (WifiRemoteStation *st,
265
RraaWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
266
                                uint32_t size)
266
                                uint32_t size)
267
{
267
{
268
  RraaWifiRemoteStation *station = (RraaWifiRemoteStation *) st;
268
  RraaWifiRemoteStation *station = (RraaWifiRemoteStation *) st;
 Lines 270-281    Link Here 
270
    {
270
    {
271
      ResetCountersBasic (station);
271
      ResetCountersBasic (station);
272
    }
272
    }
273
  return GetSupported (station, station->m_rate);
273
  return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel ());
274
}
274
}
275
WifiMode
275
WifiTxVector
276
RraaWifiManager::DoGetRtsMode (WifiRemoteStation *st)
276
RraaWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
277
{
277
{
278
  return GetSupported (st, 0);
278
  return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel ());
279
}
279
}
280
280
281
bool
281
bool
(-)a/src/devices/wifi/rraa-wifi-manager.h (-2 / +2 lines)
 Lines 65-72    Link Here 
65
                               double ackSnr, WifiMode ackMode, double dataSnr);
65
                               double ackSnr, WifiMode ackMode, double dataSnr);
66
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
66
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
67
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
67
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
68
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
68
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
69
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
69
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
70
  virtual bool DoNeedRts (WifiRemoteStation *st,
70
  virtual bool DoNeedRts (WifiRemoteStation *st,
71
                          Ptr<const Packet> packet, bool normally);
71
                          Ptr<const Packet> packet, bool normally);
72
  virtual bool IsLowLatency (void) const;
72
  virtual bool IsLowLatency (void) const;
(-)a/src/devices/wifi/wifi-remote-station-manager.cc (-62 / +98 lines)
 Lines 39-51    Link Here 
39
39
40
namespace ns3 {
40
namespace ns3 {
41
41
42
class TxModeTag : public Tag
42
class HighLatencyTxVectorTag : public Tag
43
{
43
{
44
public:
44
public:
45
  TxModeTag ();
45
  HighLatencyTxVectorTag ();
46
  TxModeTag (WifiMode rtsMode, WifiMode dataMode);
46
  HighLatencyTxVectorTag (WifiTxVector rtsTxVector, WifiTxVector dataTxVector);
47
  WifiMode GetRtsMode (void) const;
47
  WifiTxVector GetRtsTxVector (void) const;
48
  WifiMode GetDataMode (void) const;
48
  WifiTxVector GetDataTxVector (void) const;
49
49
50
  static TypeId GetTypeId (void);
50
  static TypeId GetTypeId (void);
51
  virtual TypeId GetInstanceTypeId (void) const;
51
  virtual TypeId GetInstanceTypeId (void) const;
 Lines 54-124    Link Here 
54
  virtual void Deserialize (TagBuffer i);
54
  virtual void Deserialize (TagBuffer i);
55
  virtual void Print (std::ostream &os) const;
55
  virtual void Print (std::ostream &os) const;
56
private:
56
private:
57
  WifiMode m_rtsMode;
57
  WifiTxVector m_rtsTxVector;
58
  WifiMode m_dataMode;
58
  WifiTxVector m_dataTxVector;
59
};
59
};
60
60
61
TxModeTag::TxModeTag ()
61
HighLatencyTxVectorTag::HighLatencyTxVectorTag ()
62
{}
62
{}
63
TxModeTag::TxModeTag (WifiMode rtsMode, WifiMode dataMode)
63
HighLatencyTxVectorTag::HighLatencyTxVectorTag (WifiTxVector rtsTxVector, WifiTxVector dataTxVector)
64
  : m_rtsMode (rtsMode),
64
  : m_rtsTxVector (rtsTxVector),
65
    m_dataMode (dataMode)
65
    m_dataTxVector (dataTxVector)
66
{}
66
{}
67
WifiMode 
67
WifiTxVector 
68
TxModeTag::GetRtsMode (void) const
68
HighLatencyTxVectorTag::GetRtsTxVector (void) const
69
{
69
{
70
  return m_rtsMode;
70
  return m_rtsTxVector;
71
}
71
}
72
WifiMode 
72
WifiTxVector 
73
TxModeTag::GetDataMode (void) const
73
HighLatencyTxVectorTag::GetDataTxVector (void) const
74
{
74
{
75
  return m_dataMode;
75
  return m_dataTxVector;
76
}
76
}
77
TypeId 
77
TypeId 
78
TxModeTag::GetTypeId (void)
78
HighLatencyTxVectorTag::GetTypeId (void)
79
{
79
{
80
  static TypeId tid = TypeId ("ns3::TxModeTag")
80
  static TypeId tid = TypeId ("ns3::HighLatencyTxVectorTag")
81
    .SetParent<Tag> ()
81
    .SetParent<Tag> ()
82
    .AddConstructor<TxModeTag> ()
82
    .AddConstructor<HighLatencyTxVectorTag> ()   
83
    .AddAttribute ("RtsTxMode", 
84
                   "Tx mode of rts to use later",
85
                   EmptyAttributeValue (),
86
                   MakeWifiModeAccessor (&TxModeTag::GetRtsMode),
87
                   MakeWifiModeChecker ())
88
    .AddAttribute ("DataTxMode", 
89
                   "Tx mode of data to use later",
90
                   EmptyAttributeValue (),
91
                   MakeWifiModeAccessor (&TxModeTag::GetDataMode),
92
                   MakeWifiModeChecker ())
93
    ;
83
    ;
94
  return tid;
84
  return tid;
95
}
85
}
96
TypeId 
86
TypeId 
97
TxModeTag::GetInstanceTypeId (void) const
87
HighLatencyTxVectorTag::GetInstanceTypeId (void) const
98
{
88
{
99
  return GetTypeId ();
89
  return GetTypeId ();
100
}
90
}
101
uint32_t 
91
uint32_t 
102
TxModeTag::GetSerializedSize (void) const
92
HighLatencyTxVectorTag::GetSerializedSize (void) const
103
{
93
{
104
  return sizeof (WifiMode) * 2;
94
  return sizeof (WifiTxVector) * 2;
105
}
95
}
106
void 
96
void 
107
TxModeTag::Serialize (TagBuffer i) const
97
HighLatencyTxVectorTag::Serialize (TagBuffer i) const
108
{
98
{
109
  i.Write ((uint8_t *)&m_rtsMode, sizeof (WifiMode));
99
  i.Write ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector));
110
  i.Write ((uint8_t *)&m_dataMode, sizeof (WifiMode));
100
  i.Write ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector));
111
}
101
}
112
void 
102
void 
113
TxModeTag::Deserialize (TagBuffer i)
103
HighLatencyTxVectorTag::Deserialize (TagBuffer i)
114
{
104
{
115
  i.Read ((uint8_t *)&m_rtsMode, sizeof (WifiMode));
105
  i.Read ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector));
116
  i.Read ((uint8_t *)&m_dataMode, sizeof (WifiMode));
106
  i.Read ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector));
117
}
107
}
118
void 
108
void 
119
TxModeTag::Print (std::ostream &os) const
109
HighLatencyTxVectorTag::Print (std::ostream &os) const
120
{
110
{
121
  os << "Rts=" << m_rtsMode << ", Data=" << m_dataMode;
111
  os << "Rts=" << m_rtsTxVector << ", Data=" << m_dataTxVector;
122
}
112
}
123
113
124
} // namespace ns3
114
} // namespace ns3
 Lines 166-171    Link Here 
166
                   WifiModeValue (),
156
                   WifiModeValue (),
167
                   MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
157
                   MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
168
                   MakeWifiModeChecker ())
158
                   MakeWifiModeChecker ())
159
    .AddAttribute ("DefaultTxPowerLevel", "Default power level to be used for transmissions. "
160
                   "This is the power level that is used by all those WifiManagers that do not"
161
                   "implement TX power control.",
162
                   UintegerValue (0),
163
                   MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxPowerLevel),
164
                   MakeUintegerChecker<uint8_t> ())
169
    .AddTraceSource ("MacTxRtsFailed", 
165
    .AddTraceSource ("MacTxRtsFailed", 
170
                     "The transmission of a RTS by the MAC layer has failed",
166
                     "The transmission of a RTS by the MAC layer has failed",
171
                     MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed))
167
                     MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed))
 Lines 339-385    Link Here 
339
      return;
335
      return;
340
    }
336
    }
341
  WifiRemoteStation *station = Lookup (address, header);
337
  WifiRemoteStation *station = Lookup (address, header);
342
  WifiMode rts = DoGetRtsMode (station);
338
  WifiTxVector rts = DoGetRtsTxVector (station);
343
  WifiMode data = DoGetDataMode (station, fullPacketSize);
339
  WifiTxVector data = DoGetDataTxVector (station, fullPacketSize);
344
  TxModeTag tag;
340
  HighLatencyTxVectorTag tag;
345
  // first, make sure that the tag is not here anymore.
341
  // first, make sure that the tag is not here anymore.
346
  ConstCast<Packet> (packet)->RemovePacketTag (tag);
342
  ConstCast<Packet> (packet)->RemovePacketTag (tag);
347
  tag = TxModeTag (rts, data);
343
  tag = HighLatencyTxVectorTag (rts, data);
348
  // and then, add it back
344
  // and then, add it back
349
  packet->AddPacketTag (tag);
345
  packet->AddPacketTag (tag);
350
}
346
}
351
WifiMode
347
WifiTxVector
352
WifiRemoteStationManager::GetDataMode (Mac48Address address, const WifiMacHeader *header,
348
WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHeader *header,
353
                                       Ptr<const Packet> packet, uint32_t fullPacketSize)
349
                                       Ptr<const Packet> packet, uint32_t fullPacketSize)
354
{
350
{
355
  if (address.IsGroup ())
351
  if (address.IsGroup ())
356
    {
352
    {
357
      return GetNonUnicastMode ();
353
      WifiTxVector v;
354
      v.mode = GetNonUnicastMode ();
355
      v.txPowerLevel = m_defaultTxPowerLevel;
356
      return v;
358
    }
357
    }
359
  if (!IsLowLatency ())
358
  if (!IsLowLatency ())
360
    {
359
    {
361
      TxModeTag tag;
360
      HighLatencyTxVectorTag tag;
362
      bool found;
361
      bool found;
363
      found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
362
      found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
364
      NS_ASSERT (found);
363
      NS_ASSERT (found);
365
      return tag.GetDataMode ();
364
      return tag.GetDataTxVector ();
366
    }
365
    }
367
  return DoGetDataMode (Lookup (address, header), fullPacketSize);
366
  return DoGetDataTxVector (Lookup (address, header), fullPacketSize);
368
}
367
}
369
WifiMode
368
WifiTxVector
370
WifiRemoteStationManager::GetRtsMode (Mac48Address address, const WifiMacHeader *header,
369
WifiRemoteStationManager::GetRtsTxVector (Mac48Address address, const WifiMacHeader *header,
371
                                      Ptr<const Packet> packet)
370
                                      Ptr<const Packet> packet)
372
{
371
{
373
  NS_ASSERT (!address.IsGroup ());
372
  NS_ASSERT (!address.IsGroup ());
374
  if (!IsLowLatency ())
373
  if (!IsLowLatency ())
375
    {
374
    {
376
      TxModeTag tag;
375
      HighLatencyTxVectorTag tag;
377
      bool found;
376
      bool found;
378
      found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
377
      found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
379
      NS_ASSERT (found);
378
      NS_ASSERT (found);
380
      return tag.GetRtsMode ();
379
      return tag.GetRtsTxVector ();
381
    }
380
    }
382
  return DoGetRtsMode (Lookup (address, header));
381
  return DoGetRtsTxVector (Lookup (address, header));
383
}
382
}
384
void
383
void
385
WifiRemoteStationManager::ReportRtsFailed (Mac48Address address, const WifiMacHeader *header)
384
WifiRemoteStationManager::ReportRtsFailed (Mac48Address address, const WifiMacHeader *header)
 Lines 641-657    Link Here 
641
  return mode;
640
  return mode;
642
}
641
}
643
642
644
WifiMode
643
WifiTxVector
645
WifiRemoteStationManager::GetCtsMode (Mac48Address address, WifiMode rtsMode)
644
WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode)
646
{
645
{
647
  NS_ASSERT (!address.IsGroup ());
646
  NS_ASSERT (!address.IsGroup ());
648
  return GetControlAnswerMode (address, rtsMode);
647
  WifiTxVector v;
648
  v.mode = GetControlAnswerMode (address, rtsMode);
649
  v.txPowerLevel = DoGetCtsTxPowerLevel (address, v.mode);
650
  return v;
649
}
651
}
650
WifiMode
652
WifiTxVector
651
WifiRemoteStationManager::GetAckMode (Mac48Address address, WifiMode dataMode)
653
WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMode)
652
{
654
{
653
  NS_ASSERT (!address.IsGroup ());
655
  NS_ASSERT (!address.IsGroup ());
654
  return GetControlAnswerMode (address, dataMode);
656
  WifiTxVector v;
657
  v.mode = GetControlAnswerMode (address, dataMode);
658
  v.txPowerLevel = DoGetCtsTxPowerLevel (address, v.mode);
659
  return v;
660
}
661
WifiTxVector
662
WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode blockAckReqMode)
663
{
664
  NS_ASSERT (!address.IsGroup ());
665
  WifiTxVector v;
666
  v.mode = GetControlAnswerMode (address, blockAckReqMode);
667
  v.txPowerLevel = DoGetCtsTxPowerLevel (address, v.mode);
668
  return v;
669
}
670
671
uint8_t 
672
WifiRemoteStationManager::DoGetCtsTxPowerLevel (Mac48Address address, WifiMode ctsMode)
673
{
674
  return m_defaultTxPowerLevel;
675
}
676
uint8_t 
677
WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode)
678
{
679
  return m_defaultTxPowerLevel;
680
}
681
uint8_t 
682
WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode)
683
{
684
  return m_defaultTxPowerLevel;
685
}
686
687
uint8_t
688
WifiRemoteStationManager::GetDefaultTxPowerLevel (void) const
689
{
690
  return m_defaultTxPowerLevel;
655
}
691
}
656
692
657
WifiRemoteStationInfo 
693
WifiRemoteStationInfo 
(-)a/src/devices/wifi/wifi-remote-station-manager.h (-6 / +42 lines)
 Lines 28-33    Link Here 
28
#include "ns3/object.h"
28
#include "ns3/object.h"
29
#include "ns3/nstime.h"
29
#include "ns3/nstime.h"
30
#include "wifi-mode.h"
30
#include "wifi-mode.h"
31
#include "wifi-tx-vector.h"
31
32
32
namespace ns3 {
33
namespace ns3 {
33
34
 Lines 155-161    Link Here 
155
   * \param fullPacketSize the size of the packet after its 802.11 MAC header has been added.
156
   * \param fullPacketSize the size of the packet after its 802.11 MAC header has been added.
156
   * \returns the transmission mode to use to send this packet
157
   * \returns the transmission mode to use to send this packet
157
   */
158
   */
158
  WifiMode GetDataMode (Mac48Address address, const WifiMacHeader *header,
159
  WifiTxVector GetDataTxVector (Mac48Address address, const WifiMacHeader *header,
159
                        Ptr<const Packet> packet, uint32_t fullPacketSize);
160
                        Ptr<const Packet> packet, uint32_t fullPacketSize);
160
  /**
161
  /**
161
   * \param address remote address
162
   * \param address remote address
 Lines 164-170    Link Here 
164
   * \returns the transmission mode to use to send the RTS prior to the
165
   * \returns the transmission mode to use to send the RTS prior to the
165
   *          transmission of the data packet itself.
166
   *          transmission of the data packet itself.
166
   */
167
   */
167
  WifiMode GetRtsMode (Mac48Address address, const WifiMacHeader *header,
168
  WifiTxVector GetRtsTxVector (Mac48Address address, const WifiMacHeader *header,
168
                       Ptr<const Packet> packet);
169
                       Ptr<const Packet> packet);
169
  /**
170
  /**
170
   * Should be invoked whenever the RtsTimeout associated to a transmission
171
   * Should be invoked whenever the RtsTimeout associated to a transmission
 Lines 280-293    Link Here 
280
   * \returns the transmission mode to use for the CTS to complete the RTS/CTS
281
   * \returns the transmission mode to use for the CTS to complete the RTS/CTS
281
   *          handshake.
282
   *          handshake.
282
   */
283
   */
283
  WifiMode GetCtsMode (Mac48Address address, WifiMode rtsMode);
284
  WifiTxVector GetCtsTxVector (Mac48Address address, WifiMode rtsMode);
284
  /**
285
  /**
285
   * \param address
286
   * \param address
286
   * \param dataMode the transmission mode used to send an ACK we just received
287
   * \param dataMode the transmission mode used to send an ACK we just received
287
   * \returns the transmission mode to use for the ACK to complete the data/ACK
288
   * \returns the transmission mode to use for the ACK to complete the data/ACK
288
   *          handshake.
289
   *          handshake.
289
   */
290
   */
290
  WifiMode GetAckMode (Mac48Address address, WifiMode dataMode);
291
  WifiTxVector GetAckTxVector (Mac48Address address, WifiMode dataMode);
292
  /**
293
   * \param address
294
   * \param dataMode the transmission mode used to send an ACK we just received
295
   * \returns the transmission mode to use for the ACK to complete the data/ACK
296
   *          handshake.
297
   */
298
  WifiTxVector GetBlockAckTxVector (Mac48Address address, WifiMode dataMode);
299
300
  uint8_t GetDefaultTxPowerLevel (void) const;
291
301
292
  WifiRemoteStationInfo GetInfo (Mac48Address address);
302
  WifiRemoteStationInfo GetInfo (Mac48Address address);
293
protected:
303
protected:
 Lines 366-372    Link Here 
366
   * Note: This method is called before sending a unicast packet or a fragment
376
   * Note: This method is called before sending a unicast packet or a fragment
367
   *       of a unicast packet to decide which transmission mode to use.
377
   *       of a unicast packet to decide which transmission mode to use.
368
   */
378
   */
369
  virtual WifiMode DoGetDataMode (WifiRemoteStation *station,
379
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station,
370
                                  uint32_t size) = 0;
380
                                  uint32_t size) = 0;
371
  /**
381
  /**
372
   * \param station the station with which we need to communicate
382
   * \param station the station with which we need to communicate
 Lines 375-381    Link Here 
375
   * Note: This method is called before sending an rts to a station
385
   * Note: This method is called before sending an rts to a station
376
   *       to decide which transmission mode to use for the rts.
386
   *       to decide which transmission mode to use for the rts.
377
   */
387
   */
378
  virtual WifiMode DoGetRtsMode (WifiRemoteStation *station) = 0;
388
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station) = 0;
389
390
  /** 
391
   * \param address the address of the recipient of the CTS
392
   * \param ctsMode the mode to be used for the CTS 
393
   * 
394
   * \return the power level to be used to send the CTS
395
   */
396
  virtual uint8_t DoGetCtsTxPowerLevel (Mac48Address address, WifiMode ctsMode);
397
398
  /** 
399
   * \param address the address of the recipient of the ACK
400
   * \param ctsMode the mode to be used for the ACK 
401
   * 
402
   * \return the power level to be used to send the ACK
403
   */  
404
  virtual uint8_t DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode);
405
406
  /** 
407
   * \param address the address of the recipient of the Block ACK
408
   * \param ctsMode the mode to be used for the Block ACK 
409
   * 
410
   * \return the power level to be used to send the Block ACK
411
   */  
412
  virtual uint8_t DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode);
413
379
  virtual void DoReportRtsFailed (WifiRemoteStation *station) = 0;
414
  virtual void DoReportRtsFailed (WifiRemoteStation *station) = 0;
380
  virtual void DoReportDataFailed (WifiRemoteStation *station) = 0;
415
  virtual void DoReportDataFailed (WifiRemoteStation *station) = 0;
381
  virtual void DoReportRtsOk (WifiRemoteStation *station,
416
  virtual void DoReportRtsOk (WifiRemoteStation *station,
 Lines 426-431    Link Here 
426
  uint32_t m_rtsCtsThreshold;
461
  uint32_t m_rtsCtsThreshold;
427
  uint32_t m_fragmentationThreshold;
462
  uint32_t m_fragmentationThreshold;
428
  WifiMode m_nonUnicastMode;
463
  WifiMode m_nonUnicastMode;
464
  uint8_t  m_defaultTxPowerLevel;
429
  double m_avgSlrcCoefficient;
465
  double m_avgSlrcCoefficient;
430
  /**
466
  /**
431
   * The trace source fired when the transmission of a single RTS has failed
467
   * The trace source fired when the transmission of a single RTS has failed
(-)d5cfe99001f0 (+41 lines)
Added Link Here 
1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright (c) 2010 CTTC
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as 
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 *
18
 * Author: Nicola Baldo <nbaldo@cttc.es>
19
 */
20
21
#include "ns3/wifi-tx-vector.h"
22
23
namespace ns3 {
24
25
WifiTxVector::WifiTxVector ()
26
{
27
}
28
29
WifiTxVector::WifiTxVector (WifiMode m, uint8_t l)
30
  : mode (m),
31
    txPowerLevel (l)
32
{
33
}
34
35
std::ostream & operator << (std::ostream & os, const WifiTxVector &v)
36
{
37
  os << "mode:" << v.mode << " txpwrlvl:" << v.txPowerLevel;
38
  return os;
39
}
40
41
} // namespace ns3
(-)d5cfe99001f0 (+63 lines)
Added Link Here 
1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
 * Copyright (c) 2010 CTTC
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 2 as 
7
 * published by the Free Software Foundation;
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 *
18
 * Author: Nicola Baldo <nbaldo@cttc.es>
19
 */
20
21
#ifndef WIFI_TX_VECTOR_H
22
#define WIFI_TX_VECTOR_H
23
24
#include <ns3/wifi-mode.h>
25
#include <ostream>
26
27
namespace ns3 {
28
29
30
/**
31
 * This class mimics the TXVECTOR which is to be
32
 * passed to the PHY in order to define the parameters which are to be
33
 * used for a transmission. See IEEE 802.11-2007 15.2.6 "Transmit PLCP",
34
 * and also 15.4.4.2 "PMD_SAP peer-to-peer service primitive
35
 * parameters".
36
 *
37
 * \note the above reference is valid for the DSSS PHY only (clause
38
 * 15). TXVECTOR is defined also for the other PHYs, however they
39
 * don't include the TXPWRLVL explicitly in the TXVECTOR. This is
40
 * somewhat strange, since all PHYs actually have a
41
 * PMD_TXPWRLVL.request primitive. We decide to include the power
42
 * level in WifiTxVector for all PHYs, since it serves better our
43
 * purposes, and furthermore it seems close to the way real devices
44
 * work (e.g., madwifi).
45
 */
46
struct WifiTxVector
47
{
48
  WifiTxVector ();
49
  WifiTxVector (WifiMode m, uint8_t l);
50
51
  WifiMode mode;         /**< The DATARATE parameter in Table 15-4. 
52
			    It is the value that will be passed
53
			    to PMD_RATE.request */ 
54
  uint8_t  txPowerLevel;  /**< The TXPWR_LEVEL parameter in Table 15-4. 
55
			    It is the value that will be passed
56
			    to PMD_TXPWRLVL.request */ 
57
};
58
59
std::ostream & operator << (std::ostream & os, const WifiTxVector &v);
60
61
} // namespace ns3
62
63
#endif // WIFI_TX_VECTOR_H
(-)a/src/devices/wifi/wscript (+2 lines)
 Lines 65-70    Link Here 
65
        'block-ack-agreement.cc',
65
        'block-ack-agreement.cc',
66
        'block-ack-manager.cc',
66
        'block-ack-manager.cc',
67
        'block-ack-test-suite.cc',
67
        'block-ack-test-suite.cc',
68
        'wifi-tx-vector.cc',
68
        ]
69
        ]
69
    headers = bld.new_task_gen('ns3header')
70
    headers = bld.new_task_gen('ns3header')
70
    headers.module = 'wifi'
71
    headers.module = 'wifi'
 Lines 123-128    Link Here 
123
        'ctrl-headers.h',
124
        'ctrl-headers.h',
124
        'block-ack-agreement.h',
125
        'block-ack-agreement.h',
125
        'block-ack-manager.h',
126
        'block-ack-manager.h',
127
        'wifi-tx-vector.h',
126
        ]
128
        ]
127
129
128
    if bld.env['ENABLE_GSL']:
130
    if bld.env['ENABLE_GSL']:

Return to bug 917