Manage a set of ns3::Txop. More...
#include "channel-access-manager.h"
Classes | |
struct | EmlsrLinkSwitchInfo |
Information associated with each PHY that is going to operate on another EMLSR link. More... | |
struct | Timespan |
Structure defining start time and end time for a given state. More... | |
Public Member Functions | |
ChannelAccessManager () | |
~ChannelAccessManager () override | |
void | Add (Ptr< Txop > txop) |
void | DeactivatePhyListener (Ptr< WifiPhy > phy) |
Deactivate current registered listener for PHY events on the given PHY. More... | |
void | DisableEdcaFor (Ptr< Txop > qosTxop, Time duration) |
Time | GetAccessGrantStart (bool ignoreNav=false) const |
Access will never be granted to the medium before the time returned by this method. More... | |
bool | GetGenerateBackoffOnNoTx () const |
uint16_t | GetLargestIdlePrimaryChannel (Time interval, Time end) |
Return the width of the largest primary channel that has been idle for the given time interval before the given time, if any primary channel has been idle, or zero, otherwise. More... | |
bool | GetPer20MHzBusy (const std::set< uint8_t > &indices) const |
bool | IsBusy () const |
Check if the device is busy sending or receiving, or NAV or CCA busy. More... | |
bool | NeedBackoffUponAccess (Ptr< Txop > txop, bool hadFramesToTransmit, bool checkMediumBusy) |
Determine if a new backoff needs to be generated as per letter a) of Section 10.23.2.2 of IEEE 802.11-2020 ("EDCA backoff procedure"). More... | |
void | NotifyAckTimeoutResetNow () |
Notify that ack timer has reset. More... | |
void | NotifyAckTimeoutStartNow (Time duration) |
Notify that ack timer has started for the given duration. More... | |
void | NotifyCcaBusyStartNow (Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations) |
void | NotifyCtsTimeoutResetNow () |
Notify that CTS timer has reset. More... | |
void | NotifyCtsTimeoutStartNow (Time duration) |
Notify that CTS timer has started for the given duration. More... | |
void | NotifyNavResetNow (Time duration) |
void | NotifyNavStartNow (Time duration) |
void | NotifyOffNow () |
Notify the Txop that the device has been put in off mode. More... | |
void | NotifyOnNow () |
Notify the Txop that the device has been resumed from off mode. More... | |
void | NotifyRxEndErrorNow () |
Notify the Txop that a packet reception was just completed unsuccessfuly. More... | |
void | NotifyRxEndOkNow () |
Notify the Txop that a packet reception was just completed successfully. More... | |
void | NotifyRxStartNow (Time duration) |
void | NotifySleepNow () |
Notify the Txop that the device has been put in sleep mode. More... | |
void | NotifyStartUsingOtherEmlsrLink () |
Notify that another EMLSR link is being used, hence medium access should be disabled. More... | |
void | NotifyStopUsingOtherEmlsrLink () |
Notify that another EMLSR link is no longer being used, hence medium access can be resumed. More... | |
void | NotifySwitchingEmlsrLink (Ptr< WifiPhy > phy, const WifiPhyOperatingChannel &channel, uint8_t linkId) |
Notify that the given PHY is about to switch to the given operating channel, which is used by the given link. More... | |
void | NotifySwitchingStartNow (PhyListener *phyListener, Time duration) |
void | NotifyTxStartNow (Time duration) |
void | NotifyWakeupNow () |
Notify the Txop that the device has been resumed from sleep mode. More... | |
void | RemovePhyListener (Ptr< WifiPhy > phy) |
Remove current registered listener for PHY events on the given PHY. More... | |
void | RequestAccess (Ptr< Txop > txop) |
void | ResetAllBackoffs () |
Reset the backoff for all the DCF/EDCAF. More... | |
void | ResetBackoff (Ptr< Txop > txop) |
Reset the backoff for the given DCF/EDCAF. More... | |
void | ResetState () |
Reset the state variables of this channel access manager. More... | |
void | SetGenerateBackoffOnNoTx (bool enable) |
Set the member variable indicating whether the backoff should be invoked when an AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty. More... | |
void | SetLinkId (uint8_t linkId) |
Set the ID of the link this Channel Access Manager is associated with. More... | |
void | SetupFrameExchangeManager (Ptr< FrameExchangeManager > feManager) |
Set up the Frame Exchange Manager. More... | |
void | SetupPhyListener (Ptr< WifiPhy > phy) |
Set up (or reactivate) listener for PHY events on the given PHY. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Protected Member Functions | |
void | DoDispose () override |
Destructor implementation. More... | |
void | DoInitialize () override |
Initialize() implementation. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Types | |
using | PhyListenerMap = std::unordered_map< Ptr< WifiPhy >, std::shared_ptr< PhyListener > > |
Maps each PHY listener to the associated PHY. More... | |
typedef std::vector< Ptr< Txop > > | Txops |
typedef for a vector of Txops More... | |
Private Member Functions | |
void | AccessTimeout () |
Called when access timeout should occur (e.g. More... | |
void | DoGrantDcfAccess () |
Grant access to Txop using DCF/EDCF contention rules. More... | |
void | DoRestartAccessTimeoutIfNeeded () |
Time | GetBackoffEndFor (Ptr< Txop > txop) |
Return the time when the backoff procedure ended (or will ended) for the given Txop. More... | |
Time | GetBackoffStartFor (Ptr< Txop > txop) |
Return the time when the backoff procedure started for the given Txop. More... | |
virtual Time | GetEifsNoDifs () const |
Return the EIFS duration minus a DIFS. More... | |
std::shared_ptr< PhyListener > | GetPhyListener (Ptr< WifiPhy > phy) const |
Get current registered listener for PHY events on the given PHY. More... | |
virtual Time | GetSifs () const |
Return the Short Interframe Space (SIFS) for this PHY. More... | |
virtual Time | GetSlot () const |
Return the slot duration for this PHY. More... | |
void | InitLastBusyStructs () |
Initialize the structures holding busy end times per channel type (primary, secondary, etc.) and per 20 MHz channel. More... | |
void | UpdateBackoff () |
Update backoff slots for all Txops. More... | |
void | UpdateLastIdlePeriod () |
This method determines whether the medium has been idle during a period (of non-null duration) immediately preceding the time this method is called. More... | |
Private Attributes | |
EventId | m_accessTimeout |
the access timeout ID More... | |
Time | m_eifsNoDifs |
EIFS no DIFS time. More... | |
Ptr< FrameExchangeManager > | m_feManager |
pointer to the Frame Exchange Manager More... | |
bool | m_generateBackoffOnNoTx |
whether the backoff should be invoked when the AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty More... | |
Time | m_lastAckTimeoutEnd |
the last Ack timeout end time More... | |
std::map< WifiChannelListType, Time > | m_lastBusyEnd |
the last busy end time for each channel type More... | |
Time | m_lastCtsTimeoutEnd |
the last CTS timeout end time More... | |
std::map< WifiChannelListType, Timespan > | m_lastIdle |
the last idle start and end time for each channel type More... | |
Time | m_lastNavEnd |
the last NAV end time More... | |
std::vector< Time > | m_lastPer20MHzBusyEnd |
the last busy end time per 20 MHz channel (HE stations and channel width > 20 MHz only) More... | |
Timespan | m_lastRx |
the last receive start and end time More... | |
bool | m_lastRxReceivedOk |
the last receive OK More... | |
Time | m_lastSwitchingEnd |
the last switching end time More... | |
Time | m_lastTxEnd |
the last transmit end time More... | |
uint8_t | m_linkId |
the ID of the link this object is associated with More... | |
bool | m_off |
flag whether it is in off state More... | |
Ptr< WifiPhy > | m_phy |
pointer to the unique active PHY More... | |
PhyListenerMap | m_phyListeners |
the PHY listeners More... | |
bool | m_sleeping |
flag whether it is in sleeping state More... | |
std::unordered_map< Ptr< WifiPhy >, EmlsrLinkSwitchInfo > | m_switchingEmlsrLinks |
Store information about the PHY objects that are going to operate on another EMLSR link. More... | |
Txops | m_txops |
the vector of managed Txops More... | |
bool | m_usingOtherEmlsrLink |
whether another EMLSR link is being used More... | |
Friends | |
class | ::EmlsrUlTxopTest |
Allow test cases to access private members. More... | |
Additional Inherited Members | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Manage a set of ns3::Txop.
Handle a set of independent ns3::Txop, each of which represents a single DCF within a MAC stack. Each ns3::Txop has a priority implicitly associated with it (the priority is determined when the ns3::Txop is added to the ChannelAccessManager: the first Txop to be added gets the highest priority, the second, the second highest priority, and so on.) which is used to handle "internal" collisions. i.e., when two local Txop are expected to get access to the medium at the same time, the highest priority local Txop wins access to the medium and the other Txop suffers a "internal" collision.
Definition at line 61 of file channel-access-manager.h.
|
private |
Maps each PHY listener to the associated PHY.
Definition at line 480 of file channel-access-manager.h.
|
private |
typedef for a vector of Txops
Definition at line 443 of file channel-access-manager.h.
ns3::ChannelAccessManager::ChannelAccessManager | ( | ) |
Definition at line 194 of file channel-access-manager.cc.
References ns3::MicroSeconds().
|
override |
Definition at line 211 of file channel-access-manager.cc.
References NS_LOG_FUNCTION.
|
private |
Called when access timeout should occur (e.g.
backoff procedure expired).
Definition at line 594 of file channel-access-manager.cc.
References DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), NS_LOG_FUNCTION, and UpdateBackoff().
Referenced by DoRestartAccessTimeoutIfNeeded().
txop | a new Txop. |
The ChannelAccessManager does not take ownership of this pointer so, the callee must make sure that the Txop pointer will stay valid as long as the ChannelAccessManager is valid. Note that the order in which Txop objects are added to a ChannelAccessManager matters: the first Txop added has the highest priority, the second Txop added, has the second highest priority, etc.
Definition at line 355 of file channel-access-manager.cc.
References m_txops, and NS_LOG_FUNCTION.
Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), and ns3::ApWifiMac::ConfigureStandard().
Deactivate current registered listener for PHY events on the given PHY.
All notifications but channel switch notifications coming from an inactive listener are ignored.
phy | the WifiPhy to listen to |
Definition at line 297 of file channel-access-manager.cc.
References GetPhyListener(), m_phy, NS_LOG_FUNCTION, and third::phy.
Referenced by SetupPhyListener().
qosTxop | a QosTxop that needs to be disabled |
duration | the amount of time during which the QosTxop is disabled |
Disable the given EDCA for the given amount of time. This EDCA will not be granted channel access during this period and the backoff timer will be frozen. After this period, the EDCA will start normal operations again by resuming the backoff timer.
Definition at line 809 of file channel-access-manager.cc.
References DoRestartAccessTimeoutIfNeeded(), ns3::Txop::GetBackoffSlots(), ns3::Txop::IsQosTxop(), m_linkId, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, UpdateBackoff(), and ns3::Txop::UpdateBackoffSlotsNow().
Referenced by ns3::QosTxop::StartMuEdcaTimerNow().
|
overrideprotectedvirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 224 of file channel-access-manager.cc.
References m_feManager, m_phy, m_phyListeners, m_txops, and NS_LOG_FUNCTION.
|
private |
Grant access to Txop using DCF/EDCF contention rules.
This is the first Txop we find with an expired backoff and which needs access to the medium. i.e., it has data to send.
all other Txops with a lower priority whose backoff has expired and which needed access to the medium must be notified that we did get an internal collision.
Now, we notify all of these changes in one go if the EDCAF winning the contention actually transmitted a frame. It is necessary to perform first the calculations of which Txops are colliding and then only apply the changes because applying the changes through notification could change the global state of the manager, and, thus, could change the result of the calculations.
Definition at line 512 of file channel-access-manager.cc.
References ns3::Txop::GetAccessStatus(), GetBackoffEndFor(), ns3::Txop::GetBackoffSlots(), ns3::WifiPhy::GetChannelWidth(), GetLargestIdlePrimaryChannel(), ns3::WifiPhy::GetOperatingChannel(), ns3::WifiPhy::GetPhyBand(), ns3::WifiPhy::GetPifs(), GetSifs(), GetSlot(), ns3::WifiPhyOperatingChannel::IsOfdm(), ns3::Txop::IsQosTxop(), two-ray-to-three-gpp-ch-calibration::k, m_feManager, m_linkId, m_phy, m_txops, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Txop::REQUESTED, ns3::Txop::UpdateBackoffSlotsNow(), and ns3::WIFI_PHY_BAND_2_4GHZ.
Referenced by AccessTimeout(), and RequestAccess().
|
overrideprotectedvirtual |
Initialize() implementation.
This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 217 of file channel-access-manager.cc.
References InitLastBusyStructs(), and NS_LOG_FUNCTION.
|
private |
Is there a Txop which needs to access the medium, and, if there is one, how many slots for AIFS+backoff does it require ?
Definition at line 710 of file channel-access-manager.cc.
References AccessTimeout(), ns3::EventId::Cancel(), GetBackoffEndFor(), ns3::Simulator::GetDelayLeft(), ns3::Simulator::GetMaximumSimulationTime(), ns3::EventId::IsExpired(), ns3::EventId::IsRunning(), m_accessTimeout, m_linkId, m_txops, min, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Txop::REQUESTED, and ns3::Simulator::Schedule().
Referenced by AccessTimeout(), DisableEdcaFor(), NotifyAckTimeoutResetNow(), NotifyCtsTimeoutResetNow(), NotifyNavResetNow(), and RequestAccess().
Time ns3::ChannelAccessManager::GetAccessGrantStart | ( | bool | ignoreNav = false | ) | const |
Access will never be granted to the medium before the time returned by this method.
ignoreNav | flag whether NAV should be ignored |
Definition at line 603 of file channel-access-manager.cc.
References ns3::Time::As(), ns3::ChannelAccessManager::Timespan::end, GetEifsNoDifs(), GetSifs(), m_lastAckTimeoutEnd, m_lastBusyEnd, m_lastCtsTimeoutEnd, m_lastNavEnd, m_lastRx, m_lastRxReceivedOk, m_lastSwitchingEnd, m_lastTxEnd, max, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, ns3::Time::US, and ns3::WIFI_CHANLIST_PRIMARY.
Referenced by GetBackoffStartFor(), and RequestAccess().
Return the time when the backoff procedure ended (or will ended) for the given Txop.
txop | the Txop |
Definition at line 664 of file channel-access-manager.cc.
References ns3::Time::As(), ns3::Txop::GetBackoffSlots(), GetBackoffStartFor(), GetSlot(), ns3::Txop::GetWifiMacQueue(), m_linkId, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::US.
Referenced by DoGrantDcfAccess(), and DoRestartAccessTimeoutIfNeeded().
Return the time when the backoff procedure started for the given Txop.
txop | the Txop |
Definition at line 651 of file channel-access-manager.cc.
References ns3::Time::As(), GetAccessGrantStart(), ns3::Txop::GetAifsn(), ns3::Txop::GetBackoffStart(), GetSlot(), ns3::Txop::GetWifiMacQueue(), m_linkId, max, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::US.
Referenced by GetBackoffEndFor(), and UpdateBackoff().
|
privatevirtual |
Return the EIFS duration minus a DIFS.
Reimplemented in ChannelAccessManagerStub.
Definition at line 349 of file channel-access-manager.cc.
References ns3::WifiPhy::GetAckTxTime(), ns3::WifiPhy::GetSifs(), and m_phy.
Referenced by GetAccessGrantStart().
bool ns3::ChannelAccessManager::GetGenerateBackoffOnNoTx | ( | ) | const |
Definition at line 830 of file channel-access-manager.cc.
References m_generateBackoffOnNoTx.
Referenced by GetTypeId(), and ns3::QosTxop::NotifyChannelReleased().
Return the width of the largest primary channel that has been idle for the given time interval before the given time, if any primary channel has been idle, or zero, otherwise.
interval | the given time interval |
end | the given end time |
Definition at line 751 of file channel-access-manager.cc.
References ns3::Time::As(), m_lastIdle, NS_LOG_FUNCTION, ns3::Time::S, UpdateLastIdlePeriod(), and ns3::Time::US.
Referenced by DoGrantDcfAccess(), ns3::QosFrameExchangeManager::PifsRecovery(), and LargestIdlePrimaryChannelTest::RunOne().
bool ns3::ChannelAccessManager::GetPer20MHzBusy | ( | const std::set< uint8_t > & | indices | ) | const |
indices | a set of indices (starting at 0) specifying the 20 MHz channels to test |
Definition at line 785 of file channel-access-manager.cc.
References ns3::WifiPhy::GetChannelWidth(), m_lastBusyEnd, m_lastPer20MHzBusyEnd, m_phy, ns3::Simulator::Now(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, and ns3::WIFI_CHANLIST_PRIMARY.
|
private |
Get current registered listener for PHY events on the given PHY.
phy | the given PHY |
Definition at line 238 of file channel-access-manager.cc.
References m_phyListeners, and third::phy.
Referenced by DeactivatePhyListener(), RemovePhyListener(), and SetupPhyListener().
|
privatevirtual |
Return the Short Interframe Space (SIFS) for this PHY.
Reimplemented in ChannelAccessManagerStub.
Definition at line 343 of file channel-access-manager.cc.
References ns3::WifiPhy::GetSifs(), and m_phy.
Referenced by DoGrantDcfAccess(), GetAccessGrantStart(), NeedBackoffUponAccess(), and NotifyTxStartNow().
|
privatevirtual |
Return the slot duration for this PHY.
Reimplemented in ChannelAccessManagerStub.
Definition at line 337 of file channel-access-manager.cc.
References ns3::WifiPhy::GetSlot(), and m_phy.
Referenced by DoGrantDcfAccess(), GetBackoffEndFor(), GetBackoffStartFor(), NeedBackoffUponAccess(), RequestAccess(), and UpdateBackoff().
|
static |
Get the type ID.
Definition at line 175 of file channel-access-manager.cc.
References GetGenerateBackoffOnNoTx(), ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), SetGenerateBackoffOnNoTx(), and ns3::TypeId::SetParent().
|
private |
Initialize the structures holding busy end times per channel type (primary, secondary, etc.) and per 20 MHz channel.
Definition at line 362 of file channel-access-manager.cc.
References ns3::WifiPhy::GetChannelWidth(), ns3::WifiPhy::GetOperatingChannel(), ns3::WifiPhy::GetStandard(), ns3::WifiPhyOperatingChannel::IsOfdm(), m_lastBusyEnd, m_lastIdle, m_lastPer20MHzBusyEnd, m_phy, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::WIFI_CHANLIST_PRIMARY, ns3::WIFI_CHANLIST_SECONDARY, ns3::WIFI_CHANLIST_SECONDARY40, ns3::WIFI_CHANLIST_SECONDARY80, and ns3::WIFI_STANDARD_80211ax.
Referenced by DoInitialize(), ResetState(), and SetupPhyListener().
bool ns3::ChannelAccessManager::IsBusy | ( | ) | const |
Check if the device is busy sending or receiving, or NAV or CCA busy.
Definition at line 403 of file channel-access-manager.cc.
References ns3::ChannelAccessManager::Timespan::end, m_lastBusyEnd, m_lastNavEnd, m_lastRx, m_lastTxEnd, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::WIFI_CHANLIST_PRIMARY.
Referenced by NeedBackoffUponAccess().
bool ns3::ChannelAccessManager::NeedBackoffUponAccess | ( | Ptr< Txop > | txop, |
bool | hadFramesToTransmit, | ||
bool | checkMediumBusy | ||
) |
Determine if a new backoff needs to be generated as per letter a) of Section 10.23.2.2 of IEEE 802.11-2020 ("EDCA backoff procedure").
This method is called upon the occurrence of events such as the enqueuing of a packet or the unblocking of some links after they have been blocked for some reason (e.g., wait for ADDBA Response, wait for TX on another EMLSR link to finish, etc.). The checkMediumBusy argument allows to generate a new backoff regardless of the busy/idle state of the medium, as per Section 35.3.16.4 of 802.11be D4.0.
txop | the Txop requesting to generate a backoff |
hadFramesToTransmit | whether packets available for transmission were queued just before the occurrence of the event triggering this call |
checkMediumBusy | whether generation of backoff (also) depends on the busy/idle state of the medium |
Definition at line 416 of file channel-access-manager.cc.
References ns3::Txop::GetAccessStatus(), ns3::Txop::GetAifsn(), ns3::Txop::GetBackoffSlots(), GetSifs(), GetSlot(), ns3::Txop::GRANTED, ns3::Txop::HasFramesToTransmit(), IsBusy(), ns3::Txop::IsQosTxop(), m_linkId, m_off, m_phy, m_sleeping, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::Seconds(), UpdateBackoff(), and ns3::Txop::UpdateBackoffSlotsNow().
Referenced by ns3::Txop::StartAccessAfterEvent().
void ns3::ChannelAccessManager::NotifyAckTimeoutResetNow | ( | ) |
Notify that ack timer has reset.
Definition at line 1114 of file channel-access-manager.cc.
References DoRestartAccessTimeoutIfNeeded(), m_lastAckTimeoutEnd, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by ns3::FrameExchangeManager::ReceivedNormalAck(), ns3::HtFrameExchangeManager::ReceiveMpdu(), and ns3::FrameExchangeManager::RxStartIndication().
void ns3::ChannelAccessManager::NotifyAckTimeoutStartNow | ( | Time | duration | ) |
Notify that ack timer has started for the given duration.
duration | the duration of the timer |
Definition at line 1106 of file channel-access-manager.cc.
References m_lastAckTimeoutEnd, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::FrameExchangeManager::SendMpdu(), ns3::HtFrameExchangeManager::SendPsdu(), and ns3::HeFrameExchangeManager::SendPsduMap().
void ns3::ChannelAccessManager::NotifyCcaBusyStartNow | ( | Time | duration, |
WifiChannelListType | channelType, | ||
const std::vector< Time > & | per20MhzDurations | ||
) |
duration | expected duration of CCA busy period |
channelType | the channel type for which the CCA busy state is reported. |
per20MhzDurations | vector that indicates for how long each 20 MHz subchannel (corresponding to the index of the element in the vector) is busy and where a zero duration indicates that the subchannel is idle. The vector is non-empty if the PHY supports 802.11ax or later and if the operational channel width is larger than 20 MHz. |
Notify the Txop that a CCA busy period has just started.
Definition at line 889 of file channel-access-manager.cc.
References m_lastBusyEnd, m_lastPer20MHzBusyEnd, ns3::Simulator::Now(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, UpdateBackoff(), and UpdateLastIdlePeriod().
Referenced by ns3::PhyListener::NotifyCcaBusyStart().
void ns3::ChannelAccessManager::NotifyCtsTimeoutResetNow | ( | ) |
Notify that CTS timer has reset.
Definition at line 1129 of file channel-access-manager.cc.
References DoRestartAccessTimeoutIfNeeded(), m_lastCtsTimeoutEnd, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by ns3::FrameExchangeManager::ReceiveMpdu(), and ns3::HtFrameExchangeManager::ReceiveMpdu().
void ns3::ChannelAccessManager::NotifyCtsTimeoutStartNow | ( | Time | duration | ) |
Notify that CTS timer has started for the given duration.
duration | the duration of the timer |
Definition at line 1122 of file channel-access-manager.cc.
References m_lastCtsTimeoutEnd, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by ns3::HeFrameExchangeManager::SendMuRts(), and ns3::FrameExchangeManager::SendRts().
void ns3::ChannelAccessManager::NotifyNavResetNow | ( | Time | duration | ) |
duration | the value of the received NAV. |
Called at end of RX
If the NAV reset indicates an end-of-NAV which is earlier than the previous end-of-NAV, the expected end of backoff might be later than previously thought so, we might need to restart a new access timeout.
Definition at line 1073 of file channel-access-manager.cc.
References DoRestartAccessTimeoutIfNeeded(), m_lastNavEnd, m_phy, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().
Referenced by ns3::FrameExchangeManager::NavResetTimeout(), and ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel().
void ns3::ChannelAccessManager::NotifyNavStartNow | ( | Time | duration | ) |
duration | the value of the received NAV. |
Called at end of RX
Definition at line 1097 of file channel-access-manager.cc.
References m_lastNavEnd, max, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().
Referenced by ns3::FrameExchangeManager::UpdateNav().
void ns3::ChannelAccessManager::NotifyOffNow | ( | ) |
Notify the Txop that the device has been put in off mode.
Definition at line 1031 of file channel-access-manager.cc.
References ns3::EventId::Cancel(), ns3::EventId::IsRunning(), m_accessTimeout, m_off, m_txops, and NS_LOG_FUNCTION.
Referenced by ns3::PhyListener::NotifyOff().
void ns3::ChannelAccessManager::NotifyOnNow | ( | ) |
Notify the Txop that the device has been resumed from off mode.
Definition at line 1061 of file channel-access-manager.cc.
References m_off, m_txops, NS_LOG_FUNCTION, and ResetBackoff().
Referenced by ns3::PhyListener::NotifyOn().
void ns3::ChannelAccessManager::NotifyRxEndErrorNow | ( | ) |
Notify the Txop that a packet reception was just completed unsuccessfuly.
Definition at line 857 of file channel-access-manager.cc.
References ns3::ChannelAccessManager::Timespan::end, m_lastRx, m_lastRxReceivedOk, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::PhyListener::NotifyRxEndError().
void ns3::ChannelAccessManager::NotifyRxEndOkNow | ( | ) |
Notify the Txop that a packet reception was just completed successfully.
Definition at line 848 of file channel-access-manager.cc.
References ns3::ChannelAccessManager::Timespan::end, m_lastRx, m_lastRxReceivedOk, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::PhyListener::NotifyRxEndOk().
void ns3::ChannelAccessManager::NotifyRxStartNow | ( | Time | duration | ) |
duration | expected duration of reception |
Notify the Txop that a packet reception started for the expected duration.
Definition at line 836 of file channel-access-manager.cc.
References ns3::ChannelAccessManager::Timespan::end, m_lastRx, m_lastRxReceivedOk, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::ChannelAccessManager::Timespan::start, UpdateBackoff(), and UpdateLastIdlePeriod().
Referenced by ns3::PhyListener::NotifyRxStart().
void ns3::ChannelAccessManager::NotifySleepNow | ( | ) |
Notify the Txop that the device has been put in sleep mode.
Definition at line 1013 of file channel-access-manager.cc.
References ns3::EventId::Cancel(), ns3::EventId::IsRunning(), m_accessTimeout, m_linkId, m_sleeping, m_txops, and NS_LOG_FUNCTION.
Referenced by ns3::PhyListener::NotifySleep().
void ns3::ChannelAccessManager::NotifyStartUsingOtherEmlsrLink | ( | ) |
Notify that another EMLSR link is being used, hence medium access should be disabled.
Definition at line 1137 of file channel-access-manager.cc.
References m_usingOtherEmlsrLink, and NS_LOG_FUNCTION.
Referenced by ns3::EmlsrManager::NotifyIcfReceived(), and ns3::EmlsrManager::NotifyUlTxopStart().
void ns3::ChannelAccessManager::NotifyStopUsingOtherEmlsrLink | ( | ) |
Notify that another EMLSR link is no longer being used, hence medium access can be resumed.
Definition at line 1144 of file channel-access-manager.cc.
References m_usingOtherEmlsrLink, and NS_LOG_FUNCTION.
void ns3::ChannelAccessManager::NotifySwitchingEmlsrLink | ( | Ptr< WifiPhy > | phy, |
const WifiPhyOperatingChannel & | channel, | ||
uint8_t | linkId | ||
) |
Notify that the given PHY is about to switch to the given operating channel, which is used by the given link.
This notification is sent by the EMLSR Manager when a PHY object switches operating channel to operate on another link.
phy | the PHY object that is going to switch channel |
channel | the new operating channel of the given PHY |
linkId | the ID of the link on which the given PHY is going to operate |
Definition at line 311 of file channel-access-manager.cc.
References third::channel, m_switchingEmlsrLinks, NS_ASSERT_MSG, NS_LOG_FUNCTION, and third::phy.
void ns3::ChannelAccessManager::NotifySwitchingStartNow | ( | PhyListener * | phyListener, |
Time | duration | ||
) |
phyListener | the PHY listener that sent this notification |
duration | expected duration of channel switching period |
Notify the Txop that a channel switching period has just started. During switching state, new packets can be enqueued in Txop/QosTxop but they won't access to the medium until the end of the channel switching.
Definition at line 914 of file channel-access-manager.cc.
References m_feManager, m_lastSwitchingEnd, m_lastTxEnd, m_phyListeners, m_switchingEmlsrLinks, m_txops, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, third::phy, RemovePhyListener(), ResetBackoff(), and ResetState().
Referenced by ns3::PhyListener::NotifySwitchingStart().
void ns3::ChannelAccessManager::NotifyTxStartNow | ( | Time | duration | ) |
duration | expected duration of transmission |
Notify the Txop that a packet transmission was just started and is expected to last for the specified duration.
Definition at line 867 of file channel-access-manager.cc.
References ns3::ChannelAccessManager::Timespan::end, GetSifs(), m_lastRx, m_lastRxReceivedOk, m_lastTxEnd, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::ChannelAccessManager::Timespan::start, UpdateBackoff(), and UpdateLastIdlePeriod().
Referenced by ns3::PhyListener::NotifyTxStart().
void ns3::ChannelAccessManager::NotifyWakeupNow | ( | ) |
Notify the Txop that the device has been resumed from sleep mode.
Definition at line 1049 of file channel-access-manager.cc.
References m_linkId, m_sleeping, m_txops, NS_LOG_FUNCTION, and ResetBackoff().
Referenced by ns3::PhyListener::NotifyWakeup().
Remove current registered listener for PHY events on the given PHY.
phy | the WifiPhy to listen to |
Definition at line 281 of file channel-access-manager.cc.
References GetPhyListener(), m_phy, m_phyListeners, NS_LOG_FUNCTION, and third::phy.
Referenced by LargestIdlePrimaryChannelTest::DoRun(), and NotifySwitchingStartNow().
txop | a Txop |
Notify the ChannelAccessManager that a specific Txop needs access to the medium. The ChannelAccessManager is then responsible for starting an access timer and, invoking FrameExchangeManager::StartTransmission when the access is granted if it ever gets granted.
Definition at line 476 of file channel-access-manager.cc.
References DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), GetAccessGrantStart(), ns3::Txop::GetAccessStatus(), ns3::Txop::GetAifsn(), ns3::Txop::GetBackoffStart(), GetSlot(), ns3::Txop::HasFramesToTransmit(), ns3::Txop::IsQosTxop(), m_linkId, m_off, m_phy, m_sleeping, ns3::Txop::NotifyAccessRequested(), ns3::WifiPhy::NotifyChannelAccessRequested(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Txop::REQUESTED, UpdateBackoff(), and ns3::Txop::UpdateBackoffSlotsNow().
Referenced by ns3::MultiUserScheduler::AccessReqTimeout(), ns3::Txop::RequestAccess(), and ns3::Txop::StartAccessAfterEvent().
void ns3::ChannelAccessManager::ResetAllBackoffs | ( | ) |
Reset the backoff for all the DCF/EDCAF.
Additionally, cancel the access timeout event.
Definition at line 1001 of file channel-access-manager.cc.
References ns3::EventId::Cancel(), m_accessTimeout, m_txops, NS_LOG_FUNCTION, and ResetBackoff().
Reset the backoff for the given DCF/EDCAF.
txop | the given DCF/EDCAF |
Definition at line 986 of file channel-access-manager.cc.
References ns3::Txop::LinkEntity::access, ns3::Txop::GetBackoffSlots(), ns3::Txop::GetLink(), m_linkId, ns3::Txop::NOT_REQUESTED, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Txop::ResetCw(), and ns3::Txop::UpdateBackoffSlotsNow().
Referenced by NotifyOnNow(), NotifySwitchingStartNow(), NotifyWakeupNow(), and ResetAllBackoffs().
void ns3::ChannelAccessManager::ResetState | ( | ) |
Reset the state variables of this channel access manager.
Definition at line 964 of file channel-access-manager.cc.
References ns3::EventId::Cancel(), ns3::ChannelAccessManager::Timespan::end, InitLastBusyStructs(), ns3::EventId::IsRunning(), m_accessTimeout, m_lastAckTimeoutEnd, m_lastCtsTimeoutEnd, m_lastNavEnd, m_lastRx, m_lastRxReceivedOk, min, ns3::Simulator::Now(), NS_LOG_FUNCTION, and UpdateLastIdlePeriod().
Referenced by NotifySwitchingStartNow().
void ns3::ChannelAccessManager::SetGenerateBackoffOnNoTx | ( | bool | enable | ) |
Set the member variable indicating whether the backoff should be invoked when an AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty.
enable | whether to enable backoff generation when no TX is performed in a TXOP |
Definition at line 823 of file channel-access-manager.cc.
References m_generateBackoffOnNoTx, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::ChannelAccessManager::SetLinkId | ( | uint8_t | linkId | ) |
Set the ID of the link this Channel Access Manager is associated with.
linkId | the ID of the link this Channel Access Manager is associated with |
Definition at line 322 of file channel-access-manager.cc.
References m_linkId, and NS_LOG_FUNCTION.
void ns3::ChannelAccessManager::SetupFrameExchangeManager | ( | Ptr< FrameExchangeManager > | feManager | ) |
Set up the Frame Exchange Manager.
feManager | the Frame Exchange Manager |
Definition at line 329 of file channel-access-manager.cc.
References m_feManager, and NS_LOG_FUNCTION.
Set up (or reactivate) listener for PHY events on the given PHY.
The new (or reactivated) listener becomes the active listener and the previous active listener attached to another PHY, if any, is deactivated.
phy | the WifiPhy to listen to |
Definition at line 248 of file channel-access-manager.cc.
References DeactivatePhyListener(), GetPhyListener(), InitLastBusyStructs(), m_lastSwitchingEnd, m_phy, m_phyListeners, ns3::Simulator::Now(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, and third::phy.
Referenced by LargestIdlePrimaryChannelTest::DoRun().
|
private |
Update backoff slots for all Txops.
Definition at line 675 of file channel-access-manager.cc.
References GetBackoffStartFor(), GetSlot(), two-ray-to-three-gpp-ch-calibration::k, m_linkId, m_txops, min, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by AccessTimeout(), DisableEdcaFor(), NeedBackoffUponAccess(), NotifyCcaBusyStartNow(), NotifyNavResetNow(), NotifyNavStartNow(), NotifyRxStartNow(), NotifyTxStartNow(), and RequestAccess().
|
private |
This method determines whether the medium has been idle during a period (of non-null duration) immediately preceding the time this method is called.
If so, the last idle start time and end time for each channel type are updated. Otherwise, no change is made by this method. This method is normally called when we are notified of the start of a transmission, reception, CCA Busy or switching to correctly maintain the information about the last idle period.
Definition at line 1151 of file channel-access-manager.cc.
References ns3::ChannelAccessManager::Timespan::end, m_lastBusyEnd, m_lastIdle, m_lastRx, m_lastSwitchingEnd, m_lastTxEnd, max, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::S.
Referenced by GetLargestIdlePrimaryChannel(), NotifyCcaBusyStartNow(), NotifyRxStartNow(), NotifyTxStartNow(), and ResetState().
|
friend |
Allow test cases to access private members.
Definition at line 64 of file channel-access-manager.h.
|
private |
the access timeout ID
Definition at line 463 of file channel-access-manager.h.
Referenced by DoRestartAccessTimeoutIfNeeded(), NotifyOffNow(), NotifySleepNow(), ResetAllBackoffs(), and ResetState().
|
private |
EIFS no DIFS time.
Definition at line 462 of file channel-access-manager.h.
|
private |
pointer to the Frame Exchange Manager
Definition at line 484 of file channel-access-manager.h.
Referenced by DoDispose(), DoGrantDcfAccess(), NotifySwitchingStartNow(), and SetupFrameExchangeManager().
|
private |
whether the backoff should be invoked when the AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty
Definition at line 464 of file channel-access-manager.h.
Referenced by GetGenerateBackoffOnNoTx(), and SetGenerateBackoffOnNoTx().
|
private |
the last Ack timeout end time
Definition at line 446 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), NotifyAckTimeoutResetNow(), NotifyAckTimeoutStartNow(), and ResetState().
|
private |
the last busy end time for each channel type
Definition at line 453 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), GetPer20MHzBusy(), InitLastBusyStructs(), IsBusy(), NotifyCcaBusyStartNow(), and UpdateLastIdlePeriod().
|
private |
the last CTS timeout end time
Definition at line 447 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), NotifyCtsTimeoutResetNow(), NotifyCtsTimeoutStartNow(), and ResetState().
|
private |
the last idle start and end time for each channel type
Definition at line 457 of file channel-access-manager.h.
Referenced by GetLargestIdlePrimaryChannel(), InitLastBusyStructs(), and UpdateLastIdlePeriod().
|
private |
the last NAV end time
Definition at line 448 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), IsBusy(), NotifyNavResetNow(), NotifyNavStartNow(), and ResetState().
|
private |
the last busy end time per 20 MHz channel (HE stations and channel width > 20 MHz only)
Definition at line 454 of file channel-access-manager.h.
Referenced by GetPer20MHzBusy(), InitLastBusyStructs(), and NotifyCcaBusyStartNow().
|
private |
the last receive start and end time
Definition at line 449 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), IsBusy(), NotifyRxEndErrorNow(), NotifyRxEndOkNow(), NotifyRxStartNow(), NotifyTxStartNow(), ResetState(), and UpdateLastIdlePeriod().
|
private |
the last receive OK
Definition at line 450 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), NotifyRxEndErrorNow(), NotifyRxEndOkNow(), NotifyRxStartNow(), NotifyTxStartNow(), and ResetState().
|
private |
the last switching end time
Definition at line 458 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), NotifySwitchingStartNow(), SetupPhyListener(), and UpdateLastIdlePeriod().
|
private |
the last transmit end time
Definition at line 451 of file channel-access-manager.h.
Referenced by GetAccessGrantStart(), IsBusy(), NotifySwitchingStartNow(), NotifyTxStartNow(), and UpdateLastIdlePeriod().
|
private |
the ID of the link this object is associated with
Definition at line 485 of file channel-access-manager.h.
Referenced by DisableEdcaFor(), DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), GetBackoffEndFor(), GetBackoffStartFor(), NeedBackoffUponAccess(), NotifySleepNow(), NotifyWakeupNow(), RequestAccess(), ResetBackoff(), SetLinkId(), and UpdateBackoff().
|
private |
flag whether it is in off state
Definition at line 461 of file channel-access-manager.h.
Referenced by NeedBackoffUponAccess(), NotifyOffNow(), NotifyOnNow(), and RequestAccess().
pointer to the unique active PHY
Definition at line 483 of file channel-access-manager.h.
Referenced by DeactivatePhyListener(), DoDispose(), DoGrantDcfAccess(), GetEifsNoDifs(), GetPer20MHzBusy(), GetSifs(), GetSlot(), InitLastBusyStructs(), NeedBackoffUponAccess(), NotifyNavResetNow(), RemovePhyListener(), RequestAccess(), and SetupPhyListener().
|
private |
the PHY listeners
Definition at line 482 of file channel-access-manager.h.
Referenced by DoDispose(), GetPhyListener(), NotifySwitchingStartNow(), RemovePhyListener(), and SetupPhyListener().
|
private |
flag whether it is in sleeping state
Definition at line 460 of file channel-access-manager.h.
Referenced by NeedBackoffUponAccess(), NotifySleepNow(), NotifyWakeupNow(), and RequestAccess().
|
private |
Store information about the PHY objects that are going to operate on another EMLSR link.
Definition at line 477 of file channel-access-manager.h.
Referenced by NotifySwitchingEmlsrLink(), and NotifySwitchingStartNow().
|
private |
the vector of managed Txops
Definition at line 445 of file channel-access-manager.h.
Referenced by Add(), DoDispose(), DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), NotifyOffNow(), NotifyOnNow(), NotifySleepNow(), NotifySwitchingStartNow(), NotifyWakeupNow(), ResetAllBackoffs(), and UpdateBackoff().
|
private |
whether another EMLSR link is being used
Definition at line 459 of file channel-access-manager.h.
Referenced by NotifyStartUsingOtherEmlsrLink(), and NotifyStopUsingOtherEmlsrLink().