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

(-)a/src/devices/wifi/dcf-manager.cc (-7 / +7 lines)
 Lines 243-249    Link Here 
243
    m_lastSwitchingStart (MicroSeconds (0)), 
243
    m_lastSwitchingStart (MicroSeconds (0)), 
244
    m_lastSwitchingDuration (MicroSeconds (0)), 
244
    m_lastSwitchingDuration (MicroSeconds (0)), 
245
    m_rxing (false),
245
    m_rxing (false),
246
    m_slotTime (Seconds (0.0)),
246
    m_slotTimeUs (0),
247
    m_sifs (Seconds (0.0)),
247
    m_sifs (Seconds (0.0)),
248
    m_phyListener (0),
248
    m_phyListener (0),
249
    m_lowListener (0)
249
    m_lowListener (0)
 Lines 273-279    Link Here 
273
void 
273
void 
274
DcfManager::SetSlot (Time slotTime)
274
DcfManager::SetSlot (Time slotTime)
275
{
275
{
276
  m_slotTime = slotTime;
276
  m_slotTimeUs = slotTime.GetMicroSeconds ();
277
}
277
}
278
void 
278
void 
279
DcfManager::SetSifs (Time sifs)
279
DcfManager::SetSifs (Time sifs)
 Lines 497-503    Link Here 
497
DcfManager::GetBackoffStartFor (DcfState *state)
497
DcfManager::GetBackoffStartFor (DcfState *state)
498
{
498
{
499
  Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
499
  Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
500
                                     GetAccessGrantStart () + Scalar (state->GetAifsn ()) * m_slotTime);
500
                                     GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs));
501
  
501
  
502
  return mostRecentEvent;
502
  return mostRecentEvent;
503
}
503
}
 Lines 505-511    Link Here 
505
Time
505
Time
506
DcfManager::GetBackoffEndFor (DcfState *state)
506
DcfManager::GetBackoffEndFor (DcfState *state)
507
{
507
{
508
  return GetBackoffStartFor (state) + Scalar (state->GetBackoffSlots ()) * m_slotTime;
508
  return GetBackoffStartFor (state) + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs);
509
}
509
}
510
510
511
void
511
void
 Lines 519-529    Link Here 
519
      Time backoffStart = GetBackoffStartFor (state);
519
      Time backoffStart = GetBackoffStartFor (state);
520
      if (backoffStart <= Simulator::Now ())
520
      if (backoffStart <= Simulator::Now ())
521
        {
521
        {
522
          Scalar nSlots = (Simulator::Now () - backoffStart) / m_slotTime;
522
          uint32_t nus = (Simulator::Now () - backoffStart).GetMicroSeconds ();
523
          uint32_t nIntSlots = lrint (nSlots.GetDouble ());          
523
          uint32_t nIntSlots = nus / m_slotTimeUs;
524
          uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ());
524
          uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ());
525
          MY_DEBUG ("dcf " << k << " dec backoff slots=" << n);
525
          MY_DEBUG ("dcf " << k << " dec backoff slots=" << n);
526
          Time backoffUpdateBound = backoffStart + Scalar (n) * m_slotTime;
526
          Time backoffUpdateBound = backoffStart + MicroSeconds (n * m_slotTimeUs);
527
          state->UpdateBackoffSlotsNow (n, backoffUpdateBound);
527
          state->UpdateBackoffSlotsNow (n, backoffUpdateBound);
528
        }
528
        }
529
    }
529
    }
(-)a/src/devices/wifi/dcf-manager.h (-1 / +1 lines)
 Lines 323-329    Link Here 
323
  bool m_sleeping;
323
  bool m_sleeping;
324
  Time m_eifsNoDifs;
324
  Time m_eifsNoDifs;
325
  EventId m_accessTimeout;
325
  EventId m_accessTimeout;
326
  Time m_slotTime;
326
  uint32_t m_slotTimeUs;
327
  Time m_sifs;
327
  Time m_sifs;
328
  class PhyListener *m_phyListener;
328
  class PhyListener *m_phyListener;
329
  class LowDcfListener *m_lowListener;
329
  class LowDcfListener *m_lowListener;

Return to bug 695