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

(-)a/src/devices/wifi/dcf-manager-test.cc (+28 lines)
 Lines 75-80    Link Here 
75
  void ExpectCollision (uint64_t time, uint32_t from, uint32_t nSlots);
75
  void ExpectCollision (uint64_t time, uint32_t from, uint32_t nSlots);
76
  void AddRxOkEvt (uint64_t at, uint64_t duration);
76
  void AddRxOkEvt (uint64_t at, uint64_t duration);
77
  void AddRxErrorEvt (uint64_t at, uint64_t duration);
77
  void AddRxErrorEvt (uint64_t at, uint64_t duration);
78
  void AddRxInsideSifsEvt (uint64_t at, uint64_t duration);
79
  void AddTxEvt (uint64_t at, uint64_t duration);
78
  void AddNavReset (uint64_t at, uint64_t duration);
80
  void AddNavReset (uint64_t at, uint64_t duration);
79
  void AddNavStart (uint64_t at, uint64_t duration);
81
  void AddNavStart (uint64_t at, uint64_t duration);
80
  void AddAckTimeoutReset (uint64_t at);
82
  void AddAckTimeoutReset (uint64_t at);
 Lines 143-148    Link Here 
143
      m_result = result;
145
      m_result = result;
144
    }
146
    }
145
}
147
}
148
void
149
DcfManagerTest::AddTxEvt (uint64_t at, uint64_t duration)
150
{
151
  Simulator::Schedule (MicroSeconds (at) - Now (), 
152
                       &DcfManager::NotifyTxStartNow, m_dcfManager, 
153
                       MicroSeconds (duration));
154
}
146
void 
155
void 
147
DcfManagerTest::NotifyInternalCollision (uint32_t i)
156
DcfManagerTest::NotifyInternalCollision (uint32_t i)
148
{
157
{
 Lines 244-249    Link Here 
244
  Simulator::Schedule (MicroSeconds (at+duration) - Now (), 
253
  Simulator::Schedule (MicroSeconds (at+duration) - Now (), 
245
                       &DcfManager::NotifyRxEndOkNow, m_dcfManager);
254
                       &DcfManager::NotifyRxEndOkNow, m_dcfManager);
246
}
255
}
256
void
257
DcfManagerTest::AddRxInsideSifsEvt (uint64_t at, uint64_t duration)
258
{
259
  Simulator::Schedule (MicroSeconds (at) - Now (), 
260
                       &DcfManager::NotifyRxStartNow, m_dcfManager, 
261
                       MicroSeconds (duration));
262
}
247
void 
263
void 
248
DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration)
264
DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration)
249
{
265
{
 Lines 321-326    Link Here 
321
  AddAccessRequest (1, 1, 4, 0);
337
  AddAccessRequest (1, 1, 4, 0);
322
  AddAccessRequest (10, 2, 10, 0);
338
  AddAccessRequest (10, 2, 10, 0);
323
  EndTest ();
339
  EndTest ();
340
  // Check that receiving inside SIFS shall be cancelled properly:
341
  //  0      3       4    5      8     9     12       13 14
342
  //  | sifs | aifsn | tx | sifs | ack | sifs | aifsn |  |tx | 
343
  //
344
  StartTest (1, 3, 10);
345
  AddDcfState (1);
346
  AddAccessRequest (1, 1, 4, 0);
347
  AddRxInsideSifsEvt (6, 10);
348
  AddTxEvt(8, 1);
349
  AddAccessRequest (14, 2, 14, 0);
350
  EndTest ();
351
324
352
325
  // The test below mainly intends to test the case where the medium
353
  // The test below mainly intends to test the case where the medium
326
  // becomes busy in the middle of a backoff slot: the backoff counter
354
  // becomes busy in the middle of a backoff slot: the backoff counter
(-)a/src/devices/wifi/dcf-manager.cc (+11 lines)
 Lines 572-577    Link Here 
572
void 
572
void 
573
DcfManager::NotifyTxStartNow (Time duration)
573
DcfManager::NotifyTxStartNow (Time duration)
574
{
574
{
575
  if (m_rxing)
576
  {
577
    //this may be caused only if PHY has started to receive a packet
578
    //inside SIFS, so, we check that lastRxStart was maximum a SIFS
579
    //ago
580
    NS_ASSERT(Simulator::Now () - m_lastRxStart < m_sifs);
581
    m_lastRxEnd = Simulator::Now ();
582
    m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
583
    m_lastRxReceivedOk = true;
584
    m_rxing = false;
585
  }
575
  MY_DEBUG ("tx start for "<<duration);
586
  MY_DEBUG ("tx start for "<<duration);
576
  UpdateBackoff ();
587
  UpdateBackoff ();
577
  m_lastTxStart = Simulator::Now ();
588
  m_lastTxStart = Simulator::Now ();

Return to bug 595