Ack timeout patch was merged. HWMP: DO=1 by default, if packet is unresolved -
we queue it
This commit is contained in:
@@ -132,13 +132,13 @@ HwmpProtocol::GetTypeId ()
|
||||
)
|
||||
.AddAttribute ("doFlag",
|
||||
"Destination only HWMP flag",
|
||||
BooleanValue (false),
|
||||
BooleanValue (true),
|
||||
MakeUintegerAccessor (&HwmpProtocol::m_doFlag),
|
||||
MakeUintegerChecker<bool> ()
|
||||
)
|
||||
.AddAttribute ("rfFlag",
|
||||
"Reply and forward flag",
|
||||
BooleanValue (false),
|
||||
BooleanValue (true),
|
||||
MakeUintegerAccessor (&HwmpProtocol::m_rfFlag),
|
||||
MakeUintegerChecker<bool> ()
|
||||
);
|
||||
@@ -286,8 +286,6 @@ HwmpProtocol::ForwardUnicast(uint32_t sourceIface, const Mac48Address source, c
|
||||
// root
|
||||
if(result.retransmitter == Mac48Address::GetBroadcast ())
|
||||
result = m_rtable->LookupProactiveExpired ();
|
||||
if(result.retransmitter == Mac48Address::GetBroadcast ())
|
||||
return false;
|
||||
std::vector<IePerr::FailedDestination> destinations = m_rtable->GetUnreachableDestinations (result.retransmitter);
|
||||
MakePathError (destinations);
|
||||
}
|
||||
|
||||
@@ -160,17 +160,29 @@ DcfState::NotifyInternalCollision (void)
|
||||
* Listener for Nav events. Forwards to DcfManager
|
||||
***************************************************************/
|
||||
|
||||
class LowNavListener : public ns3::MacLowNavListener {
|
||||
class LowDcfListener : public ns3::MacLowDcfListener {
|
||||
public:
|
||||
LowNavListener (ns3::DcfManager *dcf)
|
||||
LowDcfListener (ns3::DcfManager *dcf)
|
||||
: m_dcf (dcf) {}
|
||||
virtual ~LowNavListener () {}
|
||||
virtual ~LowDcfListener () {}
|
||||
virtual void NavStart (Time duration) {
|
||||
m_dcf->NotifyNavStartNow (duration);
|
||||
}
|
||||
virtual void NavReset (Time duration) {
|
||||
m_dcf->NotifyNavResetNow (duration);
|
||||
}
|
||||
virtual void AckTimeoutStart (Time duration) {
|
||||
m_dcf->NotifyAckTimeoutStartNow (duration);
|
||||
}
|
||||
virtual void AckTimeoutReset () {
|
||||
m_dcf->NotifyAckTimeoutResetNow ();
|
||||
}
|
||||
virtual void CtsTimeoutStart (Time duration) {
|
||||
m_dcf->NotifyCtsTimeoutStartNow (duration);
|
||||
}
|
||||
virtual void CtsTimeoutReset () {
|
||||
m_dcf->NotifyCtsTimeoutResetNow ();
|
||||
}
|
||||
private:
|
||||
ns3::DcfManager *m_dcf;
|
||||
};
|
||||
@@ -208,7 +220,9 @@ private:
|
||||
****************************************************************/
|
||||
|
||||
DcfManager::DcfManager ()
|
||||
: m_lastNavStart (MicroSeconds (0)),
|
||||
: m_lastAckTimeoutEnd (MicroSeconds (0)),
|
||||
m_lastCtsTimeoutEnd (MicroSeconds (0)),
|
||||
m_lastNavStart (MicroSeconds (0)),
|
||||
m_lastNavDuration (MicroSeconds (0)),
|
||||
m_lastRxStart (MicroSeconds (0)),
|
||||
m_lastRxDuration (MicroSeconds (0)),
|
||||
@@ -242,8 +256,8 @@ DcfManager::SetupPhyListener (Ptr<WifiPhy> phy)
|
||||
void
|
||||
DcfManager::SetupLowListener (Ptr<MacLow> low)
|
||||
{
|
||||
m_lowListener = new LowNavListener (this);
|
||||
low->RegisterNavListener (m_lowListener);
|
||||
m_lowListener = new LowDcfListener (this);
|
||||
low->RegisterDcfListener (m_lowListener);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -289,6 +303,16 @@ DcfManager::MostRecent (Time a, Time b, Time c, Time d) const
|
||||
Time retval = Max (e, f);
|
||||
return retval;
|
||||
}
|
||||
Time
|
||||
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const
|
||||
{
|
||||
Time g = Max (a, b);
|
||||
Time h = Max (c, d);
|
||||
Time i = Max (e, f);
|
||||
Time k = Max (g, h);
|
||||
Time retval = Max (k, i);
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool
|
||||
DcfManager::IsBusy (void) const
|
||||
@@ -346,7 +370,7 @@ DcfManager::DoGrantAccess (void)
|
||||
{
|
||||
DcfState *state = *i;
|
||||
if (state->IsAccessRequested () &&
|
||||
GetBackoffEndFor (state) <= Simulator::Now ())
|
||||
GetBackoffEndFor (state).GetTimeStep() <= Simulator::Now ().GetTimeStep ())
|
||||
{
|
||||
/**
|
||||
* This is the first dcf we find with an expired backoff and which
|
||||
@@ -426,7 +450,10 @@ DcfManager::GetAccessGrantStart (void) const
|
||||
Time accessGrantedStart = MostRecent (rxAccessStart,
|
||||
busyAccessStart,
|
||||
txAccessStart,
|
||||
navAccessStart);
|
||||
navAccessStart,
|
||||
m_lastAckTimeoutEnd,
|
||||
m_lastCtsTimeoutEnd
|
||||
);
|
||||
NS_LOG_INFO ("access grant start=" << accessGrantedStart <<
|
||||
", rx access start=" << rxAccessStart <<
|
||||
", busy access start=" << busyAccessStart <<
|
||||
@@ -486,8 +513,9 @@ DcfManager::DoRestartAccessTimeoutIfNeeded (void)
|
||||
if (state->IsAccessRequested ())
|
||||
{
|
||||
Time tmp = GetBackoffEndFor (state);
|
||||
if (tmp > Simulator::Now ())
|
||||
if (tmp.GetTimeStep () > Simulator::Now ().GetTimeStep ())
|
||||
{
|
||||
//NS_LOG_UNCOND("Now:"<<Simulator::Now ().GetTimeStep ());
|
||||
accessTimeoutNeeded = true;
|
||||
expectedBackoffEnd = std::min (expectedBackoffEnd, tmp);
|
||||
}
|
||||
@@ -581,5 +609,26 @@ DcfManager::NotifyNavStartNow (Time duration)
|
||||
m_lastNavDuration = duration;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DcfManager::NotifyAckTimeoutStartNow (Time duration)
|
||||
{
|
||||
m_lastAckTimeoutEnd = Simulator::Now () + duration;
|
||||
}
|
||||
void
|
||||
DcfManager::NotifyAckTimeoutResetNow ()
|
||||
{
|
||||
m_lastAckTimeoutEnd = Simulator::Now ();
|
||||
DoRestartAccessTimeoutIfNeeded ();
|
||||
}
|
||||
void
|
||||
DcfManager::NotifyCtsTimeoutStartNow (Time duration)
|
||||
{
|
||||
m_lastCtsTimeoutEnd = Simulator::Now () + duration;
|
||||
}
|
||||
void
|
||||
DcfManager::NotifyCtsTimeoutResetNow ()
|
||||
{
|
||||
m_lastCtsTimeoutEnd = Simulator::Now ();
|
||||
DoRestartAccessTimeoutIfNeeded ();
|
||||
}
|
||||
} // namespace ns3
|
||||
|
||||
@@ -233,12 +233,17 @@ public:
|
||||
* Called at end of rx
|
||||
*/
|
||||
void NotifyNavStartNow (Time duration);
|
||||
|
||||
void NotifyAckTimeoutStartNow (Time duration);
|
||||
void NotifyAckTimeoutResetNow ();
|
||||
void NotifyCtsTimeoutStartNow (Time duration);
|
||||
void NotifyCtsTimeoutResetNow ();
|
||||
void NotifyAckTimeoutEnd (Time duration);
|
||||
private:
|
||||
void UpdateBackoff (void);
|
||||
Time MostRecent (Time a, Time b) const;
|
||||
Time MostRecent (Time a, Time b, Time c) const;
|
||||
Time MostRecent (Time a, Time b, Time c, Time d) const;
|
||||
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const;
|
||||
/**
|
||||
* Access will never be granted to the medium _before_
|
||||
* the time returned by this method.
|
||||
@@ -257,6 +262,8 @@ private:
|
||||
typedef std::vector<DcfState *> States;
|
||||
|
||||
States m_states;
|
||||
Time m_lastAckTimeoutEnd;
|
||||
Time m_lastCtsTimeoutEnd;
|
||||
Time m_lastNavStart;
|
||||
Time m_lastNavDuration;
|
||||
Time m_lastRxStart;
|
||||
@@ -274,7 +281,7 @@ private:
|
||||
Time m_slotTime;
|
||||
Time m_sifs;
|
||||
class PhyListener *m_phyListener;
|
||||
class LowNavListener *m_lowListener;
|
||||
class LowDcfListener *m_lowListener;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -110,9 +110,9 @@ MacLowTransmissionListener::MacLowTransmissionListener ()
|
||||
{}
|
||||
MacLowTransmissionListener::~MacLowTransmissionListener ()
|
||||
{}
|
||||
MacLowNavListener::MacLowNavListener ()
|
||||
MacLowDcfListener::MacLowDcfListener ()
|
||||
{}
|
||||
MacLowNavListener::~MacLowNavListener ()
|
||||
MacLowDcfListener::~MacLowDcfListener ()
|
||||
{}
|
||||
|
||||
MacLowTransmissionParameters::MacLowTransmissionParameters ()
|
||||
@@ -424,9 +424,9 @@ MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *> callback
|
||||
m_rxCallback = callback;
|
||||
}
|
||||
void
|
||||
MacLow::RegisterNavListener (MacLowNavListener *listener)
|
||||
MacLow::RegisterDcfListener (MacLowDcfListener *listener)
|
||||
{
|
||||
m_navListeners.push_back (listener);
|
||||
m_dcfListeners.push_back (listener);
|
||||
}
|
||||
|
||||
|
||||
@@ -544,6 +544,7 @@ MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamb
|
||||
station->ReportRtsOk (rxSnr, txMode, tag.Get ());
|
||||
|
||||
m_ctsTimeoutEvent.Cancel ();
|
||||
NotifyCtsTimeoutResetNow ();
|
||||
m_listener->GotCts (rxSnr, txMode);
|
||||
NS_ASSERT (m_sendDataEvent.IsExpired ());
|
||||
m_sendDataEvent = Simulator::Schedule (GetSifs (),
|
||||
@@ -570,12 +571,14 @@ MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamb
|
||||
m_normalAckTimeoutEvent.IsRunning ())
|
||||
{
|
||||
m_normalAckTimeoutEvent.Cancel ();
|
||||
NotifyAckTimeoutResetNow ();
|
||||
gotAck = true;
|
||||
}
|
||||
if (m_txParams.MustWaitFastAck () &&
|
||||
m_fastAckTimeoutEvent.IsRunning ())
|
||||
{
|
||||
m_fastAckTimeoutEvent.Cancel ();
|
||||
NotifyAckTimeoutResetNow ();
|
||||
gotAck = true;
|
||||
}
|
||||
if (gotAck)
|
||||
@@ -797,7 +800,7 @@ MacLow::NavCounterResetCtsMissed (Time rtsEndRxTime)
|
||||
void
|
||||
MacLow::DoNavResetNow (Time duration)
|
||||
{
|
||||
for (NavListenersCI i = m_navListeners.begin (); i != m_navListeners.end (); i++)
|
||||
for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
|
||||
{
|
||||
(*i)->NavReset (duration);
|
||||
}
|
||||
@@ -807,7 +810,7 @@ MacLow::DoNavResetNow (Time duration)
|
||||
bool
|
||||
MacLow::DoNavStartNow (Time duration)
|
||||
{
|
||||
for (NavListenersCI i = m_navListeners.begin (); i != m_navListeners.end (); i++)
|
||||
for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
|
||||
{
|
||||
(*i)->NavStart (duration);
|
||||
}
|
||||
@@ -821,6 +824,38 @@ MacLow::DoNavStartNow (Time duration)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void
|
||||
MacLow::NotifyAckTimeoutStartNow (Time duration)
|
||||
{
|
||||
for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
|
||||
{
|
||||
(*i)->AckTimeoutStart (duration);
|
||||
}
|
||||
}
|
||||
void
|
||||
MacLow::NotifyAckTimeoutResetNow ()
|
||||
{
|
||||
for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
|
||||
{
|
||||
(*i)->AckTimeoutReset ();
|
||||
}
|
||||
}
|
||||
void
|
||||
MacLow::NotifyCtsTimeoutStartNow (Time duration)
|
||||
{
|
||||
for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
|
||||
{
|
||||
(*i)->CtsTimeoutStart (duration);
|
||||
}
|
||||
}
|
||||
void
|
||||
MacLow::NotifyCtsTimeoutResetNow ()
|
||||
{
|
||||
for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
|
||||
{
|
||||
(*i)->CtsTimeoutReset ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MacLow::ForwardDown (Ptr<const Packet> packet, WifiMacHeader const* hdr,
|
||||
@@ -946,6 +981,7 @@ MacLow::SendRtsForPacket (void)
|
||||
Time timerDelay = txDuration + GetCtsTimeout ();
|
||||
|
||||
NS_ASSERT (m_ctsTimeoutEvent.IsExpired ());
|
||||
NotifyCtsTimeoutStartNow (timerDelay);
|
||||
m_ctsTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::CtsTimeout, this);
|
||||
|
||||
Ptr<Packet> packet = Create<Packet> ();
|
||||
@@ -965,18 +1001,21 @@ MacLow::StartDataTxTimers (void)
|
||||
{
|
||||
Time timerDelay = txDuration + GetAckTimeout ();
|
||||
NS_ASSERT (m_normalAckTimeoutEvent.IsExpired ());
|
||||
NotifyAckTimeoutStartNow (timerDelay);
|
||||
m_normalAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::NormalAckTimeout, this);
|
||||
}
|
||||
else if (m_txParams.MustWaitFastAck ())
|
||||
{
|
||||
Time timerDelay = txDuration + GetPifs ();
|
||||
NS_ASSERT (m_fastAckTimeoutEvent.IsExpired ());
|
||||
NotifyAckTimeoutStartNow (timerDelay);
|
||||
m_fastAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::FastAckTimeout, this);
|
||||
}
|
||||
else if (m_txParams.MustWaitSuperFastAck ())
|
||||
{
|
||||
Time timerDelay = txDuration + GetPifs ();
|
||||
NS_ASSERT (m_superFastAckTimeoutEvent.IsExpired ());
|
||||
NotifyAckTimeoutStartNow (timerDelay);
|
||||
m_superFastAckTimeoutEvent = Simulator::Schedule (timerDelay,
|
||||
&MacLow::SuperFastAckTimeout, this);
|
||||
}
|
||||
|
||||
@@ -100,10 +100,10 @@ public:
|
||||
* and calls to its methods are forwards to the corresponding
|
||||
* ns3::Dcf methods.
|
||||
*/
|
||||
class MacLowNavListener {
|
||||
class MacLowDcfListener {
|
||||
public:
|
||||
MacLowNavListener ();
|
||||
virtual ~MacLowNavListener ();
|
||||
MacLowDcfListener ();
|
||||
virtual ~MacLowDcfListener ();
|
||||
/**
|
||||
* \param duration duration of NAV timer
|
||||
*/
|
||||
@@ -112,6 +112,10 @@ public:
|
||||
* \param duration duration of NAV timer
|
||||
*/
|
||||
virtual void NavReset (Time duration) = 0;
|
||||
virtual void AckTimeoutStart (Time duration) = 0;
|
||||
virtual void AckTimeoutReset () = 0;
|
||||
virtual void CtsTimeoutStart (Time duration) = 0;
|
||||
virtual void CtsTimeoutReset () = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -306,7 +310,7 @@ public:
|
||||
* \param listener listen to NAV events for every incoming
|
||||
* and outgoing packet.
|
||||
*/
|
||||
void RegisterNavListener (MacLowNavListener *listener);
|
||||
void RegisterDcfListener (MacLowDcfListener *listener);
|
||||
|
||||
/**
|
||||
* \param packet to send (does not include the 802.11 MAC header and checksum)
|
||||
@@ -375,6 +379,10 @@ private:
|
||||
void DoNavResetNow (Time duration);
|
||||
bool DoNavStartNow (Time duration);
|
||||
bool IsNavZero (void) const;
|
||||
void NotifyAckTimeoutStartNow (Time duration);
|
||||
void NotifyAckTimeoutResetNow ();
|
||||
void NotifyCtsTimeoutStartNow (Time duration);
|
||||
void NotifyCtsTimeoutResetNow ();
|
||||
void MaybeCancelPrevious (void);
|
||||
|
||||
void NavCounterResetCtsMissed (Time rtsEndRxTime);
|
||||
@@ -397,9 +405,9 @@ private:
|
||||
Ptr<WifiPhy> m_phy;
|
||||
Ptr<WifiRemoteStationManager> m_stationManager;
|
||||
MacLowRxCallback m_rxCallback;
|
||||
typedef std::vector<MacLowNavListener *>::const_iterator NavListenersCI;
|
||||
typedef std::vector<MacLowNavListener *> NavListeners;
|
||||
NavListeners m_navListeners;
|
||||
typedef std::vector<MacLowDcfListener *>::const_iterator DcfListenersCI;
|
||||
typedef std::vector<MacLowDcfListener *> DcfListeners;
|
||||
DcfListeners m_dcfListeners;
|
||||
|
||||
EventId m_normalAckTimeoutEvent;
|
||||
EventId m_fastAckTimeoutEvent;
|
||||
|
||||
Reference in New Issue
Block a user